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