X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ee0a94cfc2f71e8b770eedda5197a1f4bd62b5cb..d5a0a2bcf856f97702d5f8469e6e2b925ed93dfa:/src/gtk1/menu.cpp?ds=sidebyside diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index 016f700872..fa3f149dd0 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -769,10 +769,11 @@ wxString wxMenuItemBase::GetLabelFromText(const wxString& text) void wxMenuItem::SetText( const wxString& string ) { wxString str = string; - if (str.IsEmpty()) + 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); + 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 @@ -865,8 +866,6 @@ void wxMenuItem::DoSetText( const wxString& str ) 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 @@ -879,11 +878,12 @@ wxAcceleratorEntry *wxMenuItem::GetAccel() const 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 @@ -1423,7 +1423,7 @@ static wxString GetGtkHotKey( const wxMenuItem& item ) 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: