]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/stockitem.cpp
added wxConvFileName which is a variable, not define as wxConvFile; added comments...
[wxWidgets.git] / src / common / stockitem.cpp
index 13be116b1fafaba00e9ac4e272a670d5b2c1a853..1946b288aed0355ea5eea4d0cb049604c579fe36 100644 (file)
@@ -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)