model_server/gala/src/view.cxx
// FindSmallestXElt - Returns the left-most element in the pane.
//    Also sets the ratio and removes the item from this pane..
Returns the left-most element in the pane.
Also sets the ratio and removes the item from this pane
Returns the left - most element in the pane . Also sets the ratio and removes the item from this pane
Pane* Pane::FindSmallestXElt(int* ratio)
{
    vrect newRect;
    vdialogItem* nextItem;
    vdialogItem* smallestItem = GetItemAt(0);
    vrect smallestRect = *(smallestItem->GetRect());
    for (int x = 1; x < GetItemCount(); x++) {
        nextItem = GetItemAt(x);
        newRect = *(nextItem->GetRect());
        if (newRect.GetX() < smallestRect.GetX()) {
            smallestItem = nextItem;
            smallestRect = newRect;
        }
    }
    newRect = *(GetRect());
    *ratio = (int)(100 * (float)(smallestRect.GetWidth())/
             ((float)(newRect.GetWidth() - smallestRect.GetX())) + 0.5);
    return (Pane*) smallestItem;
}
Pane * Pane :: FindSmallestXElt ( int * ratio ) { vrect newRect ; vdialogItem * nextItem ; vdialogItem * smallestItem = GetItemAt ( 0 ) ; vrect smallestRect = * ( smallestItem -> GetRect ( ) ) ; for ( int x = 1 ; x < GetItemCount ( ) ; x ++ ) { nextItem = GetItemAt ( x ) ; newRect = * ( nextItem -> GetRect ( ) ) ; if ( newRect . GetX ( ) < smallestRect . GetX ( ) ) { smallestItem = nextItem ; smallestRect = newRect ; } } newRect = * ( GetRect ( ) ) ; * ratio = ( int ) ( 100 * ( float ) ( smallestRect . GetWidth ( ) ) / ( ( float ) ( newRect . GetWidth ( ) - smallestRect . GetX ( ) ) ) + 0.5 ) ; return ( Pane * ) smallestItem ; }
FindSmallestXElt - Returns the left-most element in the pane.
FindSmallestXElt - Returns the left - most element in the pane .
// Get the size of the first item. // Loop through all items to find the leftmost. // Compute the size ratio of this rect to the whole pane. // Return the leftmost item.