bool CPtnZler::ProcessCmd(int nType) { switch (nType) { case ID_APP_PATTERN: OnMenuPattern(); break; case ID_APP_EXIT: OnMenuExit(); break; default: return false; } return true; }
void wxMenuWalker::WalkMenuItem(wxMenuBar *p, wxMenuItem *m, void *data) { wxKBLogDebug(wxT("wxMenuWalker::WalkMenuItem - walking on [%s] at level [%d]"), m->GetItemLabelText().c_str(), m_nLevel); void *tmp = OnMenuItemWalk(p, m, data); if (m->GetSubMenu()) { // if this item contains a sub menu, add recursively the menu items // of that sub menu... using the cookie from OnMenuItemWalk. wxKBLogDebug(wxT("wxMenuWalker::WalkMenuItem - recursing on [%s]"), m->GetItemLabelText().c_str()); m_nLevel++; WalkMenu(p, m->GetSubMenu(), tmp); OnMenuExit(p, m->GetSubMenu(), tmp); m_nLevel--; } // we can delete the cookie we got form OnMenuItemWalk DeleteData(tmp); }
void wxMenuWalker::WalkMenu(wxMenuBar *p, wxMenu *m, void *data) { wxKBLogDebug(wxT("wxMenuWalker::WalkMenu - walking on [%s] at level [%d]"), m->GetTitle().c_str(), m_nLevel); for (int i=0; i < (int)m->GetMenuItemCount(); i++) { wxMenuItem *pitem = m->GetMenuItems().Item(i)->GetData(); // inform the derived class that we have reached a menu // and get the cookie to give on WalkMenuItem... void *tmp = OnMenuWalk(p, m, data); // skip separators (on wxMSW they are marked as wxITEM_NORMAL // but they do have empty labels)... if (pitem->GetKind() != wxITEM_SEPARATOR && pitem->GetItemLabelText() != wxEmptyString) WalkMenuItem(p, pitem, tmp); // the cookie we gave to WalkMenuItem is not useful anymore DeleteData(tmp); } OnMenuExit(p, m, data); }
bool CTraceZler::ProcessCmd(int nType) { switch (nType) { case ID_APP_TRACE: OnMenuTrace(); break; case ID_APP_LIMITARYTRACE: OnMenuTrace(true); break; case ID_APP_NEXT: OnMenuNext(); break; case ID_APP_LAST: OnMenuLast(); break; case ID_APP_EXIT: OnMenuExit(); break; default: return false; } return true; }
void MainFrame::OnWindowClose(wxCloseEvent& WXUNUSED(e)) { wxCommandEvent nullEvent; OnMenuExit(nullEvent); }