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