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