1 \section{\class{wxBitmapButton
}}\label{wxbitmapbutton
}
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.
8 \wxheading{Derived from
}
10 \helpref{wxButton
}{wxbutton
}\\
11 \helpref{wxControl
}{wxcontrol
}\\
12 \helpref{wxWindow
}{wxwindow
}\\
13 \helpref{wxEvtHandler
}{wxevthandler
}\\
14 \helpref{wxObject
}{wxobject
}
17 \wxheading{Include files
}
24 A bitmap button can be supplied with a single bitmap, and wxWidgets will draw
25 all button states using this bitmap. If the application needs more control, additional bitmaps for
26 the selected state, unpressed focused state, and greyed-out state may be supplied.
29 \wxheading{Button states
}
31 This class supports bitmaps for several different states:
34 \begin{twocollist
}\itemsep=
0pt
35 \twocolitem{\windowstyle{normal
}}{This is the bitmap shown in the default state,
36 it must be always valid while all the other bitmaps are optional and don't have
38 \twocolitem{\windowstyle{disabled
}}{Bitmap shown when the button is disabled.
}
39 \twocolitem{\windowstyle{selected
}}{Bitmap shown when the button is pushed
40 (e.g. while the user keeps the mouse button pressed on it)
}
41 \twocolitem{\windowstyle{focus
}}{Bitmap shown when the button has keyboard
42 focus but is not pressed.
}
43 \twocolitem{\windowstyle{hover
}}{Bitmap shown when the mouse is over the
44 button (but it is not pressed). Notice that if hover bitmap is not specified
45 but the current platform UI uses hover images for the buttons (such as Windows
46 XP or GTK+), then the focus bitmap is used for hover state as well. This makes
47 it possible to set focus bitmap only to get reasonably good behaviour on all
52 \wxheading{Window styles
}
55 \begin{twocollist
}\itemsep=
0pt
56 \twocolitem{\windowstyle{wxBU
\_AUTODRAW}}{If
57 this is specified, the button will be drawn automatically using the label bitmap only, providing
58 a
3D-look border. If this style is not specified, the button will be drawn without borders and using all
59 provided bitmaps. WIN32 only.
}
60 \twocolitem{\windowstyle{wxBU
\_LEFT}}{Left-justifies the bitmap label. WIN32 only.
}
61 \twocolitem{\windowstyle{wxBU
\_TOP}}{Aligns the bitmap label to the top of the button. WIN32 only.
}
62 \twocolitem{\windowstyle{wxBU
\_RIGHT}}{Right-justifies the bitmap label. WIN32 only.
}
63 \twocolitem{\windowstyle{wxBU
\_BOTTOM}}{Aligns the bitmap label to the bottom of the button. WIN32 only.
}
66 Note that
\windowstyle{wxBU
\_EXACTFIT} supported by
67 \helpref{wxButton
}{wxbutton
} is
\emph{not
} used by this class as bitmap buttons
68 don't have any minimal standard size by default.
70 See also
\helpref{window styles overview
}{windowstyles
}.
73 \wxheading{Event handling
}
76 \begin{twocollist
}\itemsep=
0pt
77 \twocolitem{{\bf EVT
\_BUTTON(id, func)
}}{Process a wxEVT
\_COMMAND\_BUTTON\_CLICKED event,
78 when the button is clicked.
}
84 \helpref{wxButton
}{wxbutton
}
88 \latexignore{\rtfignore{\wxheading{Members
}}}
91 \membersection{wxBitmapButton::wxBitmapButton
}\label{wxbitmapbuttonctor
}
93 \func{}{wxBitmapButton
}{\void}
97 \func{}{wxBitmapButton
}{
98 \param{wxWindow*
}{parent
},
99 \param{wxWindowID
}{id
},
100 \param{const wxBitmap\&
}{bitmap
},
\rtfsp
101 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
102 \param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
103 \param{long
}{style = wxBU
\_AUTODRAW},
104 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
105 \param{const wxString\&
}{name = ``button"
}}
107 Constructor, creating and showing a button.
109 \wxheading{Parameters
}
111 \docparam{parent
}{Parent window. Must not be NULL.
}
113 \docparam{id
}{Button identifier. A value of -
1 indicates a default value.
}
115 \docparam{bitmap
}{Bitmap to be displayed.
}
117 \docparam{pos
}{Button position.
}
119 \docparam{size
}{Button size. If the default size (-
1, -
1) is specified then the button is sized
120 appropriately for the bitmap.
}
122 \docparam{style
}{Window style. See
\helpref{wxBitmapButton
}{wxbitmapbutton
}.
}
124 \docparam{validator
}{Window validator.
}
126 \docparam{name
}{Window name.
}
130 The
{\it bitmap
} parameter is normally the only bitmap you need to provide, and wxWidgets will
131 draw the button correctly in its different states. If you want more control, call
132 any of the functions
\helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
},
\rtfsp
133 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
},
\rtfsp
134 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}.
136 Note that the bitmap passed is smaller than the actual button created.
140 \helpref{wxBitmapButton::Create
}{wxbitmapbuttoncreate
},
\helpref{wxValidator
}{wxvalidator
}
143 \membersection{wxBitmapButton::
\destruct{wxBitmapButton
}}\label{wxbitmapbuttondtor
}
145 \func{}{\destruct{wxBitmapButton
}}{\void}
147 Destructor, destroying the button.
150 \membersection{wxBitmapButton::Create
}\label{wxbitmapbuttoncreate
}
152 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{ id
},
\param{const wxBitmap\&
}{bitmap
},
\rtfsp
153 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
154 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator
},
\param{const wxString\&
}{name = ``button"
}}
156 Button creation function for two-step creation. For more details, see
\helpref{wxBitmapButton::wxBitmapButton
}{wxbitmapbuttonctor
}.
159 \membersection{wxBitmapButton::GetBitmapDisabled
}\label{wxbitmapbuttongetbitmapdisabled
}
161 \constfunc{const wxBitmap\&
}{GetBitmapDisabled
}{\void}
162 \func{wxBitmap\&
}{GetBitmapDisabled
}{\void}
164 Returns the bitmap for the disabled state, may be invalid.
166 \wxheading{Return value
}
168 A reference to the disabled state bitmap.
172 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}
175 \membersection{wxBitmapButton::GetBitmapFocus
}\label{wxbitmapbuttongetbitmapfocus
}
177 \constfunc{const wxBitmap\&
}{GetBitmapFocus
}{\void}
178 \func{wxBitmap\&
}{GetBitmapFocus
}{\void}
180 Returns the bitmap for the focused state, may be invalid.
182 \wxheading{Return value
}
184 A reference to the focused state bitmap.
188 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
}
191 \membersection{wxBitmapButton::GetBitmapHover
}\label{wxbitmapbuttongetbitmaphover
}
193 \constfunc{const wxBitmap\&
}{GetBitmapHover
}{\void}
194 \func{wxBitmap\&
}{GetBitmapHover
}{\void}
196 Returns the bitmap used when the mouse is over the button, may be invalid.
200 \helpref{wxBitmapButton::SetBitmapHover
}{wxbitmapbuttonsetbitmaphover
}
203 \membersection{wxBitmapButton::GetBitmapLabel
}\label{wxbitmapbuttongetbitmaplabel
}
205 \constfunc{const wxBitmap\&
}{GetBitmapLabel
}{\void}
206 \func{wxBitmap\&
}{GetBitmapLabel
}{\void}
208 Returns the label bitmap (the one passed to the constructor), always valid.
210 \wxheading{Return value
}
212 A reference to the button's label bitmap.
216 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
}
219 \membersection{wxBitmapButton::GetBitmapSelected
}\label{wxbitmapbuttongetbitmapselected
}
221 \constfunc{wxBitmap\&
}{GetBitmapSelected
}{\void}
222 \func{wxBitmap\&
}{GetBitmapSelected
}{\void}
224 Returns the bitmap for the pushed button state, may be invalid.
226 \wxheading{Return value
}
228 A reference to the selected state bitmap.
232 \helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
}
235 \membersection{wxBitmapButton::SetBitmapDisabled
}\label{wxbitmapbuttonsetbitmapdisabled
}
237 \func{void
}{SetBitmapDisabled
}{\param{const wxBitmap\&
}{bitmap
}}
239 Sets the bitmap for the disabled button appearance.
241 \wxheading{Parameters
}
243 \docparam{bitmap
}{The bitmap to set.
}
247 \helpref{wxBitmapButton::GetBitmapDisabled
}{wxbitmapbuttongetbitmapdisabled
},
\rtfsp
248 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
},
\rtfsp
249 \helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
},
\rtfsp
250 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
}
253 \membersection{wxBitmapButton::SetBitmapFocus
}\label{wxbitmapbuttonsetbitmapfocus
}
255 \func{void
}{SetBitmapFocus
}{\param{const wxBitmap\&
}{bitmap
}}
257 Sets the bitmap for the button appearance when it has the keyboard focus.
259 \wxheading{Parameters
}
261 \docparam{bitmap
}{The bitmap to set.
}
265 \helpref{wxBitmapButton::GetBitmapFocus
}{wxbitmapbuttongetbitmapfocus
},
\rtfsp
266 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
},
\rtfsp
267 \helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
},
\rtfsp
268 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}
271 \membersection{wxBitmapButton::SetBitmapHover
}\label{wxbitmapbuttonsetbitmaphover
}
273 \func{void
}{SetBitmapHover
}{\param{const wxBitmap\&
}{bitmap
}}
275 Sets the bitmap to be shown when the mouse is over the button.
277 \newsince{2.7.0} and the hover bitmap is currently only supported in wxMSW.
281 \helpref{wxBitmapButton::GetBitmapHover
}{wxbitmapbuttongetbitmaphover
}
283 \membersection{wxBitmapButton::SetBitmapLabel
}\label{wxbitmapbuttonsetbitmaplabel
}
285 \func{void
}{SetBitmapLabel
}{\param{const wxBitmap\&
}{bitmap
}}
287 Sets the bitmap label for the button.
289 \wxheading{Parameters
}
291 \docparam{bitmap
}{The bitmap label to set.
}
295 This is the bitmap used for the unselected state, and for all other states
296 if no other bitmaps are provided.
300 \helpref{wxBitmapButton::GetBitmapLabel
}{wxbitmapbuttongetbitmaplabel
}
303 \membersection{wxBitmapButton::SetBitmapSelected
}\label{wxbitmapbuttonsetbitmapselected
}
305 \func{void
}{SetBitmapSelected
}{\param{const wxBitmap\&
}{bitmap
}}
307 Sets the bitmap for the selected (depressed) button appearance.
309 \wxheading{Parameters
}
311 \docparam{bitmap
}{The bitmap to set.
}
315 \helpref{wxBitmapButton::GetBitmapSelected
}{wxbitmapbuttongetbitmapselected
},
\rtfsp
316 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
},
\rtfsp
317 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
},
\rtfsp
318 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}