X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad7aff71f517de318f0b8ef83d789be4e934bd63..b4c1fe36b9854cdb404906ba3a181a67f9247e0e:/src/common/stockitem.cpp diff --git a/src/common/stockitem.cpp b/src/common/stockitem.cpp index 927fa245ef..9a02d8bf58 100644 --- a/src/common/stockitem.cpp +++ b/src/common/stockitem.cpp @@ -199,12 +199,32 @@ wxString wxGetStockLabel(wxWindowID id, long flags) STOCKITEM(wxID_ZOOM_OUT, _("Zoom &Out")) default: - wxFAIL_MSG( _T("invalid stock item ID") ); + wxFAIL_MSG( wxT("invalid stock item ID") ); break; }; #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); @@ -215,7 +235,7 @@ wxString wxGetStockLabel(wxWindowID id, long flags) { wxAcceleratorEntry accel = wxGetStockAccelerator(id); if (accel.IsOk()) - stockLabel << _T('\t') << accel.ToString(); + stockLabel << wxT('\t') << accel.ToString(); } #endif // wxUSE_ACCEL @@ -308,7 +328,7 @@ bool wxIsStockLabel(wxWindowID id, const wxString& label) if (label == stock) return true; - stock.Replace(_T("&"), wxEmptyString); + stock.Replace(wxT("&"), wxEmptyString); if (label == stock) return true;