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