bool ActionManager::initWithApp(IApplication *app) { if (!IActionManager::initWithApp(app)) { return false; } insertMenu(ID_MENU_FILE,tr("&File")); insertMenu(ID_MENU_RECENT,tr("&Recent")); insertMenu(ID_MENU_EDIT,tr("&Edit")); insertMenu(ID_MENU_FIND,tr("F&ind")); m_viewMenu = insertMenu(ID_MENU_VIEW,tr("&View")); m_viewMenu->addSeparator(); m_baseToolBarAct = m_viewMenu->addSeparator(); m_baseBrowserAct = m_viewMenu->addSeparator(); m_viewMenu->addSeparator(); insertMenu(ID_MENU_TOOLS,tr("&Tools")); insertMenu(ID_MENU_BUILD,tr("&Build")); insertMenu(ID_MENU_DEBUG,tr("&Debug")); insertMenu(ID_MENU_HELP,tr("&Help")); QToolBar *stdToolBar = insertToolBar(ID_TOOLBAR_STD,tr("Standard Toolbar")); insertViewMenu(LiteApi::ViewMenuToolBarPos,stdToolBar->toggleViewAction()); return true; }
void NewTabMenuManager::InsertActionWParent (QAction *act, QObject *pObj, bool sub) { const auto& tabClasses = qobject_cast<IHaveTabs*> (pObj)->GetTabClasses (); const auto& tcCount = std::count_if (tabClasses.begin (), tabClasses.end (), [] (const TabClassInfo& tc) { return tc.Features_ & TFOpenableByRequest; }); const auto ii = qobject_cast<IInfo*> (pObj); const auto& name = ii->GetName (); auto rootMenu = NewTabMenu_; if (sub || tcCount > 1) { bool menuFound = false; for (auto menuAct : rootMenu->actions ()) if (menuAct->menu () && menuAct->text () == name) { rootMenu = menuAct->menu (); menuFound = true; break; } if (!menuFound) { auto menu = new QMenu (name, rootMenu); menu->setIcon (ii->GetIcon ()); rootMenu->insertMenu (FindActionBefore (name, rootMenu), menu); rootMenu = menu; } } rootMenu->insertAction (FindActionBefore (act->text (), rootMenu), act); }
void rlc_menu_action(rlc_console c, menu_data *data) { RlcData b = rlc_get_data(c); if ( !data || data->magic != MEN_MAGIC ) return; if ( data->menu ) /* rlc_insert_menu_item() */ { HMENU popup; if ( (popup = findPopup(b, data->menu, NULL)) ) data->rc = insertMenu(popup, data->label, data->before); else data->rc = FALSE; } else /* insert_menu() */ { HMENU mb; HWND hwnd = rlc_hwnd(c); if ( !(mb = GetMenu(hwnd)) ) { data->rc = FALSE; return; } if ( !findPopup(b, data->label, NULL) ) /* already there */ { MENUITEMINFO info; int bid = -1; if ( data->before ) findPopup(b, data->before, &bid); memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); info.fMask = MIIM_TYPE|MIIM_SUBMENU; info.fType = MFT_STRING; info.hSubMenu = CreatePopupMenu(); info.dwTypeData = (TCHAR *)data->label; info.cch = (int)_tcslen(data->label); InsertMenuItem(mb, bid, TRUE, &info); /* force redraw; not automatic! */ DrawMenuBar(hwnd); } data->rc = TRUE; } }
void ui::menuSwitch() { // This swith calls the next menu UI dependant on the user "choice". switch(choice) { case 1 : insertMenu(); break; case 2 : searchMenu(); break; case 3 : printerMenu(); break; case 4 : deleteMenu(); break; default: break; } }
void MenuBarTree::contextMenuEvent(QContextMenuEvent * event) { QTreeWidgetItem* item = itemAt(event->pos()); if (item != currentItem()) setCurrentItem(item); QMenu* menu = new QMenu(this); QAction * action; if (!item || indexOfTopLevelItem(item) >= 0) action = menu->addAction(tr("Insert Menu")); else action = menu->addAction(tr("Insert Submenu")); connect(action, SIGNAL(triggered()), this, SLOT(insertMenu())); if (item) { action = menu->addAction(tr("Remove \"%1\"").arg(item->text(0))); connect(action, SIGNAL(triggered()), this, SLOT(removeItem())); } menu->exec(event->globalPos()); delete menu; }
bool ActionManager::initWithApp(IApplication *app) { if (!IActionManager::initWithApp(app)) { return false; } insertMenu("menu/file",tr("&File")); insertMenu("menu/recent",tr("&Recent")); insertMenu("menu/edit",tr("&Edit")); insertMenu("menu/find",tr("F&ind")); m_viewMenu = insertMenu("menu/view",tr("&View")); m_viewToolMenu = m_viewMenu->addMenu(tr("Tool Windows")); m_viewMenu->addSeparator(); m_baseToolBarAct = m_viewMenu->addSeparator(); m_baseBrowserAct = m_viewMenu->addSeparator(); m_viewMenu->addSeparator(); insertMenu("menu/help",tr("&Help")); QToolBar *stdToolBar = insertToolBar("toolbar/std",tr("Standard Toolbar")); insertViewMenu(LiteApi::ViewMenuToolBarPos,stdToolBar->toggleViewAction()); return true; }
WMenuItem *WMenu::insertMenu(int index, const WString& text, WMenu *menu) { return insertMenu(index, std::string(), text, menu); }
UserMenuRefData::UserMenuRefData ( QWidget* parent, const char* name ) : Inherited( parent, name, 241664 ) { MenuName = new("QLineEdit") QLineEdit( this, "LineEdit_1" ); MenuName->setGeometry( 280, 40, 100, 30 ); MenuName->setMinimumSize( 10, 10 ); MenuName->setMaximumSize( 32767, 32767 ); MenuName->setText( "" ); MenuName->setMaxLength( 32767 ); MenuName->setEchoMode( QLineEdit::Normal ); MenuName->setFrame( TRUE ); MenuCommand = new("QLineEdit") QLineEdit( this, "LineEdit_2" ); MenuCommand->setGeometry( 280, 120, 100, 30 ); MenuCommand->setMinimumSize( 100, 30 ); MenuCommand->setMaximumSize( 100, 30 ); MenuCommand->setText( "" ); MenuCommand->setMaxLength( 32767 ); MenuCommand->setEchoMode( QLineEdit::Normal ); MenuCommand->setFrame( TRUE ); MenuType = new("QComboBox") QComboBox( FALSE, this, "ComboBox_1" ); MenuType->setGeometry( 280, 80, 100, 30 ); MenuType->setMinimumSize( 10, 10 ); MenuType->setMaximumSize( 32767, 32767 ); connect( MenuType, SIGNAL(highlighted(int)), SLOT(typeSetActive(int)) ); MenuType->setSizeLimit( 2 ); MenuType->setAutoResize( FALSE ); MenuType->insertItem( "Seperator" ); MenuType->insertItem( "Action" ); QLabel* dlgedit_Label_1; dlgedit_Label_1 = new("QLabel") QLabel( this, "Label_1" ); dlgedit_Label_1->setGeometry( 170, 40, 100, 30 ); dlgedit_Label_1->setMinimumSize( 10, 10 ); dlgedit_Label_1->setMaximumSize( 32767, 32767 ); dlgedit_Label_1->setText( i18n("Menu Name") ); dlgedit_Label_1->setAlignment( 290 ); dlgedit_Label_1->setMargin( -1 ); QLabel* dlgedit_Label_2; dlgedit_Label_2 = new("QLabel") QLabel( this, "Label_2" ); dlgedit_Label_2->setGeometry( 170, 80, 100, 30 ); dlgedit_Label_2->setMinimumSize( 10, 10 ); dlgedit_Label_2->setMaximumSize( 32767, 32767 ); dlgedit_Label_2->setText( i18n("Type") ); dlgedit_Label_2->setAlignment( 290 ); dlgedit_Label_2->setMargin( -1 ); QLabel* dlgedit_Label_3; dlgedit_Label_3 = new("QLabel") QLabel( this, "Label_3" ); dlgedit_Label_3->setGeometry( 180, 120, 90, 30 ); dlgedit_Label_3->setMinimumSize( 10, 10 ); dlgedit_Label_3->setMaximumSize( 32767, 32767 ); dlgedit_Label_3->setText( i18n("Command") ); dlgedit_Label_3->setAlignment( 290 ); dlgedit_Label_3->setMargin( -1 ); MenuOpOnly = new("QCheckBox") QCheckBox( this, "CheckBox_1" ); MenuOpOnly->setGeometry( 280, 160, 100, 30 ); MenuOpOnly->setMinimumSize( 10, 10 ); MenuOpOnly->setMaximumSize( 32767, 32767 ); MenuOpOnly->setText( i18n("OP Only") ); MenuOpOnly->setAutoRepeat( FALSE ); MenuOpOnly->setAutoResize( FALSE ); ApplyButton = new("QPushButton") QPushButton( this, "PushButton_1" ); ApplyButton->setGeometry( 280, 240, 100, 30 ); ApplyButton->setMinimumSize( 10, 10 ); ApplyButton->setMaximumSize( 32767, 32767 ); connect( ApplyButton, SIGNAL(clicked()), SLOT(terminate()) ); ApplyButton->setText( i18n("Close") ); ApplyButton->setAutoRepeat( FALSE ); ApplyButton->setAutoResize( FALSE ); insertButton = new("QPushButton") QPushButton( this, "PushButton_2" ); insertButton->setGeometry( 170, 240, 100, 30 ); insertButton->setMinimumSize( 10, 10 ); insertButton->setMaximumSize( 32767, 32767 ); connect( insertButton, SIGNAL(clicked()), SLOT(insertMenu()) ); insertButton->setText( i18n("Insert") ); insertButton->setAutoRepeat( FALSE ); insertButton->setAutoResize( FALSE ); MainListBox = new("QListBox") QListBox( this, "ListBox_1" ); MainListBox->setGeometry( 30, 40, 120, 230 ); MainListBox->setMinimumSize( 10, 10 ); MainListBox->setMaximumSize( 32767, 32767 ); connect( MainListBox, SIGNAL(highlighted(int)), SLOT(newHighlight(int)) ); connect( MainListBox, SIGNAL(selected(int)), SLOT(newHighlight(int)) ); MainListBox->setFrameStyle( 51 ); MainListBox->setLineWidth( 2 ); MainListBox->setMultiSelection( FALSE ); QPushButton* dlgedit_PushButton_3; dlgedit_PushButton_3 = new("QPushButton") QPushButton( this, "PushButton_3" ); dlgedit_PushButton_3->setGeometry( 170, 200, 100, 30 ); dlgedit_PushButton_3->setMinimumSize( 10, 10 ); dlgedit_PushButton_3->setMaximumSize( 32767, 32767 ); connect( dlgedit_PushButton_3, SIGNAL(clicked()), SLOT(deleteMenu()) ); dlgedit_PushButton_3->setText( i18n("Delete") ); dlgedit_PushButton_3->setAutoRepeat( FALSE ); dlgedit_PushButton_3->setAutoResize( FALSE ); QPushButton* dlgedit_PushButton_4; dlgedit_PushButton_4 = new("QPushButton") QPushButton( this, "PushButton_4" ); dlgedit_PushButton_4->setGeometry( 280, 200, 100, 30 ); dlgedit_PushButton_4->setMinimumSize( 10, 10 ); dlgedit_PushButton_4->setMaximumSize( 32767, 32767 ); connect( dlgedit_PushButton_4, SIGNAL(clicked()), SLOT(modifyMenu()) ); dlgedit_PushButton_4->setText( i18n("Modify") ); dlgedit_PushButton_4->setAutoRepeat( FALSE ); dlgedit_PushButton_4->setAutoResize( FALSE ); resize( 400,300 ); setMinimumSize( 400, 300 ); setMaximumSize( 400, 300 ); }