X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5f7bcb48fd9a642036a3bf5c70e2b0c9576df1b1..84aa68c427aab0b6604c68aa6b228714ef48b66c:/src/common/stockitem.cpp diff --git a/src/common/stockitem.cpp b/src/common/stockitem.cpp index 80fd5e25f5..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) { @@ -158,8 +161,18 @@ 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) @@ -171,11 +184,11 @@ bool wxIsStockLabel(wxWindowID id, const wxString& label) if (label == stock) return true; - + stock.Replace(_T("&"), wxEmptyString); if (label == stock) return true; - + return false; } @@ -189,9 +202,9 @@ const char *wxGetStockGtkID(wxWindowID id) #define STOCKITEM(wx,gtk) \ case wx: \ return gtk; - + #define STOCKITEM_MISSING(wx) \ - case wxid: \ + case wx: \ return NULL; #if GTK_CHECK_VERSION(2,4,0) @@ -259,7 +272,7 @@ const char *wxGetStockGtkID(wxWindowID id) }; #undef STOCKITEM - + return NULL; }