#include "wx/wxprec.h"
#include "wx/menu.h"
-#include "wx/log.h"
-#include "wx/intl.h"
-#include "wx/app.h"
-#include "wx/bitmap.h"
+#include "wx/stockitem.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/intl.h"
+ #include "wx/log.h"
+ #include "wx/app.h"
+ #include "wx/bitmap.h"
+#endif
#if wxUSE_ACCEL
#include "wx/accel.h"
return label;
}
-void wxMenuItem::SetText( const wxString& str )
+void wxMenuItem::SetText( const wxString& string )
{
+ wxString str = string;
+ if ( str.empty() && !IsSeparator() )
+ {
+ wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
+ str = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR |
+ wxSTOCK_WITH_MNEMONIC);
+ }
+
// Some optimization to avoid flicker
wxString oldLabel = m_text;
oldLabel = wxStripMenuCodes(oldLabel);
pc++;
m_hotKey = pc;
}
-
- // wxPrintf( wxT("DoSetText(): str %s m_text %s hotkey %s\n"), str.c_str(), m_text.c_str(), m_hotKey.c_str() );
}
#if wxUSE_ACCEL
return (wxAcceleratorEntry *)NULL;
}
- // as wxGetAccelFromString() looks for TAB, insert a dummy one here
+ // accelerator parsing code looks for them after a TAB, so insert a dummy
+ // one here
wxString label;
label << wxT('\t') << GetHotKey();
- return wxGetAccelFromString(label);
+ return wxAcceleratorEntry::Create(label);
}
#endif // wxUSE_ACCEL
text = mitem->GetText();
const wxBitmap *bitmap = &mitem->GetBitmap();
- // TODO
+ // TODO
wxUnusedVar(bitmap);
menuItem = gtk_menu_item_new_with_label( wxGTK_CONV( text ) );
label = GTK_LABEL( GTK_BIN(menuItem)->child );
hotkey << wxT("Down" );
break;
case WXK_PAGEUP:
- case WXK_PRIOR:
- hotkey << wxT("Prior" );
+ hotkey << wxT("PgUp" );
break;
case WXK_PAGEDOWN:
- case WXK_NEXT:
- hotkey << wxT("Next" );
+ hotkey << wxT("PgDn" );
break;
case WXK_LEFT:
hotkey << wxT("Left" );
case WXK_NUMPAD_DOWN:
hotkey << wxT("KP_Down" );
break;
- case WXK_NUMPAD_PRIOR: case WXK_NUMPAD_PAGEUP:
- hotkey << wxT("KP_Prior" );
+ case WXK_NUMPAD_PAGEUP:
+ hotkey << wxT("KP_PgUp" );
break;
- case WXK_NUMPAD_NEXT: case WXK_NUMPAD_PAGEDOWN:
- hotkey << wxT("KP_Next" );
+ case WXK_NUMPAD_PAGEDOWN:
+ hotkey << wxT("KP_PgDn" );
break;
case WXK_NUMPAD_END:
hotkey << wxT("KP_End" );
hotkey += wxString::Format(wxT("Special%d"), code - WXK_SPECIAL1 + 1);
break;
*/
- // if there are any other keys wxGetAccelFromString() may
+ // if there are any other keys wxAcceleratorEntry::Create() may
// return, we should process them here
default:
extern "C" WXDLLIMPEXP_CORE
void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting )
{
- *is_waiting = FALSE;
+ *is_waiting = false;
}
WXDLLIMPEXP_CORE void SetInvokingWindow( wxMenu *menu, wxWindow* win )