本文整理汇总了C++中MenuBar类的典型用法代码示例。如果您正苦于以下问题:C++ MenuBar类的具体用法?C++ MenuBar怎么用?C++ MenuBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MenuBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
AppWindow* win = new AppWindow(215, 144);
win->begin();
MenuBar* o = new MenuBar(0, 0, 215, 25);
o->menu(menu_);
Fl_Image* img1 = (Fl_Image*)IconLoader::get("document-new", ICON_SIZE_TINY);
Fl_Image* img2 = (Fl_Image*)IconLoader::get("document-save", ICON_SIZE_SMALL);
Fl_Image* img3 = (Fl_Image*)IconLoader::get("system-log-out", ICON_SIZE_TINY);
menu_[1].image(img1);
menu_[1].tooltip("Tooltip for First Item");
menu_[2].image(img2);
menu_[8].image(img3);
MenuButton* b = new MenuButton(65, 80, 90, 25, "menu");
b->menu(menu_menu);
Fl_Image* img4 = (Fl_Image*)IconLoader::get("folder", ICON_SIZE_TINY);
menu_menu[0].image(img4);
menu_menu[0].tooltip("This should be some folder");
win->end();
win->show(argc, argv);
return Fl::run();
}
示例2: hideUI
//------------------------------------------------------------------------------------
void TimeStateTool::hideUI()
{
MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
mb->removeItem("TimeState");
mb->removeItem("Sky");
showTimeStatePanel(false);
}
示例3: init_menus
void DinoGUI::init_menus(MenuBar& mbar) {
MenuItem* file_item = manage(new MenuItem("_File", true));
Menu* file_menu = manage(new Menu);
file_item->set_submenu(*file_menu);
mbar.append(*file_item);
create_menu_item(*file_menu, "Clear all", "file_clear_all",
Stock::CLEAR, &DinoGUI::slot_file_clear_all);
file_menu->append(*manage(new SeparatorMenuItem));
create_menu_item(*file_menu, Stock::QUIT, "file_quit",
&DinoGUI::slot_file_quit);
MenuItem* edit_item = manage(new MenuItem("_Edit", true));
Menu* edit_menu = manage(new Menu);
edit_item->set_submenu(*edit_menu);
mbar.append(*edit_item);
create_menu_item(*edit_menu, Stock::UNDO, "edit_undo",
&DinoGUI::slot_edit_undo);
m_proxy.signal_stack_changed().
connect(compose(mem_fun(*this, &DinoGUI::update_undo),
mem_fun(m_proxy, &CommandProxy::get_next_undo_name)));
update_undo(m_proxy.get_next_undo_name());
edit_menu->append(*manage(new SeparatorMenuItem));
create_menu_item(*edit_menu, Stock::CUT, "edit_cut",
&DinoGUI::slot_edit_cut);
create_menu_item(*edit_menu, Stock::COPY, "edit_copy",
&DinoGUI::slot_edit_copy);
create_menu_item(*edit_menu, Stock::PASTE, "edit_paste",
&DinoGUI::slot_edit_paste);
create_menu_item(*edit_menu, Stock::DELETE, "edit_delete",
&DinoGUI::slot_edit_delete);
edit_menu->append(*manage(new SeparatorMenuItem));
create_menu_item(*edit_menu, "Select all", "edit_select_all",
&DinoGUI::slot_edit_select_all);
MenuItem* transport_item = manage(new MenuItem("_Transport", true));
Menu* transport_menu = manage(new Menu);
transport_item->set_submenu(*transport_menu);
mbar.append(*transport_item);
create_menu_item(*transport_menu, Stock::MEDIA_PLAY, "transport_play",
&DinoGUI::slot_transport_play);
create_menu_item(*transport_menu, "_Stop", "transport_stop",
Stock::MEDIA_PAUSE, &DinoGUI::slot_transport_stop);
create_menu_item(*transport_menu, "_Go to start", "transport_go_to_start",
Stock::MEDIA_PREVIOUS, &DinoGUI::slot_transport_go_to_start);
MenuItem* plugins_item = manage(new MenuItem("_Plugins", true));
Menu* plugins_menu = manage(new Menu);
plugins_item->set_submenu(*plugins_menu);
mbar.append(*plugins_item);
create_menu_item(*plugins_menu, "_Manage plugins", "plugins_manage_plugins",
Stock::DISCONNECT, &DinoGUI::slot_plugins_manage);
MenuItem* help_item = manage(new MenuItem("_Help", true));
Menu* help_menu = manage(new Menu);
help_item->set_submenu(*help_menu);
mbar.append(*help_item);
create_menu_item(*help_menu, "_About Dino", "help_about",
Stock::ABOUT, &DinoGUI::slot_help_about_dino);
}
示例4:
//------------------------------------------------------------------------------------
WorldObjectPropertiesTool::~WorldObjectPropertiesTool()
{
MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
mb->removeItem("WorldObjectProperties");
mb->removeItem("WorldObjectPropertiesSep");
mb->removeItem("Windows");
}
示例5: pShowAction
QAction* SpectralLibraryMatchResults::createAction()
{
// Add toolbar button and menu item to invoke the window
QAction* pShowAction(NULL);
ToolBar* pToolBar = static_cast<ToolBar*>(Service<DesktopServices>()->getWindow("Spectral", TOOLBAR));
if (pToolBar != NULL)
{
MenuBar* pMenuBar = pToolBar->getMenuBar();
if (pMenuBar != NULL)
{
QAction* pMenuAction = pMenuBar->getMenuItem("/Spectral/Support Tools");
if (pMenuAction != NULL)
{
QMenu* pMenu = pMenuBar->getMenu(pMenuAction);
if (pMenu != NULL)
{
pShowAction = pMenu->addAction("Spectral Library Match Results Window");
if (pShowAction != NULL)
{
QPixmap pixShowResults(ShowResultsIcon);
pShowAction->setIcon(QIcon(pixShowResults));
pShowAction->setCheckable(true);
pShowAction->setAutoRepeat(false);
pShowAction->setStatusTip("Toggles the display of the Spectral Library Match Results Window");
pToolBar->addSeparator();
pToolBar->addButton(pShowAction);
}
}
}
}
}
return pShowAction;
}
示例6: WindowMenu
void DockCont::WindowMenu()
{
MenuBar bar;
DockContMenu menu(base);
menu.ContainerMenu(bar, this, true);
bar.Execute();
}
示例7: getAction
SpectralLibraryMatchResults::~SpectralLibraryMatchResults()
{
Service<DesktopServices> pDesktop;
// remove toolbar button and menu item
QAction* pAction = getAction();
if (pAction != NULL)
{
ToolBar* pToolBar = static_cast<ToolBar*>(pDesktop->getWindow("Spectral", TOOLBAR));
if (pToolBar != NULL)
{
pToolBar->removeItem(pAction);
MenuBar* pMenuBar = pToolBar->getMenuBar();
if (pMenuBar != NULL)
{
pMenuBar->removeMenuItem(pAction);
}
}
}
// dockwindow should still exist so detach from it
DockWindow* pWindow = getDockWindow();
if (pWindow != NULL)
{
pWindow->detach(SIGNAL_NAME(DockWindow, AboutToShowContextMenu),
Slot(this, &SpectralLibraryMatchResults::updateContextMenu));
}
}
示例8:
//------------------------------------------------------------------------------------
QuitTool::~QuitTool()
{
MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
mb->removeItem("Quit");
mb->removeItem("QuitSep");
mb->removeItem("File");
}
示例9: showUI
//------------------------------------------------------------------------------------
void EnvironmentTool::showUI()
{
MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
mb->insertItem("Sky", MenuItemType::POPUP, "#{Sky}");
mb->insertItem("EnvironmentParams", MenuItemType::NORMAL, "#{Environment}", "Sky");
mb->setItemDescription("EnvironmentParams", "#{Environment_Desc}");
mb->attachTool("EnvironmentParams", this);
}
示例10:
//------------------------------------------------------------------------------------
FrameStatsConfigTool::FrameStatsConfigTool()
{
MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
mb->insertItem("Settings", MenuItemType::Popup, "#{Settings}");
mb->insertItem("FrameStatsConfig", MenuItemType::Normal, "#{FrameStatsConfig}", "Settings");
mb->setItemDescription("FrameStatsConfig", "#{FrameStatsConfig_Desc}");
mb->attachTool("FrameStatsConfig", this);
}
示例11: MenuBar
void TestWindow::Initialize()
{
MenuBar *mbar;
Menu *menu;
mbar = new MenuBar(this);
container = new Container("PrinterSubSystem", this, "Printers");
container->WidthHeight(600, 400);
container->ContainerView(TREE);
SetWorkWindow(container);
// File menu
menu = new Menu(mbar, "File", "F");
new Button(menu, "Exit", PUSH_BUTTON, ExitCB, this, "x", "ALT+F4");
// Edit menu
menu = new Menu(mbar, "Edit", "E");
new Button(menu, "Cut", PUSH_BUTTON, NULL, NULL, "t", "Shift+Del");
new Button(menu, "Copy", PUSH_BUTTON, NULL, NULL, "C", "Ctrl+Ins");
new Button(menu, "Paste", PUSH_BUTTON, NULL, NULL, "P", "Shift+Ins");
new Button(menu, "Delete", PUSH_BUTTON, NULL, NULL, "D");
// View menu
menu = new Menu(mbar, "View", "V");
new Button(menu, "New", PUSH_BUTTON, NULL, NULL, "N");
new Sep(menu);
new Button(menu, "Select All", PUSH_BUTTON, NULL, NULL, "S", "Ctrl+/");
new Button(menu, "Unselect All", PUSH_BUTTON, NULL, NULL, "U", "Ctrl+\\");
new Sep(menu);
new Button(menu, "Set Preferences...", PUSH_BUTTON, NULL, NULL, "P");
new Sep(menu);
new Button(menu, "Save Settings...", PUSH_BUTTON, NULL, NULL, "t");
// Actions Menu
menu = new Menu(mbar, "Actions", "A");
new Button(menu, "Monitor", PUSH_BUTTON, NULL, NULL, "M");
new Button(menu, "Cancel Job", PUSH_BUTTON, NULL, NULL, "C");
// Help Menu
menu = new Menu(mbar, "Help", "H");
new Button(menu, "Introduction", PUSH_BUTTON, NULL, NULL, "I");
new Sep(menu);
new Button(menu, "Tasks", PUSH_BUTTON, NULL, NULL, "T");
new Button(menu, "Reference", PUSH_BUTTON, NULL, NULL, "R");
new Button(menu, "On Item", PUSH_BUTTON, NULL, NULL, "O");
new Sep(menu);
new Button(menu, "Using Help", PUSH_BUTTON, NULL, NULL, "U");
new Sep(menu);
new Button(menu, "Version", PUSH_BUTTON, NULL, NULL, "V");
mbar->SetHelpMenu(menu);
// Debug menu
menu = new Menu(mbar, "Debug", "G");
new Button(menu, "Print Objects", PUSH_BUTTON, PrintObjectsCB, Parent());
new Button(menu, "Print UI", PUSH_BUTTON, PrintUICB, Parent());
}
示例12: updateMenuItems
//------------------------------------------------------------------------------------
void CameraPositionTool::updateMenuItems()
{
MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
bool hasActiveWorld = (WorldManager::getSingleton().getActiveWorld() != nullptr);
for(int i = 0; i != NUM_POSITIONS; ++i)
{
mb->setItemEnabled( STORE_MENU_ITEM_ID[i], hasActiveWorld );
mb->setItemEnabled( RESTORE_MENU_ITEM_ID[i], hasActiveWorld && isPositionSaved(i) );
}
}
示例13: GetMasterMenu
void MenuBar::SetupRestoreFocus()
{
MenuBar *q = GetMasterMenu();
while(q) {
if(q->HasFocusDeep()) return;
q = q->submenu;
}
restorefocus = GetFocusCtrl();
LLOG("SetupRestoreFocus -> " << UPP::Name(restorefocus));
}
示例14: GetFileFolder
void Ide::FindStdDir()
{
String n = GetFileFolder(editfile);
MenuBar menu;
if(!IsNull(n))
menu.Add(n, THISBACK1(FindSetStdDir, n));
Vector<String> d = GetUppDirs();
for(int i = 0; i < d.GetCount(); i++)
menu.Add(d[i], THISBACK1(FindSetStdDir, d[i]));
menu.Execute(&ff.folder, ff.folder.GetPushScreenRect().BottomLeft());
}
示例15: RightDown
void RightDown(Point, dword) {
CallbackArgTarget<int> result;
MenuBar menu;
for(int i = 0; i < 10; i++)
menu.Add(AsString(i), result[i]);
menu.Separator();
menu.Add("Exit", THISBACK(Exit));
menu.Execute();
if(!IsNull(result))
PromptOK("You have selected " + AsString((int)result));
}