wxMotif compiles (and runs minimal sample) again after wxMenu changes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4311 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-11-02 17:23:29 +00:00
parent d76e994a28
commit c71830c3b6
6 changed files with 212 additions and 455 deletions

View File

@@ -21,10 +21,38 @@
class WXDLLEXPORT wxSpinCtrl : public wxTextCtrl
{
public:
wxSpinCtrlBase() { Init(); }
wxSpinCtrl() { Init(); }
wxSpinCtrl(wxWindow *parent,
wxWindowID id = -1,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_ARROW_KEYS,
int min = 0, int max = 100, int initial = 0,
const wxString& name = _T("wxSpinCtrl"))
{
Create(parent, id, value, pos, size, style, min, max, initial, name);
}
bool Create(wxWindow *parent,
wxWindowID id = -1,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_ARROW_KEYS,
int min = 0, int max = 100, int initial = 0,
const wxString& name = _T("wxSpinCtrl"))
{
SetValue(initial);
SetRange(min, max);
return wxTextCtrl::Create(parent, id, value, pos, size, style,
wxDefaultValidator, name);
}
// accessors
int GetValue() const
int GetValue(int WXUNUSED(dummy) = 1) const
{
int n;
if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%d"), &n) != 1) )

View File

@@ -25,107 +25,56 @@ class wxFrame;
// Menu
// ----------------------------------------------------------------------------
class wxMenu : public wxEvtHandler
class wxMenu : public wxMenuBase
{
DECLARE_DYNAMIC_CLASS(wxMenu)
public:
// ctor & dtor
#ifdef WXWIN_COMPATIBILITY
wxMenu( const wxString& title, const wxFunction func)
{
Init(title, 0, func);
}
#endif // WXWIN_COMPATIBILITY
wxMenu( const wxString& title = wxEmptyString, long style = 0 )
{
Init(title, style);
}
// ctors & dtor
wxMenu(const wxString& title, long style = 0)
: wxMenuBase(title, style) { Init(); }
wxMenu(long style = 0) : wxMenuBase(style) { Init(); }
virtual ~wxMenu();
// construct menu
// append items to the menu
// separator line
void AppendSeparator();
// normal item
void Append(int id, const wxString& Label, const wxString& helpString = wxEmptyString,
bool checkable = FALSE);
// a submenu
void Append(int id, const wxString& Label, wxMenu *SubMenu,
const wxString& helpString = wxEmptyString);
// the most generic form (create wxMenuItem first and use it's functions)
void Append(wxMenuItem *pItem);
// insert a break in the menu
void Break();
// delete an item
void Delete(int id);
// implement base class virtuals
virtual bool DoAppend(wxMenuItem *item);
virtual bool DoInsert(size_t pos, wxMenuItem *item);
virtual wxMenuItem *DoRemove(wxMenuItem *item);
// menu item control
void Enable(int id, bool Flag);
bool Enabled(int id) const;
bool IsEnabled(int id) const { return Enabled(id); };
void Check(int id, bool Flag);
bool Checked(int id) const;
bool IsChecked(int id) const { return IsChecked(id); };
virtual void Break();
// Client data
void SetClientData(void* clientData) { m_clientData = clientData; }
void* GetClientData() const { return m_clientData; }
virtual void SetTitle(const wxString& title);
// item properties
// title
void SetTitle(const wxString& label);
const wxString GetTitle() const;
// label
void SetLabel(int id, const wxString& label);
wxString GetLabel(int id) const;
// help string
virtual void SetHelpString(int id, const wxString& helpString);
virtual wxString GetHelpString(int id) const ;
bool ProcessCommand(wxCommandEvent& event);
// find item
// Finds the item id matching the given string, -1 if not found.
virtual int FindItem(const wxString& itemString) const ;
// Find wxMenuItem by ID, and item's menu too if itemMenu is !NULL.
wxMenuItem *FindItemForId(int itemId, wxMenu **itemMenu = NULL) const;
// Updates the UI for a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*) NULL);
void ProcessCommand(wxCommandEvent& event);
#ifdef WXWIN_COMPATIBILITY
void Callback(const wxFunction func) { m_callback = func; }
#if WXWIN_COMPATIBILITY
wxMenu(const wxString& title, const wxFunction func)
: wxMenuBase(title)
{
Callback(func);
}
#endif // WXWIN_COMPATIBILITY
void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
wxEvtHandler *GetEventHandler() { return m_eventHandler; }
wxList& GetItems() const { return (wxList&) m_menuItems; }
void SetInvokingWindow(wxWindow *pWin) { m_pInvokingWindow = pWin; }
wxWindow *GetInvokingWindow() const { return m_pInvokingWindow; }
//// Motif-specific
WXWidget GetButtonWidget() const { return m_buttonWidget; }
void SetButtonWidget(WXWidget buttonWidget) { m_buttonWidget = buttonWidget; }
WXWidget GetMainWidget() const { return m_menuWidget; }
wxMenu* GetParent() const { return m_menuParent; }
int GetId() const { return m_menuId; }
void SetId(int id) { m_menuId = id; }
void SetMenuBar(wxMenuBar* menuBar) { m_menuBar = menuBar; }
wxMenuBar* GetMenuBar() const { return m_menuBar; }
void CreatePopup(WXWidget logicalParent, int x, int y);
void DestroyPopup (void);
void DestroyPopup();
void ShowPopup(int x, int y);
void HidePopup (void);
void HidePopup();
WXWidget CreateMenu(wxMenuBar *menuBar, WXWidget parent, wxMenu *topMenu,
const wxString& title = "", bool isPulldown = FALSE);
const wxString& title = wxEmptyString,
bool isPulldown = FALSE);
// For popups, need to destroy, then recreate menu for a different (or
// possibly same) window, since the parent may change.
@@ -141,33 +90,18 @@ public:
void SetFont(const wxFont& colour);
void ChangeFont(bool keepOriginalSize = FALSE);
// implementation from now on
WXWidget GetHandle() const { return m_menuWidget; }
bool IsTearOff() const { return (m_style & wxMENU_TEAROFF) != 0; }
public:
#ifdef WXWIN_COMPATIBILITY
wxFunction m_callback;
#endif // WXWIN_COMPATIBILITY
int m_noItems;
wxString m_title;
wxMenuBar * m_menuBar;
wxList m_menuItems;
wxEvtHandler * m_eventHandler;
void* m_clientData;
wxWindow* m_pInvokingWindow;
long m_style;
//// Motif-specific
// Motif-specific data
int m_numColumns;
WXWidget m_menuWidget;
WXWidget m_popupShell; // For holding the popup shell widget
WXWidget m_buttonWidget; // The actual string, so we can grey it etc.
int m_menuId;
wxMenu* m_topLevelMenu ;
wxMenu* m_menuParent;
bool m_ownedByMenuBar;
wxColour m_foregroundColour;
wxColour m_backgroundColour;
@@ -175,12 +109,9 @@ public:
private:
// common code for both constructors:
void Init( const wxString& title,
long style
#ifdef WXWIN_COMPATIBILITY
, const wxFunction func = (wxFunction) NULL
#endif
);
void Init();
DECLARE_DYNAMIC_CLASS(wxMenu)
};
// ----------------------------------------------------------------------------

View File

@@ -16,11 +16,13 @@
#pragma interface "menuitem.h"
#endif
class WXDLLEXPORT wxMenuBar;
// ----------------------------------------------------------------------------
// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMenuItem: public wxMenuItemBase
class wxMenuItem : public wxMenuItemBase
{
public:
// ctor & dtor
@@ -34,6 +36,7 @@ public:
// accessors (some more are inherited from wxOwnerDrawn or are below)
virtual void SetText(const wxString& label);
virtual wxString GetLabel() const;
virtual void Enable(bool enable = TRUE);
virtual void Check(bool check = TRUE);

View File

@@ -59,21 +59,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
// ----------------------------------------------------------------------------
// Construct a menu with optional title (then use append)
void wxMenu::Init(const wxString& title,
long style
#ifdef WXWIN_COMPATIBILITY
, const wxFunction func
#endif
)
void wxMenu::Init()
{
m_title = title;
m_eventHandler = this;
m_noItems = 0;
m_menuBar = NULL;
m_pInvokingWindow = NULL;
m_style = style;
//// Motif-specific members
// Motif-specific members
m_numColumns = 1;
m_menuWidget = (WXWidget) NULL;
m_popupShell = (WXWidget) NULL;
@@ -81,21 +69,16 @@ void wxMenu::Init(const wxString& title,
m_menuId = 0;
m_topLevelMenu = (wxMenu*) NULL;
m_ownedByMenuBar = FALSE;
m_menuParent = (wxMenu*) NULL;
m_clientData = (void*) NULL;
if (m_title != "")
if ( !!m_title )
{
Append(ID_SEPARATOR, m_title) ;
Append(wxID_SEPARATOR, m_title) ;
AppendSeparator() ;
}
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENU);
m_foregroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENUTEXT);
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
#ifdef WXWIN_COMPATIBILITY
Callback(func);
#endif
}
// The wxWindow destructor will take care of deleting the submenus.
@@ -115,22 +98,6 @@ wxMenu::~wxMenu()
m_menuParent = NULL;
// m_menuBar = NULL;
}
wxNode *node = m_menuItems.First();
while (node)
{
wxMenuItem *item = (wxMenuItem *)node->Data();
/*
if (item->GetSubMenu())
item->DeleteSubMenu();
*/
wxNode *next = node->Next();
delete item;
delete node;
node = next;
}
}
void wxMenu::Break()
@@ -139,249 +106,70 @@ void wxMenu::Break()
}
// function appends a new item or submenu to the menu
void wxMenu::Append(wxMenuItem *pItem)
bool wxMenu::DoAppend(wxMenuItem *pItem)
{
wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
m_menuItems.Append(pItem);
if (m_menuWidget)
pItem->CreateItem (m_menuWidget, m_menuBar, m_topLevelMenu); // this is a dynamic Append
m_noItems++;
{
// this is a dynamic Append
pItem->CreateItem(m_menuWidget, m_menuBar, m_topLevelMenu);
}
void wxMenu::AppendSeparator()
if ( pItem->IsSubMenu() )
{
Append(new wxMenuItem(this, ID_SEPARATOR));
pItem->GetSubMenu()->m_topLevelMenu = m_topLevelMenu;
}
// Pullright item
// N.B.: difference between old and new code.
// Old code stores subMenu in 'children' for later deletion,
// as well as in m_menuItems, whereas we only store it in
// m_menuItems here. What implications does this have?
void wxMenu::Append(int id, const wxString& label, wxMenu *subMenu,
const wxString& helpString)
{
Append(new wxMenuItem(this, id, label, helpString, FALSE, subMenu));
subMenu->m_topLevelMenu = m_topLevelMenu;
return wxMenuBase::DoAppend(pItem);
}
// Ordinary menu item
void wxMenu::Append(int id, const wxString& label,
const wxString& helpString, bool checkable)
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
{
// 'checkable' parameter is useless for Windows.
Append(new wxMenuItem(this, id, label, helpString, checkable));
}
void wxMenu::Delete(int id)
{
wxNode *node;
wxMenuItem *item;
int pos;
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++)
{
item = (wxMenuItem *)node->Data();
if (item->GetId() == id)
break;
}
if (!node)
return;
item->DestroyItem(TRUE);
// See also old code - don't know if this is needed (seems redundant).
/*
if (item->GetSubMenu()) {
item->subMenu->top_level_menu = item->GetSubMenu();
item->subMenu->window_parent = NULL;
children->DeleteObject(item->GetSubMenu());
}
*/
m_menuItems.DeleteNode(node);
delete item;
return wxMenuBase::DoRemove(item);
}
void wxMenu::Enable(int id, bool flag)
bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
{
wxMenuItem *item = FindItemForId(id);
wxCHECK_RET( item != NULL, "can't enable non-existing menu item" );
if ( !wxMenuBase::DoInsert(pos, item) )
return FALSE;
item->Enable(flag);
}
wxFAIL_MSG(wxT("not implemented"));
bool wxMenu::Enabled(int Id) const
{
wxMenuItem *item = FindItemForId(Id);
wxCHECK( item != NULL, FALSE );
return item->IsEnabled();
}
void wxMenu::Check(int Id, bool Flag)
{
wxMenuItem *item = FindItemForId(Id);
wxCHECK_RET( item != NULL, "can't get status of non-existing menu item" );
item->Check(Flag);
}
bool wxMenu::Checked(int id) const
{
wxMenuItem *item = FindItemForId(id);
wxCHECK( item != NULL, FALSE );
return item->IsChecked();
return FALSE;
}
void wxMenu::SetTitle(const wxString& label)
{
m_title = label;
wxNode *node = m_menuItems.First ();
wxMenuItemList::Node *node = GetMenuItems().GetFirst();
if ( !node )
return;
wxMenuItem *item = (wxMenuItem *) node->Data ();
wxMenuItem *item = node->GetData ();
Widget widget = (Widget) item->GetButtonWidget();
if ( !widget )
return;
XmString title_str = XmStringCreateSimple ((char*) (const char*) label);
wxXmString title_str(label);
XtVaSetValues(widget,
XmNlabelString, title_str,
XmNlabelString, title_str(),
NULL);
// TODO: should we delete title_str now?
}
const wxString wxMenu::GetTitle() const
{
return m_title;
}
void wxMenu::SetLabel(int id, const wxString& label)
{
wxMenuItem *item = FindItemForId(id);
if (item == (wxMenuItem*) NULL)
return;
item->SetText(label);
}
wxString wxMenu::GetLabel(int id) const
{
wxMenuItem *it = NULL;
WXWidget w = FindMenuItem (id, &it);
if (w)
{
XmString text;
char *s;
XtVaGetValues ((Widget) w,
XmNlabelString, &text,
NULL);
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
{
wxString str(s);
XtFree (s);
return str;
}
else
{
XmStringFree (text);
return wxEmptyString;
}
}
else
return wxEmptyString;
}
// Finds the item id matching the given string, -1 if not found.
int wxMenu::FindItem (const wxString& itemString) const
{
char buf1[200];
char buf2[200];
wxStripMenuCodes ((char *)(const char *)itemString, buf1);
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
{
wxMenuItem *item = (wxMenuItem *) node->Data ();
if (item->GetSubMenu())
{
int ans = item->GetSubMenu()->FindItem(itemString);
if (ans > -1)
return ans;
}
if ( !item->IsSeparator() )
{
wxStripMenuCodes((char *)item->GetName().c_str(), buf2);
if (strcmp(buf1, buf2) == 0)
return item->GetId();
}
}
return -1;
}
wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const
{
if (itemMenu)
*itemMenu = NULL;
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
{
wxMenuItem *item = (wxMenuItem *) node->Data ();
if (item->GetId() == itemId)
{
if (itemMenu)
*itemMenu = (wxMenu *) this;
return item;
}
if (item->GetSubMenu())
{
wxMenuItem *ans = item->GetSubMenu()->FindItemForId (itemId, itemMenu);
if (ans)
return ans;
}
}
if (itemMenu)
*itemMenu = NULL;
return NULL;
}
void wxMenu::SetHelpString(int itemId, const wxString& helpString)
{
wxMenuItem *item = FindItemForId (itemId);
if (item)
item->SetHelp(helpString);
}
wxString wxMenu::GetHelpString (int itemId) const
{
wxMenuItem *item = FindItemForId (itemId);
wxString str("");
return (item == NULL) ? str : item->GetHelp();
}
void wxMenu::ProcessCommand(wxCommandEvent & event)
bool wxMenu::ProcessCommand(wxCommandEvent & event)
{
bool processed = FALSE;
#if WXWIN_COMPATIBILITY
// Try a callback
if (m_callback)
{
(void) (*(m_callback)) (*this, event);
processed = TRUE;
}
#endif // WXWIN_COMPATIBILITY
// Try the menu's event handler
if ( !processed && GetEventHandler())
@@ -392,46 +180,8 @@ void wxMenu::ProcessCommand(wxCommandEvent & event)
// through the hierarchy)
if ( !processed && GetInvokingWindow())
processed = GetInvokingWindow()->ProcessEvent(event);
}
// Update a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void wxMenu::UpdateUI(wxEvtHandler* source)
{
if (!source && GetInvokingWindow())
source = GetInvokingWindow()->GetEventHandler();
if (!source)
source = GetEventHandler();
if (!source)
source = this;
wxNode* node = GetItems().First();
while (node)
{
wxMenuItem* item = (wxMenuItem*) node->Data();
if ( !item->IsSeparator() )
{
wxWindowID id = item->GetId();
wxUpdateUIEvent event(id);
event.SetEventObject( source );
if (source->ProcessEvent(event))
{
if (event.GetSetText())
SetLabel(id, event.GetText());
if (event.GetSetChecked())
Check(id, event.GetChecked());
if (event.GetSetEnabled())
Enable(id, event.GetEnabled());
}
if (item->GetSubMenu())
item->GetSubMenu()->UpdateUI(source);
}
node = node->Next();
}
return processed;
}
// ----------------------------------------------------------------------------
@@ -596,7 +346,7 @@ wxMenuItem *wxMenuBar::FindItem(int id, wxMenu ** itemMenu) const
wxMenuItem *item = NULL;
size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++)
if ((item = m_menus[i]->FindItemForId (id, itemMenu)))
if ((item = m_menus[i]->FindItem(id, itemMenu)))
return item;
return NULL;
}
@@ -691,16 +441,31 @@ int PostDeletionOfMenu( XtPointer* clientData )
XtRemoveWorkProc(WorkProcMenuId);
wxMenu *menu = (wxMenu *)clientData;
if (menu->GetMainWidget()) {
if (menu->GetParent())
if (menu->GetMainWidget())
{
wxList& list = menu->GetParent()->GetItems();
list.DeleteObject(menu);
wxMenu *menuParent = menu->GetParent();
if ( menuParent )
{
wxMenuItemList::Node *node = menuParent->GetMenuItems().GetFirst();
while ( node )
{
if ( node->GetData()->GetSubMenu() == menu )
{
menuParent->GetMenuItems().DeleteNode(node);
break;
}
node = node->GetNext();
}
}
menu->DestroyMenu(TRUE);
}
/* Mark as no longer popped up */
// Mark as no longer popped up
menu->m_menuId = -1;
return TRUE;
}
@@ -774,9 +539,12 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
m_menuBar = menuBar;
m_topLevelMenu = topMenu;
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
wxMenuItem *item = (wxMenuItem *) node->Data ();
wxMenuItem *item = node->GetData();
item->CreateItem(menu, menuBar, topMenu);
}
@@ -792,13 +560,15 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
// do a CreateMenu again.
void wxMenu::DestroyMenu (bool full)
{
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
wxMenuItem *item = (wxMenuItem *) node->Data ();
wxMenuItem *item = node->GetData();
item->SetMenuBar((wxMenuBar*) NULL);
item->DestroyItem(full);
}// for()
}
if (m_buttonWidget)
{
@@ -825,9 +595,11 @@ WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const
return m_buttonWidget;
}
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
wxMenuItem *item = (wxMenuItem *) node->Data ();
wxMenuItem *item = node->GetData ();
if (item->GetId() == id)
{
if (it)
@@ -843,7 +615,7 @@ WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const
return w;
}
}
}// for()
}
if (it)
*it = (wxMenuItem*) NULL;
@@ -858,10 +630,11 @@ void wxMenu::SetBackgroundColour(const wxColour& col)
if (m_buttonWidget)
wxDoChangeBackgroundColour(m_buttonWidget, (wxColour&) col, TRUE);
wxNode* node = m_menuItems.First();
while (node)
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
wxMenuItem* item = (wxMenuItem*) node->Data();
wxMenuItem* item = node->GetData();
if (item->GetButtonWidget())
{
// This crashes because it uses gadgets
@@ -869,7 +642,6 @@ void wxMenu::SetBackgroundColour(const wxColour& col)
}
if (item->GetSubMenu())
item->GetSubMenu()->SetBackgroundColour((wxColour&) col);
node = node->Next();
}
}
@@ -881,10 +653,11 @@ void wxMenu::SetForegroundColour(const wxColour& col)
if (m_buttonWidget)
wxDoChangeForegroundColour(m_buttonWidget, (wxColour&) col);
wxNode* node = m_menuItems.First();
while (node)
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
wxMenuItem* item = (wxMenuItem*) node->Data();
wxMenuItem* item = node->GetData();
if (item->GetButtonWidget())
{
// This crashes because it uses gadgets
@@ -892,7 +665,6 @@ void wxMenu::SetForegroundColour(const wxColour& col)
}
if (item->GetSubMenu())
item->GetSubMenu()->SetForegroundColour((wxColour&) col);
node = node->Next();
}
}
@@ -914,10 +686,12 @@ void wxMenu::ChangeFont(bool keepOriginalSize)
XmNfontList, fontList,
NULL);
}
wxNode* node = m_menuItems.First();
while (node)
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
wxMenuItem* item = (wxMenuItem*) node->Data();
wxMenuItem* item = node->GetData();
if (m_menuWidget && item->GetButtonWidget() && m_font.Ok())
{
XtVaSetValues ((Widget) item->GetButtonWidget(),
@@ -926,7 +700,6 @@ void wxMenu::ChangeFont(bool keepOriginalSize)
}
if (item->GetSubMenu())
item->GetSubMenu()->ChangeFont(keepOriginalSize);
node = node->Next();
}
#endif
}

View File

@@ -150,7 +150,29 @@ void wxMenuItem::Check(bool bDoCheck)
}
}
//// Motif-specific
wxString wxMenuItem::GetLabel() const
{
return wxStripMenuCodes(m_text);
}
// ----------------------------------------------------------------------------
// wxMenuItemBase
// ----------------------------------------------------------------------------
wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu,
int id,
const wxString& name,
const wxString& help,
bool isCheckable,
wxMenu *subMenu)
{
return new wxMenuItem(parentMenu, id, name, help, isCheckable, subMenu);
}
// ----------------------------------------------------------------------------
// Motif-specific
// ----------------------------------------------------------------------------
void wxMenuItem::CreateItem (WXWidget menu, wxMenuBar * menuBar, wxMenu * topMenu)
{

View File

@@ -1657,7 +1657,7 @@ bool wxWindow::ProcessAccelerator(wxKeyEvent& event)
// Try for a menu command
if (frame->GetMenuBar())
{
wxMenuItem* item = frame->GetMenuBar()->FindItemForId(entry->GetCommand());
wxMenuItem* item = frame->GetMenuBar()->FindItem(entry->GetCommand());
if (item)
{
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, entry->GetCommand());