/////////////////////////////////////////////////////////////////////////////
-// Name: menu.cpp
+// Name: src/motif/menu.cpp
// Purpose: wxMenu, wxMenuBar, wxMenuItem
// Author: Julian Smart
// Modified by:
// 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/log.h"
-#include "wx/utils.h"
-#include "wx/app.h"
-#include "wx/frame.h"
-#include "wx/settings.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+ #include "wx/app.h"
+ #include "wx/utils.h"
+ #include "wx/frame.h"
+ #include "wx/settings.h"
+ #include "wx/menuitem.h"
+#endif
#ifdef __VMS__
#pragma message disable nosimpint
item->GetSubMenu()->m_topLevelMenu = m_topLevelMenu;
}
- return pos == GetMenuItemCount() ? wxMenuBase::DoAppend(item) :
+ return pos == GetMenuItemCount() ? wxMenuBase::DoAppend(item) :
wxMenuBase::DoInsert(pos, item);
}
// Find the menu menuString, item itemString, and return the item id.
// Returns -1 if none found.
-int wxMenuBar::FindMenuItem (const wxString& menuString, const wxString& itemString) const
+int wxMenuBar::FindMenuItem(const wxString& menuString, const wxString& itemString) const
{
- char buf1[200];
- char buf2[200];
- wxStripMenuCodes (wxConstCast(menuString.c_str(), char), buf1);
+ const wxString stripped = wxStripMenuCodes(menuString);
size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++)
{
- wxStripMenuCodes (wxConstCast(m_titles[i].c_str(), char), buf2);
- if (strcmp (buf1, buf2) == 0)
+ if ( wxStripMenuCodes(m_titles[i]) == stripped )
return m_menus.Item(i)->GetData()->FindItem (itemString);
}
- return -1;
+ return wxNOT_FOUND;
}
wxMenuItem *wxMenuBar::FindItem(int id, wxMenu ** itemMenu) const
if (itemMenu)
*itemMenu = NULL;
- wxMenuItem *item = NULL;
size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++)
- if ((item = m_menus.Item(i)->GetData()->FindItem(id, itemMenu)))
- return item;
- return NULL;
+ {
+ wxMenuItem *item = m_menus.Item(i)->GetData()->FindItem(id, itemMenu);
+ if (item) return item;
+ }
+
+ return NULL;
}
// Create menubar
*
*/
-WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topMenu, size_t index, const wxString& title, bool pullDown)
+WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar,
+ WXWidget parent,
+ wxMenu * topMenu,
+ size_t WXUNUSED(index),
+ const wxString& title,
+ bool pullDown)
{
Widget menu = (Widget) 0;
Widget buttonWidget = (Widget) 0;
if (item->GetSubMenu())
item->GetSubMenu()->ChangeFont(keepOriginalSize);
}
+#else
+ wxUnusedVar(keepOriginalSize);
#endif
}
return true;
}
-