]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxBitmapButton}}\label{wxbitmapbutton} |
2 | ||
3 | A bitmap button is a control that contains a bitmap. | |
4 | It may be placed on a \helpref{dialog box}{wxdialog} or \helpref{panel}{wxpanel}, or indeed | |
5 | almost any other window. | |
6 | ||
7 | \wxheading{Derived from} | |
8 | ||
9 | \helpref{wxButton}{wxbutton}\\ | |
10 | \helpref{wxControl}{wxcontrol}\\ | |
11 | \helpref{wxWindow}{wxwindow}\\ | |
12 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
13 | \helpref{wxObject}{wxobject} | |
14 | ||
954b8ae6 JS |
15 | \wxheading{Include files} |
16 | ||
17 | <wx/bmpbuttn.h> | |
18 | ||
a660d684 KB |
19 | \wxheading{Remarks} |
20 | ||
fc2171bd | 21 | A bitmap button can be supplied with a single bitmap, and wxWidgets will draw |
a660d684 | 22 | all button states using this bitmap. If the application needs more control, additional bitmaps for |
f6bcfd97 | 23 | the selected state, unpressed focused state, and greyed-out state may be supplied. |
a660d684 KB |
24 | |
25 | \wxheading{Window styles} | |
26 | ||
27 | \twocolwidtha{5cm} | |
28 | \begin{twocollist}\itemsep=0pt | |
29 | \twocolitem{\windowstyle{wxBU\_AUTODRAW}}{If | |
30 | this is specified, the button will be drawn automatically using the label bitmap only, providing | |
31 | a 3D-look border. If this style is not specified, the button will be drawn without borders and using all | |
f6bcfd97 BP |
32 | provided bitmaps. WIN32 only.} |
33 | \twocolitem{\windowstyle{wxBU\_LEFT}}{Left-justifies the bitmap label. WIN32 only.} | |
34 | \twocolitem{\windowstyle{wxBU\_TOP}}{Aligns the bitmap label to the top of the button. WIN32 only.} | |
35 | \twocolitem{\windowstyle{wxBU\_RIGHT}}{Right-justifies the bitmap label. WIN32 only.} | |
36 | \twocolitem{\windowstyle{wxBU\_BOTTOM}}{Aligns the bitmap label to the bottom of the button. WIN32 only.} | |
a660d684 KB |
37 | \end{twocollist} |
38 | ||
39 | See also \helpref{window styles overview}{windowstyles}. | |
40 | ||
5de76427 JS |
41 | \wxheading{Event handling} |
42 | ||
43 | \twocolwidtha{7cm} | |
44 | \begin{twocollist}\itemsep=0pt | |
45 | \twocolitem{{\bf EVT\_BUTTON(id, func)}}{Process a wxEVT\_COMMAND\_BUTTON\_CLICKED event, | |
46 | when the button is clicked.} | |
47 | \end{twocollist} | |
48 | ||
a660d684 KB |
49 | \wxheading{See also} |
50 | ||
51 | \helpref{wxButton}{wxbutton} | |
52 | ||
53 | \latexignore{\rtfignore{\wxheading{Members}}} | |
54 | ||
f510b7b2 | 55 | \membersection{wxBitmapButton::wxBitmapButton}\label{wxbitmapbuttonctor} |
a660d684 KB |
56 | |
57 | \func{}{wxBitmapButton}{\void} | |
58 | ||
59 | Default constructor. | |
60 | ||
2e76d519 SB |
61 | \func{}{wxBitmapButton}{ |
62 | \param{wxWindow* }{parent}, | |
63 | \param{wxWindowID }{id}, | |
64 | \param{const wxBitmap\& }{bitmap},\rtfsp | |
65 | \param{const wxPoint\& }{pos = wxDefaultPosition}, | |
66 | \param{const wxSize\& }{size = wxDefaultSize},\rtfsp | |
67 | \param{long }{style = wxBU\_AUTODRAW}, | |
68 | \param{const wxValidator\& }{validator = wxDefaultValidator}, | |
69 | \param{const wxString\& }{name = ``button"}} | |
a660d684 KB |
70 | |
71 | Constructor, creating and showing a button. | |
72 | ||
73 | \wxheading{Parameters} | |
74 | ||
75 | \docparam{parent}{Parent window. Must not be NULL.} | |
76 | ||
77 | \docparam{id}{Button identifier. A value of -1 indicates a default value.} | |
78 | ||
79 | \docparam{bitmap}{Bitmap to be displayed.} | |
80 | ||
81 | \docparam{pos}{Button position.} | |
82 | ||
83 | \docparam{size}{Button size. If the default size (-1, -1) is specified then the button is sized | |
84 | appropriately for the bitmap.} | |
85 | ||
86 | \docparam{style}{Window style. See \helpref{wxBitmapButton}{wxbitmapbutton}.} | |
87 | ||
88 | \docparam{validator}{Window validator.} | |
89 | ||
90 | \docparam{name}{Window name.} | |
91 | ||
92 | \wxheading{Remarks} | |
93 | ||
fc2171bd | 94 | The {\it bitmap} parameter is normally the only bitmap you need to provide, and wxWidgets will |
a660d684 KB |
95 | draw the button correctly in its different states. If you want more control, call |
96 | any of the functions \helpref{wxBitmapButton::SetBitmapSelected}{wxbitmapbuttonsetbitmapselected},\rtfsp | |
97 | \helpref{wxBitmapButton::SetBitmapFocus}{wxbitmapbuttonsetbitmapfocus},\rtfsp | |
98 | \helpref{wxBitmapButton::SetBitmapDisabled}{wxbitmapbuttonsetbitmapdisabled}. | |
99 | ||
100 | Note that the bitmap passed is smaller than the actual button created. | |
101 | ||
102 | \wxheading{See also} | |
103 | ||
104 | \helpref{wxBitmapButton::Create}{wxbitmapbuttoncreate}, \helpref{wxValidator}{wxvalidator} | |
105 | ||
f510b7b2 | 106 | \membersection{wxBitmapButton::\destruct{wxBitmapButton}}\label{wxbitmapbuttondtor} |
a660d684 KB |
107 | |
108 | \func{}{\destruct{wxBitmapButton}}{\void} | |
109 | ||
110 | Destructor, destroying the button. | |
111 | ||
112 | \membersection{wxBitmapButton::Create}\label{wxbitmapbuttoncreate} | |
113 | ||
eaaa6a06 | 114 | \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxBitmap\& }{bitmap},\rtfsp |
a660d684 | 115 | \param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp |
eaaa6a06 | 116 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}} |
a660d684 | 117 | |
f510b7b2 | 118 | Button creation function for two-step creation. For more details, see \helpref{wxBitmapButton::wxBitmapButton}{wxbitmapbuttonctor}. |
a660d684 KB |
119 | |
120 | \membersection{wxBitmapButton::GetBitmapDisabled}\label{wxbitmapbuttongetbitmapdisabled} | |
121 | ||
f6bcfd97 | 122 | \constfunc{wxBitmap\&}{GetBitmapDisabled}{\void} |
a660d684 KB |
123 | |
124 | Returns the bitmap for the disabled state. | |
125 | ||
126 | \wxheading{Return value} | |
127 | ||
128 | A reference to the disabled state bitmap. | |
129 | ||
130 | \wxheading{See also} | |
131 | ||
132 | \helpref{wxBitmapButton::SetBitmapDisabled}{wxbitmapbuttonsetbitmapdisabled} | |
133 | ||
134 | \membersection{wxBitmapButton::GetBitmapFocus}\label{wxbitmapbuttongetbitmapfocus} | |
135 | ||
136 | \constfunc{wxBitmap\&}{GetBitmapFocus}{\void} | |
137 | ||
f6bcfd97 | 138 | Returns the bitmap for the focused state. |
a660d684 KB |
139 | |
140 | \wxheading{Return value} | |
141 | ||
f6bcfd97 | 142 | A reference to the focused state bitmap. |
a660d684 KB |
143 | |
144 | \wxheading{See also} | |
145 | ||
146 | \helpref{wxBitmapButton::SetBitmapFocus}{wxbitmapbuttonsetbitmapfocus} | |
147 | ||
148 | \membersection{wxBitmapButton::GetBitmapLabel}\label{wxbitmapbuttongetbitmaplabel} | |
149 | ||
150 | \constfunc{wxBitmap\&}{GetBitmapLabel}{\void} | |
151 | ||
152 | Returns the label bitmap (the one passed to the constructor). | |
153 | ||
154 | \wxheading{Return value} | |
155 | ||
156 | A reference to the button's label bitmap. | |
157 | ||
158 | \wxheading{See also} | |
159 | ||
160 | \helpref{wxBitmapButton::SetBitmapLabel}{wxbitmapbuttonsetbitmaplabel} | |
161 | ||
162 | \membersection{wxBitmapButton::GetBitmapSelected}\label{wxbitmapbuttongetbitmapselected} | |
163 | ||
164 | \constfunc{wxBitmap\&}{GetBitmapSelected}{\void} | |
165 | ||
166 | Returns the bitmap for the selected state. | |
167 | ||
168 | \wxheading{Return value} | |
169 | ||
170 | A reference to the selected state bitmap. | |
171 | ||
172 | \wxheading{See also} | |
173 | ||
174 | \helpref{wxBitmapButton::SetBitmapSelected}{wxbitmapbuttonsetbitmapselected} | |
175 | ||
176 | \membersection{wxBitmapButton::SetBitmapDisabled}\label{wxbitmapbuttonsetbitmapdisabled} | |
177 | ||
178 | \func{void}{SetBitmapDisabled}{\param{const wxBitmap\& }{bitmap}} | |
179 | ||
180 | Sets the bitmap for the disabled button appearance. | |
181 | ||
182 | \wxheading{Parameters} | |
183 | ||
184 | \docparam{bitmap}{The bitmap to set.} | |
185 | ||
186 | \wxheading{See also} | |
187 | ||
188 | \helpref{wxBitmapButton::GetBitmapDisabled}{wxbitmapbuttongetbitmapdisabled},\rtfsp | |
189 | \helpref{wxBitmapButton::SetBitmapLabel}{wxbitmapbuttonsetbitmaplabel},\rtfsp | |
190 | \helpref{wxBitmapButton::SetBitmapSelected}{wxbitmapbuttonsetbitmapselected},\rtfsp | |
191 | \helpref{wxBitmapButton::SetBitmapFocus}{wxbitmapbuttonsetbitmapfocus} | |
192 | ||
193 | \membersection{wxBitmapButton::SetBitmapFocus}\label{wxbitmapbuttonsetbitmapfocus} | |
194 | ||
195 | \func{void}{SetBitmapFocus}{\param{const wxBitmap\& }{bitmap}} | |
196 | ||
197 | Sets the bitmap for the button appearance when it has the keyboard focus. | |
198 | ||
199 | \wxheading{Parameters} | |
200 | ||
201 | \docparam{bitmap}{The bitmap to set.} | |
202 | ||
203 | \wxheading{See also} | |
204 | ||
205 | \helpref{wxBitmapButton::GetBitmapFocus}{wxbitmapbuttongetbitmapfocus},\rtfsp | |
206 | \helpref{wxBitmapButton::SetBitmapLabel}{wxbitmapbuttonsetbitmaplabel},\rtfsp | |
207 | \helpref{wxBitmapButton::SetBitmapSelected}{wxbitmapbuttonsetbitmapselected},\rtfsp | |
208 | \helpref{wxBitmapButton::SetBitmapDisabled}{wxbitmapbuttonsetbitmapdisabled} | |
209 | ||
210 | \membersection{wxBitmapButton::SetBitmapLabel}\label{wxbitmapbuttonsetbitmaplabel} | |
211 | ||
212 | \func{void}{SetBitmapLabel}{\param{const wxBitmap\& }{bitmap}} | |
213 | ||
214 | Sets the bitmap label for the button. | |
215 | ||
216 | \wxheading{Parameters} | |
217 | ||
218 | \docparam{bitmap}{The bitmap label to set.} | |
219 | ||
220 | \wxheading{Remarks} | |
221 | ||
222 | This is the bitmap used for the unselected state, and for all other states | |
223 | if no other bitmaps are provided. | |
224 | ||
225 | \wxheading{See also} | |
226 | ||
227 | \helpref{wxBitmapButton::GetBitmapLabel}{wxbitmapbuttongetbitmaplabel} | |
228 | ||
229 | \membersection{wxBitmapButton::SetBitmapSelected}\label{wxbitmapbuttonsetbitmapselected} | |
230 | ||
231 | \func{void}{SetBitmapSelected}{\param{const wxBitmap\& }{bitmap}} | |
232 | ||
233 | Sets the bitmap for the selected (depressed) button appearance. | |
234 | ||
235 | \wxheading{Parameters} | |
236 | ||
237 | \docparam{bitmap}{The bitmap to set.} | |
238 | ||
239 | \wxheading{See also} | |
240 | ||
241 | \helpref{wxBitmapButton::GetBitmapSelected}{wxbitmapbuttongetbitmapselected},\rtfsp | |
242 | \helpref{wxBitmapButton::SetBitmapLabel}{wxbitmapbuttonsetbitmaplabel},\rtfsp | |
243 | \helpref{wxBitmapButton::SetBitmapFocus}{wxbitmapbuttonsetbitmapfocus},\rtfsp | |
244 | \helpref{wxBitmapButton::SetBitmapDisabled}{wxbitmapbuttonsetbitmapdisabled} | |
245 |