]>
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 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "propdlg.h" | |
17 | #endif | |
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 | class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog | |
52 | { | |
53 | public: | |
54 | wxPropertySheetDialog() : wxDialog() { Init(); } | |
55 | ||
56 | wxPropertySheetDialog(wxWindow* parent, wxWindowID id, | |
57 | const wxString& title, | |
58 | const wxPoint& pos = wxDefaultPosition, | |
59 | const wxSize& sz = wxDefaultSize, | |
60 | long style = wxDEFAULT_DIALOG_STYLE, | |
61 | const wxString& name = wxDialogNameStr) | |
62 | { | |
63 | Init(); | |
64 | Create(parent, id, title, pos, sz, style, name); | |
65 | } | |
66 | ||
67 | bool Create(wxWindow* parent, wxWindowID id, | |
68 | const wxString& title, | |
69 | const wxPoint& pos = wxDefaultPosition, | |
70 | const wxSize& sz = wxDefaultSize, | |
71 | long style = wxDEFAULT_DIALOG_STYLE, | |
72 | const wxString& name = wxDialogNameStr); | |
73 | ||
74 | //// Accessors | |
75 | ||
76 | // Set and get the notebook | |
77 | void SetBookCtrl(wxBookCtrlBase* book) { m_bookCtrl = book; } | |
78 | wxBookCtrlBase* GetBookCtrl() const { return m_bookCtrl; } | |
79 | ||
80 | // Set and get the inner sizer | |
81 | void SetInnerSize(wxSizer* sizer) { m_innerSizer = sizer; } | |
82 | wxSizer* GetInnerSizer() const { return m_innerSizer ; } | |
83 | ||
84 | /// Operations | |
85 | ||
86 | // Creates the buttons (none on PocketPC) | |
87 | virtual void CreateButtons(int flags = wxOK|wxCANCEL); | |
88 | ||
89 | // Lay out the dialog, to be called after pages have been created | |
90 | virtual void LayoutDialog(); | |
91 | ||
92 | /// Implementation | |
93 | ||
94 | // Creates the book control. If you want to use a different kind of | |
95 | // control, override. | |
96 | virtual wxBookCtrlBase* CreateBookCtrl(); | |
97 | ||
98 | // Adds the book control to the inner sizer. | |
99 | virtual void AddBookCtrl(wxSizer* sizer); | |
100 | ||
101 | // Set the focus | |
102 | void OnActivate(wxActivateEvent& event); | |
103 | ||
104 | private: | |
105 | void Init(); | |
106 | ||
107 | protected: | |
108 | wxBookCtrlBase* m_bookCtrl; | |
109 | wxSizer* m_innerSizer; // sizer for extra space | |
110 | ||
111 | DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog) | |
112 | DECLARE_EVENT_TABLE() | |
113 | }; | |
114 | ||
115 | #endif // _WX_PROPDLG_H_ | |
116 |