void TBarView::PlaceApplicationBar(BRect screenFrame) { if (fExpando != NULL) { fExpando->RemoveSelf(); delete fExpando; fExpando = NULL; } if (fState == kMiniState) return; BRect expandoFrame(0, 0, 0, 0); if (fVertical) { // top left/right if (fTrayLocation != 0) expandoFrame.top = fDragRegion->Frame().bottom + 2; else { #if SA_CLOCK if (fShowClock) expandoFrame.top = fClock->Frame().bottom + 2; else #endif expandoFrame.top = fBarMenuBar->Frame().bottom + 2; } expandoFrame.bottom = expandoFrame.top + 1; if (fState == kFullState) expandoFrame.right = fBarMenuBar->Frame().Width(); else expandoFrame.right = kMinimumWindowWidth; } else { // top or bottom expandoFrame.top = -1; expandoFrame.bottom = kHModeHeight; if (fTrayLocation != 0) { #if SA_CLOCK if (fShowClock) expandoFrame.right = fClock->Frame().left; else #endif expandoFrame.right = fDragRegion->Frame().left; } else expandoFrame.right = screenFrame.Width(); } fExpando = new TExpandoMenuBar(this, expandoFrame, "ExpandoMenuBar", fVertical, (fState != kFullState)); AddChild(fExpando); }
void TBarView::PlaceApplicationBar() { SaveExpandedItems(); if (fInlineScrollView != NULL) { fInlineScrollView->DetachScrollers(); fInlineScrollView->RemoveSelf(); delete fInlineScrollView; fInlineScrollView = NULL; } if (fExpando != NULL) { delete fExpando; fExpando = NULL; } BRect screenFrame = (BScreen(Window())).Frame(); if (fState == kMiniState) { SizeWindow(screenFrame); PositionWindow(screenFrame); Window()->UpdateIfNeeded(); Invalidate(); return; } BRect expandoFrame(0, 0, 0, 0); BRect menuScrollFrame(0, 0, 0, 0); if (fVertical) { // top left/right if (fTrayLocation != 0) expandoFrame.top = fDragRegion->Frame().bottom + 1; else expandoFrame.top = fBarMenuBar->Frame().bottom + 1; expandoFrame.bottom = expandoFrame.top + 1; if (fState == kFullState) expandoFrame.right = fBarMenuBar->Frame().Width(); else expandoFrame.right = sMinimumWindowWidth; menuScrollFrame = expandoFrame; menuScrollFrame.bottom = screenFrame.bottom; } else { // top or bottom expandoFrame.top = 0; int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize(); expandoFrame.bottom = iconSize + 4; if (fBarMenuBar != NULL) expandoFrame.left = fBarMenuBar->Frame().Width(); if (fTrayLocation != 0 && fDragRegion != NULL) { expandoFrame.right = screenFrame.Width() - fDragRegion->Frame().Width() - 1; } else expandoFrame.right = screenFrame.Width(); menuScrollFrame = expandoFrame; } bool hideLabels = ((TBarApp*)be_app)->Settings()->hideLabels; fExpando = new TExpandoMenuBar(this, expandoFrame, "ExpandoMenuBar", fVertical, !hideLabels && fState != kFullState); fInlineScrollView = new TInlineScrollView(menuScrollFrame, fExpando, fVertical ? B_VERTICAL : B_HORIZONTAL); AddChild(fInlineScrollView); if (fVertical) ExpandItems(); SizeWindow(screenFrame); PositionWindow(screenFrame); fExpando->DoLayout(); // force menu to autosize CheckForScrolling(); Window()->UpdateIfNeeded(); Invalidate(); }
void TBarView::PlaceApplicationBar() { BRect screenFrame = (BScreen(Window())).Frame(); if (fState == kMiniState) { if (!fInlineScrollView->IsHidden()) fInlineScrollView->Hide(); SizeWindow(screenFrame); PositionWindow(screenFrame); Window()->UpdateIfNeeded(); Invalidate(); return; } if (fInlineScrollView->IsHidden()) fInlineScrollView->Show(); BRect expandoFrame(0, 0, 0, 0); if (fVertical) { // left or right if (fTrayLocation != 0) { expandoFrame.top = fDragRegion->Frame().bottom + 1; expandoFrame.left = fDragRegion->Frame().left; } else { expandoFrame.top = fBarMenuBar->Frame().bottom + 1; expandoFrame.left = fDragRegion->Frame().left; } expandoFrame.right = expandoFrame.left + sMinimumWindowWidth; if (fState == kFullState) expandoFrame.bottom = screenFrame.bottom; else expandoFrame.bottom = expandoFrame.top + 1; } else { // top or bottom expandoFrame.top = 0; expandoFrame.bottom = fBarApp->IconSize() + 4; if (fBarMenuBar != NULL) expandoFrame.left = fBarMenuBar->Frame().Width() + 1; if (fTrayLocation != 0 && fDragRegion != NULL) { expandoFrame.right = screenFrame.Width() - fDragRegion->Frame().Width() - 1; } else expandoFrame.right = screenFrame.Width(); } fInlineScrollView->DetachScrollers(); fInlineScrollView->MoveTo(expandoFrame.LeftTop()); fInlineScrollView->ResizeTo(expandoFrame.Width(), fVertical ? screenFrame.bottom - expandoFrame.top : expandoFrame.Height()); fExpandoMenuBar->MoveTo(0, 0); fExpandoMenuBar->ResizeTo(expandoFrame.Width(), expandoFrame.Height()); if (!fVertical) { // Set the max item width based on icon size fExpandoMenuBar->SetMaxItemWidth(); } fExpandoMenuBar->BuildItems(); if (fVertical) ExpandItems(); SizeWindow(screenFrame); PositionWindow(screenFrame); fExpandoMenuBar->DoLayout(); // force menu to resize CheckForScrolling(); Window()->UpdateIfNeeded(); Invalidate(); }