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