mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@9904 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
b2eac03a64
commit
caaf1092b8
3 changed files with 13 additions and 15 deletions
|
|
@ -1,4 +1,4 @@
|
|||
description "Using MenuBar";
|
||||
description "Using MenuBar\377";
|
||||
|
||||
uses
|
||||
CtrlLib;
|
||||
|
|
|
|||
4
reference/Menu/init
Normal file
4
reference/Menu/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _Menu_icpp_init_stub
|
||||
#define _Menu_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#endif
|
||||
|
|
@ -10,34 +10,28 @@ struct App : public TopWindow {
|
|||
Close();
|
||||
}
|
||||
|
||||
void EnableNumbers()
|
||||
{
|
||||
numbers_enabled = !numbers_enabled;
|
||||
}
|
||||
|
||||
void ShowNumber(int n)
|
||||
{
|
||||
PromptOK(AsString(n));
|
||||
}
|
||||
|
||||
void SubMenu(Bar& bar)
|
||||
{
|
||||
for(int i = 0; i < 10; i++)
|
||||
bar.Add(AsString(i), THISBACK1(ShowNumber, i));
|
||||
bar.Add(~AsString(i), [=] { PromptOK(AsString(i)); });
|
||||
}
|
||||
|
||||
void Menu(Bar& bar)
|
||||
{
|
||||
bar.Add("Enable numbers", THISBACK(EnableNumbers))
|
||||
bar.Add("Enable numbers", [=] { numbers_enabled = !numbers_enabled; })
|
||||
.Check(numbers_enabled);
|
||||
bar.Add(numbers_enabled, "Numbers", THISBACK(SubMenu));
|
||||
bar.Add("Exit", THISBACK(Exit))
|
||||
bar.Add("Exit", [=] { Exit(); })
|
||||
.Key(K_CTRL_E);
|
||||
}
|
||||
|
||||
void MainBar(Bar& bar)
|
||||
{
|
||||
bar.Add("Menu", THISBACK(Menu));
|
||||
bar.Add("Numbers", THISBACK(Menu));
|
||||
bar.Sub("Items", [=](Bar& bar) {
|
||||
bar.Add("Item 1", [&] { Exclamation("Item 1 invoked"); });
|
||||
bar.Add("Item 2", [&] { Exclamation("Item 2 invoked"); });
|
||||
});
|
||||
}
|
||||
|
||||
MenuBar menu;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue