X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d775fa82354a1f8d5db87ad1d71ab00ef7d9123c..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/src/common/stockitem.cpp diff --git a/src/common/stockitem.cpp b/src/common/stockitem.cpp index 13be116b1f..1946b288ae 100644 --- a/src/common/stockitem.cpp +++ b/src/common/stockitem.cpp @@ -30,7 +30,7 @@ #include "wx/stockitem.h" #include "wx/intl.h" - +#include "wx/utils.h" // for wxStripMenuCodes() bool wxIsStockID(wxWindowID id) { @@ -93,11 +93,14 @@ bool wxIsStockID(wxWindowID id) }; } -wxString wxGetStockLabel(wxWindowID id) +wxString wxGetStockLabel(wxWindowID id, bool withCodes, wxString accelerator) { + wxString stockLabel; + #define STOCKITEM(stockid, label) \ case stockid: \ - return label; + stockLabel = label; \ + break; switch (id) { @@ -159,7 +162,17 @@ wxString wxGetStockLabel(wxWindowID id) #undef STOCKITEM - return wxEmptyString; + if(!withCodes) + { + stockLabel = wxStripMenuCodes( stockLabel ); + } + else if (!stockLabel.empty() && !accelerator.empty()) + { + stockLabel += _T("\t"); + stockLabel += accelerator; + } + + return stockLabel; } bool wxIsStockLabel(wxWindowID id, const wxString& label)