]>
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 | ============== ========================================== | |
41 | wx.BU_LEFT Left-justifies the label. WIN32 only. | |
42 | wx.BU_TOP Aligns the label to the top of the button. | |
43 | WIN32 only. | |
44 | wx.BU_RIGHT Right-justifies the bitmap label. WIN32 only. | |
45 | wx.BU_BOTTOM Aligns the label to the bottom of the button. | |
46 | WIN32 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` | |
1e0c8722 RD |
59 | "); |
60 | ||
ab1f7d2a RD |
61 | MustHaveApp(wxButton); |
62 | ||
d14a1e28 RD |
63 | class wxButton : public wxControl |
64 | { | |
65 | public: | |
2b9048c5 RD |
66 | %pythonAppend wxButton "self._setOORInfo(self)" |
67 | %pythonAppend wxButton() "" | |
d14a1e28 RD |
68 | |
69 | ||
dce2bd22 | 70 | DocCtorStr( |
d5573410 RD |
71 | wxButton(wxWindow* parent, wxWindowID id=-1, |
72 | const wxString& label=wxPyEmptyString, | |
dce2bd22 RD |
73 | const wxPoint& pos = wxDefaultPosition, |
74 | const wxSize& size = wxDefaultSize, | |
75 | long style = 0, | |
76 | const wxValidator& validator = wxDefaultValidator, | |
77 | const wxString& name = wxPyButtonNameStr), | |
d07d2bc9 | 78 | "Create and show a button.", ""); |
dce2bd22 RD |
79 | |
80 | DocCtorStrName( | |
81 | wxButton(), | |
d07d2bc9 | 82 | "Precreate a Button for 2-phase creation.", "", |
dce2bd22 RD |
83 | PreButton); |
84 | ||
85 | DocDeclStr( | |
d5573410 RD |
86 | bool , Create(wxWindow* parent, wxWindowID id=-1, |
87 | const wxString& label=wxPyEmptyString, | |
dce2bd22 RD |
88 | const wxPoint& pos = wxDefaultPosition, |
89 | const wxSize& size = wxDefaultSize, | |
90 | long style = 0, | |
91 | const wxValidator& validator = wxDefaultValidator, | |
92 | const wxString& name = wxPyButtonNameStr), | |
d07d2bc9 | 93 | "Acutally create the GUI Button for 2-phase creation.", ""); |
dce2bd22 | 94 | |
d14a1e28 | 95 | |
d14a1e28 | 96 | |
dce2bd22 RD |
97 | DocDeclStr( |
98 | void , SetDefault(), | |
d07d2bc9 | 99 | "This sets the button to be the default item for the panel or dialog box.", ""); |
dce2bd22 | 100 | |
d14a1e28 | 101 | |
dce2bd22 RD |
102 | DocDeclStr( |
103 | static wxSize , GetDefaultSize(), | |
d07d2bc9 | 104 | "Returns the default button size for this platform.", ""); |
880715c9 RD |
105 | |
106 | static wxVisualAttributes | |
107 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
d14a1e28 RD |
108 | }; |
109 | ||
110 | ||
111 | ||
112 | //--------------------------------------------------------------------------- | |
113 | ||
1e0c8722 | 114 | |
856bf319 RD |
115 | DocStr(wxBitmapButton, |
116 | "A Button that contains a bitmap. A bitmap button can be supplied with a | |
dce2bd22 | 117 | single bitmap, and wxWidgets will draw all button states using this bitmap. If |
856bf319 | 118 | the application needs more control, additional bitmaps for the selected state, |
d07d2bc9 | 119 | unpressed focused state, and greyed-out state may be supplied.", " |
856bf319 | 120 | |
dce2bd22 RD |
121 | Window Styles |
122 | ------------- | |
123 | ============== ============================================= | |
124 | wx.BU_AUTODRAW If this is specified, the button will be drawn | |
125 | automatically using the label bitmap only, | |
126 | providing a 3D-look border. If this style is | |
127 | not specified, the button will be drawn | |
128 | without borders and using all provided | |
856bf319 | 129 | bitmaps. WIN32 only. |
dce2bd22 RD |
130 | wx.BU_LEFT Left-justifies the label. WIN32 only. |
131 | wx.BU_TOP Aligns the label to the top of the button. WIN32 | |
132 | only. | |
133 | wx.BU_RIGHT Right-justifies the bitmap label. WIN32 only. | |
134 | wx.BU_BOTTOM Aligns the label to the bottom of the | |
135 | button. WIN32 only. | |
136 | wx.BU_EXACTFIT Creates the button as small as possible | |
137 | instead of making it of the standard size | |
138 | (which is the default behaviour.) | |
139 | ============== ============================================= | |
140 | ||
141 | Events | |
142 | ------ | |
143 | =========== ================================== | |
144 | EVT_BUTTON Sent when the button is clicked. | |
145 | =========== ================================== | |
146 | ||
147 | :see: `wx.Button`, `wx.Bitmap` | |
856bf319 | 148 | "); |
1e0c8722 | 149 | |
ab1f7d2a RD |
150 | MustHaveApp(wxBitmapButton); |
151 | ||
d14a1e28 RD |
152 | class wxBitmapButton : public wxButton |
153 | { | |
154 | public: | |
2b9048c5 RD |
155 | %pythonAppend wxBitmapButton "self._setOORInfo(self)" |
156 | %pythonAppend wxBitmapButton() "" | |
d14a1e28 | 157 | |
dce2bd22 | 158 | DocCtorStr( |
d5573410 RD |
159 | wxBitmapButton(wxWindow* parent, wxWindowID id=-1, |
160 | const wxBitmap& bitmap = wxNullBitmap, | |
dce2bd22 RD |
161 | const wxPoint& pos = wxDefaultPosition, |
162 | const wxSize& size = wxDefaultSize, | |
163 | long style = wxBU_AUTODRAW, | |
164 | const wxValidator& validator = wxDefaultValidator, | |
165 | const wxString& name = wxPyButtonNameStr), | |
d07d2bc9 | 166 | "Create and show a button with a bitmap for the label.", ""); |
dce2bd22 RD |
167 | |
168 | DocCtorStrName( | |
169 | wxBitmapButton(), | |
d07d2bc9 | 170 | "Precreate a BitmapButton for 2-phase creation.", "", |
dce2bd22 RD |
171 | PreBitmapButton); |
172 | ||
173 | DocDeclStr( | |
d5573410 RD |
174 | bool , Create(wxWindow* parent, wxWindowID id=-1, |
175 | const wxBitmap& bitmap = wxNullBitmap, | |
176 | const wxPoint& pos = wxDefaultPosition, | |
177 | const wxSize& size = wxDefaultSize, | |
178 | long style = wxBU_AUTODRAW, | |
179 | const wxValidator& validator = wxDefaultValidator, | |
dce2bd22 | 180 | const wxString& name = wxPyButtonNameStr), |
d07d2bc9 | 181 | "Acutally create the GUI BitmapButton for 2-phase creation.", ""); |
dce2bd22 | 182 | |
1e0c8722 | 183 | |
dce2bd22 RD |
184 | DocDeclStr( |
185 | wxBitmap , GetBitmapLabel(), | |
d07d2bc9 | 186 | "Returns the label bitmap (the one passed to the constructor).", ""); |
dce2bd22 RD |
187 | |
188 | DocDeclStr( | |
189 | wxBitmap , GetBitmapDisabled(), | |
d07d2bc9 | 190 | "Returns the bitmap for the disabled state.", ""); |
dce2bd22 RD |
191 | |
192 | DocDeclStr( | |
193 | wxBitmap , GetBitmapFocus(), | |
d07d2bc9 | 194 | "Returns the bitmap for the focused state.", ""); |
dce2bd22 | 195 | |
1e0c8722 | 196 | |
dce2bd22 RD |
197 | DocDeclStr( |
198 | wxBitmap , GetBitmapSelected(), | |
d07d2bc9 | 199 | "Returns the bitmap for the selected state.", ""); |
dce2bd22 | 200 | |
1e0c8722 | 201 | |
dce2bd22 RD |
202 | DocDeclStr( |
203 | void , SetBitmapDisabled(const wxBitmap& bitmap), | |
d07d2bc9 | 204 | "Sets the bitmap for the disabled button appearance.", ""); |
dce2bd22 | 205 | |
1e0c8722 | 206 | |
dce2bd22 RD |
207 | DocDeclStr( |
208 | void , SetBitmapFocus(const wxBitmap& bitmap), | |
d07d2bc9 | 209 | "Sets the bitmap for the button appearance when it has the keyboard focus.", ""); |
dce2bd22 | 210 | |
1e0c8722 | 211 | |
dce2bd22 RD |
212 | DocDeclStr( |
213 | void , SetBitmapSelected(const wxBitmap& bitmap), | |
d07d2bc9 | 214 | "Sets the bitmap for the selected (depressed) button appearance.", ""); |
dce2bd22 | 215 | |
1e0c8722 | 216 | |
dce2bd22 RD |
217 | DocDeclStr( |
218 | void , SetBitmapLabel(const wxBitmap& bitmap), | |
219 | "Sets the bitmap label for the button. This is the bitmap used for the | |
d07d2bc9 | 220 | unselected state, and for all other states if no other bitmaps are provided.", ""); |
dce2bd22 | 221 | |
d14a1e28 RD |
222 | |
223 | void SetMargins(int x, int y); | |
224 | int GetMarginX() const; | |
225 | int GetMarginY() const; | |
226 | }; | |
227 | ||
228 | ||
229 | //--------------------------------------------------------------------------- |