#if wxUSE_MENUS
#include "wx/menu.h"
+#include "wx/stockitem.h"
#ifndef WX_PRECOMP
#include "wx/dynarray.h"
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);
void wxPopupMenuWindow::ChangeCurrent(wxMenuItemIter node)
{
- if ( node != m_nodeCurrent )
+ if ( !m_nodeCurrent || !node || (node != m_nodeCurrent) )
{
wxMenuItemIter nodeOldCurrent = m_nodeCurrent;
// the window (see below)
if ( node )
{
- if ( node != m_nodeCurrent )
+ if ( !m_nodeCurrent || (node != m_nodeCurrent) )
{
ChangeCurrent(node);
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
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();
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 )