]>
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 | ||
532d575b WS |
15 | #include "wx/defs.h" |
16 | ||
17 | #if wxUSE_BOOKCTRL | |
18 | ||
38b13085 PC |
19 | #include "wx/dialog.h" |
20 | ||
21 | class WXDLLIMPEXP_CORE wxBookCtrlBase; | |
3c9287bb JS |
22 | |
23 | //----------------------------------------------------------------------------- | |
24 | // wxPropertySheetDialog | |
25 | // A platform-independent properties dialog. | |
26 | // | |
27 | // * on PocketPC, a flat-look 'property sheet' notebook will be used, with | |
28 | // no OK/Cancel/Help buttons | |
29 | // * on other platforms, a normal notebook will be used, with standard buttons | |
30 | // | |
31 | // To use this class, call Create from your derived class. | |
32 | // Then create pages and add to the book control. Finally call CreateButtons and | |
33 | // LayoutDialog. | |
34 | // | |
35 | // For example: | |
36 | // | |
37 | // MyPropertySheetDialog::Create(...) | |
38 | // { | |
39 | // wxPropertySheetDialog::Create(...); | |
40 | // | |
41 | // // Add page | |
42 | // wxPanel* panel = new wxPanel(GetBookCtrl(), ...); | |
43 | // GetBookCtrl()->AddPage(panel, wxT("General")); | |
44 | // | |
45 | // CreateButtons(); | |
46 | // LayoutDialog(); | |
47 | // } | |
48 | // | |
49 | // Override CreateBookCtrl and AddBookCtrl to create and add a different | |
50 | // kind of book control. | |
51 | //----------------------------------------------------------------------------- | |
52 | ||
cc8bc5aa | 53 | // Use the platform default |
6334d903 | 54 | #define wxPROPSHEET_DEFAULT 0x0001 |
cc8bc5aa JS |
55 | |
56 | // Use a notebook | |
6334d903 | 57 | #define wxPROPSHEET_NOTEBOOK 0x0002 |
cc8bc5aa JS |
58 | |
59 | // Use a toolbook | |
6334d903 | 60 | #define wxPROPSHEET_TOOLBOOK 0x0004 |
cc8bc5aa JS |
61 | |
62 | // Use a choicebook | |
6334d903 | 63 | #define wxPROPSHEET_CHOICEBOOK 0x0008 |
cc8bc5aa JS |
64 | |
65 | // Use a listbook | |
6334d903 | 66 | #define wxPROPSHEET_LISTBOOK 0x0010 |
cc8bc5aa | 67 | |
64d3ed17 | 68 | // Use a wxButtonToolBar toolbook |
6334d903 JS |
69 | #define wxPROPSHEET_BUTTONTOOLBOOK 0x0020 |
70 | ||
71 | // Use a treebook | |
72 | #define wxPROPSHEET_TREEBOOK 0x0040 | |
73 | ||
74 | // Shrink dialog to fit current page | |
75 | #define wxPROPSHEET_SHRINKTOFIT 0x0100 | |
64d3ed17 | 76 | |
c27bcbd5 | 77 | class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog |
3c9287bb JS |
78 | { |
79 | public: | |
80 | wxPropertySheetDialog() : wxDialog() { Init(); } | |
81 | ||
82 | wxPropertySheetDialog(wxWindow* parent, wxWindowID id, | |
83 | const wxString& title, | |
84 | const wxPoint& pos = wxDefaultPosition, | |
85 | const wxSize& sz = wxDefaultSize, | |
86 | long style = wxDEFAULT_DIALOG_STYLE, | |
87 | const wxString& name = wxDialogNameStr) | |
88 | { | |
89 | Init(); | |
90 | Create(parent, id, title, pos, sz, style, name); | |
91 | } | |
92 | ||
93 | bool Create(wxWindow* parent, wxWindowID id, | |
94 | const wxString& title, | |
95 | const wxPoint& pos = wxDefaultPosition, | |
96 | const wxSize& sz = wxDefaultSize, | |
97 | long style = wxDEFAULT_DIALOG_STYLE, | |
98 | const wxString& name = wxDialogNameStr); | |
99 | ||
3c9287bb JS |
100 | //// Accessors |
101 | ||
102 | // Set and get the notebook | |
103 | void SetBookCtrl(wxBookCtrlBase* book) { m_bookCtrl = book; } | |
104 | wxBookCtrlBase* GetBookCtrl() const { return m_bookCtrl; } | |
105 | ||
106 | // Set and get the inner sizer | |
107 | void SetInnerSize(wxSizer* sizer) { m_innerSizer = sizer; } | |
108 | wxSizer* GetInnerSizer() const { return m_innerSizer ; } | |
109 | ||
cc8bc5aa JS |
110 | // Set and get the book style |
111 | void SetSheetStyle(long sheetStyle) { m_sheetStyle = sheetStyle; } | |
112 | long GetSheetStyle() const { return m_sheetStyle ; } | |
113 | ||
1a1190b2 JS |
114 | // Set and get the border around the whole dialog |
115 | void SetSheetOuterBorder(int border) { m_sheetOuterBorder = border; } | |
116 | int GetSheetOuterBorder() const { return m_sheetOuterBorder ; } | |
117 | ||
118 | // Set and get the border around the book control only | |
119 | void SetSheetInnerBorder(int border) { m_sheetInnerBorder = border; } | |
120 | int GetSheetInnerBorder() const { return m_sheetInnerBorder ; } | |
121 | ||
3c9287bb JS |
122 | /// Operations |
123 | ||
124 | // Creates the buttons (none on PocketPC) | |
125 | virtual void CreateButtons(int flags = wxOK|wxCANCEL); | |
126 | ||
127 | // Lay out the dialog, to be called after pages have been created | |
cc8bc5aa | 128 | virtual void LayoutDialog(int centreFlags = wxBOTH); |
3c9287bb JS |
129 | |
130 | /// Implementation | |
131 | ||
132 | // Creates the book control. If you want to use a different kind of | |
133 | // control, override. | |
134 | virtual wxBookCtrlBase* CreateBookCtrl(); | |
135 | ||
136 | // Adds the book control to the inner sizer. | |
137 | virtual void AddBookCtrl(wxSizer* sizer); | |
138 | ||
c9ab63f4 JS |
139 | // Set the focus |
140 | void OnActivate(wxActivateEvent& event); | |
141 | ||
cc8bc5aa JS |
142 | // Resize dialog if necessary |
143 | void OnIdle(wxIdleEvent& event); | |
144 | ||
c9ab63f4 JS |
145 | private: |
146 | void Init(); | |
147 | ||
3c9287bb JS |
148 | protected: |
149 | wxBookCtrlBase* m_bookCtrl; | |
150 | wxSizer* m_innerSizer; // sizer for extra space | |
cc8bc5aa | 151 | long m_sheetStyle; |
1a1190b2 JS |
152 | int m_sheetOuterBorder; |
153 | int m_sheetInnerBorder; | |
cc8bc5aa | 154 | int m_selectedPage; |
3c9287bb JS |
155 | |
156 | DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog) | |
c9ab63f4 | 157 | DECLARE_EVENT_TABLE() |
3c9287bb JS |
158 | }; |
159 | ||
532d575b WS |
160 | #endif // wxUSE_BOOKCTRL |
161 | ||
3c9287bb JS |
162 | #endif // _WX_PROPDLG_H_ |
163 |