Added test for adding a BMenu instead of a BMenuItem, but everything works
fine, at least in the context of the layout management. I am investigating a bug though that shows at least in WonderBrush (missing Filter menu). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27284 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
57b269650e
commit
86dab989e5
@ -14,6 +14,7 @@
|
||||
|
||||
enum {
|
||||
MSG_THIRD_ITEM = '3rdi',
|
||||
MSG_CHILD_MENU = 'chmn',
|
||||
MSG_CHANGE_ITEM_TEXT = 'chit'
|
||||
};
|
||||
|
||||
@ -29,6 +30,7 @@ MenuBarTest::MenuBarTest()
|
||||
fMenuBar->AddItem(fFirstItem = new BMenuItem("Menu item 1", NULL));
|
||||
fMenuBar->AddItem(new BMenuItem("Menu item 2", NULL));
|
||||
fThirdItem = new BMenuItem("Menu item 3", NULL);
|
||||
fChildMenu = new BMenu("Child menu");
|
||||
}
|
||||
|
||||
|
||||
@ -53,6 +55,11 @@ MenuBarTest::ActivateTest(View* controls)
|
||||
new BMessage(MSG_THIRD_ITEM), this);
|
||||
group->AddChild(fThirdItemCheckBox);
|
||||
|
||||
// child menu
|
||||
fChildMenuCheckBox = new LabeledCheckBox("Child menu",
|
||||
new BMessage(MSG_CHILD_MENU), this);
|
||||
group->AddChild(fChildMenuCheckBox);
|
||||
|
||||
// long text
|
||||
fLongTextCheckBox = new LabeledCheckBox("Long label text",
|
||||
new BMessage(MSG_CHANGE_ITEM_TEXT), this);
|
||||
@ -80,6 +87,9 @@ MenuBarTest::MessageReceived(BMessage* message)
|
||||
case MSG_THIRD_ITEM:
|
||||
UpdateThirdItem();
|
||||
break;
|
||||
case MSG_CHILD_MENU:
|
||||
UpdateChildMenu();
|
||||
break;
|
||||
case MSG_CHANGE_ITEM_TEXT:
|
||||
UpdateLongText();
|
||||
break;
|
||||
@ -107,6 +117,23 @@ MenuBarTest::UpdateThirdItem()
|
||||
}
|
||||
|
||||
|
||||
// UpdateChildMenu
|
||||
void
|
||||
MenuBarTest::UpdateChildMenu()
|
||||
{
|
||||
if (!fChildMenuCheckBox || !fMenuBar)
|
||||
return;
|
||||
|
||||
if (fChildMenuCheckBox->IsSelected() == (fChildMenu->Supermenu() != NULL))
|
||||
return;
|
||||
|
||||
if (fChildMenuCheckBox->IsSelected())
|
||||
fMenuBar->AddItem(fChildMenu);
|
||||
else
|
||||
fMenuBar->RemoveItem(fChildMenu);
|
||||
}
|
||||
|
||||
|
||||
// UpdateLongText
|
||||
void
|
||||
MenuBarTest::UpdateLongText()
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "Test.h"
|
||||
|
||||
|
||||
class BMenu;
|
||||
class BMenuBar;
|
||||
class BMenuItem;
|
||||
class LabeledCheckBox;
|
||||
@ -27,13 +28,16 @@ public:
|
||||
|
||||
private:
|
||||
void UpdateThirdItem();
|
||||
void UpdateChildMenu();
|
||||
void UpdateLongText();
|
||||
|
||||
private:
|
||||
BMenuBar* fMenuBar;
|
||||
BMenuItem* fFirstItem;
|
||||
BMenuItem* fThirdItem;
|
||||
BMenu* fChildMenu;
|
||||
LabeledCheckBox* fThirdItemCheckBox;
|
||||
LabeledCheckBox* fChildMenuCheckBox;
|
||||
LabeledCheckBox* fLongTextCheckBox;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user