void PoeditApp::OnNew(wxCommandEvent& event) { TRY_FORWARD_TO_ACTIVE_WINDOW( OnNew(event) ); PoeditFrame *f = PoeditFrame::CreateEmpty(); f->OnNew(event); }
// ------------------------------------------------------------------------- // 函数 : KUiSelPlayer::OnClickButton // 功能 : 响应点击按钮 // 参数 : KWndWindow* pWnd ---> 被点击的控件指针 // ------------------------------------------------------------------------- void KUiSelPlayer::OnClickButton(KWndButton* pWnd, bool bDoubleClick) { // ---> 判断点中的是那个控件 for (int i = 0; i < m_nNumPlayer; i ++) { if (pWnd == (KWndWindow*)&m_player[i]) // 点中了某个玩家信息框 { OnSelectPlayer(i, !bDoubleClick); // 如果是双击,就仿真选择用户 if (bDoubleClick) { OnEnterGame(); } return; } } if (pWnd == (KWndWindow*)&m_btnNew) OnNew(); else if (pWnd == (KWndWindow*)&m_btnCancel) OnCancel(); else if (pWnd == (KWndWindow*)&m_btnOk) OnEnterGame(); else if (pWnd == (KWndWindow*)&m_btnDel) OnDel(); }
/** * RegEdit */ RegEdit::RegEdit(Backend *backend, QWidget *parent) :QWidget(parent), m_backend(backend) { QVBoxLayout *m_vert_layout = new QVBoxLayout(); m_file_group = new QGroupBox("File selection", this); QHBoxLayout *m_file_group_layout = new QHBoxLayout(); m_file_edit = new QLineEdit(this); m_file_edit->setReadOnly(true); m_file_open = new QToolButton(this); m_file_open->setText("Open"); m_file_open->setIcon(QIcon::fromTheme("document-open")); m_file_open->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QMenu *file_open_menu = new QMenu(this); QAction *new_act = file_open_menu->addAction(QIcon::fromTheme("document-new"), "New..."); m_file_open->setMenu(file_open_menu); m_file_save = new QToolButton(this); m_file_save->setText("Save"); m_file_save->setIcon(QIcon::fromTheme("document-save")); m_file_save->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QMenu *file_save_menu = new QMenu(this); QAction *saveas_act = file_save_menu->addAction(QIcon::fromTheme("document-save-as"), "Save as..."); m_file_save->setMenu(file_save_menu); m_file_group_layout->addWidget(m_file_open); m_file_group_layout->addWidget(m_file_save); m_file_group_layout->addWidget(m_file_edit); m_splitter = new QSplitter(this); m_soc_tree = new QTreeWidget(this); m_soc_tree->setColumnCount(1); m_soc_tree->setHeaderLabel(QString("Name")); m_soc_tree->setContextMenuPolicy(Qt::ActionsContextMenu); QAction *soc_tree_delete_action = new QAction("&Delete", this); soc_tree_delete_action->setIcon(QIcon::fromTheme("list-remove")); connect(soc_tree_delete_action, SIGNAL(triggered()), this, SLOT(OnSocItemDelete())); m_soc_tree->addAction(soc_tree_delete_action); m_splitter->addWidget(m_soc_tree); m_splitter->setStretchFactor(0, 0); m_file_group->setLayout(m_file_group_layout); m_vert_layout->addWidget(m_file_group); m_vert_layout->addWidget(m_splitter, 1); setLayout(m_vert_layout); SetModified(false, false); m_right_panel = 0; SetPanel(new EmptyEditPanel(this)); UpdateTabName(); connect(m_file_open, SIGNAL(clicked()), this, SLOT(OnOpen())); connect(m_file_save, SIGNAL(clicked()), this, SLOT(OnSave())); connect(new_act, SIGNAL(triggered()), this, SLOT(OnNew())); connect(saveas_act, SIGNAL(triggered()), this, SLOT(OnSaveAs())); connect(m_soc_tree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(OnSocItemChanged(QTreeWidgetItem*, QTreeWidgetItem*))); connect(m_soc_tree, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(OnSocItemActivated(QTreeWidgetItem*, int))); }
Nin10Edit::Nin10Edit() : Nin10EditGUI(nullptr) { palette_panel->SetColorInfoPanel(color_info); palette_panel->SetGraphicsNotebook(graphics_notebook); wxCommandEvent dummy; OnNew(dummy); }
void AccelEditor::OnListDblClick(NMHDR *pNMHDR, LRESULT *pResult) { if (m_currents.GetFirstSelectedItemPosition()) OnEdit(); else OnNew(); *pResult = 0; }
void MainWindow::SetupUi() { resize(600, 400); //set the main toolbar mainToolbar = new QToolBar(); mainToolbar->setEnabled(true); mainToolbar->setIconSize(QSize(16, 16)); addToolBar(Qt::TopToolBarArea, mainToolbar); newAction = new QAction(QIcon(":/Resources/images/new.png"), tr("&New"), this); connect(newAction, SIGNAL(triggered()), this, SLOT(OnNew())); mainToolbar->addAction(newAction); openAction = new QAction(QIcon(":/Resources/images/open.png"), tr("&Open"), this); openAction->setShortcut(QKeySequence::Open); connect(openAction, SIGNAL(triggered()), this, SLOT(OnOpen())); mainToolbar->addAction(openAction); saveAction = new QAction(QIcon(":/Resources/images/save.png"), tr("&Save"), this); saveAction->setShortcut(QKeySequence::Save); connect(saveAction, SIGNAL(triggered()), this, SLOT(OnSave())); mainToolbar->addAction(saveAction); undoAction = new QAction(QIcon(":/Resources/images/undo.png"), tr("&Undo"), this); undoAction->setShortcut(QKeySequence::Undo); connect(undoAction, SIGNAL(triggered()), this, SLOT(OnUndo())); mainToolbar->addAction(undoAction); redoAction = new QAction(QIcon(":/Resources/images/redo.png"), tr("&Redo"), this); redoAction->setShortcut(QKeySequence::Redo); connect(redoAction, SIGNAL(triggered()), this, SLOT(OnRedo())); mainToolbar->addAction(redoAction); setWindowTitle(QApplication::translate("Natural Calculator", "Natural Calculator", 0, QApplication::UnicodeUTF8)); QMetaObject::connectSlotsByName(this); QVariant p = settings.Load("NaturalCalculator", "position"); move(p.toPoint()); p = settings.Load("NaturalCalculator", "size"); resize(p.toSize()); //set the main window formulaWnd = new FormulaWnd(this); formulaWnd->setObjectName(QString::fromUtf8("formulaWnd")); formulaWnd->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); QWidget* c = new QWidget(); QBoxLayout* layout = new QBoxLayout(QBoxLayout::LeftToRight); layout->addWidget(formulaWnd); c->setLayout(layout); setCentralWidget(c); }
void EditorBase::InitActions() { mNewAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this); mNewAct->setShortcut(tr("Ctrl+N")); mNewAct->setStatusTip(tr("Create a new file")); connect(mNewAct, SIGNAL(triggered()), this, SLOT(OnNew())); mOpenAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this); mOpenAct->setShortcut(tr("Ctrl+O")); mOpenAct->setStatusTip(tr("Open an existing file")); connect(mOpenAct, SIGNAL(triggered()), this, SLOT(OnOpen())); mSaveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this); mSaveAct->setShortcut(tr("Ctrl+S")); mSaveAct->setStatusTip(tr("Save the document to disk")); connect(mSaveAct, SIGNAL(triggered()), this, SLOT(OnSave())); mSaveAsAct = new QAction(tr("Save &As..."), this); mSaveAsAct->setStatusTip(tr("Save the document under a new name")); connect(mSaveAsAct, SIGNAL(triggered()), this, SLOT(OnSaveAs())); mExitAct = new QAction(tr("E&xit"), this); mExitAct->setShortcut(tr("Ctrl+Q")); mExitAct->setStatusTip(tr("Exit the application")); connect(mExitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); mCutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this); mCutAct->setShortcut(tr("Ctrl+X")); mCutAct->setStatusTip(tr("Cut the current selection's contents to the clipboard")); connect(mCutAct, SIGNAL(triggered()), this, SLOT(OnCut())); mCopyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this); mCopyAct->setShortcut(tr("Ctrl+C")); mCopyAct->setStatusTip(tr("Copy the current selection's contents to the clipboard")); connect(mCopyAct, SIGNAL(triggered()), this, SLOT(OnCopy())); mPasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this); mPasteAct->setShortcut(tr("Ctrl+V")); mPasteAct->setStatusTip(tr("Paste the clipboard's contents into the current selection")); connect(mPasteAct, SIGNAL(triggered()), this, SLOT(OnPaste())); mSeparatorAct = new QAction(this); mSeparatorAct->setSeparator(true); mAboutAct = new QAction(tr("&About"), this); mAboutAct->setStatusTip(tr("Show the application's About box")); connect(mAboutAct, SIGNAL(triggered()), this, SLOT(OnAbout())); mAboutQtAct = new QAction(tr("About &Qt"), this); mAboutQtAct->setStatusTip(tr("Show the Qt library's About box")); connect(mAboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); }
void MainMenu::OnMenuCtrlAccept(MyGUI::MenuControl* _sender, MyGUI::MenuItem* _item) { const std::string& id = _item->getItemId(); if (id == "CTRL_Menu_Load") OnLoad(); else if (id == "CTRL_Menu_Save") OnSave(); else if (id == "CTRL_Menu_Import") OnImport(); else if (id == "CTRL_Menu_Export") OnExport(); else if (id == "CTRL_Menu_New") OnNew(); }
BOOL AccelEditor::PreTranslateMessage(MSG *pMsg) { CWnd *pFocus = GetFocus(); if (pFocus == &m_currents) { if (pMsg->message == WM_KEYDOWN) { switch (pMsg->wParam) { case VK_ESCAPE: m_currents.SetItemState(-1, 0, LVIS_SELECTED); CheckListSelections(); break; case VK_RETURN: case VK_INSERT: // kludge to workaround CKeyboardEdit::PreTranslateMessage() break; case VK_DELETE: case VK_BACK: OnRemove(); break; case VK_F6: case VK_LEFT: m_commands.SetFocus(); break; case VK_RIGHT: GetDlgItem(ID_OK)->SetFocus(); default: return ResizeDlg::PreTranslateMessage(pMsg); } return TRUE; } else if (pMsg->message == WM_KEYUP) // kludge to workaround CKeyboardEdit::PreTranslateMessage() { switch (pMsg->wParam) { case VK_RETURN: OnEdit(); break; case VK_INSERT: OnNew(); break; default: return ResizeDlg::PreTranslateMessage(pMsg); } return TRUE; } } else if (pFocus == &m_commands) { if (pMsg->message == WM_KEYDOWN) { switch (pMsg->wParam) { case VK_F6: m_currents.SetFocus(); break; case VK_RIGHT: if (!m_commands.ItemHasChildren(m_commands.GetSelectedItem())) { m_currents.SetFocus(); break; } // fall through default: return ResizeDlg::PreTranslateMessage(pMsg); } return TRUE; } } return ResizeDlg::PreTranslateMessage(pMsg); }