X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d775fa82354a1f8d5db87ad1d71ab00ef7d9123c..faa112c4ca49e1f1d9467107d6e54cb9986bd900:/src/common/stockitem.cpp diff --git a/src/common/stockitem.cpp b/src/common/stockitem.cpp index 13be116b1f..c1b7d71ad8 100644 --- a/src/common/stockitem.cpp +++ b/src/common/stockitem.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "stockitem.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -30,7 +26,7 @@ #include "wx/stockitem.h" #include "wx/intl.h" - +#include "wx/utils.h" // for wxStripMenuCodes() bool wxIsStockID(wxWindowID id) { @@ -90,14 +86,17 @@ bool wxIsStockID(wxWindowID id) default: return false; - }; + } } -wxString wxGetStockLabel(wxWindowID id) +wxString wxGetStockLabel(wxWindowID id, bool withCodes, const wxString& accelerator) { + wxString stockLabel; + #define STOCKITEM(stockid, label) \ case stockid: \ - return label; + stockLabel = label; \ + break; switch (id) { @@ -159,7 +158,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)