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