File: wx34.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (254 lines) | stat: -rw-r--r-- 10,447 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<HTML>
<head><title>wxBitmapButton</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="wxbitmapbutton"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx33.htm#wxbitmaphandler"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx35.htm#wxbitmapdataobject"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>wxBitmapButton</H2>
<P>
A bitmap button is a control that contains a bitmap.
It may be placed on a <A HREF="wx71.htm#wxdialog">dialog box</A> or <A HREF="wx166.htm#wxpanel">panel</A>, or indeed
almost any other window.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx31.htm#wxbutton">wxButton</A><BR>

<A HREF="wx56.htm#wxcontrol">wxControl</A><BR>

<A HREF="wx260.htm#wxwindow">wxWindow</A><BR>

<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>

<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
&lt;wx/bmpbuttn.h&gt;<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
A bitmap button can be supplied with a single bitmap, and wxWindows will draw
all button states using this bitmap. If the application needs more control, additional bitmaps for
the selected state, unpressed focussed state, and greyed-out state may be supplied.<P>
<B><FONT COLOR="#FF0000">Window styles</FONT></B><P>


<TABLE>


<TR><TD VALIGN=TOP>
<B>wxBU_AUTODRAW</B>
</TD>

<TD VALIGN=TOP>
If
this is specified, the button will be drawn automatically using the label bitmap only, providing
a 3D-look border. If this style is not specified, the button will be drawn without borders and using all
provided bitmaps.
</TD></TR>


</TABLE>
<P>
See also <A HREF="wx305.htm#windowstyles">window styles overview</A>.<P>
<B><FONT COLOR="#FF0000">Event handling</FONT></B><P>


<TABLE>


<TR><TD VALIGN=TOP>
<B>EVT_BUTTON(id, func)</B>
</TD>

<TD VALIGN=TOP>
Process a wxEVT_COMMAND_BUTTON_CLICKED event,
when the button is clicked.
</TD></TR>


</TABLE>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx31.htm#wxbutton">wxButton</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxbitmapbuttonconstr">wxBitmapButton::wxBitmapButton</A><BR>
<A HREF="#topic71">wxBitmapButton::~wxBitmapButton</A><BR>
<A HREF="#wxbitmapbuttoncreate">wxBitmapButton::Create</A><BR>
<A HREF="#wxbitmapbuttongetbitmapdisabled">wxBitmapButton::GetBitmapDisabled</A><BR>
<A HREF="#wxbitmapbuttongetbitmapfocus">wxBitmapButton::GetBitmapFocus</A><BR>
<A HREF="#wxbitmapbuttongetbitmaplabel">wxBitmapButton::GetBitmapLabel</A><BR>
<A HREF="#wxbitmapbuttongetbitmapselected">wxBitmapButton::GetBitmapSelected</A><BR>
<A HREF="#wxbitmapbuttonsetbitmapdisabled">wxBitmapButton::SetBitmapDisabled</A><BR>
<A HREF="#wxbitmapbuttonsetbitmapfocus">wxBitmapButton::SetBitmapFocus</A><BR>
<A HREF="#wxbitmapbuttonsetbitmaplabel">wxBitmapButton::SetBitmapLabel</A><BR>
<A HREF="#wxbitmapbuttonsetbitmapselected">wxBitmapButton::SetBitmapSelected</A><BR>
<P>

<HR>
<A NAME="wxbitmapbuttonconstr"></A>
<H3>wxBitmapButton::wxBitmapButton</H3>
<P>
<B></B> <B>wxBitmapButton</B>()<P>
Default constructor.<P>
<B></B> <B>wxBitmapButton</B>(<B>wxWindow* </B><I>parent</I>, <B>wxWindowID</B><I> id</I>, <B>const wxBitmap&amp; </B><I>bitmap</I>,
<B>const wxPoint&amp; </B><I>pos</I>, <B>const wxSize&amp; </B><I>size = wxDefaultSize</I>,
<B>long</B><I> style = wxBU_AUTODRAW</I>, <B>const wxValidator&amp; </B><I>validator</I>, <B>const wxString&amp; </B><I>name = "button"</I>)<P>
Constructor, creating and showing a button.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>parent</I><UL><UL>
Parent window. Must not be NULL.</UL></UL>
<P>
<I>id</I><UL><UL>
Button identifier. A value of -1 indicates a default value.</UL></UL>
<P>
<I>bitmap</I><UL><UL>
Bitmap to be displayed.</UL></UL>
<P>
<I>pos</I><UL><UL>
Button position.</UL></UL>
<P>
<I>size</I><UL><UL>
Button size. If the default size (-1, -1) is specified then the button is sized
appropriately for the bitmap.</UL></UL>
<P>
<I>style</I><UL><UL>
Window style. See <A HREF="wx34.htm#wxbitmapbutton">wxBitmapButton</A>.</UL></UL>
<P>
<I>validator</I><UL><UL>
Window validator.</UL></UL>
<P>
<I>name</I><UL><UL>
Window name.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
The <I>bitmap</I> parameter is normally the only bitmap you need to provide, and wxWindows will
draw the button correctly in its different states. If you want more control, call
any of the functions <A HREF="wx34.htm#wxbitmapbuttonsetbitmapselected">wxBitmapButton::SetBitmapSelected</A>,
<A HREF="wx34.htm#wxbitmapbuttonsetbitmapfocus">wxBitmapButton::SetBitmapFocus</A>,
<A HREF="wx34.htm#wxbitmapbuttonsetbitmapdisabled">wxBitmapButton::SetBitmapDisabled</A>.<P>
Note that the bitmap passed is smaller than the actual button created.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx34.htm#wxbitmapbuttoncreate">wxBitmapButton::Create</A>, <A HREF="wx255.htm#wxvalidator">wxValidator</A><P>

<HR>
<A NAME="topic71"></A>
<H3>wxBitmapButton::~wxBitmapButton</H3>
<P>
<B></B> <B>~wxBitmapButton</B>()<P>
Destructor, destroying the button.<P>

<HR>
<A NAME="wxbitmapbuttoncreate"></A>
<H3>wxBitmapButton::Create</H3>
<P>
<B>bool</B> <B>Create</B>(<B>wxWindow* </B><I>parent</I>, <B>wxWindowID</B><I> id</I>, <B>const wxBitmap&amp; </B><I>bitmap</I>,
<B>const wxPoint&amp; </B><I>pos</I>, <B>const wxSize&amp; </B><I>size = wxDefaultSize</I>,
<B>long</B><I> style = 0</I>, <B>const wxValidator&amp; </B><I>validator</I>, <B>const wxString&amp; </B><I>name = "button"</I>)<P>
Button creation function for two-step creation. For more details, see <A HREF="wx34.htm#wxbitmapbuttonconstr">wxBitmapButton::wxBitmapButton</A>.<P>

<HR>
<A NAME="wxbitmapbuttongetbitmapdisabled"></A>
<H3>wxBitmapButton::GetBitmapDisabled</H3>
<P>
<B>wxBitmap&amp;</B> <B>GetBitmapLabel</B>() <B>const</B><P>
Returns the bitmap for the disabled state.<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
A reference to the disabled state bitmap.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx34.htm#wxbitmapbuttonsetbitmapdisabled">wxBitmapButton::SetBitmapDisabled</A><P>

<HR>
<A NAME="wxbitmapbuttongetbitmapfocus"></A>
<H3>wxBitmapButton::GetBitmapFocus</H3>
<P>
<B>wxBitmap&amp;</B> <B>GetBitmapFocus</B>() <B>const</B><P>
Returns the bitmap for the focussed state.<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
A reference to the focussed state bitmap.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx34.htm#wxbitmapbuttonsetbitmapfocus">wxBitmapButton::SetBitmapFocus</A><P>

<HR>
<A NAME="wxbitmapbuttongetbitmaplabel"></A>
<H3>wxBitmapButton::GetBitmapLabel</H3>
<P>
<B>wxBitmap&amp;</B> <B>GetBitmapLabel</B>() <B>const</B><P>
Returns the label bitmap (the one passed to the constructor).<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
A reference to the button's label bitmap.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx34.htm#wxbitmapbuttonsetbitmaplabel">wxBitmapButton::SetBitmapLabel</A><P>

<HR>
<A NAME="wxbitmapbuttongetbitmapselected"></A>
<H3>wxBitmapButton::GetBitmapSelected</H3>
<P>
<B>wxBitmap&amp;</B> <B>GetBitmapSelected</B>() <B>const</B><P>
Returns the bitmap for the selected state.<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
A reference to the selected state bitmap.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx34.htm#wxbitmapbuttonsetbitmapselected">wxBitmapButton::SetBitmapSelected</A><P>

<HR>
<A NAME="wxbitmapbuttonsetbitmapdisabled"></A>
<H3>wxBitmapButton::SetBitmapDisabled</H3>
<P>
<B>void</B> <B>SetBitmapDisabled</B>(<B>const wxBitmap&amp; </B><I>bitmap</I>)<P>
Sets the bitmap for the disabled button appearance.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>bitmap</I><UL><UL>
The bitmap to set.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx34.htm#wxbitmapbuttongetbitmapdisabled">wxBitmapButton::GetBitmapDisabled</A>,
<A HREF="wx34.htm#wxbitmapbuttonsetbitmaplabel">wxBitmapButton::SetBitmapLabel</A>,
<A HREF="wx34.htm#wxbitmapbuttonsetbitmapselected">wxBitmapButton::SetBitmapSelected</A>,
<A HREF="wx34.htm#wxbitmapbuttonsetbitmapfocus">wxBitmapButton::SetBitmapFocus</A><P>

<HR>
<A NAME="wxbitmapbuttonsetbitmapfocus"></A>
<H3>wxBitmapButton::SetBitmapFocus</H3>
<P>
<B>void</B> <B>SetBitmapFocus</B>(<B>const wxBitmap&amp; </B><I>bitmap</I>)<P>
Sets the bitmap for the button appearance when it has the keyboard focus.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>bitmap</I><UL><UL>
The bitmap to set.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx34.htm#wxbitmapbuttongetbitmapfocus">wxBitmapButton::GetBitmapFocus</A>,
<A HREF="wx34.htm#wxbitmapbuttonsetbitmaplabel">wxBitmapButton::SetBitmapLabel</A>,
<A HREF="wx34.htm#wxbitmapbuttonsetbitmapselected">wxBitmapButton::SetBitmapSelected</A>,
<A HREF="wx34.htm#wxbitmapbuttonsetbitmapdisabled">wxBitmapButton::SetBitmapDisabled</A><P>

<HR>
<A NAME="wxbitmapbuttonsetbitmaplabel"></A>
<H3>wxBitmapButton::SetBitmapLabel</H3>
<P>
<B>void</B> <B>SetBitmapLabel</B>(<B>const wxBitmap&amp; </B><I>bitmap</I>)<P>
Sets the bitmap label for the button.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>bitmap</I><UL><UL>
The bitmap label to set.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
This is the bitmap used for the unselected state, and for all other states
if no other bitmaps are provided.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx34.htm#wxbitmapbuttongetbitmaplabel">wxBitmapButton::GetBitmapLabel</A><P>

<HR>
<A NAME="wxbitmapbuttonsetbitmapselected"></A>
<H3>wxBitmapButton::SetBitmapSelected</H3>
<P>
<B>void</B> <B>SetBitmapSelected</B>(<B>const wxBitmap&amp; </B><I>bitmap</I>)<P>
Sets the bitmap for the selected (depressed) button appearance.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>bitmap</I><UL><UL>
The bitmap to set.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx34.htm#wxbitmapbuttongetbitmapselected">wxBitmapButton::GetBitmapSelected</A>,
<A HREF="wx34.htm#wxbitmapbuttonsetbitmaplabel">wxBitmapButton::SetBitmapLabel</A>,
<A HREF="wx34.htm#wxbitmapbuttonsetbitmapfocus">wxBitmapButton::SetBitmapFocus</A>,
<A HREF="wx34.htm#wxbitmapbuttonsetbitmapdisabled">wxBitmapButton::SetBitmapDisabled</A><P>

</BODY></HTML>