]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_button.i
More True/False fixes
[wxWidgets.git] / wxPython / src / _button.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _button.i
3 // Purpose: SWIG interface defs for wxButton, wxBitmapButton
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
19 MAKE_CONST_WXSTRING(ButtonNameStr);
20
21 enum {
22 wxBU_LEFT,
23 wxBU_TOP,
24 wxBU_RIGHT,
25 wxBU_BOTTOM,
26
27 wxBU_EXACTFIT,
28 wxBU_AUTODRAW,
29 };
30
31 //---------------------------------------------------------------------------
32
33 DocStr(wxButton,
34 "A button is a control that contains a text string, and is one of the most
35 common elements of a GUI. It may be placed on a dialog box or panel, or
36 indeed almost any other window.", "
37
38 Window Styles
39 -------------
40 ============== ==========================================
41 wx.BU_LEFT Left-justifies the label. Windows and GTK+ only.
42 wx.BU_TOP Aligns the label to the top of the button.
43 Windows and GTK+ only.
44 wx.BU_RIGHT Right-justifies the bitmap label. Windows and GTK+ only.
45 wx.BU_BOTTOM Aligns the label to the bottom of the button.
46 Windows and GTK+ only.
47 wx.BU_EXACTFIT Creates the button as small as possible
48 instead of making it of the standard size
49 (which is the default behaviour.)
50 ============== ==========================================
51
52 Events
53 ------
54 ============ ==========================================
55 EVT_BUTTON Sent when the button is clicked.
56 ============ ==========================================
57
58 :see: `wx.BitmapButton`
59 ");
60
61
62 MustHaveApp(wxButton);
63
64 class wxButton : public wxControl
65 {
66 public:
67 %pythonAppend wxButton "self._setOORInfo(self)"
68 %pythonAppend wxButton() ""
69 %typemap(out) wxButton*; // turn off this typemap
70
71
72 DocCtorStr(
73 wxButton(wxWindow* parent, wxWindowID id=-1,
74 const wxString& label=wxPyEmptyString,
75 const wxPoint& pos = wxDefaultPosition,
76 const wxSize& size = wxDefaultSize,
77 long style = 0,
78 const wxValidator& validator = wxDefaultValidator,
79 const wxString& name = wxPyButtonNameStr),
80 "Create and show a button. The preferred way to create standard
81 buttons is to use a standard ID and an empty label. In this case
82 wxWigets will automatically use a stock label that coresponds to the
83 ID given. In additon, the button will be decorated with stock icons
84 under GTK+ 2.", "
85
86 The stock IDs and coresponding labels are
87
88 ===================== ======================
89 wx.ID_ADD 'Add'
90 wx.ID_APPLY '\&Apply'
91 wx.ID_BOLD '\&Bold'
92 wx.ID_CANCEL '\&Cancel'
93 wx.ID_CLEAR '\&Clear'
94 wx.ID_CLOSE '\&Close'
95 wx.ID_COPY '\&Copy'
96 wx.ID_CUT 'Cu\&t'
97 wx.ID_DELETE '\&Delete'
98 wx.ID_FIND '\&Find'
99 wx.ID_REPLACE 'Find and rep\&lace'
100 wx.ID_BACKWARD '\&Back'
101 wx.ID_DOWN '\&Down'
102 wx.ID_FORWARD '\&Forward'
103 wx.ID_UP '\&Up'
104 wx.ID_HELP '\&Help'
105 wx.ID_HOME '\&Home'
106 wx.ID_INDENT 'Indent'
107 wx.ID_INDEX '\&Index'
108 wx.ID_ITALIC '\&Italic'
109 wx.ID_JUSTIFY_CENTER 'Centered'
110 wx.ID_JUSTIFY_FILL 'Justified'
111 wx.ID_JUSTIFY_LEFT 'Align Left'
112 wx.ID_JUSTIFY_RIGHT 'Align Right'
113 wx.ID_NEW '\&New'
114 wx.ID_NO '\&No'
115 wx.ID_OK '\&OK'
116 wx.ID_OPEN '\&Open'
117 wx.ID_PASTE '\&Paste'
118 wx.ID_PREFERENCES '\&Preferences'
119 wx.ID_PRINT '\&Print'
120 wx.ID_PREVIEW 'Print previe\&w'
121 wx.ID_PROPERTIES '\&Properties'
122 wx.ID_EXIT '\&Quit'
123 wx.ID_REDO '\&Redo'
124 wx.ID_REFRESH 'Refresh'
125 wx.ID_REMOVE 'Remove'
126 wx.ID_REVERT_TO_SAVED 'Revert to Saved'
127 wx.ID_SAVE '\&Save'
128 wx.ID_SAVEAS 'Save \&As...'
129 wx.ID_STOP '\&Stop'
130 wx.ID_UNDELETE 'Undelete'
131 wx.ID_UNDERLINE '\&Underline'
132 wx.ID_UNDO '\&Undo'
133 wx.ID_UNINDENT '\&Unindent'
134 wx.ID_YES '\&Yes'
135 wx.ID_ZOOM_100 '\&Actual Size'
136 wx.ID_ZOOM_FIT 'Zoom to \&Fit'
137 wx.ID_ZOOM_IN 'Zoom \&In'
138 wx.ID_ZOOM_OUT 'Zoom \&Out'
139 ===================== ======================
140 ");
141
142 DocCtorStrName(
143 wxButton(),
144 "Precreate a Button for 2-phase creation.", "",
145 PreButton);
146
147 // Turn it back on again
148 %typemap(out) wxButton* { $result = wxPyMake_wxObject($1, $owner); }
149
150
151 DocDeclStr(
152 bool , Create(wxWindow* parent, wxWindowID id=-1,
153 const wxString& label=wxPyEmptyString,
154 const wxPoint& pos = wxDefaultPosition,
155 const wxSize& size = wxDefaultSize,
156 long style = 0,
157 const wxValidator& validator = wxDefaultValidator,
158 const wxString& name = wxPyButtonNameStr),
159 "Acutally create the GUI Button for 2-phase creation.", "");
160
161
162
163 DocDeclStr(
164 void , SetDefault(),
165 "This sets the button to be the default item for the panel or dialog box.", "");
166
167
168 DocDeclStr(
169 static wxSize , GetDefaultSize(),
170 "Returns the default button size for this platform.", "");
171
172 static wxVisualAttributes
173 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
174 };
175
176
177
178 //---------------------------------------------------------------------------
179
180
181 DocStr(wxBitmapButton,
182 "A Button that contains a bitmap. A bitmap button can be supplied with a
183 single bitmap, and wxWidgets will draw all button states using this bitmap. If
184 the application needs more control, additional bitmaps for the selected state,
185 unpressed focused state, and greyed-out state may be supplied.", "
186
187 Window Styles
188 -------------
189 ============== =============================================
190 wx.BU_AUTODRAW If this is specified, the button will be drawn
191 automatically using the label bitmap only,
192 providing a 3D-look border. If this style is
193 not specified, the button will be drawn
194 without borders and using all provided
195 bitmaps. WIN32 only.
196 wx.BU_LEFT Left-justifies the label. WIN32 only.
197 wx.BU_TOP Aligns the label to the top of the button. WIN32
198 only.
199 wx.BU_RIGHT Right-justifies the bitmap label. WIN32 only.
200 wx.BU_BOTTOM Aligns the label to the bottom of the
201 button. WIN32 only.
202 wx.BU_EXACTFIT Creates the button as small as possible
203 instead of making it of the standard size
204 (which is the default behaviour.)
205 ============== =============================================
206
207 Events
208 ------
209 =========== ==================================
210 EVT_BUTTON Sent when the button is clicked.
211 =========== ==================================
212
213 :see: `wx.Button`, `wx.Bitmap`
214 ");
215
216 MustHaveApp(wxBitmapButton);
217
218 class wxBitmapButton : public wxButton
219 {
220 public:
221 %pythonAppend wxBitmapButton "self._setOORInfo(self)"
222 %pythonAppend wxBitmapButton() ""
223 %typemap(out) wxBitmapButton*; // turn off this typemap
224
225 DocCtorStr(
226 wxBitmapButton(wxWindow* parent, wxWindowID id=-1,
227 const wxBitmap& bitmap = wxNullBitmap,
228 const wxPoint& pos = wxDefaultPosition,
229 const wxSize& size = wxDefaultSize,
230 long style = wxBU_AUTODRAW,
231 const wxValidator& validator = wxDefaultValidator,
232 const wxString& name = wxPyButtonNameStr),
233 "Create and show a button with a bitmap for the label.", "");
234
235 DocCtorStrName(
236 wxBitmapButton(),
237 "Precreate a BitmapButton for 2-phase creation.", "",
238 PreBitmapButton);
239
240 // Turn it back on again
241 %typemap(out) wxBitmapButton* { $result = wxPyMake_wxObject($1, $owner); }
242
243
244 DocDeclStr(
245 bool , Create(wxWindow* parent, wxWindowID id=-1,
246 const wxBitmap& bitmap = wxNullBitmap,
247 const wxPoint& pos = wxDefaultPosition,
248 const wxSize& size = wxDefaultSize,
249 long style = wxBU_AUTODRAW,
250 const wxValidator& validator = wxDefaultValidator,
251 const wxString& name = wxPyButtonNameStr),
252 "Acutally create the GUI BitmapButton for 2-phase creation.", "");
253
254
255 DocDeclStr(
256 wxBitmap , GetBitmapLabel(),
257 "Returns the label bitmap (the one passed to the constructor).", "");
258
259 DocDeclStr(
260 wxBitmap , GetBitmapDisabled(),
261 "Returns the bitmap for the disabled state.", "");
262
263 DocDeclStr(
264 wxBitmap , GetBitmapFocus(),
265 "Returns the bitmap for the focused state.", "");
266
267
268 DocDeclStr(
269 wxBitmap , GetBitmapSelected(),
270 "Returns the bitmap for the selected state.", "");
271
272
273 DocDeclStr(
274 void , SetBitmapDisabled(const wxBitmap& bitmap),
275 "Sets the bitmap for the disabled button appearance.", "");
276
277
278 DocDeclStr(
279 void , SetBitmapFocus(const wxBitmap& bitmap),
280 "Sets the bitmap for the button appearance when it has the keyboard focus.", "");
281
282
283 DocDeclStr(
284 void , SetBitmapSelected(const wxBitmap& bitmap),
285 "Sets the bitmap for the selected (depressed) button appearance.", "");
286
287
288 DocDeclStr(
289 void , SetBitmapLabel(const wxBitmap& bitmap),
290 "Sets the bitmap label for the button. This is the bitmap used for the
291 unselected state, and for all other states if no other bitmaps are provided.", "");
292
293
294 void SetMargins(int x, int y);
295 int GetMarginX() const;
296 int GetMarginY() const;
297 };
298
299
300 //---------------------------------------------------------------------------