]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/stockitem.cpp
refactor wxLog documentation moving verbose parts to the wxLog overview and grouping...
[wxWidgets.git] / src / common / stockitem.cpp
index f9f3fc049ea4e73a456b9f2ad47b247c5d10bb54..1d0e914631b16b506a745b71eac2d79eb7f59eab 100644 (file)
@@ -205,6 +205,27 @@ wxString wxGetStockLabel(wxWindowID id, long flags)
 
     #undef STOCKITEM
 
+    if ( flags & wxSTOCK_WITHOUT_ELLIPSIS )
+    {
+        wxString baseLabel;
+        if ( stockLabel.EndsWith("...", &baseLabel) )
+            stockLabel = baseLabel;
+
+        // accelerators only make sense for the menu items which should have
+        // ellipsis too while wxSTOCK_WITHOUT_ELLIPSIS is mostly useful for
+        // buttons which shouldn't have accelerators in their labels
+        wxASSERT_MSG( !(flags & wxSTOCK_WITH_ACCELERATOR),
+                        "labels without ellipsis shouldn't 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);