X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/937013e0fd914d4c42f9f5ec98da665986b93dfa..359cde15e07bd684c9175b51c04ab02c9ee40745:/src/motif/menu.cpp diff --git a/src/motif/menu.cpp b/src/motif/menu.cpp index ed09c4e47d..3312c052ad 100644 --- a/src/motif/menu.cpp +++ b/src/motif/menu.cpp @@ -33,8 +33,6 @@ #ifdef __VMS__ #pragma message disable nosimpint -#define XtDisplay XTDISPLAY -#define XtWindow XTWINDOW #endif #include #include @@ -54,9 +52,6 @@ // other standard headers #include -IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler) -IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler) - // ============================================================================ // implementation // ============================================================================ @@ -74,7 +69,7 @@ void wxMenu::Init() m_popupShell = (WXWidget) NULL; m_buttonWidget = (WXWidget) NULL; m_menuId = 0; - m_topLevelMenu = (wxMenu*) NULL; + m_topLevelMenu = NULL; m_ownedByMenuBar = false; if ( !m_title.empty() ) @@ -162,17 +157,14 @@ void wxMenu::SetTitle(const wxString& label) bool wxMenu::ProcessCommand(wxCommandEvent & event) { - bool processed = false; + // Try the menu's event handler first + wxEvtHandler * const handler = GetEventHandler(); + bool processed = handler ? handler->SafelyProcessEvent(event) : false; - // Try the menu's event handler - if ( !processed && GetEventHandler()) - { - processed = HandleWindowEvent(event); - } // Try the window the menu was popped up from (and up // through the hierarchy) if ( !processed && GetInvokingWindow()) - processed = GetInvokingWindow()->ProcessEvent(event); + processed = GetInvokingWindow()->HandleWindowEvent(event); return processed; } @@ -369,8 +361,8 @@ bool wxMenuBar::CreateMenuBar(wxFrame* parent) Widget tearOff = XmGetTearOffControl(GetWidget(menu)); wxDoChangeForegroundColour((Widget) tearOff, m_foregroundColour); wxDoChangeBackgroundColour((Widget) tearOff, m_backgroundColour, true); -#endif } +#endif } PostCreation(); @@ -388,7 +380,7 @@ bool wxMenuBar::DestroyMenuBar() { if (!m_mainWidget) { - SetMenuBarFrame((wxFrame*) NULL); + SetMenuBarFrame(NULL); return false; } @@ -405,7 +397,7 @@ bool wxMenuBar::DestroyMenuBar() XtDestroyWidget((Widget) m_mainWidget); m_mainWidget = (WXWidget) 0; - SetMenuBarFrame((wxFrame*) NULL); + SetMenuBarFrame(NULL); return true; } @@ -451,7 +443,7 @@ void wxMenu::DestroyWidgetAndDetach() WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topMenu, - size_t WXUNUSED(index), + size_t menuIndex, const wxString& title, bool pullDown) { @@ -498,7 +490,7 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, XmNlabelString, label_str(), XmNsubMenuId, menu, (String)wxFont::GetFontTag(), m_font.GetFontTypeC(dpy), - XmNpositionIndex, index, + XmNpositionIndex, menuIndex, NULL); if (mnem != 0) @@ -534,7 +526,7 @@ void wxMenu::DestroyMenu (bool full) node = node->GetNext() ) { wxMenuItem *item = node->GetData(); - item->SetMenuBar((wxMenuBar*) NULL); + item->SetMenuBar(NULL); item->DestroyItem(full); } @@ -560,7 +552,7 @@ WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const if (id == m_menuId) { if (it) - *it = (wxMenuItem*) NULL; + *it = NULL; return m_buttonWidget; } @@ -587,7 +579,7 @@ WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const } if (it) - *it = (wxMenuItem*) NULL; + *it = NULL; return (WXWidget) NULL; }