]>
Commit | Line | Data |
---|---|---|
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 | ||
19 | MAKE_CONST_WXSTRING(ButtonNameStr); | |
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 | ||
33 | DocStr(wxButton, | |
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` | |
59 | "); | |
60 | ||
61 | class wxButton : public wxControl | |
62 | { | |
63 | public: | |
64 | %pythonAppend wxButton "self._setOORInfo(self)" | |
65 | %pythonAppend wxButton() "" | |
66 | ||
67 | ||
68 | RefDoc(wxButton, ""); | |
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 | ||
92 | ||
93 | ||
94 | DocDeclStr( | |
95 | void , SetDefault(), | |
96 | "This sets the button to be the default item for the panel or dialog box."); | |
97 | ||
98 | ||
99 | DocDeclStr( | |
100 | static wxSize , GetDefaultSize(), | |
101 | "Returns the default button size for this platform."); | |
102 | ||
103 | static wxVisualAttributes | |
104 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
105 | }; | |
106 | ||
107 | ||
108 | ||
109 | //--------------------------------------------------------------------------- | |
110 | ||
111 | ||
112 | DocStr(wxBitmapButton, | |
113 | "A Button that contains a bitmap. A bitmap button can be supplied with a | |
114 | single bitmap, and wxWidgets will draw all button states using this bitmap. If | |
115 | the application needs more control, additional bitmaps for the selected state, | |
116 | unpressed focused state, and greyed-out state may be supplied. | |
117 | ||
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 | |
126 | bitmaps. WIN32 only. | |
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` | |
145 | "); | |
146 | ||
147 | class wxBitmapButton : public wxButton | |
148 | { | |
149 | public: | |
150 | %pythonAppend wxBitmapButton "self._setOORInfo(self)" | |
151 | %pythonAppend wxBitmapButton() "" | |
152 | ||
153 | RefDoc(wxBitmapButton, ""); // turn it off for the ctors | |
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, | |
171 | const wxPoint& pos = wxDefaultPosition, | |
172 | const wxSize& size = wxDefaultSize, | |
173 | long style = wxBU_AUTODRAW, | |
174 | const wxValidator& validator = wxDefaultValidator, | |
175 | const wxString& name = wxPyButtonNameStr), | |
176 | "Acutally create the GUI BitmapButton for 2-phase creation."); | |
177 | ||
178 | ||
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 | ||
191 | ||
192 | DocDeclStr( | |
193 | wxBitmap , GetBitmapSelected(), | |
194 | "Returns the bitmap for the selected state."); | |
195 | ||
196 | ||
197 | DocDeclStr( | |
198 | void , SetBitmapDisabled(const wxBitmap& bitmap), | |
199 | "Sets the bitmap for the disabled button appearance."); | |
200 | ||
201 | ||
202 | DocDeclStr( | |
203 | void , SetBitmapFocus(const wxBitmap& bitmap), | |
204 | "Sets the bitmap for the button appearance when it has the keyboard focus."); | |
205 | ||
206 | ||
207 | DocDeclStr( | |
208 | void , SetBitmapSelected(const wxBitmap& bitmap), | |
209 | "Sets the bitmap for the selected (depressed) button appearance."); | |
210 | ||
211 | ||
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 | ||
217 | ||
218 | void SetMargins(int x, int y); | |
219 | int GetMarginX() const; | |
220 | int GetMarginY() const; | |
221 | }; | |
222 | ||
223 | ||
224 | //--------------------------------------------------------------------------- |