]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/stockitem.cpp
Hide value label explicitly
[wxWidgets.git] / src / common / stockitem.cpp
index f9f3fc049ea4e73a456b9f2ad47b247c5d10bb54..9a02d8bf5845f071d2dacf0a9c0cbf768a8d41c4 100644 (file)
@@ -205,6 +205,26 @@ wxString wxGetStockLabel(wxWindowID id, long flags)
 
     #undef STOCKITEM
 
+    // we assume that buttons use the same labels as menu items but unlike them
+    // they should never use ellipsis
+    if ( (flags & wxSTOCK_FOR_BUTTON) == wxSTOCK_FOR_BUTTON )
+    {
+        wxString baseLabel;
+        if ( stockLabel.EndsWith("...", &baseLabel) )
+            stockLabel = baseLabel;
+
+        wxASSERT_MSG( !(flags & wxSTOCK_WITH_ACCELERATOR),
+                        "button labels never use accelerators" );
+    }
+
+#ifdef __WXMSW__
+    // special case: the "Cancel" button shouldn't have a mnemonic under MSW
+    // for consistency with the native dialogs (which don't use any mnemonic
+    // for it because it is already bound to Esc implicitly)
+    if ( id == wxID_CANCEL )
+        flags &= ~wxSTOCK_WITH_MNEMONIC;
+#endif // __WXMSW__
+
     if ( !(flags & wxSTOCK_WITH_MNEMONIC) )
     {
         stockLabel = wxStripMenuCodes(stockLabel);