]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _checkbox.i | |
3 | // Purpose: SWIG interface defs for wxCheckBox | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 10-June-1998 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | %newgroup; | |
18 | ||
b2dc1044 | 19 | MAKE_CONST_WXSTRING(CheckBoxNameStr); |
d14a1e28 RD |
20 | |
21 | ||
22 | enum { | |
23 | // Determine whether to use a 3-state or 2-state | |
24 | // checkbox. 3-state enables to differentiate | |
25 | // between 'unchecked', 'checked' and 'undetermined'. | |
26 | wxCHK_2STATE, | |
27 | wxCHK_3STATE, | |
28 | ||
29 | ||
30 | // If this style is set the user can set the checkbox to the | |
31 | // undetermined state. If not set the undetermined set can only | |
32 | // be set programmatically. | |
33 | // This style can only be used with 3 state checkboxes. | |
34 | wxCHK_ALLOW_3RD_STATE_FOR_USER, | |
35 | }; | |
36 | ||
37 | enum wxCheckBoxState | |
38 | { | |
39 | wxCHK_UNCHECKED, | |
40 | wxCHK_CHECKED, | |
41 | wxCHK_UNDETERMINED /* 3-state checkbox only */ | |
42 | }; | |
43 | ||
44 | ||
45 | //--------------------------------------------------------------------------- | |
46 | ||
fcafa8a9 | 47 | DocStr(wxCheckBox, |
dce2bd22 RD |
48 | "A checkbox is a labelled box which by default is either on (the |
49 | checkmark is visible) or off (no checkmark). Optionally (When the | |
50 | wx.CHK_3STATE style flag is set) it can have a third state, called the | |
51 | mixed or undetermined state. Often this is used as a \"Does Not | |
d07d2bc9 | 52 | Apply\" state.", " |
dce2bd22 RD |
53 | |
54 | Window Styles | |
55 | ------------- | |
56 | ================================= =============================== | |
57 | wx.CHK_2STATE Create a 2-state checkbox. | |
58 | This is the default. | |
59 | wx.CHK_3STATE Create a 3-state checkbox. | |
60 | wx.CHK_ALLOW_3RD_STATE_FOR_USER By default a user can't set a | |
61 | 3-state checkbox to the | |
62 | third state. It can only be | |
63 | done from code. Using this | |
64 | flags allows the user to set | |
65 | the checkbox to the third | |
66 | state by clicking. | |
67 | wx.ALIGN_RIGHT Makes the | |
68 | text appear on the left of | |
69 | the checkbox. | |
70 | ================================= =============================== | |
71 | ||
72 | Events | |
73 | ------ | |
74 | =============================== =============================== | |
75 | EVT_CHECKBOX Sent when checkbox is clicked. | |
76 | =============================== =============================== | |
fcafa8a9 RD |
77 | "); |
78 | ||
79 | ||
80 | ||
ab1f7d2a RD |
81 | MustHaveApp(wxCheckBox); |
82 | ||
d14a1e28 RD |
83 | class wxCheckBox : public wxControl |
84 | { | |
85 | public: | |
2b9048c5 RD |
86 | %pythonAppend wxCheckBox "self._setOORInfo(self)" |
87 | %pythonAppend wxCheckBox() "" | |
fcafa8a9 RD |
88 | |
89 | DocCtorStr( | |
d5573410 RD |
90 | wxCheckBox(wxWindow* parent, wxWindowID id=-1, |
91 | const wxString& label = wxPyEmptyString, | |
fcafa8a9 RD |
92 | const wxPoint& pos = wxDefaultPosition, |
93 | const wxSize& size = wxDefaultSize, | |
94 | long style = 0, | |
95 | const wxValidator& validator = wxDefaultValidator, | |
96 | const wxString& name = wxPyCheckBoxNameStr), | |
d07d2bc9 | 97 | "Creates and shows a CheckBox control", ""); |
fcafa8a9 RD |
98 | |
99 | DocCtorStrName( | |
100 | wxCheckBox(), | |
d07d2bc9 | 101 | "Precreate a CheckBox for 2-phase creation.", "", |
fcafa8a9 RD |
102 | PreCheckBox); |
103 | ||
104 | ||
105 | DocDeclStr( | |
d5573410 RD |
106 | bool, Create(wxWindow* parent, wxWindowID id=-1, |
107 | const wxString& label = wxPyEmptyString, | |
fcafa8a9 RD |
108 | const wxPoint& pos = wxDefaultPosition, |
109 | const wxSize& size = wxDefaultSize, | |
110 | long style = 0, | |
111 | const wxValidator& validator = wxDefaultValidator, | |
112 | const wxString& name = wxPyCheckBoxNameStr), | |
d07d2bc9 | 113 | "Actually create the GUI CheckBox for 2-phase creation.", ""); |
fcafa8a9 RD |
114 | |
115 | ||
116 | DocDeclStr( | |
117 | bool, GetValue(), | |
dce2bd22 | 118 | "Gets the state of a 2-state CheckBox. Returns True if it is checked, |
d07d2bc9 | 119 | False otherwise.", ""); |
fcafa8a9 RD |
120 | |
121 | DocDeclStr( | |
122 | bool, IsChecked(), | |
dce2bd22 | 123 | "Similar to GetValue, but raises an exception if it is not a 2-state |
d07d2bc9 | 124 | CheckBox.", ""); |
fcafa8a9 RD |
125 | |
126 | DocDeclStr( | |
127 | void, SetValue(const bool state), | |
dce2bd22 | 128 | "Set the state of a 2-state CheckBox. Pass True for checked, False for |
d07d2bc9 | 129 | unchecked.", ""); |
fcafa8a9 RD |
130 | |
131 | DocDeclStr( | |
132 | wxCheckBoxState, Get3StateValue() const, | |
dce2bd22 RD |
133 | "Returns wx.CHK_UNCHECKED when the CheckBox is unchecked, |
134 | wx.CHK_CHECKED when it is checked and wx.CHK_UNDETERMINED when it's in | |
135 | the undetermined state. Raises an exceptiion when the function is | |
d07d2bc9 | 136 | used with a 2-state CheckBox.", ""); |
fcafa8a9 RD |
137 | |
138 | DocDeclStr( | |
139 | void, Set3StateValue(wxCheckBoxState state), | |
dce2bd22 RD |
140 | "Sets the CheckBox to the given state. The state parameter can be one |
141 | of the following: wx.CHK_UNCHECKED (Check is off), wx.CHK_CHECKED (the | |
142 | Check is on) or wx.CHK_UNDETERMINED (Check is mixed). Raises an | |
143 | exception when the CheckBox is a 2-state checkbox and setting the | |
d07d2bc9 | 144 | state to wx.CHK_UNDETERMINED.", ""); |
fcafa8a9 RD |
145 | |
146 | DocDeclStr( | |
147 | bool, Is3State() const, | |
d07d2bc9 | 148 | "Returns whether or not the CheckBox is a 3-state CheckBox.", ""); |
fcafa8a9 RD |
149 | |
150 | DocDeclStr( | |
151 | bool, Is3rdStateAllowedForUser() const, | |
dce2bd22 | 152 | "Returns whether or not the user can set the CheckBox to the third |
d07d2bc9 | 153 | state.", ""); |
d14a1e28 | 154 | |
880715c9 RD |
155 | static wxVisualAttributes |
156 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
d14a1e28 RD |
157 | }; |
158 | ||
159 | //--------------------------------------------------------------------------- | |
160 | //--------------------------------------------------------------------------- |