X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e08931c05af0aae83bbe1e2f4a5a2eab641f346b..da8b1d4b3b535aba94d04494f5b6e2b3e47901ee:/include/wx/msgdlg.h?ds=sidebyside diff --git a/include/wx/msgdlg.h b/include/wx/msgdlg.h index 80644941ff..1f69aba4f9 100644 --- a/include/wx/msgdlg.h +++ b/include/wx/msgdlg.h @@ -46,6 +46,21 @@ public: { } + ButtonLabel(const char *label) + : m_label(label), m_stockId(wxID_NONE) + { + } + + ButtonLabel(const wchar_t *label) + : m_label(label), m_stockId(wxID_NONE) + { + } + + ButtonLabel(const wxCStrData& label) + : m_label(label), m_stockId(wxID_NONE) + { + } + // default copy ctor and dtor are ok // get the string label, whether it was originally specified directly @@ -53,8 +68,9 @@ public: // stock items id support wxString GetAsString() const { - return m_stockId == wxID_NONE ? m_label - : wxGetStockLabel(m_stockId); + return m_stockId == wxID_NONE + ? m_label + : wxGetStockLabel(m_stockId, wxSTOCK_FOR_BUTTON); } // return the stock id or wxID_NONE if this is not a stock label @@ -122,19 +138,34 @@ public: m_extendedMessage = extendedMessage; } -protected: - // common validation of wxMessageDialog style + // change the dialog style flag void SetMessageDialogStyle(long style) { wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || !(style & wxYES_NO), "wxYES and wxNO may only be used together" ); + wxASSERT_MSG( !(style & wxYES) || !(style & wxOK), + "wxOK and wxYES/wxNO can't be used together" ); + + wxASSERT_MSG( (style & wxYES) || (style & wxOK), + "one of wxOK and wxYES/wxNO must be used" ); + wxASSERT_MSG( (style & wxID_OK) != wxID_OK, "wxMessageBox: Did you mean wxOK (and not wxID_OK)?" ); + wxASSERT_MSG( !(style & wxNO_DEFAULT) || (style & wxNO), + "wxNO_DEFAULT is invalid without wxNO" ); + + wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || (style & wxCANCEL), + "wxCANCEL_DEFAULT is invalid without wxCANCEL" ); + + wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || !(style & wxNO_DEFAULT), + "only one default button can be specified" ); + m_dialogStyle = style; } +protected: long GetMessageDialogStyle() const { return m_dialogStyle; } @@ -154,7 +185,7 @@ protected: m_caption; long m_dialogStyle; - DECLARE_NO_COPY_CLASS(wxMessageDialogBase) + wxDECLARE_NO_COPY_CLASS(wxMessageDialogBase); }; // this is a helper class for native wxMessageDialog implementations which need @@ -246,10 +277,10 @@ protected: private: // these functions may be overridden to provide different defaults for the // default button labels (this is used by wxGTK) - virtual wxString GetDefaultYesLabel() const { return _("Yes"); } - virtual wxString GetDefaultNoLabel() const { return _("No"); } - virtual wxString GetDefaultOKLabel() const { return _("OK"); } - virtual wxString GetDefaultCancelLabel() const { return _("Cancel"); } + virtual wxString GetDefaultYesLabel() const { return wxGetTranslation("Yes"); } + virtual wxString GetDefaultNoLabel() const { return wxGetTranslation("No"); } + virtual wxString GetDefaultOKLabel() const { return wxGetTranslation("OK"); } + virtual wxString GetDefaultCancelLabel() const { return wxGetTranslation("Cancel"); } // labels for the buttons, initially empty meaning that the defaults should // be used, use GetYes/No/OK/CancelLabel() to access them @@ -258,7 +289,7 @@ private: m_ok, m_cancel; - DECLARE_NO_COPY_CLASS(wxMessageDialogWithCustomLabels) + wxDECLARE_NO_COPY_CLASS(wxMessageDialogWithCustomLabels); }; #endif // ports needing wxMessageDialogWithCustomLabels