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