#ifdef __VMS__
#pragma message disable nosimpint
-#define XtDisplay XTDISPLAY
-#define XtWindow XTWINDOW
#endif
#include <Xm/Label.h>
#include <Xm/LabelG.h>
// other standard headers
#include <string.h>
-IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
-IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
-
// ============================================================================
// implementation
// ============================================================================
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 = 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;
}
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)
{
XtSetArg (args[0], XmNnumColumns, m_numColumns);
XtSetArg (args[1], XmNpacking, (m_numColumns > 1) ? XmPACK_COLUMN : XmPACK_TIGHT);
- if ( !m_font.Ok() )
+ if ( !m_font.IsOk() )
{
if ( menuBar )
m_font = menuBar->GetFont();
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;
}
void wxMenu::SetBackgroundColour(const wxColour& col)
{
m_backgroundColour = col;
- if (!col.Ok())
+ if (!col.IsOk())
return;
if (m_menuWidget)
wxDoChangeBackgroundColour(m_menuWidget, (wxColour&) col);
void wxMenu::SetForegroundColour(const wxColour& col)
{
m_foregroundColour = col;
- if (!col.Ok())
+ if (!col.IsOk())
return;
if (m_menuWidget)
wxDoChangeForegroundColour(m_menuWidget, (wxColour&) col);
{
// Lesstif 0.87 hangs here, but 0.93 does not; MBN: sometimes it does
#if !wxCHECK_LESSTIF() // || wxCHECK_LESSTIF_VERSION( 0, 93 )
- if (!m_font.Ok() || !m_menuWidget)
+ if (!m_font.IsOk() || !m_menuWidget)
return;
Display* dpy = XtDisplay((Widget) m_menuWidget);
node = node->GetNext() )
{
wxMenuItem* item = node->GetData();
- if (m_menuWidget && item->GetButtonWidget() && m_font.Ok())
+ if (m_menuWidget && item->GetButtonWidget() && m_font.IsOk())
{
XtVaSetValues ((Widget) item->GetButtonWidget(),
wxFont::GetFontTag(), m_font.GetFontTypeC(dpy),
{
if (!wxWindowBase::SetBackgroundColour(col))
return false;
- if (!col.Ok())
+ if (!col.IsOk())
return false;
if (m_mainWidget)
wxDoChangeBackgroundColour(m_mainWidget, (wxColour&) col);
{
if (!wxWindowBase::SetForegroundColour(col))
return false;
- if (!col.Ok())
+ if (!col.IsOk())
return false;
if (m_mainWidget)
wxDoChangeForegroundColour(m_mainWidget, (wxColour&) col);