File: propdlg.h

package info (click to toggle)
wxwidgets3.0 3.0.2%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 120,808 kB
  • ctags: 118,010
  • sloc: cpp: 889,420; makefile: 52,980; ansic: 21,933; sh: 5,603; python: 2,935; xml: 1,534; perl: 281
file content (190 lines) | stat: -rw-r--r-- 5,800 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/////////////////////////////////////////////////////////////////////////////
// Name:        propdlg.h
// Purpose:     interface of wxPropertySheetDialog
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////


/**
    Values used by wxPropertySheetDialog::SetSheetStyle
*/
enum wxPropertySheetDialogFlags
{
    /**
        Uses the default look and feel for the controller window,
        normally a notebook except on Smartphone where a choice control is used.
    */
    wxPROPSHEET_DEFAULT = 0x0001,

    /**
        Uses a notebook for the controller window.
    */
    wxPROPSHEET_NOTEBOOK = 0x0002,

    /**
        Uses a toolbook for the controller window.
    */
    wxPROPSHEET_TOOLBOOK = 0x0004,

    /**
        Uses a choicebook for the controller window.
    */
    wxPROPSHEET_CHOICEBOOK = 0x0008,

    /**
        Uses a listbook for the controller window.
    */
    wxPROPSHEET_LISTBOOK = 0x0010,

    /**
        Uses a button toolbox for the controller window.
    */
    wxPROPSHEET_BUTTONTOOLBOOK = 0x0020,

    /**
        Uses a treebook for the controller window.
    */
    wxPROPSHEET_TREEBOOK = 0x0040,

    /**
        Shrinks the dialog window to fit the currently selected page
        (common behaviour for property sheets on Mac OS X).
    */
    wxPROPSHEET_SHRINKTOFIT = 0x0100,
};


/**
    @class wxPropertySheetDialog

    This class represents a property sheet dialog: a tabbed dialog
    for showing settings. It is optimized to show flat tabs
    on PocketPC devices, and can be customized to use different
    controllers instead of the default notebook style.

    To use this class, call Create() from your own Create function.
    Then call CreateButtons(), and create pages, adding them to the book control.
    Finally call LayoutDialog().

    For example:

    @code
    bool MyPropertySheetDialog::Create(...)
    {
        if (!wxPropertySheetDialog::Create(...))
            return false;

        CreateButtons(wxOK|wxCANCEL|wxHELP);

        // Add page
        wxPanel* panel = new wxPanel(GetBookCtrl(), ...);
        GetBookCtrl()->AddPage(panel, "General");

        LayoutDialog();
        return true;
    }
    @endcode

    If necessary, override CreateBookCtrl() and AddBookCtrl() to create and add a
    different kind of book control. You will then need to use two-step construction
    for the dialog or change the style of the book control by calling SetSheetStyle()
    before calling Create().

    The @ref page_samples_dialogs shows this class being used with notebook and toolbook
    controllers (for Windows-style and Mac-style settings dialogs).

    To make pages of the dialog scroll when the display is too small to fit the
    whole dialog, you can switch layout adaptation on globally with
    wxDialog::EnableLayoutAdaptation() or per dialog with
    wxDialog::SetLayoutAdaptationMode().

    For more about layout adaptation, see @ref overview_dialog_autoscrolling.

    @library{wxadv}
    @category{managedwnd}
*/
class wxPropertySheetDialog : public wxDialog
{
public:
    /**
        Constructor.
    */
    wxPropertySheetDialog(wxWindow* parent, wxWindowID id,
                          const wxString& title,
                          const wxPoint& pos = wxDefaultPosition,
                          const wxSize& size = wxDefaultSize,
                          long style = wxDEFAULT_DIALOG_STYLE,
                          const wxString& name = wxDialogNameStr);

    /**
        Override this if you wish to add the book control in a way different from the
        standard way (for example, using different spacing).
    */
    virtual void AddBookCtrl(wxSizer* sizer);

    /**
        Call this from your own Create function, before adding buttons and pages.
    */
    bool Create(wxWindow* parent, wxWindowID id, const wxString& title,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = wxDEFAULT_DIALOG_STYLE,
                const wxString& name = wxDialogNameStr);

    /**
        Override this if you wish to create a different kind of book control; by
        default, the value passed to SetSheetStyle() is used to determine the control.

        The default behaviour is to create a notebook except on Smartphone, where a
        choicebook is used.
    */
    virtual wxBookCtrlBase* CreateBookCtrl();

    /**
        Call this to create the buttons for the dialog.
        This calls wxDialog::CreateButtonSizer(), and the flags are the same.

        @note On PocketPC, no buttons are created.
    */
    virtual void CreateButtons(int flags = wxOK|wxCANCEL);

    /**
        Returns the book control that will contain your settings pages.
    */
    wxBookCtrlBase* GetBookCtrl() const;

    /**
        Returns the inner sizer that contains the book control and button sizer.
    */
    wxSizer* GetInnerSizer() const;

    /**
        Returns the sheet style.

        See SetSheetStyle() for allowed values.
    */
    long GetSheetStyle() const;

    /**
        Call this to lay out the dialog.

        @note On PocketPC, this does nothing, since the dialog will be shown full-screen,
              and the layout will be done when the dialog receives a size event.
    */
    virtual void LayoutDialog(int centreFlags = wxBOTH);

    /**
        Sets the book control used for the dialog.

        You will normally not need to use this.
    */
    void SetBookCtrl(wxBookCtrlBase* bookCtrl);

    /**
        You can customize the look and feel of the dialog by setting the sheet style.
        It is a bit list of the ::wxPropertySheetDialogFlags values.
    */
    void SetSheetStyle(long style);
};