aboutdlgg.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/generic/aboutdlgg.h
  3. // Purpose: generic wxAboutBox() implementation
  4. // Author: Vadim Zeitlin
  5. // Created: 2006-10-07
  6. // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_GENERIC_ABOUTDLGG_H_
  10. #define _WX_GENERIC_ABOUTDLGG_H_
  11. #include "wx/defs.h"
  12. #if wxUSE_ABOUTDLG
  13. #include "wx/dialog.h"
  14. class WXDLLIMPEXP_FWD_ADV wxAboutDialogInfo;
  15. class WXDLLIMPEXP_FWD_CORE wxSizer;
  16. class WXDLLIMPEXP_FWD_CORE wxSizerFlags;
  17. // Under GTK and OS X "About" dialogs are not supposed to be modal, unlike MSW
  18. // and, presumably, all the other platforms.
  19. #ifndef wxUSE_MODAL_ABOUT_DIALOG
  20. #if defined(__WXGTK__) || defined(__WXMAC__)
  21. #define wxUSE_MODAL_ABOUT_DIALOG 0
  22. #else
  23. #define wxUSE_MODAL_ABOUT_DIALOG 1
  24. #endif
  25. #endif // wxUSE_MODAL_ABOUT_DIALOG not defined
  26. // ----------------------------------------------------------------------------
  27. // wxGenericAboutDialog: generic "About" dialog implementation
  28. // ----------------------------------------------------------------------------
  29. class WXDLLIMPEXP_ADV wxGenericAboutDialog : public wxDialog
  30. {
  31. public:
  32. // constructors and Create() method
  33. // --------------------------------
  34. // default ctor, you must use Create() to really initialize the dialog
  35. wxGenericAboutDialog() { Init(); }
  36. // ctor which fully initializes the object
  37. wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = NULL)
  38. {
  39. Init();
  40. (void)Create(info, parent);
  41. }
  42. // this method must be called if and only if the default ctor was used
  43. bool Create(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
  44. protected:
  45. // this virtual method may be overridden to add some more controls to the
  46. // dialog
  47. //
  48. // notice that for this to work you must call Create() from the derived
  49. // class ctor and not use the base class ctor directly as otherwise the
  50. // virtual function of the derived class wouldn't be called
  51. virtual void DoAddCustomControls() { }
  52. // add arbitrary control to the text sizer contents with the specified
  53. // flags
  54. void AddControl(wxWindow *win, const wxSizerFlags& flags);
  55. // add arbitrary control to the text sizer contents and center it
  56. void AddControl(wxWindow *win);
  57. // add the text, if it's not empty, to the text sizer contents
  58. void AddText(const wxString& text);
  59. #if wxUSE_COLLPANE
  60. // add a wxCollapsiblePane containing the given text
  61. void AddCollapsiblePane(const wxString& title, const wxString& text);
  62. #endif // wxUSE_COLLPANE
  63. private:
  64. // common part of all ctors
  65. void Init() { m_sizerText = NULL; }
  66. #if !wxUSE_MODAL_ABOUT_DIALOG
  67. // An explicit handler for deleting the dialog when it's closed is needed
  68. // when we show it non-modally.
  69. void OnCloseWindow(wxCloseEvent& event);
  70. void OnOK(wxCommandEvent& event);
  71. #endif // !wxUSE_MODAL_ABOUT_DIALOG
  72. wxSizer *m_sizerText;
  73. };
  74. // unlike wxAboutBox which can show either the native or generic about dialog,
  75. // this function always shows the generic one
  76. WXDLLIMPEXP_ADV void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
  77. #endif // wxUSE_ABOUTDLG
  78. #endif // _WX_GENERIC_ABOUTDLGG_H_