~brian-sidebotham/wxwidgets-cmake/wxpython-2.9.4

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
/////////////////////////////////////////////////////////////////////////////
// Name:        checkbox.h
// Purpose:     interface of wxCheckBox
// Author:      wxWidgets team
// RCS-ID:      $Id: checkbox.h 70353 2012-01-15 14:46:41Z VZ $
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/*
 * wxCheckBox style flags
 * (Using wxCHK_* because wxCB_* is used by wxComboBox).
 * Determine whether to use a 3-state or 2-state
 * checkbox. 3-state enables to differentiate
 * between 'unchecked', 'checked' and 'undetermined'.
 *
 * In addition to the styles here it is also possible to specify just 0 which
 * is treated the same as wxCHK_2STATE for compatibility (but using explicit
 * flag is preferred).
 */
#define wxCHK_2STATE           0x4000
#define wxCHK_3STATE           0x1000

/*
 * If this style is set the user can set the checkbox to the
 * undetermined state. If not set the undetermined set can only
 * be set programmatically.
 * This style can only be used with 3 state checkboxes.
 */
#define wxCHK_ALLOW_3RD_STATE_FOR_USER 0x2000

/**
    The possible states of a 3-state wxCheckBox (Compatible with the 2-state
    wxCheckBox).
*/
enum wxCheckBoxState
{
    wxCHK_UNCHECKED,
    wxCHK_CHECKED,
    wxCHK_UNDETERMINED  ///< 3-state checkbox only
};

/**
    @class wxCheckBox

    A checkbox is a labelled box which by default is either on (checkmark is
    visible) or off (no checkmark). Optionally (when the wxCHK_3STATE style
    flag is set) it can have a third state, called the mixed or undetermined
    state. Often this is used as a "Does Not Apply" state.

    @beginStyleTable
    @style{wxCHK_2STATE}
           Create a 2-state checkbox. This is the default.
    @style{wxCHK_3STATE}
           Create a 3-state checkbox. Not implemented in wxOS2 and
           wxGTK built against GTK+ 1.2.
    @style{wxCHK_ALLOW_3RD_STATE_FOR_USER}
           By default a user can't set a 3-state checkbox to the third state.
           It can only be done from code. Using this flags allows the user to
           set the checkbox to the third state by clicking.
    @style{wxALIGN_RIGHT}
           Makes the text appear on the left of the checkbox.
    @endStyleTable

    @beginEventEmissionTable{wxCommandEvent}
    @event{EVT_CHECKBOX(id, func)}
           Process a @c wxEVT_COMMAND_CHECKBOX_CLICKED event, when the checkbox
           is clicked.
    @endEventTable

    @library{wxcore}
    @category{ctrl}
    @appearance{checkbox.png}

    @see wxRadioButton, wxCommandEvent
*/
class wxCheckBox : public wxControl
{
public:
    /**
        Default constructor.

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

    /**
        Constructor, creating and showing a checkbox.

        @param parent
            Parent window. Must not be @NULL.
        @param id
            Checkbox identifier. The value wxID_ANY indicates a default value.
        @param label
            Text to be displayed next to the checkbox.
        @param pos
            Checkbox position. 
            If ::wxDefaultPosition is specified then a default position is chosen.
        @param size
            Checkbox size. 
            If ::wxDefaultSize is specified then a default size is chosen.
        @param style
            Window style. See wxCheckBox.
        @param validator
            Window validator.
        @param name
            Window name.

        @see Create(), wxValidator
    */
    wxCheckBox(wxWindow* parent, wxWindowID id,
               const wxString& label,
               const wxPoint& pos = wxDefaultPosition,
               const wxSize& size = wxDefaultSize,
               long style = 0,
               const wxValidator& validator = wxDefaultValidator,
               const wxString& name = wxCheckBoxNameStr);

    /**
        Destructor, destroying the checkbox.
    */
    virtual ~wxCheckBox();

    /**
        Creates the checkbox for two-step construction. See wxCheckBox()
        for details.
    */
    bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize, long style = 0,
                const wxValidator& validator = wxDefaultValidator,
                const wxString& name = wxCheckBoxNameStr);

    /**
        Gets the state of a 2-state checkbox.

        @return Returns @true if it is checked, @false otherwise.
    */
    virtual bool GetValue() const;

    /**
        Gets the state of a 3-state checkbox. Asserts when the function is used
        with a 2-state checkbox.
    */
    wxCheckBoxState Get3StateValue() const;

    /**
        Returns whether or not the checkbox is a 3-state checkbox.

        @return @true if this checkbox is a 3-state checkbox, @false if it's
                a 2-state checkbox.
    */
    bool Is3State() const;

    /**
        Returns whether or not the user can set the checkbox to the third
        state.

        @return @true if the user can set the third state of this checkbox,
                @false if it can only be set programmatically or if it's a
                2-state checkbox.
    */
    bool Is3rdStateAllowedForUser() const;

    /**
        This is just a maybe more readable synonym for GetValue(): just as the
        latter, it returns @true if the checkbox is checked and @false
        otherwise.
    */
    bool IsChecked() const;

    /**
        Sets the checkbox to the given state. This does not cause a
        @c wxEVT_COMMAND_CHECKBOX_CLICKED event to get emitted.

        @param state
            If @true, the check is on, otherwise it is off.
    */
    virtual void SetValue(bool state);

    /**
        Sets the checkbox to the given state. This does not cause a
        @c wxEVT_COMMAND_CHECKBOX_CLICKED event to get emitted.

        Asserts when the checkbox is a 2-state checkbox and setting the state
        to wxCHK_UNDETERMINED.
    */
    void Set3StateValue(wxCheckBoxState state);
};