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