projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
avoid duplicated empty help menu in localized applications (patch 1600747)
[wxWidgets.git]
/
src
/
gtk1
/
menu.cpp
diff --git
a/src/gtk1/menu.cpp
b/src/gtk1/menu.cpp
index fecfe0b787e510f689f97fed5ba7398fa8e235a7..fa3f149dd054385613bb75c1d021055647c90e97 100644
(file)
--- a/
src/gtk1/menu.cpp
+++ b/
src/gtk1/menu.cpp
@@
-11,15
+11,15
@@
#include "wx/wxprec.h"
#include "wx/menu.h"
#include "wx/wxprec.h"
#include "wx/menu.h"
+#include "wx/stockitem.h"
#ifndef WX_PRECOMP
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/app.h"
#ifndef WX_PRECOMP
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/app.h"
+ #include "wx/bitmap.h"
#endif
#endif
-#include "wx/bitmap.h"
-
#if wxUSE_ACCEL
#include "wx/accel.h"
#endif // wxUSE_ACCEL
#if wxUSE_ACCEL
#include "wx/accel.h"
#endif // wxUSE_ACCEL
@@
-766,8
+766,16
@@
wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
return label;
}
return label;
}
-void wxMenuItem::SetText( const wxString& str )
+void wxMenuItem::SetText( const wxString& str
ing
)
{
{
+ 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);
// Some optimization to avoid flicker
wxString oldLabel = m_text;
oldLabel = wxStripMenuCodes(oldLabel);
@@
-858,8
+866,6
@@
void wxMenuItem::DoSetText( const wxString& str )
pc++;
m_hotKey = pc;
}
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
}
#if wxUSE_ACCEL
@@
-872,11
+878,12
@@
wxAcceleratorEntry *wxMenuItem::GetAccel() const
return (wxAcceleratorEntry *)NULL;
}
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();
wxString label;
label << wxT('\t') << GetHotKey();
- return wx
GetAccelFromString
(label);
+ return wx
AcceleratorEntry::Create
(label);
}
#endif // wxUSE_ACCEL
}
#endif // wxUSE_ACCEL
@@
-1416,7
+1423,7
@@
static wxString GetGtkHotKey( const wxMenuItem& item )
hotkey += wxString::Format(wxT("Special%d"), code - WXK_SPECIAL1 + 1);
break;
*/
hotkey += wxString::Format(wxT("Special%d"), code - WXK_SPECIAL1 + 1);
break;
*/
- // if there are any other keys wx
GetAccelFromString
() may
+ // if there are any other keys wx
AcceleratorEntry::Create
() may
// return, we should process them here
default:
// return, we should process them here
default: