]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/aboutdlgg.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / generic / aboutdlgg.h
CommitLineData
ca7adbf8
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/generic/aboutdlgg.h
453c9e3b 3// Purpose: generic wxAboutBox() implementation
ca7adbf8
VZ
4// Author: Vadim Zeitlin
5// Created: 2006-10-07
ca7adbf8
VZ
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
b5dbe15d
VS
19class WXDLLIMPEXP_FWD_ADV wxAboutDialogInfo;
20class WXDLLIMPEXP_FWD_CORE wxSizer;
21class WXDLLIMPEXP_FWD_CORE wxSizerFlags;
ca7adbf8 22
04ca40fc
VZ
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
ca7adbf8 33// ----------------------------------------------------------------------------
453c9e3b 34// wxGenericAboutDialog: generic "About" dialog implementation
ca7adbf8
VZ
35// ----------------------------------------------------------------------------
36
b85db900 37class WXDLLIMPEXP_ADV wxGenericAboutDialog : public wxDialog
ca7adbf8
VZ
38{
39public:
40 // constructors and Create() method
41 // --------------------------------
42
43 // default ctor, you must use Create() to really initialize the dialog
453c9e3b 44 wxGenericAboutDialog() { Init(); }
ca7adbf8
VZ
45
46 // ctor which fully initializes the object
c173e541 47 wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = NULL)
ca7adbf8
VZ
48 {
49 Init();
50
c173e541 51 (void)Create(info, parent);
ca7adbf8
VZ
52 }
53
54 // this method must be called if and only if the default ctor was used
c173e541 55 bool Create(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
ca7adbf8
VZ
56
57protected:
453c9e3b
VZ
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
ca7adbf8
VZ
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
4b98d13d 76#if wxUSE_COLLPANE
b9993189
VZ
77 // add a wxCollapsiblePane containing the given text
78 void AddCollapsiblePane(const wxString& title, const wxString& text);
4b98d13d 79#endif // wxUSE_COLLPANE
b9993189 80
453c9e3b
VZ
81private:
82 // common part of all ctors
83 void Init() { m_sizerText = NULL; }
84
04ca40fc
VZ
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
ca7adbf8
VZ
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
c173e541 97WXDLLIMPEXP_ADV void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
ca7adbf8
VZ
98
99#endif // wxUSE_ABOUTDLG
100
101#endif // _WX_GENERIC_ABOUTDLGG_H_
102