1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/propdlg.h
3 // Purpose: wxPropertySheetDialog
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_PROPDLG_H_
12 #define _WX_PROPDLG_H_
18 #include "wx/dialog.h"
20 class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase
;
22 //-----------------------------------------------------------------------------
23 // wxPropertySheetDialog
24 // A platform-independent properties dialog.
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
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
36 // MyPropertySheetDialog::Create(...)
38 // wxPropertySheetDialog::Create(...);
41 // wxPanel* panel = new wxPanel(GetBookCtrl(), ...);
42 // GetBookCtrl()->AddPage(panel, wxT("General"));
48 // Override CreateBookCtrl and AddBookCtrl to create and add a different
49 // kind of book control.
50 //-----------------------------------------------------------------------------
52 enum wxPropertySheetDialogFlags
54 // Use the platform default
55 wxPROPSHEET_DEFAULT
= 0x0001,
58 wxPROPSHEET_NOTEBOOK
= 0x0002,
61 wxPROPSHEET_TOOLBOOK
= 0x0004,
64 wxPROPSHEET_CHOICEBOOK
= 0x0008,
67 wxPROPSHEET_LISTBOOK
= 0x0010,
69 // Use a wxButtonToolBar toolbook
70 wxPROPSHEET_BUTTONTOOLBOOK
= 0x0020,
73 wxPROPSHEET_TREEBOOK
= 0x0040,
75 // Shrink dialog to fit current page
76 wxPROPSHEET_SHRINKTOFIT
= 0x0100
79 class WXDLLIMPEXP_ADV wxPropertySheetDialog
: public wxDialog
82 wxPropertySheetDialog() : wxDialog() { Init(); }
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
)
92 Create(parent
, id
, title
, pos
, sz
, style
, name
);
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
);
104 // Set and get the notebook
105 void SetBookCtrl(wxBookCtrlBase
* book
) { m_bookCtrl
= book
; }
106 wxBookCtrlBase
* GetBookCtrl() const { return m_bookCtrl
; }
108 // Override function in base
109 virtual wxWindow
* GetContentWindow() const;
111 // Set and get the inner sizer
112 void SetInnerSize(wxSizer
* sizer
) { m_innerSizer
= sizer
; }
113 wxSizer
* GetInnerSizer() const { return m_innerSizer
; }
115 // Set and get the book style
116 void SetSheetStyle(long sheetStyle
) { m_sheetStyle
= sheetStyle
; }
117 long GetSheetStyle() const { return m_sheetStyle
; }
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
; }
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
; }
129 // Creates the buttons (none on PocketPC)
130 virtual void CreateButtons(int flags
= wxOK
|wxCANCEL
);
132 // Lay out the dialog, to be called after pages have been created
133 virtual void LayoutDialog(int centreFlags
= wxBOTH
);
137 // Creates the book control. If you want to use a different kind of
138 // control, override.
139 virtual wxBookCtrlBase
* CreateBookCtrl();
141 // Adds the book control to the inner sizer.
142 virtual void AddBookCtrl(wxSizer
* sizer
);
145 void OnActivate(wxActivateEvent
& event
);
147 // Resize dialog if necessary
148 void OnIdle(wxIdleEvent
& event
);
154 wxBookCtrlBase
* m_bookCtrl
;
155 wxSizer
* m_innerSizer
; // sizer for extra space
157 int m_sheetOuterBorder
;
158 int m_sheetInnerBorder
;
161 DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog
)
162 DECLARE_EVENT_TABLE()
165 #endif // wxUSE_BOOKCTRL
167 #endif // _WX_PROPDLG_H_