X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e633eb2f36ebdfafffbbf6b4cc0f5ae6e498b54e..0286d08d1453506f9ff9a830d58b3b35817d0b14:/src/univ/menu.cpp diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index c77350cc1e..2d3fa88a55 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -25,19 +25,21 @@ #if wxUSE_MENUS +#include "wx/menu.h" +#include "wx/stockitem.h" + #ifndef WX_PRECOMP #include "wx/dynarray.h" #include "wx/control.h" // for FindAccelIndex() - #include "wx/menu.h" #include "wx/settings.h" #include "wx/accel.h" #include "wx/log.h" + #include "wx/frame.h" + #include "wx/dcclient.h" #endif // WX_PRECOMP #include "wx/popupwin.h" #include "wx/evtloop.h" -#include "wx/dcclient.h" -#include "wx/frame.h" #include "wx/univ/renderer.h" @@ -121,7 +123,7 @@ class wxPopupMenuWindow : public wxPopupTransientWindow public: wxPopupMenuWindow(wxWindow *parent, wxMenu *menu); - ~wxPopupMenuWindow(); + virtual ~wxPopupMenuWindow(); // override the base class version to select the first item initially virtual void Popup(wxWindow *focus = NULL); @@ -345,7 +347,7 @@ void wxPopupMenuWindow::SetCurrentItem(wxMenuItemIter node) void wxPopupMenuWindow::ChangeCurrent(wxMenuItemIter node) { - if ( node != m_nodeCurrent ) + if ( !m_nodeCurrent || !node || (node != m_nodeCurrent) ) { wxMenuItemIter nodeOldCurrent = m_nodeCurrent; @@ -761,7 +763,7 @@ void wxPopupMenuWindow::ProcessMouseMove(const wxPoint& pt) // the window (see below) if ( node ) { - if ( node != m_nodeCurrent ) + if ( !m_nodeCurrent || (node != m_nodeCurrent) ) { ChangeCurrent(node); @@ -986,7 +988,7 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key) int idxAccel = item->GetAccelIndex(); if ( idxAccel != -1 && - wxTolower(item->GetLabel()[(size_t)idxAccel]) + (wxChar)wxTolower(item->GetLabel()[(size_t)idxAccel]) == chAccel ) { // ok, found an item with this accel @@ -1541,6 +1543,7 @@ void wxMenuItem::SetText(const wxString& text) if ( text != m_text ) { // first call the base class version to change m_text + // (and also check if we don't have a stock menu item) wxMenuItemBase::SetText(text); UpdateAccelInfo(); @@ -2327,8 +2330,7 @@ int wxMenuBar::FindNextItemForAccel(int idxStart, int key, bool *unique) const int idxAccel = info.GetAccelIndex(); if ( idxAccel != -1 && - wxTolower(info.GetLabel()[(size_t)idxAccel]) - == chAccel ) + (wxChar)wxTolower(info.GetLabel()[(size_t)idxAccel]) == chAccel ) { // ok, found an item with this accel if ( idxFound == -1 )