///////////////////////////////////////////////////////////////////////////////
-// Name: menuitem.cpp
+// Name: src/motif/menuitem.cpp
// Purpose: wxMenuItem implementation
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWidgets licence
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "menuitem.h"
-#endif
-
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#include "wx/defs.h"
-
-#include "wx/menu.h"
#include "wx/menuitem.h"
-#include "wx/utils.h"
-#include "wx/frame.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/utils.h"
+ #include "wx/frame.h"
+ #include "wx/menu.h"
+#endif
#ifdef __VMS__
#pragma message disable nosimpint
// Motif-specific
// ----------------------------------------------------------------------------
-void wxMenuItem::CreateItem (WXWidget menu, wxMenuBar * menuBar, wxMenu * topMenu)
+void wxMenuItem::CreateItem (WXWidget menu, wxMenuBar * menuBar,
+ wxMenu * topMenu, size_t index)
{
m_menuBar = menuBar;
m_topMenu = topMenu;
(wxStripMenuCodes(m_text),
xmLabelGadgetClass, (Widget) menu, NULL);
}
- else if ((!m_text.IsNull() && m_text != "") && (!m_subMenu))
+ else if (!m_text.empty() && !m_subMenu)
{
wxString strName = wxStripMenuCodes(m_text);
if (IsCheckable())
{
m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (strName,
xmToggleButtonGadgetClass, (Widget) menu,
+#ifdef XmNpositionIndex
+ XmNpositionIndex, index,
+#endif
NULL);
XtVaSetValues ((Widget) m_buttonWidget, XmNset, (Boolean) IsChecked(), NULL);
}
else
m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (strName,
xmPushButtonGadgetClass, (Widget) menu,
+#ifdef XmNpositionIndex
+ XmNpositionIndex, index,
+#endif
NULL);
char mnem = wxFindMnemonic (m_text);
if (mnem != 0)
else if (GetId() == wxID_SEPARATOR)
{
m_buttonWidget = (WXWidget) XtVaCreateManagedWidget ("separator",
- xmSeparatorGadgetClass, (Widget) menu, NULL);
+ xmSeparatorGadgetClass, (Widget) menu,
+#ifndef XmNpositionIndex
+ XmNpositionIndex, index,
+#endif
+ NULL);
}
else if (m_subMenu)
{
- m_buttonWidget = m_subMenu->CreateMenu (menuBar, menu, topMenu, m_text, TRUE);
+ m_buttonWidget = m_subMenu->CreateMenu (menuBar, menu, topMenu, index, m_text, true);
m_subMenu->SetButtonWidget(m_buttonWidget);
XtAddCallback ((Widget) m_buttonWidget,
XmNcascadingCallback,
; // Nothing
}
- else if ((!m_text.IsNull() && (m_text != "")) && !m_subMenu)
+ else if (!m_text.empty() && !m_subMenu)
{
if (m_buttonWidget)
{
if (item->IsCheckable())
{
- Boolean isChecked = FALSE;
+ Boolean isChecked = false;
XtVaGetValues ((Widget) item->GetButtonWidget(),
XmNset, & isChecked,
NULL);
}
}
}
-