]>
Commit | Line | Data |
---|---|---|
3c9287bb JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/generic/propdlg.h | |
3 | // Purpose: wxPropertySheetDialog | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 2005-03-12 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_PROPDLG_H_ | |
13 | #define _WX_PROPDLG_H_ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "propdlg.h" | |
17 | #endif | |
18 | ||
532d575b WS |
19 | #include "wx/defs.h" |
20 | ||
21 | #if wxUSE_BOOKCTRL | |
22 | ||
3c9287bb JS |
23 | class WXDLLEXPORT wxBookCtrlBase; |
24 | ||
25 | //----------------------------------------------------------------------------- | |
26 | // wxPropertySheetDialog | |
27 | // A platform-independent properties dialog. | |
28 | // | |
29 | // * on PocketPC, a flat-look 'property sheet' notebook will be used, with | |
30 | // no OK/Cancel/Help buttons | |
31 | // * on other platforms, a normal notebook will be used, with standard buttons | |
32 | // | |
33 | // To use this class, call Create from your derived class. | |
34 | // Then create pages and add to the book control. Finally call CreateButtons and | |
35 | // LayoutDialog. | |
36 | // | |
37 | // For example: | |
38 | // | |
39 | // MyPropertySheetDialog::Create(...) | |
40 | // { | |
41 | // wxPropertySheetDialog::Create(...); | |
42 | // | |
43 | // // Add page | |
44 | // wxPanel* panel = new wxPanel(GetBookCtrl(), ...); | |
45 | // GetBookCtrl()->AddPage(panel, wxT("General")); | |
46 | // | |
47 | // CreateButtons(); | |
48 | // LayoutDialog(); | |
49 | // } | |
50 | // | |
51 | // Override CreateBookCtrl and AddBookCtrl to create and add a different | |
52 | // kind of book control. | |
53 | //----------------------------------------------------------------------------- | |
54 | ||
c27bcbd5 | 55 | class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog |
3c9287bb JS |
56 | { |
57 | public: | |
58 | wxPropertySheetDialog() : wxDialog() { Init(); } | |
59 | ||
60 | wxPropertySheetDialog(wxWindow* parent, wxWindowID id, | |
61 | const wxString& title, | |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& sz = wxDefaultSize, | |
64 | long style = wxDEFAULT_DIALOG_STYLE, | |
65 | const wxString& name = wxDialogNameStr) | |
66 | { | |
67 | Init(); | |
68 | Create(parent, id, title, pos, sz, style, name); | |
69 | } | |
70 | ||
71 | bool Create(wxWindow* parent, wxWindowID id, | |
72 | const wxString& title, | |
73 | const wxPoint& pos = wxDefaultPosition, | |
74 | const wxSize& sz = wxDefaultSize, | |
75 | long style = wxDEFAULT_DIALOG_STYLE, | |
76 | const wxString& name = wxDialogNameStr); | |
77 | ||
3c9287bb JS |
78 | //// Accessors |
79 | ||
80 | // Set and get the notebook | |
81 | void SetBookCtrl(wxBookCtrlBase* book) { m_bookCtrl = book; } | |
82 | wxBookCtrlBase* GetBookCtrl() const { return m_bookCtrl; } | |
83 | ||
84 | // Set and get the inner sizer | |
85 | void SetInnerSize(wxSizer* sizer) { m_innerSizer = sizer; } | |
86 | wxSizer* GetInnerSizer() const { return m_innerSizer ; } | |
87 | ||
88 | /// Operations | |
89 | ||
90 | // Creates the buttons (none on PocketPC) | |
91 | virtual void CreateButtons(int flags = wxOK|wxCANCEL); | |
92 | ||
93 | // Lay out the dialog, to be called after pages have been created | |
94 | virtual void LayoutDialog(); | |
95 | ||
96 | /// Implementation | |
97 | ||
98 | // Creates the book control. If you want to use a different kind of | |
99 | // control, override. | |
100 | virtual wxBookCtrlBase* CreateBookCtrl(); | |
101 | ||
102 | // Adds the book control to the inner sizer. | |
103 | virtual void AddBookCtrl(wxSizer* sizer); | |
104 | ||
c9ab63f4 JS |
105 | // Set the focus |
106 | void OnActivate(wxActivateEvent& event); | |
107 | ||
108 | private: | |
109 | void Init(); | |
110 | ||
3c9287bb JS |
111 | protected: |
112 | wxBookCtrlBase* m_bookCtrl; | |
113 | wxSizer* m_innerSizer; // sizer for extra space | |
114 | ||
115 | DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog) | |
c9ab63f4 | 116 | DECLARE_EVENT_TABLE() |
3c9287bb JS |
117 | }; |
118 | ||
532d575b WS |
119 | #endif // wxUSE_BOOKCTRL |
120 | ||
3c9287bb JS |
121 | #endif // _WX_PROPDLG_H_ |
122 |