]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
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 | ||
b2dc1044 | 19 | MAKE_CONST_WXSTRING(ButtonNameStr); |
d14a1e28 RD |
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 | ||
1e0c8722 | 33 | DocStr(wxButton, |
dce2bd22 RD |
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 | |
d07d2bc9 | 36 | indeed almost any other window.", " |
dce2bd22 RD |
37 | |
38 | Window Styles | |
39 | ------------- | |
40 | ============== ========================================== | |
ab9bb9c0 | 41 | wx.BU_LEFT Left-justifies the label. Windows and GTK+ only. |
dce2bd22 | 42 | wx.BU_TOP Aligns the label to the top of the button. |
ab9bb9c0 RD |
43 | Windows and GTK+ only. |
44 | wx.BU_RIGHT Right-justifies the bitmap label. Windows and GTK+ only. | |
dce2bd22 | 45 | wx.BU_BOTTOM Aligns the label to the bottom of the button. |
ab9bb9c0 | 46 | Windows and GTK+ only. |
dce2bd22 RD |
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` | |
1e0c8722 | 59 | "); |
ab9bb9c0 | 60 | |
1e0c8722 | 61 | |
ab1f7d2a RD |
62 | MustHaveApp(wxButton); |
63 | ||
d14a1e28 RD |
64 | class wxButton : public wxControl |
65 | { | |
66 | public: | |
2b9048c5 RD |
67 | %pythonAppend wxButton "self._setOORInfo(self)" |
68 | %pythonAppend wxButton() "" | |
b39c3fa0 | 69 | %typemap(out) wxButton*; // turn off this typemap |
d14a1e28 RD |
70 | |
71 | ||
dce2bd22 | 72 | DocCtorStr( |
d5573410 RD |
73 | wxButton(wxWindow* parent, wxWindowID id=-1, |
74 | const wxString& label=wxPyEmptyString, | |
dce2bd22 RD |
75 | const wxPoint& pos = wxDefaultPosition, |
76 | const wxSize& size = wxDefaultSize, | |
77 | long style = 0, | |
78 | const wxValidator& validator = wxDefaultValidator, | |
79 | const wxString& name = wxPyButtonNameStr), | |
1a1ed526 RD |
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 | ||
b7287719 | 88 | ===================== ====================== |
1a1ed526 RD |
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' | |
b7287719 | 139 | ===================== ====================== |
1a1ed526 | 140 | "); |
dce2bd22 RD |
141 | |
142 | DocCtorStrName( | |
143 | wxButton(), | |
d07d2bc9 | 144 | "Precreate a Button for 2-phase creation.", "", |
dce2bd22 RD |
145 | PreButton); |
146 | ||
b39c3fa0 RD |
147 | // Turn it back on again |
148 | %typemap(out) wxButton* { $result = wxPyMake_wxObject($1, $owner); } | |
149 | ||
150 | ||
dce2bd22 | 151 | DocDeclStr( |
d5573410 RD |
152 | bool , Create(wxWindow* parent, wxWindowID id=-1, |
153 | const wxString& label=wxPyEmptyString, | |
dce2bd22 RD |
154 | const wxPoint& pos = wxDefaultPosition, |
155 | const wxSize& size = wxDefaultSize, | |
156 | long style = 0, | |
157 | const wxValidator& validator = wxDefaultValidator, | |
158 | const wxString& name = wxPyButtonNameStr), | |
d07d2bc9 | 159 | "Acutally create the GUI Button for 2-phase creation.", ""); |
dce2bd22 | 160 | |
d14a1e28 | 161 | |
d14a1e28 | 162 | |
dce2bd22 RD |
163 | DocDeclStr( |
164 | void , SetDefault(), | |
d07d2bc9 | 165 | "This sets the button to be the default item for the panel or dialog box.", ""); |
dce2bd22 | 166 | |
d14a1e28 | 167 | |
dce2bd22 RD |
168 | DocDeclStr( |
169 | static wxSize , GetDefaultSize(), | |
d07d2bc9 | 170 | "Returns the default button size for this platform.", ""); |
880715c9 RD |
171 | |
172 | static wxVisualAttributes | |
173 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
d14a1e28 RD |
174 | }; |
175 | ||
176 | ||
177 | ||
178 | //--------------------------------------------------------------------------- | |
179 | ||
1e0c8722 | 180 | |
856bf319 RD |
181 | DocStr(wxBitmapButton, |
182 | "A Button that contains a bitmap. A bitmap button can be supplied with a | |
dce2bd22 | 183 | single bitmap, and wxWidgets will draw all button states using this bitmap. If |
856bf319 | 184 | the application needs more control, additional bitmaps for the selected state, |
d07d2bc9 | 185 | unpressed focused state, and greyed-out state may be supplied.", " |
856bf319 | 186 | |
dce2bd22 RD |
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 | |
856bf319 | 195 | bitmaps. WIN32 only. |
dce2bd22 RD |
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` | |
856bf319 | 214 | "); |
1e0c8722 | 215 | |
ab1f7d2a RD |
216 | MustHaveApp(wxBitmapButton); |
217 | ||
d14a1e28 RD |
218 | class wxBitmapButton : public wxButton |
219 | { | |
220 | public: | |
2b9048c5 RD |
221 | %pythonAppend wxBitmapButton "self._setOORInfo(self)" |
222 | %pythonAppend wxBitmapButton() "" | |
b39c3fa0 | 223 | %typemap(out) wxBitmapButton*; // turn off this typemap |
d14a1e28 | 224 | |
dce2bd22 | 225 | DocCtorStr( |
d5573410 RD |
226 | wxBitmapButton(wxWindow* parent, wxWindowID id=-1, |
227 | const wxBitmap& bitmap = wxNullBitmap, | |
dce2bd22 RD |
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), | |
d07d2bc9 | 233 | "Create and show a button with a bitmap for the label.", ""); |
dce2bd22 RD |
234 | |
235 | DocCtorStrName( | |
236 | wxBitmapButton(), | |
d07d2bc9 | 237 | "Precreate a BitmapButton for 2-phase creation.", "", |
dce2bd22 RD |
238 | PreBitmapButton); |
239 | ||
b39c3fa0 RD |
240 | // Turn it back on again |
241 | %typemap(out) wxBitmapButton* { $result = wxPyMake_wxObject($1, $owner); } | |
242 | ||
243 | ||
dce2bd22 | 244 | DocDeclStr( |
d5573410 RD |
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, | |
dce2bd22 | 251 | const wxString& name = wxPyButtonNameStr), |
d07d2bc9 | 252 | "Acutally create the GUI BitmapButton for 2-phase creation.", ""); |
dce2bd22 | 253 | |
1e0c8722 | 254 | |
dce2bd22 RD |
255 | DocDeclStr( |
256 | wxBitmap , GetBitmapLabel(), | |
d07d2bc9 | 257 | "Returns the label bitmap (the one passed to the constructor).", ""); |
dce2bd22 RD |
258 | |
259 | DocDeclStr( | |
260 | wxBitmap , GetBitmapDisabled(), | |
d07d2bc9 | 261 | "Returns the bitmap for the disabled state.", ""); |
dce2bd22 RD |
262 | |
263 | DocDeclStr( | |
264 | wxBitmap , GetBitmapFocus(), | |
d07d2bc9 | 265 | "Returns the bitmap for the focused state.", ""); |
dce2bd22 | 266 | |
1e0c8722 | 267 | |
dce2bd22 RD |
268 | DocDeclStr( |
269 | wxBitmap , GetBitmapSelected(), | |
d07d2bc9 | 270 | "Returns the bitmap for the selected state.", ""); |
dce2bd22 | 271 | |
1e0c8722 | 272 | |
dce2bd22 RD |
273 | DocDeclStr( |
274 | void , SetBitmapDisabled(const wxBitmap& bitmap), | |
d07d2bc9 | 275 | "Sets the bitmap for the disabled button appearance.", ""); |
dce2bd22 | 276 | |
1e0c8722 | 277 | |
dce2bd22 RD |
278 | DocDeclStr( |
279 | void , SetBitmapFocus(const wxBitmap& bitmap), | |
d07d2bc9 | 280 | "Sets the bitmap for the button appearance when it has the keyboard focus.", ""); |
dce2bd22 | 281 | |
1e0c8722 | 282 | |
dce2bd22 RD |
283 | DocDeclStr( |
284 | void , SetBitmapSelected(const wxBitmap& bitmap), | |
d07d2bc9 | 285 | "Sets the bitmap for the selected (depressed) button appearance.", ""); |
dce2bd22 | 286 | |
1e0c8722 | 287 | |
dce2bd22 RD |
288 | DocDeclStr( |
289 | void , SetBitmapLabel(const wxBitmap& bitmap), | |
290 | "Sets the bitmap label for the button. This is the bitmap used for the | |
d07d2bc9 | 291 | unselected state, and for all other states if no other bitmaps are provided.", ""); |
dce2bd22 | 292 | |
d14a1e28 RD |
293 | |
294 | void SetMargins(int x, int y); | |
295 | int GetMarginX() const; | |
296 | int GetMarginY() const; | |
297 | }; | |
298 | ||
299 | ||
300 | //--------------------------------------------------------------------------- |