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