]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/generic/aboutdlgg.h
Add wxGenericAboutDialog documentation.
[wxWidgets.git] / interface / wx / generic / aboutdlgg.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/aboutdlgg.h
3 // Purpose: generic wxAboutBox() implementation
4 // Author: eranon
5 // Created: 2012-09-25
6 // RCS-ID: $Id$
7 // Copyright: (c) 2012 wxWidgets development team
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 /**
12 @class wxGenericAboutDialog
13
14 This class defines a customizable @e About dialog.
15
16 Note that if you don't need customization, you should use the global
17 wxAboutBox() function that is both easier to use and shows the native
18 dialog if available.
19
20 To use this class, you need to derive your own class from it and override
21 the virtual method DoAddCustomControls().
22
23 To instantiate an object from your wxGenericAboutDialog-based class, you
24 can use either the default constructor followed by a call to Create(), or
25 directly using the alternate constructor. In either case, you have to
26 prepare a wxAboutDialogInfo containing standard informations to display in
27 an about-box.
28
29 Example of usage, MyAboutDlg being a class derived from wxGenericAboutDialog:
30 @code
31 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
32 {
33 wxAboutDialogInfo aboutInfo;
34
35 aboutInfo.SetName("MyApp");
36 aboutInfo.SetVersion(MY_APP_VERSION_STRING);
37 aboutInfo.SetDescription(_("My wxWidgets-based application!"));
38 aboutInfo.SetCopyright("(C) 1992-2012");
39 aboutInfo.SetWebSite("http://myapp.org");
40 aboutInfo.AddDeveloper("My Self");
41
42 MyAboutDlg dlgAbout(aboutInfo, this);
43 dlgAbout.ShowModal();
44 }
45 @endcode
46
47 @library{wxadv}
48 @category{cmndlg}
49
50 @see wxAboutDialogInfo
51 */
52 class wxGenericAboutDialog
53 {
54 public:
55 /**
56 Default constructor, Create() must be called later.
57 */
58 wxGenericAboutDialog();
59
60 /**
61 Creates the dialog and initializes it with the given information.
62 */
63 wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
64
65 /**
66 Initializes the dialog created using the default constructor.
67 */
68 bool Create(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
69
70 protected:
71 /**
72 This virtual method may be overridden to add more controls to the
73 dialog.
74
75 Use the protected AddControl(), AddText() and AddCollapsiblePane()
76 methods to add custom controls.
77
78 This method is called during the dialog creation and you don't need to
79 call it, only to override it.
80 */
81 virtual void DoAddCustomControls() { }
82
83 /**
84 Add arbitrary control to the sizer content with the specified flags.
85
86 For example, here is how to add an expandable line with a border of 3
87 pixels, then a line of text:
88 @code
89 AddControl(new wxStaticLine(this), wxSizerFlags().Expand().Border(wxALL, 3));
90
91 AddText(_("This line is just an example of custom text."));
92 @endcode
93 */
94 void AddControl(wxWindow *win, const wxSizerFlags& flags);
95
96 /**
97 Add arbitrary control to the sizer content and centre it.
98 */
99 void AddControl(wxWindow *win);
100
101 /**
102 Add the given (not empty) text to the sizer content.
103 */
104 void AddText(const wxString& text);
105
106 /**
107 Add a wxCollapsiblePane containing the given text.
108 */
109 void AddCollapsiblePane(const wxString& title, const wxString& text);
110 };
111
112 /**
113 Show generic about dialog.
114
115 This function does the same thing as wxAboutBox() except that it always
116 uses the generic wxWidgets version of the dialog instead of the native one.
117 */
118 void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);