File: radiobox.h

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (322 lines) | stat: -rw-r--r-- 10,432 bytes parent folder | download | duplicates (10)
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
/////////////////////////////////////////////////////////////////////////////
// Name:        radiobox.h
// Purpose:     interface of wxRadioBox
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxRadioBox

    A radio box item is used to select one of number of mutually exclusive
    choices.  It is displayed as a vertical column or horizontal row of
    labelled buttons.

    @beginStyleTable
    @style{wxRA_SPECIFY_ROWS}
           The major dimension parameter refers to the maximum number of rows.
    @style{wxRA_SPECIFY_COLS}
           The major dimension parameter refers to the maximum number of
           columns.
    @endStyleTable

    @beginEventEmissionTable{wxCommandEvent}
    @event{EVT_RADIOBOX(id, func)}
           Process a @c wxEVT_RADIOBOX event, when a radiobutton
           is clicked.
    @endEventTable

    @library{wxcore}
    @category{ctrl}
    @appearance{radiobox}

    @see @ref overview_events, wxRadioButton, wxCheckBox
*/
class wxRadioBox : public wxControl, wxItemContainerImmutable
{
public:

    /**
        Default constructor.

        @see Create(), wxValidator
    */
    wxRadioBox();

    /**
        Constructor, creating and showing a radiobox.

        @param parent
            Parent window. Must not be @NULL.
        @param id
            Window identifier. The value @c wxID_ANY indicates a default value.
        @param label
            Label for the static box surrounding the radio buttons.
        @param pos
            Window position. If ::wxDefaultPosition is specified then a
            default position is chosen.
        @param size
            Window size. If ::wxDefaultSize is specified then a default size
            is chosen.
        @param n
            Number of choices with which to initialize the radiobox.
        @param choices
            An array of choices with which to initialize the radiobox.
        @param majorDimension
            Specifies the maximum number of rows (if style contains
            @c wxRA_SPECIFY_ROWS) or columns (if style contains
            @c wxRA_SPECIFY_COLS) for a two-dimensional radiobox. The default
            value of 0 means to use the number of items, i.e. @a n.
        @param style
            Window style. See wxRadioBox.
        @param validator
            Window validator.
        @param name
            Window name.

        @beginWxPerlOnly
        Not supported by wxPerl.
        @endWxPerlOnly

        @see Create(), wxValidator
    */
    wxRadioBox(wxWindow* parent, wxWindowID id,
               const wxString& label,
               const wxPoint& pos = wxDefaultPosition,
               const wxSize& size = wxDefaultSize,
               int n = 0,
               const wxString choices[] = NULL,
               int majorDimension = 0,
               long style = wxRA_SPECIFY_COLS,
               const wxValidator& validator = wxDefaultValidator,
               const wxString& name = wxRadioBoxNameStr);

    /**
        Constructor, creating and showing a radiobox.

        @param parent
            Parent window. Must not be @NULL.
        @param id
            Window identifier. The value @c wxID_ANY indicates a default value.
        @param label
            Label for the static box surrounding the radio buttons.
        @param pos
            Window position. If ::wxDefaultPosition is specified then a
            default position is chosen.
        @param size
            Window size. If ::wxDefaultSize is specified then a default size
            is chosen.
        @param choices
            An array of choices with which to initialize the radiobox.
        @param majorDimension
            Specifies the maximum number of rows (if style contains
            @c wxRA_SPECIFY_ROWS) or columns (if style contains
            @c wxRA_SPECIFY_COLS) for a two-dimensional radiobox. The default
            value of 0 means to use the number of items, i.e. number of
            elements in @a choices.
        @param style
            Window style. See wxRadioBox.
        @param validator
            Window validator.
        @param name
            Window name.

        @beginWxPerlOnly
        Use an array reference for the @a choices parameter.
        @endWxPerlOnly

        @see Create(), wxValidator
    */
    wxRadioBox(wxWindow* parent, wxWindowID id,
               const wxString& label,
               const wxPoint& pos,
               const wxSize& size,
               const wxArrayString& choices,
               int majorDimension = 0,
               long style = wxRA_SPECIFY_COLS,
               const wxValidator& validator = wxDefaultValidator,
               const wxString& name = wxRadioBoxNameStr);

    /**
        Destructor, destroying the radiobox item.
    */
    virtual ~wxRadioBox();

    /**
        Creates the radiobox for two-step construction. See wxRadioBox()
        for further details.
    */
    bool Create(wxWindow* parent, wxWindowID id,
                const wxString& label,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                int n = 0,
                const wxString choices[] = NULL,
                int majorDimension = 0,
                long style = wxRA_SPECIFY_COLS,
                const wxValidator& validator = wxDefaultValidator,
                const wxString& name = wxRadioBoxNameStr);

    /**
        Creates the radiobox for two-step construction. See wxRadioBox()
        for further details.
    */
    bool Create(wxWindow* parent, wxWindowID id,
                const wxString& label,
                const wxPoint& pos,
                const wxSize& size,
                const wxArrayString& choices,
                int majorDimension = 0,
                long style = wxRA_SPECIFY_COLS,
                const wxValidator& validator = wxDefaultValidator,
                const wxString& name = wxRadioBoxNameStr);

    /**
        Enables or disables an individual button in the radiobox.

        @param enable
            @true to enable, @false to disable.
        @param n
            The zero-based button to enable or disable.

        @see wxWindow::Enable()

    */
    virtual bool Enable(unsigned int n, bool enable = true);

    /**
        Finds a button matching the given string, returning the position if found,
        or @c wxNOT_FOUND if not found.

        @param string
            The string to find.
        @param bCase
            Should the search be case-sensitive?
    */
    virtual int FindString(const wxString& string, bool bCase = false) const;

    /**
        Returns the number of columns in the radiobox.
    */
    unsigned int GetColumnCount() const;

    /**
        Returns a radio box item under the point, a zero-based item index, or @c
        wxNOT_FOUND if no item is under the point.

        @param pt
            Point in client coordinates.
    */
    virtual int GetItemFromPoint(const wxPoint& pt) const;

    /**
        Returns the helptext associated with the specified @a item if any or @c
        wxEmptyString.

        @param item
            The zero-based item index.

        @see SetItemHelpText()
    */
    wxString GetItemHelpText(unsigned int item) const;

    /**
        Returns the tooltip associated with the specified @a item if any or @NULL.

        @see SetItemToolTip(), wxWindow::GetToolTip()
    */
    wxToolTip* GetItemToolTip(unsigned int item) const;

    /**
        Returns the number of rows in the radiobox.
    */
    unsigned int GetRowCount() const;

    /**
        Returns @true if the item is enabled or @false if it was disabled using
        @ref Enable(unsigned int,bool) "Enable(n, false)".

        This function is currently only implemented in wxMSW, wxGTK and
        wxUniversal and always returns @true in the other ports.

        @param n
            The zero-based button position.
    */
    virtual bool IsItemEnabled(unsigned int n) const;

    /**
        Returns @true if the item is currently shown or @false if it was hidden
        using @ref Show(unsigned int,bool) "Show(n, false)".

        Note that this function returns @true for an item which hadn't been hidden
        even if the entire radiobox is not currently shown.

        This function is currently only implemented in wxMSW, wxGTK and
        wxUniversal and always returns @true in the other ports.

        @param n
            The zero-based button position.
    */
    virtual bool IsItemShown(unsigned int n) const;

    /**
        Sets the helptext for an item. Empty string erases any existing helptext.

        @param item
            The zero-based item index.
        @param helptext
            The help text to set for the item.

        @see GetItemHelpText()
    */
    void SetItemHelpText(unsigned int item, const wxString& helptext);

    /**
        Sets the tooltip text for the specified item in the radio group.

        This function is currently only implemented in wxMSW and wxGTK2 and
        does nothing in the other ports.

        @param item
            Index of the item the tooltip will be shown for.
        @param text
            Tooltip text for the item, the tooltip is removed if empty.

        @see GetItemToolTip(), wxWindow::SetToolTip()
    */
    void SetItemToolTip(unsigned int item, const wxString& text);

    /**
        Sets the selection to the given item.

        Notice that a radio box always has selection, so @a n must be valid
        here and passing @c wxNOT_FOUND is not allowed.
     */
    virtual void SetSelection(int n);

    /**
        Shows or hides individual buttons.

        @param show
            @true to show, @false to hide.
        @param item
            The zero-based position of the button to show or hide.

        @return
            @true if the item has been shown or hidden or @false if nothing
            was done because it already was in the requested state.

        @see
            wxWindow::Show()

    */
    virtual bool Show(unsigned int item, bool show = true);


    // pure virtuals that have implementations here
    virtual unsigned int GetCount() const;
    virtual wxString GetString(unsigned int n) const;
    virtual void SetString(unsigned int n, const wxString& string);
    virtual int GetSelection() const;

};