X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5bc4758090e3a725bf5b29ff89c49d6f77eebf04..3dea8ba7acb49948ccda20029655fd190a306298:/include/wx/msgdlg.h diff --git a/include/wx/msgdlg.h b/include/wx/msgdlg.h index 7c372cff6f..de2d6abe1b 100644 --- a/include/wx/msgdlg.h +++ b/include/wx/msgdlg.h @@ -68,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 @@ -140,7 +141,6 @@ public: // change the dialog style flag void SetMessageDialogStyle(long style) { -#ifdef __WXDEBUG__ wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || !(style & wxYES_NO), "wxYES and wxNO may only be used together" ); @@ -153,21 +153,14 @@ public: wxASSERT_MSG( (style & wxID_OK) != wxID_OK, "wxMessageBox: Did you mean wxOK (and not wxID_OK)?" ); - if ((style & wxNO) == 0) - wxASSERT_MSG( !(style & wxNO_DEFAULT), - "wxNO_DEFAULT is invalid without wxNO" ); + wxASSERT_MSG( !(style & wxNO_DEFAULT) || (style & wxNO), + "wxNO_DEFAULT is invalid without wxNO" ); - if ((style & wxCANCEL) == 0) - wxASSERT_MSG( !(style & wxCANCEL_DEFAULT), - "wxCANCEL_DEFAULT is invalid without wxCANCEL" ); + wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || (style & wxCANCEL), + "wxCANCEL_DEFAULT is invalid without wxCANCEL" ); - if ((style & wxCANCEL_DEFAULT) != 0) - wxASSERT_MSG( !(style & wxNO_DEFAULT), - "only one default button can be specified" ); - if ((style & wxNO_DEFAULT) != 0) - wxASSERT_MSG( !(style & wxCANCEL_DEFAULT), - "only one default button can be specified" ); -#endif + wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || !(style & wxNO_DEFAULT), + "only one default button can be specified" ); m_dialogStyle = style; } @@ -175,6 +168,26 @@ public: protected: long GetMessageDialogStyle() const { return m_dialogStyle; } + // based on message dialog style, returns exactly one of: wxICON_NONE, + // wxICON_ERROR, wxICON_WARNING, wxICON_QUESTION, wxICON_INFORMATION + long GetEffectiveIcon() const + { + if ( m_dialogStyle & wxICON_NONE ) + return wxICON_NONE; + else if ( m_dialogStyle & wxICON_ERROR ) + return wxICON_ERROR; + else if ( m_dialogStyle & wxICON_WARNING ) + return wxICON_WARNING; + else if ( m_dialogStyle & wxICON_QUESTION ) + return wxICON_QUESTION; + else if ( m_dialogStyle & wxICON_INFORMATION ) + return wxICON_INFORMATION; + else if ( m_dialogStyle & wxYES ) + return wxICON_QUESTION; + else + return wxICON_INFORMATION; + } + // for the platforms not supporting separate main and extended messages // this function should be used to combine both of them in a single string @@ -192,7 +205,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 @@ -284,10 +297,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 @@ -296,7 +309,7 @@ private: m_ok, m_cancel; - DECLARE_NO_COPY_CLASS(wxMessageDialogWithCustomLabels) + wxDECLARE_NO_COPY_CLASS(wxMessageDialogWithCustomLabels); }; #endif // ports needing wxMessageDialogWithCustomLabels