X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0ab6adfedf92aa4457821422e77c19b80f10bee..bf918b97ed1ee60dbf296fa36764e6ac3e514b94:/src/motif/menu.cpp diff --git a/src/motif/menu.cpp b/src/motif/menu.cpp index 30ca32e4cd..b7e9194893 100644 --- a/src/motif/menu.cpp +++ b/src/motif/menu.cpp @@ -22,6 +22,8 @@ // headers // ---------------------------------------------------------------------------- +#include "wx/defs.h" + #include "wx/menu.h" #include "wx/menuitem.h" #include "wx/log.h" @@ -30,6 +32,11 @@ #include "wx/frame.h" #include "wx/settings.h" +#ifdef __VMS__ +#pragma message disable nosimpint +#define XtDisplay XTDISPLAY +#define XtWindow XTWINDOW +#endif #include #include #include @@ -39,16 +46,17 @@ #include #include #include +#ifdef __VMS__ +#pragma message enable nosimpint +#endif #include "wx/motif/private.h" // other standard headers #include -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler) IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler) -#endif // ============================================================================ // implementation @@ -76,9 +84,9 @@ void wxMenu::Init() AppendSeparator() ; } - m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENU); - m_foregroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENUTEXT); - m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT); + m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_MENU); + m_foregroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUTEXT); + m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); } // The wxWindow destructor will take care of deleting the submenus. @@ -131,10 +139,10 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) bool wxMenu::DoInsert(size_t pos, wxMenuItem *item) { - if ( !wxMenuBase::DoInsert(pos, item) ) - return FALSE; + if ( wxMenuBase::DoInsert(pos, item) ) + return TRUE; - wxFAIL_MSG(wxT("not implemented")); + wxFAIL_MSG(wxT("DoInsert not implemented; or error in wxMenuBase::DoInsert")); return FALSE; } @@ -162,12 +170,14 @@ bool wxMenu::ProcessCommand(wxCommandEvent & event) { bool processed = FALSE; +#if wxUSE_MENU_CALLBACK // Try a callback if (m_callback) { (void) (*(m_callback)) (*this, event); processed = TRUE; } +#endif // wxUSE_MENU_CALLBACK // Try the menu's event handler if ( !processed && GetEventHandler()) @@ -191,9 +201,9 @@ void wxMenuBar::Init() m_eventHandler = this; m_menuBarFrame = NULL; m_mainWidget = (WXWidget) NULL; - m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENU); - m_foregroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENUTEXT); - m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT); + m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_MENU); + m_foregroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUTEXT); + m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); } wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxString titles[]) @@ -276,7 +286,7 @@ bool wxMenuBar::Append(wxMenu * menu, const wxString& title) menu->SetButtonWidget(w); } - menu->SetMenuBar(this); + //menu->SetMenuBar(this); m_titles.Add(title); @@ -296,7 +306,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) { if ( !wxMenuBarBase::Replace(pos, menu, title) ) - return FALSE; + return NULL; wxFAIL_MSG(wxT("TODO")); @@ -355,7 +365,7 @@ bool wxMenuBar::CreateMenuBar(wxFrame* parent) { if (m_mainWidget) { - XtVaSetValues((Widget) parent->GetMainWindowWidget(), XmNmenuBar, (Widget) m_mainWidget, NULL); + XtVaSetValues((Widget) parent->GetMainWidget(), XmNmenuBar, (Widget) m_mainWidget, NULL); /* if (!XtIsManaged((Widget) m_mainWidget)) XtManageChild((Widget) m_mainWidget); @@ -364,7 +374,7 @@ bool wxMenuBar::CreateMenuBar(wxFrame* parent) return TRUE; } - Widget menuBarW = XmCreateMenuBar ((Widget) parent->GetMainWindowWidget(), "MenuBar", NULL, 0); + Widget menuBarW = XmCreateMenuBar ((Widget) parent->GetMainWidget(), "MenuBar", NULL, 0); m_mainWidget = (WXWidget) menuBarW; size_t menuCount = GetMenuCount(); @@ -395,7 +405,7 @@ bool wxMenuBar::CreateMenuBar(wxFrame* parent) SetForegroundColour(m_foregroundColour); SetFont(m_font); - XtVaSetValues((Widget) parent->GetMainWindowWidget(), XmNmenuBar, (Widget) m_mainWidget, NULL); + XtVaSetValues((Widget) parent->GetMainWidget(), XmNmenuBar, (Widget) m_mainWidget, NULL); XtRealizeWidget ((Widget) menuBarW); XtManageChild ((Widget) menuBarW); SetMenuBarFrame(parent); @@ -503,7 +513,7 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM Widget buttonWidget = (Widget) 0; Arg args[5]; XtSetArg (args[0], XmNnumColumns, m_numColumns); - XtSetArg (args[1], XmNpacking, XmPACK_COLUMN); + XtSetArg (args[1], XmNpacking, (m_numColumns > 1) ? XmPACK_COLUMN : XmPACK_TIGHT); if (!pullDown) { @@ -516,8 +526,6 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM else { char mnem = wxFindMnemonic (title); - wxStripMenuCodes ((char*) (const char*) title, wxBuffer); - menu = XmCreatePulldownMenu ((Widget) parent, "pulldown", args, 2); wxString title2(wxStripMenuCodes(title));