richmsgdlg.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/richmsgdlg.h
  3. // Purpose: wxRichMessageDialogBase
  4. // Author: Rickard Westerlund
  5. // Created: 2010-07-03
  6. // Copyright: (c) 2010 wxWidgets team
  7. // Licence: wxWindows licence
  8. /////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_RICHMSGDLG_H_BASE_
  10. #define _WX_RICHMSGDLG_H_BASE_
  11. #include "wx/defs.h"
  12. #if wxUSE_RICHMSGDLG
  13. #include "wx/msgdlg.h"
  14. // Extends a message dialog with an optional checkbox and user-expandable
  15. // detailed text.
  16. class WXDLLIMPEXP_CORE wxRichMessageDialogBase : public wxGenericMessageDialog
  17. {
  18. public:
  19. wxRichMessageDialogBase( wxWindow *parent,
  20. const wxString& message,
  21. const wxString& caption,
  22. long style )
  23. : wxGenericMessageDialog( parent, message, caption, style ),
  24. m_detailsExpanderCollapsedLabel( wxGetTranslation("&See details") ),
  25. m_detailsExpanderExpandedLabel( wxGetTranslation("&Hide details") ),
  26. m_checkBoxValue( false )
  27. { }
  28. void ShowCheckBox(const wxString& checkBoxText, bool checked = false)
  29. {
  30. m_checkBoxText = checkBoxText;
  31. m_checkBoxValue = checked;
  32. }
  33. wxString GetCheckBoxText() const { return m_checkBoxText; }
  34. void ShowDetailedText(const wxString& detailedText)
  35. { m_detailedText = detailedText; }
  36. wxString GetDetailedText() const { return m_detailedText; }
  37. virtual bool IsCheckBoxChecked() const { return m_checkBoxValue; }
  38. protected:
  39. const wxString m_detailsExpanderCollapsedLabel;
  40. const wxString m_detailsExpanderExpandedLabel;
  41. wxString m_checkBoxText;
  42. bool m_checkBoxValue;
  43. wxString m_detailedText;
  44. private:
  45. void ShowDetails(bool shown);
  46. wxDECLARE_NO_COPY_CLASS(wxRichMessageDialogBase);
  47. };
  48. // Always include the generic version as it's currently used as the base class
  49. // by the MSW native implementation too.
  50. #include "wx/generic/richmsgdlgg.h"
  51. #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
  52. #include "wx/msw/richmsgdlg.h"
  53. #else
  54. class WXDLLIMPEXP_CORE wxRichMessageDialog
  55. : public wxGenericRichMessageDialog
  56. {
  57. public:
  58. wxRichMessageDialog( wxWindow *parent,
  59. const wxString& message,
  60. const wxString& caption = wxMessageBoxCaptionStr,
  61. long style = wxOK | wxCENTRE )
  62. : wxGenericRichMessageDialog( parent, message, caption, style )
  63. { }
  64. private:
  65. wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxRichMessageDialog);
  66. };
  67. #endif
  68. #endif // wxUSE_RICHMSGDLG
  69. #endif // _WX_RICHMSGDLG_H_BASE_