X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6b1eedc1bb6ed83afb7a9bed4ea6fa204adbd50f..54e280d8601f48d80bc2fc1d882b43a5f664c999:/src/common/stockitem.cpp diff --git a/src/common/stockitem.cpp b/src/common/stockitem.cpp index e0947433c1..1d0e914631 100644 --- a/src/common/stockitem.cpp +++ b/src/common/stockitem.cpp @@ -199,12 +199,33 @@ 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 + 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); @@ -215,7 +236,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 @@ -271,15 +292,17 @@ wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id) switch (id) { - STOCKITEM(wxID_COPY, wxACCEL_CTRL,'C') - STOCKITEM(wxID_CUT, wxACCEL_CTRL,'X') - STOCKITEM(wxID_FIND, wxACCEL_CTRL,'F') - STOCKITEM(wxID_REPLACE, wxACCEL_CTRL,'R') - STOCKITEM(wxID_HELP, wxACCEL_CTRL,'H') - STOCKITEM(wxID_NEW, wxACCEL_CTRL,'N') - STOCKITEM(wxID_OPEN, wxACCEL_CTRL,'O') - STOCKITEM(wxID_PASTE, wxACCEL_CTRL,'V') - STOCKITEM(wxID_SAVE, wxACCEL_CTRL,'S') + STOCKITEM(wxID_COPY, wxACCEL_CMD,'C') + STOCKITEM(wxID_CUT, wxACCEL_CMD,'X') + STOCKITEM(wxID_FIND, wxACCEL_CMD,'F') + STOCKITEM(wxID_HELP, wxACCEL_CMD,'H') + STOCKITEM(wxID_NEW, wxACCEL_CMD,'N') + STOCKITEM(wxID_OPEN, wxACCEL_CMD,'O') + STOCKITEM(wxID_PASTE, wxACCEL_CMD,'V') + STOCKITEM(wxID_REDO, wxACCEL_CMD | wxACCEL_SHIFT,'Z') + STOCKITEM(wxID_REPLACE, wxACCEL_CMD,'R') + STOCKITEM(wxID_SAVE, wxACCEL_CMD,'S') + STOCKITEM(wxID_UNDO, wxACCEL_CMD,'Z') default: // set the wxAcceleratorEntry to return into an invalid state: @@ -306,7 +329,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;