]>
Commit | Line | Data |
---|---|---|
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 | #include "wx/defs.h" | |
16 | ||
17 | #if wxUSE_BOOKCTRL | |
18 | ||
19 | class WXDLLEXPORT wxBookCtrlBase; | |
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 | ||
51 | // Use the platform default | |
52 | #define wxPROPSHEET_DEFAULT 0x0001 | |
53 | ||
54 | // Use a notebook | |
55 | #define wxPROPSHEET_NOTEBOOK 0x0002 | |
56 | ||
57 | // Use a toolbook | |
58 | #define wxPROPSHEET_TOOLBOOK 0x0004 | |
59 | ||
60 | // Use a choicebook | |
61 | #define wxPROPSHEET_CHOICEBOOK 0x0008 | |
62 | ||
63 | // Use a listbook | |
64 | #define wxPROPSHEET_LISTBOOK 0x0010 | |
65 | ||
66 | // Shrink dialog to fit current page | |
67 | #define wxPROPSHEET_SHRINKTOFIT 0x0100 | |
68 | ||
69 | // Use a wxButtonToolBar toolbook | |
70 | #define wxPROPSHEET_BUTTONTOOLBOOK 0x0200 | |
71 | ||
72 | class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog | |
73 | { | |
74 | public: | |
75 | wxPropertySheetDialog() : wxDialog() { Init(); } | |
76 | ||
77 | wxPropertySheetDialog(wxWindow* parent, wxWindowID id, | |
78 | const wxString& title, | |
79 | const wxPoint& pos = wxDefaultPosition, | |
80 | const wxSize& sz = wxDefaultSize, | |
81 | long style = wxDEFAULT_DIALOG_STYLE, | |
82 | const wxString& name = wxDialogNameStr) | |
83 | { | |
84 | Init(); | |
85 | Create(parent, id, title, pos, sz, style, name); | |
86 | } | |
87 | ||
88 | bool Create(wxWindow* parent, wxWindowID id, | |
89 | const wxString& title, | |
90 | const wxPoint& pos = wxDefaultPosition, | |
91 | const wxSize& sz = wxDefaultSize, | |
92 | long style = wxDEFAULT_DIALOG_STYLE, | |
93 | const wxString& name = wxDialogNameStr); | |
94 | ||
95 | //// Accessors | |
96 | ||
97 | // Set and get the notebook | |
98 | void SetBookCtrl(wxBookCtrlBase* book) { m_bookCtrl = book; } | |
99 | wxBookCtrlBase* GetBookCtrl() const { return m_bookCtrl; } | |
100 | ||
101 | // Set and get the inner sizer | |
102 | void SetInnerSize(wxSizer* sizer) { m_innerSizer = sizer; } | |
103 | wxSizer* GetInnerSizer() const { return m_innerSizer ; } | |
104 | ||
105 | // Set and get the book style | |
106 | void SetSheetStyle(long sheetStyle) { m_sheetStyle = sheetStyle; } | |
107 | long GetSheetStyle() const { return m_sheetStyle ; } | |
108 | ||
109 | // Set and get the border around the whole dialog | |
110 | void SetSheetOuterBorder(int border) { m_sheetOuterBorder = border; } | |
111 | int GetSheetOuterBorder() const { return m_sheetOuterBorder ; } | |
112 | ||
113 | // Set and get the border around the book control only | |
114 | void SetSheetInnerBorder(int border) { m_sheetInnerBorder = border; } | |
115 | int GetSheetInnerBorder() const { return m_sheetInnerBorder ; } | |
116 | ||
117 | /// Operations | |
118 | ||
119 | // Creates the buttons (none on PocketPC) | |
120 | virtual void CreateButtons(int flags = wxOK|wxCANCEL); | |
121 | ||
122 | // Lay out the dialog, to be called after pages have been created | |
123 | virtual void LayoutDialog(int centreFlags = wxBOTH); | |
124 | ||
125 | /// Implementation | |
126 | ||
127 | // Creates the book control. If you want to use a different kind of | |
128 | // control, override. | |
129 | virtual wxBookCtrlBase* CreateBookCtrl(); | |
130 | ||
131 | // Adds the book control to the inner sizer. | |
132 | virtual void AddBookCtrl(wxSizer* sizer); | |
133 | ||
134 | // Set the focus | |
135 | void OnActivate(wxActivateEvent& event); | |
136 | ||
137 | // Resize dialog if necessary | |
138 | void OnIdle(wxIdleEvent& event); | |
139 | ||
140 | private: | |
141 | void Init(); | |
142 | ||
143 | protected: | |
144 | wxBookCtrlBase* m_bookCtrl; | |
145 | wxSizer* m_innerSizer; // sizer for extra space | |
146 | long m_sheetStyle; | |
147 | int m_sheetOuterBorder; | |
148 | int m_sheetInnerBorder; | |
149 | int m_selectedPage; | |
150 | ||
151 | DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog) | |
152 | DECLARE_EVENT_TABLE() | |
153 | }; | |
154 | ||
155 | #endif // wxUSE_BOOKCTRL | |
156 | ||
157 | #endif // _WX_PROPDLG_H_ | |
158 |