X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e94ee7915bdb56e4a964331cbbd3ff2441e8edef..b7d74e9ca32b2ffd17bd0f98fde97361b6d5ec0f:/src/common/stockitem.cpp?ds=sidebyside diff --git a/src/common/stockitem.cpp b/src/common/stockitem.cpp index bf218c5fce..1d0e914631 100644 --- a/src/common/stockitem.cpp +++ b/src/common/stockitem.cpp @@ -205,18 +205,27 @@ 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 ) + 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), - "button labels never use accelerators" ); + "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);