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 \twocolitem{\windowstyle{normal
}}{This is the bitmap shown in the default state,
35 it must be always valid while all the other bitmaps are optional and don't have
37 \twocolitem{\windowstyle{disabled
}}{Bitmap shown when the button is disabled.
}
38 \twocolitem{\windowstyle{selected
}}{Bitmap shown when the button is pushed
39 (e.g. while the user keeps the mouse button pressed on it)
}
40 \twocolitem{\windowstyle{focus
}}{Bitmap shown when the button has keyboard
41 focus but is not pressed.
}
42 \twocolitem{\windowstyle{hover
}}{Bitmap shown when the mouse is over the
43 button (but it is not pressed). Notice that if hover bitmap is not specified
44 but the current platform UI uses hover images for the buttons (such as Windows
45 XP or GTK+), then the focus bitmap is used for hover state as well. This makes
46 it possible to set focus bitmap only to get reasonably good behaviour on all
51 \wxheading{Window styles
}
54 \begin{twocollist
}\itemsep=
0pt
55 \twocolitem{\windowstyle{wxBU
\_AUTODRAW}}{If
56 this is specified, the button will be drawn automatically using the label bitmap only, providing
57 a
3D-look border. If this style is not specified, the button will be drawn without borders and using all
58 provided bitmaps. WIN32 only.
}
59 \twocolitem{\windowstyle{wxBU
\_LEFT}}{Left-justifies the bitmap label. WIN32 only.
}
60 \twocolitem{\windowstyle{wxBU
\_TOP}}{Aligns the bitmap label to the top of the button. WIN32 only.
}
61 \twocolitem{\windowstyle{wxBU
\_RIGHT}}{Right-justifies the bitmap label. WIN32 only.
}
62 \twocolitem{\windowstyle{wxBU
\_BOTTOM}}{Aligns the bitmap label to the bottom of the button. WIN32 only.
}
65 Note that
\windowstyle{wxBU
\_EXACTFIT} supported by
66 \helpref{wxButton
}{wxbutton
} is
\emph{not
} used by this class as bitmap buttons
67 don't have any minimal standard size by default.
69 See also
\helpref{window styles overview
}{windowstyles
}.
72 \wxheading{Event handling
}
75 \begin{twocollist
}\itemsep=
0pt
76 \twocolitem{{\bf EVT
\_BUTTON(id, func)
}}{Process a wxEVT
\_COMMAND\_BUTTON\_CLICKED event,
77 when the button is clicked.
}
83 \helpref{wxButton
}{wxbutton
}
87 \latexignore{\rtfignore{\wxheading{Members
}}}
90 \membersection{wxBitmapButton::wxBitmapButton
}\label{wxbitmapbuttonctor
}
92 \func{}{wxBitmapButton
}{\void}
96 \func{}{wxBitmapButton
}{
97 \param{wxWindow*
}{parent
},
98 \param{wxWindowID
}{id
},
99 \param{const wxBitmap\&
}{bitmap
},
\rtfsp
100 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
101 \param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
102 \param{long
}{style = wxBU
\_AUTODRAW},
103 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
104 \param{const wxString\&
}{name = ``button"
}}
106 Constructor, creating and showing a button.
108 \wxheading{Parameters
}
110 \docparam{parent
}{Parent window. Must not be NULL.
}
112 \docparam{id
}{Button identifier. A value of -
1 indicates a default value.
}
114 \docparam{bitmap
}{Bitmap to be displayed.
}
116 \docparam{pos
}{Button position.
}
118 \docparam{size
}{Button size. If the default size (-
1, -
1) is specified then the button is sized
119 appropriately for the bitmap.
}
121 \docparam{style
}{Window style. See
\helpref{wxBitmapButton
}{wxbitmapbutton
}.
}
123 \docparam{validator
}{Window validator.
}
125 \docparam{name
}{Window name.
}
129 The
{\it bitmap
} parameter is normally the only bitmap you need to provide, and wxWidgets will
130 draw the button correctly in its different states. If you want more control, call
131 any of the functions
\helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
},
\rtfsp
132 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
},
\rtfsp
133 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}.
135 Note that the bitmap passed is smaller than the actual button created.
139 \helpref{wxBitmapButton::Create
}{wxbitmapbuttoncreate
},
\helpref{wxValidator
}{wxvalidator
}
142 \membersection{wxBitmapButton::
\destruct{wxBitmapButton
}}\label{wxbitmapbuttondtor
}
144 \func{}{\destruct{wxBitmapButton
}}{\void}
146 Destructor, destroying the button.
149 \membersection{wxBitmapButton::Create
}\label{wxbitmapbuttoncreate
}
151 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{ id
},
\param{const wxBitmap\&
}{bitmap
},
\rtfsp
152 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
153 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator
},
\param{const wxString\&
}{name = ``button"
}}
155 Button creation function for two-step creation. For more details, see
\helpref{wxBitmapButton::wxBitmapButton
}{wxbitmapbuttonctor
}.
158 \membersection{wxBitmapButton::GetBitmapDisabled
}\label{wxbitmapbuttongetbitmapdisabled
}
160 \constfunc{const wxBitmap\&
}{GetBitmapDisabled
}{\void}
161 \func{wxBitmap\&
}{GetBitmapDisabled
}{\void}
163 Returns the bitmap for the disabled state, may be invalid.
165 \wxheading{Return value
}
167 A reference to the disabled state bitmap.
171 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}
174 \membersection{wxBitmapButton::GetBitmapFocus
}\label{wxbitmapbuttongetbitmapfocus
}
176 \constfunc{const wxBitmap\&
}{GetBitmapFocus
}{\void}
177 \func{wxBitmap\&
}{GetBitmapFocus
}{\void}
179 Returns the bitmap for the focused state, may be invalid.
181 \wxheading{Return value
}
183 A reference to the focused state bitmap.
187 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
}
190 \membersection{wxBitmapButton::GetBitmapHover
}\label{wxbitmapbuttongetbitmaphover
}
192 \constfunc{const wxBitmap\&
}{GetBitmapHover
}{\void}
193 \func{wxBitmap\&
}{GetBitmapHover
}{\void}
195 Returns the bitmap used when the mouse is over the button, may be invalid.
199 \helpref{wxBitmapButton::SetBitmapHover
}{wxbitmapbuttonsetbitmaphover
}
202 \membersection{wxBitmapButton::GetBitmapLabel
}\label{wxbitmapbuttongetbitmaplabel
}
204 \constfunc{const wxBitmap\&
}{GetBitmapLabel
}{\void}
205 \func{wxBitmap\&
}{GetBitmapLabel
}{\void}
207 Returns the label bitmap (the one passed to the constructor), always valid.
209 \wxheading{Return value
}
211 A reference to the button's label bitmap.
215 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
}
218 \membersection{wxBitmapButton::GetBitmapSelected
}\label{wxbitmapbuttongetbitmapselected
}
220 \constfunc{wxBitmap\&
}{GetBitmapSelected
}{\void}
221 \func{wxBitmap\&
}{GetBitmapSelected
}{\void}
223 Returns the bitmap for the pushed button state, may be invalid.
225 \wxheading{Return value
}
227 A reference to the selected state bitmap.
231 \helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
}
234 \membersection{wxBitmapButton::SetBitmapDisabled
}\label{wxbitmapbuttonsetbitmapdisabled
}
236 \func{void
}{SetBitmapDisabled
}{\param{const wxBitmap\&
}{bitmap
}}
238 Sets the bitmap for the disabled button appearance.
240 \wxheading{Parameters
}
242 \docparam{bitmap
}{The bitmap to set.
}
246 \helpref{wxBitmapButton::GetBitmapDisabled
}{wxbitmapbuttongetbitmapdisabled
},
\rtfsp
247 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
},
\rtfsp
248 \helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
},
\rtfsp
249 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
}
252 \membersection{wxBitmapButton::SetBitmapFocus
}\label{wxbitmapbuttonsetbitmapfocus
}
254 \func{void
}{SetBitmapFocus
}{\param{const wxBitmap\&
}{bitmap
}}
256 Sets the bitmap for the button appearance when it has the keyboard focus.
258 \wxheading{Parameters
}
260 \docparam{bitmap
}{The bitmap to set.
}
264 \helpref{wxBitmapButton::GetBitmapFocus
}{wxbitmapbuttongetbitmapfocus
},
\rtfsp
265 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
},
\rtfsp
266 \helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
},
\rtfsp
267 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}
270 \membersection{wxBitmapButton::SetBitmapHover
}\label{wxbitmapbuttonsetbitmaphover
}
272 \func{void
}{SetBitmapHover
}{\param{const wxBitmap\&
}{bitmap
}}
274 Sets the bitmap to be shown when the mouse is over the button.
276 \newsince{2.7.0} and the hover bitmap is currently only supported in wxMSW.
280 \helpref{wxBitmapButton::GetBitmapHover
}{wxbitmapbuttongetbitmaphover
}
282 \membersection{wxBitmapButton::SetBitmapLabel
}\label{wxbitmapbuttonsetbitmaplabel
}
284 \func{void
}{SetBitmapLabel
}{\param{const wxBitmap\&
}{bitmap
}}
286 Sets the bitmap label for the button.
288 \wxheading{Parameters
}
290 \docparam{bitmap
}{The bitmap label to set.
}
294 This is the bitmap used for the unselected state, and for all other states
295 if no other bitmaps are provided.
299 \helpref{wxBitmapButton::GetBitmapLabel
}{wxbitmapbuttongetbitmaplabel
}
302 \membersection{wxBitmapButton::SetBitmapSelected
}\label{wxbitmapbuttonsetbitmapselected
}
304 \func{void
}{SetBitmapSelected
}{\param{const wxBitmap\&
}{bitmap
}}
306 Sets the bitmap for the selected (depressed) button appearance.
308 \wxheading{Parameters
}
310 \docparam{bitmap
}{The bitmap to set.
}
314 \helpref{wxBitmapButton::GetBitmapSelected
}{wxbitmapbuttongetbitmapselected
},
\rtfsp
315 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
},
\rtfsp
316 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
},
\rtfsp
317 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}