#ifdef __VMS__
#pragma message disable nosimpint
-#define XtDisplay XTDISPLAY
-#define XtWindow XTWINDOW
#endif
#include <Xm/Label.h>
#include <Xm/LabelG.h>
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() )
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 = GetEventHandler()->ProcessEvent(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;
}
// wxLogWarning("wxMenuBar::EnableTop not yet implemented.");
}
-void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
+void wxMenuBar::SetMenuLabel(size_t pos, const wxString& label)
{
wxMenu *menu = GetMenu(pos);
if ( !menu )
XmNlabelString, label_str(),
NULL);
}
+ m_titles[pos] = label;
}
-wxString wxMenuBar::GetLabelTop(size_t pos) const
+wxString wxMenuBar::GetMenuLabel(size_t pos) const
{
- wxMenu *menu = GetMenu(pos);
- if ( menu )
- {
- Widget w = (Widget)menu->GetButtonWidget();
- if (w)
- {
- XmString text;
- XtVaGetValues(w,
- XmNlabelString, &text,
- NULL);
-
- return wxXmStringToString( text );
- }
- }
-
- return wxEmptyString;
+ wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
+ wxT("invalid menu index in wxMenuBar::GetMenuLabel") );
+ return m_titles[pos];
}
bool wxMenuBar::Append(wxMenu * menu, const wxString& title)
Widget tearOff = XmGetTearOffControl(GetWidget(menu));
wxDoChangeForegroundColour((Widget) tearOff, m_foregroundColour);
wxDoChangeBackgroundColour((Widget) tearOff, m_backgroundColour, true);
-#endif
}
+#endif
}
PostCreation();
{
if (!m_mainWidget)
{
- SetMenuBarFrame((wxFrame*) NULL);
+ SetMenuBarFrame(NULL);
return false;
}
XtDestroyWidget((Widget) m_mainWidget);
m_mainWidget = (WXWidget) 0;
- SetMenuBarFrame((wxFrame*) NULL);
+ SetMenuBarFrame(NULL);
return true;
}
WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar,
WXWidget parent,
wxMenu * topMenu,
- size_t WXUNUSED(index),
+ size_t menuIndex,
const wxString& title,
bool pullDown)
{
XmNlabelString, label_str(),
XmNsubMenuId, menu,
(String)wxFont::GetFontTag(), m_font.GetFontTypeC(dpy),
- XmNpositionIndex, index,
+ XmNpositionIndex, menuIndex,
NULL);
if (mnem != 0)
node = node->GetNext() )
{
wxMenuItem *item = node->GetData();
- item->SetMenuBar((wxMenuBar*) NULL);
+ item->SetMenuBar(NULL);
item->DestroyItem(full);
}
if (id == m_menuId)
{
if (it)
- *it = (wxMenuItem*) NULL;
+ *it = NULL;
return m_buttonWidget;
}
}
if (it)
- *it = (wxMenuItem*) NULL;
+ *it = NULL;
return (WXWidget) NULL;
}