1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface defs for wxButton, wxBitmapButton
7 // Created: 10-June-1998
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
19 MAKE_CONST_WXSTRING(ButtonNameStr);
44 // wxSTOCK_FIND_AND_REPLACE,
47 // wxSTOCK_GO_FORWARD,
54 // wxSTOCK_JUSTIFY_CENTER,
55 // wxSTOCK_JUSTIFY_FILL,
56 // wxSTOCK_JUSTIFY_LEFT,
57 // wxSTOCK_JUSTIFY_RIGHT,
63 // wxSTOCK_PREFERENCES,
65 // wxSTOCK_PRINT_PREVIEW,
66 // wxSTOCK_PROPERTIES,
71 // wxSTOCK_REVERT_TO_SAVED,
86 //---------------------------------------------------------------------------
89 "A button is a control that contains a text string, and is one of the most
90 common elements of a GUI. It may be placed on a dialog box or panel, or
91 indeed almost any other window.", "
95 ============== ==========================================
96 wx.BU_LEFT Left-justifies the label. Windows and GTK+ only.
97 wx.BU_TOP Aligns the label to the top of the button.
98 Windows and GTK+ only.
99 wx.BU_RIGHT Right-justifies the bitmap label. Windows and GTK+ only.
100 wx.BU_BOTTOM Aligns the label to the bottom of the button.
101 Windows and GTK+ only.
102 wx.BU_EXACTFIT Creates the button as small as possible
103 instead of making it of the standard size
104 (which is the default behaviour.)
105 ============== ==========================================
109 ============ ==========================================
110 EVT_BUTTON Sent when the button is clicked.
111 ============ ==========================================
113 :see: `wx.BitmapButton`
118 MustHaveApp(wxButton);
120 class wxButton : public wxControl
123 %pythonAppend wxButton "self._setOORInfo(self)"
124 %pythonAppend wxButton() ""
125 %typemap(out) wxButton*; // turn off this typemap
129 wxButton(wxWindow* parent, wxWindowID id=-1,
130 const wxString& label=wxPyEmptyString,
131 const wxPoint& pos = wxDefaultPosition,
132 const wxSize& size = wxDefaultSize,
134 const wxValidator& validator = wxDefaultValidator,
135 const wxString& name = wxPyButtonNameStr),
136 "Create and show a button.", "");
140 "Precreate a Button for 2-phase creation.", "",
144 // wxButton(wxWindow *parent, wxWindowID id,
145 // wxStockItemID stock,
146 // const wxString& descriptiveLabel = wxPyEmptyString,
147 // const wxPoint& pos = wxDefaultPosition,
149 // const wxValidator& validator = wxDefaultValidator,
150 // const wxString& name = wxButtonNameStr),
151 // "Used to create a stock `wx.Button`. Stock buttons are commonly used
152 // buttons such as OK or Cancel. They have standard label and dimensions
153 // and may have different appearance on some platforms (e.g. GTK+ 2
154 // decorates them with icons). Using this from is the preferred way of
155 // creating standard buttons.", "
157 // :param stock: The stock ID of the button to create. One of the following:
159 // ============================
162 // ``wx.STOCK_APPLY``
164 // ``wx.STOCK_CANCEL``
165 // ``wx.STOCK_CLEAR``
166 // ``wx.STOCK_CLOSE``
169 // ``wx.STOCK_DELETE``
171 // ``wx.STOCK_FIND_AND_REPLACE``
172 // ``wx.STOCK_GO_BACK``
173 // ``wx.STOCK_GO_DOWN``
174 // ``wx.STOCK_GO_FORWARD``
175 // ``wx.STOCK_GO_UP``
178 // ``wx.STOCK_INDENT``
179 // ``wx.STOCK_INDEX``
180 // ``wx.STOCK_ITALIC``
181 // ``wx.STOCK_JUSTIFY_CENTER``
182 // ``wx.STOCK_JUSTIFY_FILL``
183 // ``wx.STOCK_JUSTIFY_LEFT``
184 // ``wx.STOCK_JUSTIFY_RIGHT``
189 // ``wx.STOCK_PASTE``
190 // ``wx.STOCK_PREFERENCES``
191 // ``wx.STOCK_PRINT``
192 // ``wx.STOCK_PRINT_PREVIEW``
193 // ``wx.STOCK_PROPERTIES``
196 // ``wx.STOCK_REFRESH``
197 // ``wx.STOCK_REMOVE``
198 // ``wx.STOCK_REVERT_TO_SAVED``
200 // ``wx.STOCK_SAVE_AS``
202 // ``wx.STOCK_UNDELETE``
203 // ``wx.STOCK_UNDERLINE``
205 // ``wx.STOCK_UNINDENT``
207 // ``wx.STOCK_ZOOM_100``
208 // ``wx.STOCK_ZOOM_FIT``
209 // ``wx.STOCK_ZOOM_IN``
210 // ``wx.STOCK_ZOOM_OUT``
211 // ============================
214 // :param descriptiveLabel: Optional label to be used on platforms
215 // where standard buttons have descriptive rather than generic
216 // labels. Mac is one such platforms, well-behaved Mac apps should use
217 // descriptive labels (e.g. \"Save\" and \"Don't Save\" instead of \"OK\"
218 // and \"Cancel\"). This argument is ignored on other platforms.",
222 // Turn it back on again
223 %typemap(out) wxButton* { $result = wxPyMake_wxObject($1, $owner); }
227 bool , Create(wxWindow* parent, wxWindowID id=-1,
228 const wxString& label=wxPyEmptyString,
229 const wxPoint& pos = wxDefaultPosition,
230 const wxSize& size = wxDefaultSize,
232 const wxValidator& validator = wxDefaultValidator,
233 const wxString& name = wxPyButtonNameStr),
234 "Acutally create the GUI Button for 2-phase creation.", "");
240 "This sets the button to be the default item for the panel or dialog box.", "");
244 static wxSize , GetDefaultSize(),
245 "Returns the default button size for this platform.", "");
247 static wxVisualAttributes
248 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
253 //---------------------------------------------------------------------------
256 DocStr(wxBitmapButton,
257 "A Button that contains a bitmap. A bitmap button can be supplied with a
258 single bitmap, and wxWidgets will draw all button states using this bitmap. If
259 the application needs more control, additional bitmaps for the selected state,
260 unpressed focused state, and greyed-out state may be supplied.", "
264 ============== =============================================
265 wx.BU_AUTODRAW If this is specified, the button will be drawn
266 automatically using the label bitmap only,
267 providing a 3D-look border. If this style is
268 not specified, the button will be drawn
269 without borders and using all provided
271 wx.BU_LEFT Left-justifies the label. WIN32 only.
272 wx.BU_TOP Aligns the label to the top of the button. WIN32
274 wx.BU_RIGHT Right-justifies the bitmap label. WIN32 only.
275 wx.BU_BOTTOM Aligns the label to the bottom of the
277 wx.BU_EXACTFIT Creates the button as small as possible
278 instead of making it of the standard size
279 (which is the default behaviour.)
280 ============== =============================================
284 =========== ==================================
285 EVT_BUTTON Sent when the button is clicked.
286 =========== ==================================
288 :see: `wx.Button`, `wx.Bitmap`
291 MustHaveApp(wxBitmapButton);
293 class wxBitmapButton : public wxButton
296 %pythonAppend wxBitmapButton "self._setOORInfo(self)"
297 %pythonAppend wxBitmapButton() ""
298 %typemap(out) wxBitmapButton*; // turn off this typemap
301 wxBitmapButton(wxWindow* parent, wxWindowID id=-1,
302 const wxBitmap& bitmap = wxNullBitmap,
303 const wxPoint& pos = wxDefaultPosition,
304 const wxSize& size = wxDefaultSize,
305 long style = wxBU_AUTODRAW,
306 const wxValidator& validator = wxDefaultValidator,
307 const wxString& name = wxPyButtonNameStr),
308 "Create and show a button with a bitmap for the label.", "");
312 "Precreate a BitmapButton for 2-phase creation.", "",
315 // Turn it back on again
316 %typemap(out) wxBitmapButton* { $result = wxPyMake_wxObject($1, $owner); }
320 bool , Create(wxWindow* parent, wxWindowID id=-1,
321 const wxBitmap& bitmap = wxNullBitmap,
322 const wxPoint& pos = wxDefaultPosition,
323 const wxSize& size = wxDefaultSize,
324 long style = wxBU_AUTODRAW,
325 const wxValidator& validator = wxDefaultValidator,
326 const wxString& name = wxPyButtonNameStr),
327 "Acutally create the GUI BitmapButton for 2-phase creation.", "");
331 wxBitmap , GetBitmapLabel(),
332 "Returns the label bitmap (the one passed to the constructor).", "");
335 wxBitmap , GetBitmapDisabled(),
336 "Returns the bitmap for the disabled state.", "");
339 wxBitmap , GetBitmapFocus(),
340 "Returns the bitmap for the focused state.", "");
344 wxBitmap , GetBitmapSelected(),
345 "Returns the bitmap for the selected state.", "");
349 void , SetBitmapDisabled(const wxBitmap& bitmap),
350 "Sets the bitmap for the disabled button appearance.", "");
354 void , SetBitmapFocus(const wxBitmap& bitmap),
355 "Sets the bitmap for the button appearance when it has the keyboard focus.", "");
359 void , SetBitmapSelected(const wxBitmap& bitmap),
360 "Sets the bitmap for the selected (depressed) button appearance.", "");
364 void , SetBitmapLabel(const wxBitmap& bitmap),
365 "Sets the bitmap label for the button. This is the bitmap used for the
366 unselected state, and for all other states if no other bitmaps are provided.", "");
369 void SetMargins(int x, int y);
370 int GetMarginX() const;
371 int GetMarginY() const;
375 //---------------------------------------------------------------------------