void TBarView::_ChangeState(BMessage* message) { int32 state = message->FindInt32("state"); bool vertical = message->FindBool("vertical"); bool left = message->FindBool("left"); bool top = message->FindBool("top"); bool vertSwap = (fVertical != vertical); bool leftSwap = (fLeft != left); bool stateChanged = (fState != state); fState = state; fVertical = vertical; fLeft = left; fTop = top; // Send a message to the preferences window to let it know to enable // or disable preference items if (stateChanged || vertSwap) be_app->PostMessage(kStateChanged); PlaceDeskbarMenu(); PlaceTray(vertSwap, leftSwap); PlaceApplicationBar(); }
void TBarView::_ChangeState(BMessage* message) { int32 state = message->FindInt32("state"); bool vertical = message->FindBool("vertical"); bool left = message->FindBool("left"); bool top = message->FindBool("top"); bool vertSwap = (fVertical != vertical); bool leftSwap = (fLeft != left); bool stateChanged = (fState != state); fState = state; fVertical = vertical; fLeft = left; fTop = top; SaveExpandedItems(); if (stateChanged || vertSwap) { be_app->PostMessage(kStateChanged); // Send a message to the preferences window to let it know to // enable or disable preference items. // If switching to expando state, rebuild expando menu bar. if (fState == kExpandoState) { if (fInlineScrollView != NULL) { fInlineScrollView->DetachScrollers(); fInlineScrollView->RemoveSelf(); delete fInlineScrollView; fInlineScrollView = NULL; } if (fExpandoMenuBar != NULL) { delete fExpandoMenuBar; fExpandoMenuBar = NULL; } fExpandoMenuBar = new TExpandoMenuBar(BRect(0, 0, 0, 0), "ExpandoMenuBar", this, fVertical); fInlineScrollView = new TInlineScrollView(BRect(0, 0, 0, 0), fExpandoMenuBar, fVertical ? B_VERTICAL : B_HORIZONTAL); AddChild(fInlineScrollView); } } PlaceDeskbarMenu(); PlaceTray(vertSwap, leftSwap); PlaceApplicationBar(); }
void TBarView::_ChangeState(BMessage* message) { int32 state = message->FindInt32("state"); bool vertical = message->FindBool("vertical"); bool left = message->FindBool("left"); bool top = message->FindBool("top"); bool vertSwap = (fVertical != vertical); bool leftSwap = (fLeft != left); bool stateChanged = (fState != state); fState = state; fVertical = vertical; fLeft = left; fTop = top; if (stateChanged || vertSwap) { be_app->PostMessage(kStateChanged); // Send a message to the preferences window to let it know to // enable or disable preference items. if (vertSwap && fExpandoMenuBar != NULL) { if (fVertical) { fInlineScrollView->SetOrientation(B_VERTICAL); fExpandoMenuBar->SetMenuLayout(B_ITEMS_IN_COLUMN); fExpandoMenuBar->StartMonitoringWindows(); } else { fInlineScrollView->SetOrientation(B_HORIZONTAL); fExpandoMenuBar->SetMenuLayout(B_ITEMS_IN_ROW); fExpandoMenuBar->StopMonitoringWindows(); } } } PlaceDeskbarMenu(); PlaceTray(vertSwap, leftSwap); PlaceApplicationBar(); }
void TBarView::ChangeState(int32 state, bool vertical, bool left, bool top) { bool vertSwap = (fVertical != vertical); bool leftSwap = (fLeft != left); fState = state; fVertical = vertical; fLeft = left; fTop = top; BRect screenFrame = (BScreen(Window())).Frame(); PlaceBeMenu(); if (fVertical){ #if SA_CLOCK PlaceClock(); // tray dependent on clock location #endif PlaceTray(vertSwap, leftSwap, screenFrame); } else { PlaceTray(vertSwap, leftSwap, screenFrame); #if SA_CLOCK PlaceClock(); // clock is dependent on tray location #endif } // We need to keep track of what apps are expanded. BList expandedItems; BString *signature = NULL; if (fVertical && Expando() && static_cast<TBarApp *>(be_app)->Settings()->superExpando) { // Get a list of the Signatures of expanded apps - Can't use team_id because // there can be more than one team per application if (fVertical && Expando() && vertical && fExpando) { for (int index = 0; index < fExpando->CountItems(); index++) { TTeamMenuItem *item = dynamic_cast<TTeamMenuItem *>(fExpando->ItemAt(index)); if (item != NULL && item->IsExpanded()) { signature = new BString(item->Signature()); expandedItems.AddItem((void *)signature); } } } } PlaceApplicationBar(screenFrame); SizeWindow(screenFrame); PositionWindow(screenFrame); Window()->UpdateIfNeeded(); // Re-expand those apps. if (expandedItems.CountItems() > 0) { for (int sigIndex = expandedItems.CountItems(); sigIndex-- > 0;) { signature = static_cast<BString *>(expandedItems.ItemAt(sigIndex)); if (signature == NULL) continue; // Start at the 'bottom' of the list working up. // Prevents being thrown off by expanding items. for (int teamIndex = fExpando->CountItems(); teamIndex-- > 0;) { TTeamMenuItem *item = dynamic_cast<TTeamMenuItem *>(fExpando->ItemAt(teamIndex)); if (item != NULL && !signature->Compare(item->Signature())) { item->ToggleExpandState(false); break; } } } // Clean up expanded signature list. while (!expandedItems.IsEmpty()) { delete static_cast<BString *>(expandedItems.RemoveItem((int32)0)); } fExpando->SizeWindow(); } Invalidate(); }