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);
33 //---------------------------------------------------------------------------
36 "A button is a control that contains a text string, and is one of the most
37 common elements of a GUI. It may be placed on a dialog box or panel, or
38 indeed almost any other window.", "
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 ============== ==========================================
56 ============ ==========================================
57 EVT_BUTTON Sent when the button is clicked.
58 ============ ==========================================
60 :see: `wx.BitmapButton`
64 MustHaveApp(wxButton);
66 class wxButton : public wxControl
69 %pythonAppend wxButton "self._setOORInfo(self)"
70 %pythonAppend wxButton() ""
71 %typemap(out) wxButton*; // turn off this typemap
75 wxButton(wxWindow* parent, wxWindowID id=-1,
76 const wxString& label=wxPyEmptyString,
77 const wxPoint& pos = wxDefaultPosition,
78 const wxSize& size = wxDefaultSize,
80 const wxValidator& validator = wxDefaultValidator,
81 const wxString& name = wxPyButtonNameStr),
82 "Create and show a button. The preferred way to create standard
83 buttons is to use a standard ID and an empty label. In this case
84 wxWigets will automatically use a stock label that coresponds to the
85 ID given. In additon, the button will be decorated with stock icons
88 The stock IDs and coresponding labels are
90 ===================== ======================
94 wx.ID_CANCEL '\&Cancel'
99 wx.ID_DELETE '\&Delete'
101 wx.ID_REPLACE 'Find and rep\&lace'
102 wx.ID_BACKWARD '\&Back'
104 wx.ID_FORWARD '\&Forward'
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'
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'
126 wx.ID_REFRESH 'Refresh'
127 wx.ID_REMOVE 'Remove'
128 wx.ID_REVERT_TO_SAVED 'Revert to Saved'
130 wx.ID_SAVEAS 'Save \&As...'
132 wx.ID_UNDELETE 'Undelete'
133 wx.ID_UNDERLINE '\&Underline'
135 wx.ID_UNINDENT '\&Unindent'
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 ===================== ======================
146 "Precreate a Button for 2-phase creation.", "",
149 // Turn it back on again
150 %typemap(out) wxButton* { $result = wxPyMake_wxObject($1, $owner); }
154 bool , Create(wxWindow* parent, wxWindowID id=-1,
155 const wxString& label=wxPyEmptyString,
156 const wxPoint& pos = wxDefaultPosition,
157 const wxSize& size = wxDefaultSize,
159 const wxValidator& validator = wxDefaultValidator,
160 const wxString& name = wxPyButtonNameStr),
161 "Acutally create the GUI Button for 2-phase creation.", "");
167 "This sets the button to be the default item for the panel or dialog box.", "");
171 static wxSize , GetDefaultSize(),
172 "Returns the default button size for this platform.", "");
174 static wxVisualAttributes
175 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
180 //---------------------------------------------------------------------------
183 DocStr(wxBitmapButton,
184 "A Button that contains a bitmap. A bitmap button can be supplied with a
185 single bitmap, and wxWidgets will draw all button states using this bitmap. If
186 the application needs more control, additional bitmaps for the selected state,
187 unpressed focused state, and greyed-out state may be supplied.", "
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
198 wx.BU_LEFT Left-justifies the label. WIN32 only.
199 wx.BU_TOP Aligns the label to the top of the button. WIN32
201 wx.BU_RIGHT Right-justifies the bitmap label. WIN32 only.
202 wx.BU_BOTTOM Aligns the label to the bottom of the
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 ============== =============================================
211 =========== ==================================
212 EVT_BUTTON Sent when the button is clicked.
213 =========== ==================================
215 :see: `wx.Button`, `wx.Bitmap`
218 MustHaveApp(wxBitmapButton);
220 class wxBitmapButton : public wxButton
223 %pythonAppend wxBitmapButton "self._setOORInfo(self)"
224 %pythonAppend wxBitmapButton() ""
225 %typemap(out) wxBitmapButton*; // turn off this typemap
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.", "");
239 "Precreate a BitmapButton for 2-phase creation.", "",
242 // Turn it back on again
243 %typemap(out) wxBitmapButton* { $result = wxPyMake_wxObject($1, $owner); }
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.", "");
258 wxBitmap , GetBitmapLabel(),
259 "Returns the label bitmap (the one passed to the constructor).", "");
262 wxBitmap , GetBitmapDisabled(),
263 "Returns the bitmap for the disabled state.", "");
266 wxBitmap , GetBitmapFocus(),
267 "Returns the bitmap for the focused state.", "");
271 wxBitmap , GetBitmapSelected(),
272 "Returns the bitmap for the selected state.", "");
275 wxBitmap , GetBitmapHover(),
276 "Returns the bitmap used when the mouse is over the button, may be invalid.", "");
280 void , SetBitmapDisabled(const wxBitmap& bitmap),
281 "Sets the bitmap for the disabled button appearance.", "");
285 void , SetBitmapFocus(const wxBitmap& bitmap),
286 "Sets the bitmap for the button appearance when it has the keyboard focus.", "");
290 void , SetBitmapSelected(const wxBitmap& bitmap),
291 "Sets the bitmap for the selected (depressed) button appearance.", "");
295 void , SetBitmapLabel(const wxBitmap& bitmap),
296 "Sets the bitmap label for the button. This is the bitmap used for the
297 unselected state, and for all other states if no other bitmaps are provided.", "");
301 void , SetBitmapHover(const wxBitmap& hover),
302 "Sets the bitmap to be shown when the mouse is over the button. This function
303 is new since wxWidgets version 2.7.0 and the hover bitmap is currently only
304 supported in wxMSW.", "");
306 void SetMargins(int x, int y);
307 int GetMarginX() const;
308 int GetMarginY() const;
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`");
320 //---------------------------------------------------------------------------