1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/propdlg.h
3 // Purpose: wxPropertySheetDialog
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_PROPDLG_H_
13 #define _WX_PROPDLG_H_
19 #include "wx/dialog.h"
21 class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase
;
23 //-----------------------------------------------------------------------------
24 // wxPropertySheetDialog
25 // A platform-independent properties dialog.
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
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
37 // MyPropertySheetDialog::Create(...)
39 // wxPropertySheetDialog::Create(...);
42 // wxPanel* panel = new wxPanel(GetBookCtrl(), ...);
43 // GetBookCtrl()->AddPage(panel, wxT("General"));
49 // Override CreateBookCtrl and AddBookCtrl to create and add a different
50 // kind of book control.
51 //-----------------------------------------------------------------------------
53 // Use the platform default
54 #define wxPROPSHEET_DEFAULT 0x0001
57 #define wxPROPSHEET_NOTEBOOK 0x0002
60 #define wxPROPSHEET_TOOLBOOK 0x0004
63 #define wxPROPSHEET_CHOICEBOOK 0x0008
66 #define wxPROPSHEET_LISTBOOK 0x0010
68 // Use a wxButtonToolBar toolbook
69 #define wxPROPSHEET_BUTTONTOOLBOOK 0x0020
72 #define wxPROPSHEET_TREEBOOK 0x0040
74 // Shrink dialog to fit current page
75 #define wxPROPSHEET_SHRINKTOFIT 0x0100
77 class WXDLLIMPEXP_ADV wxPropertySheetDialog
: public wxDialog
80 wxPropertySheetDialog() : wxDialog() { Init(); }
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
)
90 Create(parent
, id
, title
, pos
, sz
, style
, name
);
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
);
102 // Set and get the notebook
103 void SetBookCtrl(wxBookCtrlBase
* book
) { m_bookCtrl
= book
; }
104 wxBookCtrlBase
* GetBookCtrl() const { return m_bookCtrl
; }
106 // Override function in base
107 virtual wxWindow
* GetContentWindow() const;
109 // Set and get the inner sizer
110 void SetInnerSize(wxSizer
* sizer
) { m_innerSizer
= sizer
; }
111 wxSizer
* GetInnerSizer() const { return m_innerSizer
; }
113 // Set and get the book style
114 void SetSheetStyle(long sheetStyle
) { m_sheetStyle
= sheetStyle
; }
115 long GetSheetStyle() const { return m_sheetStyle
; }
117 // Set and get the border around the whole dialog
118 void SetSheetOuterBorder(int border
) { m_sheetOuterBorder
= border
; }
119 int GetSheetOuterBorder() const { return m_sheetOuterBorder
; }
121 // Set and get the border around the book control only
122 void SetSheetInnerBorder(int border
) { m_sheetInnerBorder
= border
; }
123 int GetSheetInnerBorder() const { return m_sheetInnerBorder
; }
127 // Creates the buttons (none on PocketPC)
128 virtual void CreateButtons(int flags
= wxOK
|wxCANCEL
);
130 // Lay out the dialog, to be called after pages have been created
131 virtual void LayoutDialog(int centreFlags
= wxBOTH
);
135 // Creates the book control. If you want to use a different kind of
136 // control, override.
137 virtual wxBookCtrlBase
* CreateBookCtrl();
139 // Adds the book control to the inner sizer.
140 virtual void AddBookCtrl(wxSizer
* sizer
);
143 void OnActivate(wxActivateEvent
& event
);
145 // Resize dialog if necessary
146 void OnIdle(wxIdleEvent
& event
);
152 wxBookCtrlBase
* m_bookCtrl
;
153 wxSizer
* m_innerSizer
; // sizer for extra space
155 int m_sheetOuterBorder
;
156 int m_sheetInnerBorder
;
159 DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog
)
160 DECLARE_EVENT_TABLE()
163 #endif // wxUSE_BOOKCTRL
165 #endif // _WX_PROPDLG_H_