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