本文整理汇总了C++中Menu::SetEventHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ Menu::SetEventHandler方法的具体用法?C++ Menu::SetEventHandler怎么用?C++ Menu::SetEventHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::SetEventHandler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateMenus
bool Menus::CreateMenus()
{
// Build the menus
Menu* menuMain = new Menu;
ASSERT(menuMain);
menuMain->AddItem(new MenuLabel(MenuItem::Title,L"main menu",0,true,NULL));
menuMain->AddItem(new MenuLabel(MenuItem::Margin,NULL,0,true,NULL));
menuMain->AddItem(new MenuLabel(MenuItem::Label,L"visualizations",1,false,NULL));
menuMain->AddItem(new MenuLabel(MenuItem::Label,L"color presets",2,false,NULL));
menuMain->AddItem(new MenuLabel(MenuItem::Seperator,NULL,0,true,NULL));
menuMain->AddItem(new MenuLabel(MenuItem::Label,L"options",3,false,NULL));
menuMain->AddItem(new MenuLabel(MenuItem::Label,L"capture source",4,false,NULL));
menuMain->AddItem(new MenuLabel(MenuItem::Seperator,NULL,0,true,NULL));
menuMain->AddItem(new MenuLabel(MenuItem::Label,L"info",5,false,NULL));
menuMain->AddItem(new MenuLabel(MenuItem::Seperator,NULL,0,true,NULL));
menuMain->AddItem(new MenuLabel(MenuItem::Label,L"close",6,false,NULL));
menuMain->SetSelectedFirstValid();
menuMain->SetEventHandler(MenuEventHandler);
mMenuRoot.AddMenu(menuMain);
Menu* menuExit = new Menu;
ASSERT(menuExit);
menuExit->AddItem(new MenuLabel(MenuItem::Title,L"close",0,true,NULL));
menuExit->AddItem(new MenuLabel(MenuItem::Margin,NULL,0,true,NULL));
menuExit->AddItem(new MenuLabel(MenuItem::Label,L"yes",1,false,NULL));
menuExit->AddItem(new MenuLabel(MenuItem::Label,L"no",2,false,NULL));
menuExit->SetSelected(3); // No
menuExit->SetEventHandler(MenuExitEventHandler);
mMenuRoot.AddMenu(menuExit);
Menu* menuCapture = new Menu;
ASSERT(menuCapture);
menuCapture->AddItem(new MenuLabel(MenuItem::Title,L"capture source menu",0,true,NULL));
menuCapture->AddItem(new MenuLabel(MenuItem::Margin,NULL,0,true,NULL));
// Add the capture sources
for(unsigned long i = 0; i < GetKernel()->GetAudio()->GetSourcesCount(); ++i)
menuCapture->AddItem(new MenuLabel(MenuItem::Label,GetKernel()->GetAudio()->GetSource(i),i+1,false,NULL));
if(!GetKernel()->GetAudio()->GetSourcesCount())
menuCapture->AddItem(new MenuLabel(MenuItem::Label,L"no capture sources",1,true,NULL));
menuCapture->AddItem(new MenuLabel(MenuItem::Seperator,NULL,0,true,NULL));
menuCapture->AddItem(new MenuLabel(MenuItem::Label,L"back",GetKernel()->GetAudio()->GetSourcesCount()+1,false,NULL));
menuCapture->SetSelectedFirstValid();
menuCapture->SetEventHandler(MenuCaptureEventHandler);
mMenuRoot.AddMenu(menuCapture);
Menu* menuOptions = new Menu;
ASSERT(menuOptions);
menuOptions->AddItem(new MenuLabel(MenuItem::Title,L"options menu",0,true,NULL));
menuOptions->AddItem(new MenuLabel(MenuItem::Margin,NULL,0,true,NULL));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,NULL,1,false,MenuItemTextHandler));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,NULL,2,false,MenuItemTextHandler));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,NULL,3,false,MenuItemTextHandler));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,NULL,4,false,MenuItemTextHandler));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,NULL,5,false,MenuItemTextHandler));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,NULL,6,false,MenuItemTextHandler));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,NULL,7,false,MenuItemTextHandler));
menuOptions->AddItem(new MenuLabel(MenuItem::Seperator,NULL,0,true,NULL));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,NULL,8,false,MenuItemTextHandler));
menuOptions->AddItem(new MenuLabel(MenuItem::Seperator,NULL,0,true,NULL));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,NULL,9,false,MenuItemTextHandler));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,NULL,10,false,MenuItemTextHandler));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,NULL,11,false,MenuItemTextHandler));
menuOptions->AddItem(new MenuLabel(MenuItem::Seperator,NULL,0,true,NULL));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,L"write config",12,false,NULL));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,L"read config",13,false,NULL));
menuOptions->AddItem(new MenuLabel(MenuItem::Seperator,NULL,0,true,NULL));
menuOptions->AddItem(new MenuLabel(MenuItem::Label,L"back",14,false,NULL));
menuOptions->SetSelectedFirstValid();
menuOptions->SetEventHandler(MenuOptionsEventHandler);
mMenuRoot.AddMenu(menuOptions);
Menu* menuInfo = new Menu;
ASSERT(menuInfo);
menuInfo->AddItem(new MenuLabel(MenuItem::Title,L"info menu",0,true,NULL));
menuInfo->AddItem(new MenuLabel(MenuItem::Margin,NULL,0,true,NULL));
menuInfo->AddItem(new MenuLabel(MenuItem::Label,NULL,1,true,MenuInfoItemTextHandler));
menuInfo->AddItem(new MenuLabel(MenuItem::Label,NULL,2,true,MenuInfoItemTextHandler));
menuInfo->AddItem(new MenuLabel(MenuItem::Margin,NULL,0,true,NULL));
menuInfo->AddItem(new MenuLabel(MenuItem::Label,L"audio analyzer v\002" TOSTRINGW(ANALYZER_VERSION_MAJOR) L"." TOSTRINGW(ANALYZER_VERSION_MINOR) L"\001",0,true,NULL));
menuInfo->AddItem(new MenuLabel(MenuItem::Label,L"marko mihovilic",0,true,NULL));
menuInfo->AddItem(new MenuLabel(MenuItem::Margin,NULL,0,true,NULL));
menuInfo->AddItem(new MenuLabel(MenuItem::Label,L"back",6,false,NULL));
menuInfo->SetSelectedFirstValid();
//.........这里部分代码省略.........