]>
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 RD |
33 | DocStr(wxButton, |
34 | "A button is a control that contains a text string, and is one of the most\n" | |
35 | "common elements of a GUI. It may be placed on a dialog box or panel, or\n" | |
36 | "indeed almost any other window."); | |
37 | ||
38 | RefDoc(wxButton, " | |
39 | Styles | |
b2dc1044 RD |
40 | wx.BU_LEFT: Left-justifies the label. WIN32 only. |
41 | wx.BU_TOP: Aligns the label to the top of the button. WIN32 only. | |
42 | wx.BU_RIGHT: Right-justifies the bitmap label. WIN32 only. | |
43 | wx.BU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only. | |
44 | wx.BU_EXACTFIT: Creates the button as small as possible instead of making | |
45 | it of the standard size (which is the default behaviour.) | |
1e0c8722 RD |
46 | |
47 | Events | |
b2dc1044 | 48 | EVT_BUTTON: Sent when the button is clicked. |
1e0c8722 RD |
49 | "); |
50 | ||
d14a1e28 RD |
51 | class wxButton : public wxControl |
52 | { | |
53 | public: | |
2b9048c5 RD |
54 | %pythonAppend wxButton "self._setOORInfo(self)" |
55 | %pythonAppend wxButton() "" | |
d14a1e28 RD |
56 | |
57 | ||
b2dc1044 RD |
58 | DocStr(wxButton, "Create and show a button."); |
59 | RefDoc(wxButton, ""); | |
d14a1e28 RD |
60 | wxButton(wxWindow* parent, wxWindowID id, const wxString& label, |
61 | const wxPoint& pos = wxDefaultPosition, | |
62 | const wxSize& size = wxDefaultSize, | |
63 | long style = 0, | |
64 | const wxValidator& validator = wxDefaultValidator, | |
65 | const wxString& name = wxPyButtonNameStr); | |
66 | ||
1e0c8722 | 67 | DocStr(wxButton(), "Precreate a Button for 2-phase creation."); |
d14a1e28 RD |
68 | %name(PreButton)wxButton(); |
69 | ||
1e0c8722 | 70 | DocStr(Create, "Acutally create the GUI Button for 2-phase creation."); |
d14a1e28 RD |
71 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, |
72 | const wxPoint& pos = wxDefaultPosition, | |
73 | const wxSize& size = wxDefaultSize, | |
74 | long style = 0, | |
75 | const wxValidator& validator = wxDefaultValidator, | |
76 | const wxString& name = wxPyButtonNameStr); | |
77 | ||
78 | ||
1e0c8722 | 79 | DocStr(SetDefault, "This sets the button to be the default item for the panel or dialog box."); |
d14a1e28 RD |
80 | void SetDefault(); |
81 | ||
82 | ||
856bf319 RD |
83 | // #ifdef __WXMSW__ |
84 | // // show the image in the button in addition to the label | |
85 | // void SetImageLabel(const wxBitmap& bitmap); | |
d14a1e28 | 86 | |
856bf319 RD |
87 | // // set the margins around the image |
88 | // void SetImageMargins(wxCoord x, wxCoord y); | |
89 | // #endif | |
d14a1e28 | 90 | |
1e0c8722 | 91 | DocStr(GetDefaultButtonSize, "Returns the default button size for this platform."); |
d14a1e28 RD |
92 | static wxSize GetDefaultSize(); |
93 | }; | |
94 | ||
95 | ||
96 | ||
97 | //--------------------------------------------------------------------------- | |
98 | ||
1e0c8722 | 99 | |
856bf319 RD |
100 | DocStr(wxBitmapButton, |
101 | "A Button that contains a bitmap. A bitmap button can be supplied with a | |
102 | single bitmap, and wxWindows will draw all button states using this bitmap. If | |
103 | the application needs more control, additional bitmaps for the selected state, | |
104 | unpressed focused state, and greyed-out state may be supplied. | |
105 | "); | |
106 | ||
e029dde7 | 107 | RefDoc(wxBitmapButton, " |
856bf319 RD |
108 | Styles |
109 | wx.BU_AUTODRAW: If this is specified, the button will be drawn | |
110 | automatically using the label bitmap only, providing a | |
111 | 3D-look border. If this style is not specified, the button | |
112 | will be drawn without borders and using all provided | |
113 | bitmaps. WIN32 only. | |
114 | wx.BU_LEFT: Left-justifies the label. WIN32 only. | |
115 | wx.BU_TOP: Aligns the label to the top of the button. WIN32 only. | |
116 | wx.BU_RIGHT: Right-justifies the bitmap label. WIN32 only. | |
117 | wx.BU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only. | |
118 | wx.BU_EXACTFIT: Creates the button as small as possible instead of making | |
119 | it of the standard size (which is the default behaviour.) | |
120 | ||
121 | Events | |
122 | EVT_BUTTON: Sent when the button is clicked. | |
123 | "); | |
1e0c8722 | 124 | |
d14a1e28 RD |
125 | class wxBitmapButton : public wxButton |
126 | { | |
127 | public: | |
2b9048c5 RD |
128 | %pythonAppend wxBitmapButton "self._setOORInfo(self)" |
129 | %pythonAppend wxBitmapButton() "" | |
d14a1e28 | 130 | |
856bf319 | 131 | DocStr(wxBitmapButton, "Create and show a button with a bitmap for the label.") |
e029dde7 RD |
132 | RefDoc(wxBitmapButton, ""); // turn it off for the ctors |
133 | ||
d14a1e28 RD |
134 | wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, |
135 | const wxPoint& pos = wxDefaultPosition, | |
136 | const wxSize& size = wxDefaultSize, | |
137 | long style = wxBU_AUTODRAW, | |
138 | const wxValidator& validator = wxDefaultValidator, | |
139 | const wxString& name = wxPyButtonNameStr); | |
1e0c8722 RD |
140 | |
141 | DocStr(wxBitmapButton(), "Precreate a BitmapButton for 2-phase creation."); | |
d14a1e28 RD |
142 | %name(PreBitmapButton)wxBitmapButton(); |
143 | ||
1e0c8722 | 144 | DocStr(Create, "Acutally create the GUI BitmapButton for 2-phase creation."); |
d14a1e28 | 145 | bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, |
1e0c8722 RD |
146 | const wxPoint& pos = wxDefaultPosition, |
147 | const wxSize& size = wxDefaultSize, | |
148 | long style = wxBU_AUTODRAW, | |
149 | const wxValidator& validator = wxDefaultValidator, | |
d14a1e28 RD |
150 | const wxString& name = wxPyButtonNameStr); |
151 | ||
1e0c8722 | 152 | DocStr(GetBitmapLabel, "Returns the label bitmap (the one passed to the constructor)."); |
d14a1e28 | 153 | wxBitmap GetBitmapLabel(); |
1e0c8722 RD |
154 | |
155 | DocStr(GetBitmapDisabled, "Returns the bitmap for the disabled state."); | |
d14a1e28 | 156 | wxBitmap GetBitmapDisabled(); |
1e0c8722 RD |
157 | |
158 | DocStr(GetBitmapFocus, "Returns the bitmap for the focused state."); | |
d14a1e28 | 159 | wxBitmap GetBitmapFocus(); |
1e0c8722 RD |
160 | |
161 | DocStr(GetBitmapSelected, "Returns the bitmap for the selected state."); | |
d14a1e28 | 162 | wxBitmap GetBitmapSelected(); |
1e0c8722 RD |
163 | |
164 | DocStr(SetBitmapDisabled, "Sets the bitmap for the disabled button appearance."); | |
d14a1e28 | 165 | void SetBitmapDisabled(const wxBitmap& bitmap); |
1e0c8722 RD |
166 | |
167 | DocStr(SetBitmapFocus, "Sets the bitmap for the button appearance when it has the keyboard focus."); | |
d14a1e28 | 168 | void SetBitmapFocus(const wxBitmap& bitmap); |
1e0c8722 RD |
169 | |
170 | DocStr(SetBitmapSelected, "Sets the bitmap for the selected (depressed) button appearance."); | |
d14a1e28 | 171 | void SetBitmapSelected(const wxBitmap& bitmap); |
1e0c8722 RD |
172 | |
173 | DocStr(SetBitmapLabel, | |
174 | "Sets the bitmap label for the button. This is the bitmap used for the\n" | |
175 | "unselected state, and for all other states if no other bitmaps are provided."); | |
d14a1e28 RD |
176 | void SetBitmapLabel(const wxBitmap& bitmap); |
177 | ||
178 | void SetMargins(int x, int y); | |
179 | int GetMarginX() const; | |
180 | int GetMarginY() const; | |
181 | }; | |
182 | ||
183 | ||
184 | //--------------------------------------------------------------------------- |