]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/propdlg.h
Use wxGetTranslation() instead of _() in the public headers.
[wxWidgets.git] / include / wx / generic / propdlg.h
CommitLineData
3c9287bb
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/generic/propdlg.h
3// Purpose: wxPropertySheetDialog
4// Author: Julian Smart
5// Modified by:
6// Created: 2005-03-12
3c9287bb
JS
7// Copyright: (c) Julian Smart
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_PROPDLG_H_
12#define _WX_PROPDLG_H_
13
532d575b
WS
14#include "wx/defs.h"
15
16#if wxUSE_BOOKCTRL
17
38b13085
PC
18#include "wx/dialog.h"
19
b5dbe15d 20class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase;
3c9287bb
JS
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
3e8ec954
FM
52enum wxPropertySheetDialogFlags
53{
54 // Use the platform default
55 wxPROPSHEET_DEFAULT = 0x0001,
cc8bc5aa 56
3e8ec954
FM
57 // Use a notebook
58 wxPROPSHEET_NOTEBOOK = 0x0002,
cc8bc5aa 59
3e8ec954
FM
60 // Use a toolbook
61 wxPROPSHEET_TOOLBOOK = 0x0004,
cc8bc5aa 62
3e8ec954
FM
63 // Use a choicebook
64 wxPROPSHEET_CHOICEBOOK = 0x0008,
cc8bc5aa 65
3e8ec954
FM
66 // Use a listbook
67 wxPROPSHEET_LISTBOOK = 0x0010,
cc8bc5aa 68
3e8ec954
FM
69 // Use a wxButtonToolBar toolbook
70 wxPROPSHEET_BUTTONTOOLBOOK = 0x0020,
6334d903 71
3e8ec954
FM
72 // Use a treebook
73 wxPROPSHEET_TREEBOOK = 0x0040,
6334d903 74
3e8ec954 75 // Shrink dialog to fit current page
35524f61 76 wxPROPSHEET_SHRINKTOFIT = 0x0100
3e8ec954 77};
64d3ed17 78
c27bcbd5 79class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog
3c9287bb
JS
80{
81public:
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
3c9287bb
JS
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
3aa8e4ea
JS
108 // Override function in base
109 virtual wxWindow* GetContentWindow() const;
110
3c9287bb
JS
111 // Set and get the inner sizer
112 void SetInnerSize(wxSizer* sizer) { m_innerSizer = sizer; }
113 wxSizer* GetInnerSizer() const { return m_innerSizer ; }
114
cc8bc5aa
JS
115 // Set and get the book style
116 void SetSheetStyle(long sheetStyle) { m_sheetStyle = sheetStyle; }
117 long GetSheetStyle() const { return m_sheetStyle ; }
118
1a1190b2
JS
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
3c9287bb
JS
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
cc8bc5aa 133 virtual void LayoutDialog(int centreFlags = wxBOTH);
3c9287bb
JS
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
c9ab63f4
JS
144 // Set the focus
145 void OnActivate(wxActivateEvent& event);
146
cc8bc5aa
JS
147 // Resize dialog if necessary
148 void OnIdle(wxIdleEvent& event);
149
c9ab63f4
JS
150private:
151 void Init();
152
3c9287bb
JS
153protected:
154 wxBookCtrlBase* m_bookCtrl;
155 wxSizer* m_innerSizer; // sizer for extra space
cc8bc5aa 156 long m_sheetStyle;
1a1190b2
JS
157 int m_sheetOuterBorder;
158 int m_sheetInnerBorder;
cc8bc5aa 159 int m_selectedPage;
3c9287bb
JS
160
161 DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog)
c9ab63f4 162 DECLARE_EVENT_TABLE()
3c9287bb
JS
163};
164
532d575b
WS
165#endif // wxUSE_BOOKCTRL
166
3c9287bb
JS
167#endif // _WX_PROPDLG_H_
168