WebPositive: Fix INTEGRATE_MENU_INTO_TAB_BAR.
It seems to have been broken for some time. Maybe some users want this and we should expose it in settings instead of hiding it behind #ifs?
This commit is contained in:
parent
730f5df354
commit
08fdc76a61
@ -390,7 +390,7 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
||||
|
||||
// Menu
|
||||
#if INTEGRATE_MENU_INTO_TAB_BAR
|
||||
BMenu* mainMenu = fTabManager->Menu();
|
||||
BMenu* mainMenu = new BMenu("≡");
|
||||
#else
|
||||
BMenu* mainMenu = new BMenuBar("Main menu");
|
||||
#endif
|
||||
@ -612,8 +612,16 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
||||
new BMessage(TOGGLE_FULLSCREEN));
|
||||
toggleFullscreenButton->SetBackgroundMode(BBitmapButton::MENUBAR_BACKGROUND);
|
||||
|
||||
BGroupLayout* menuBarGroup = BLayoutBuilder::Group<>(B_HORIZONTAL, 0.0)
|
||||
.Add(mainMenu)
|
||||
#if !INTEGRATE_MENU_INTO_TAB_BAR
|
||||
BMenu* mainMenuItem = mainMenu;
|
||||
fMenuGroup = (new BGroupView(B_HORIZONTAL, 0))->GroupLayout();
|
||||
#else
|
||||
BMenu* mainMenuItem = new BMenuBar("Main menu");
|
||||
mainMenuItem->AddItem(mainMenu);
|
||||
fMenuGroup = fTabManager->MenuContainerLayout();
|
||||
#endif
|
||||
BLayoutBuilder::Group<>(fMenuGroup)
|
||||
.Add(mainMenuItem)
|
||||
.Add(toggleFullscreenButton, 0.0f)
|
||||
;
|
||||
|
||||
@ -629,7 +637,7 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
||||
BGroupView* topView = new BGroupView(B_VERTICAL, 0.0);
|
||||
|
||||
#if !INTEGRATE_MENU_INTO_TAB_BAR
|
||||
topView->AddChild(menuBarGroup);
|
||||
topView->AddChild(fMenuGroup);
|
||||
#endif
|
||||
topView->AddChild(fTabManager->TabGroup());
|
||||
topView->AddChild(navigationGroup);
|
||||
@ -643,7 +651,6 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
||||
|
||||
fURLInputGroup->MakeFocus(true);
|
||||
|
||||
fMenuGroup = menuBarGroup;
|
||||
fTabGroup = fTabManager->TabGroup()->GetLayout();
|
||||
fNavigationGroup = navigationGroup;
|
||||
fFindGroup = findGroup;
|
||||
|
@ -40,6 +40,7 @@ class BCheckBox;
|
||||
class BDirectory;
|
||||
class BFile;
|
||||
class BFilePanel;
|
||||
class BGroupLayout;
|
||||
class BLayoutItem;
|
||||
class BMenu;
|
||||
class BMenuItem;
|
||||
@ -93,8 +94,6 @@ enum {
|
||||
SHOW_COOKIE_WINDOW = 'skwd'
|
||||
};
|
||||
|
||||
#define INTEGRATE_MENU_INTO_TAB_BAR 0
|
||||
|
||||
|
||||
class BrowserWindow : public BWebWindow {
|
||||
public:
|
||||
@ -243,7 +242,7 @@ private:
|
||||
BStringView* fStatusText;
|
||||
BStatusBar* fLoadingProgressBar;
|
||||
|
||||
BLayoutItem* fMenuGroup;
|
||||
BGroupLayout* fMenuGroup;
|
||||
BLayoutItem* fTabGroup;
|
||||
BLayoutItem* fNavigationGroup;
|
||||
BLayoutItem* fFindGroup;
|
||||
|
@ -731,12 +731,9 @@ TabManager::TabManager(const BMessenger& target, BMessage* newTabMessage)
|
||||
fController->SetTabContainerGroup(fTabContainerGroup);
|
||||
|
||||
#if INTEGRATE_MENU_INTO_TAB_BAR
|
||||
fMenu = new BMenu("Menu");
|
||||
BMenuBar* menuBar = new BMenuBar("Menu bar");
|
||||
menuBar->AddItem(fMenu);
|
||||
TabButtonContainer* menuBarContainer = new TabButtonContainer();
|
||||
menuBarContainer->GroupLayout()->AddView(menuBar);
|
||||
fTabContainerGroup->GroupLayout()->AddView(menuBarContainer, 0.0f);
|
||||
fMenuContainer = new BGroupView(B_HORIZONTAL, 0);
|
||||
fMenuContainer->GroupLayout()->SetInsets(0, -3, 0, -3);
|
||||
fTabContainerGroup->GroupLayout()->AddView(fMenuContainer, 0.0f);
|
||||
#endif
|
||||
|
||||
fTabContainerGroup->GroupLayout()->AddView(fTabContainerView);
|
||||
@ -773,10 +770,10 @@ TabManager::Target() const
|
||||
|
||||
|
||||
#if INTEGRATE_MENU_INTO_TAB_BAR
|
||||
BMenu*
|
||||
TabManager::Menu() const
|
||||
BGroupLayout*
|
||||
TabManager::MenuContainerLayout() const
|
||||
{
|
||||
return fMenu;
|
||||
return fMenuContainer->GroupLayout();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -938,5 +935,3 @@ TabManager::SetCloseButtonsAvailable(bool available)
|
||||
fController->SetCloseButtonsAvailable(available);
|
||||
fTabContainerView->Invalidate();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -18,11 +17,15 @@ enum {
|
||||
class BBitmap;
|
||||
class BCardLayout;
|
||||
class BGroupView;
|
||||
class BGroupLayout;
|
||||
class BMenu;
|
||||
class TabContainerGroup;
|
||||
class TabContainerView;
|
||||
class TabManagerController;
|
||||
|
||||
#define INTEGRATE_MENU_INTO_TAB_BAR 0
|
||||
|
||||
|
||||
class TabManager {
|
||||
public:
|
||||
TabManager(const BMessenger& target,
|
||||
@ -33,7 +36,7 @@ public:
|
||||
const BMessenger& Target() const;
|
||||
|
||||
#if INTEGRATE_MENU_INTO_TAB_BAR
|
||||
BMenu* Menu() const;
|
||||
BGroupLayout* MenuContainerLayout() const;
|
||||
#endif
|
||||
|
||||
BView* TabGroup() const;
|
||||
@ -62,7 +65,7 @@ public:
|
||||
|
||||
private:
|
||||
#if INTEGRATE_MENU_INTO_TAB_BAR
|
||||
BMenu* fMenu;
|
||||
BGroupView* fMenuContainer;
|
||||
#endif
|
||||
TabContainerGroup* fTabContainerGroup;
|
||||
TabContainerView* fTabContainerView;
|
||||
|
Loading…
Reference in New Issue
Block a user