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).
}
47 \wxheading{Window styles
}
50 \begin{twocollist
}\itemsep=
0pt
51 \twocolitem{\windowstyle{wxBU
\_AUTODRAW}}{If
52 this is specified, the button will be drawn automatically using the label bitmap only, providing
53 a
3D-look border. If this style is not specified, the button will be drawn without borders and using all
54 provided bitmaps. WIN32 only.
}
55 \twocolitem{\windowstyle{wxBU
\_LEFT}}{Left-justifies the bitmap label. WIN32 only.
}
56 \twocolitem{\windowstyle{wxBU
\_TOP}}{Aligns the bitmap label to the top of the button. WIN32 only.
}
57 \twocolitem{\windowstyle{wxBU
\_RIGHT}}{Right-justifies the bitmap label. WIN32 only.
}
58 \twocolitem{\windowstyle{wxBU
\_BOTTOM}}{Aligns the bitmap label to the bottom of the button. WIN32 only.
}
61 Note that
\windowstyle{wxBU
\_EXACTFIT} supported by
62 \helpref{wxButton
}{wxbutton
} is
\emph{not
} used by this class as bitmap buttons
63 don't have any minimal standard size by default.
65 See also
\helpref{window styles overview
}{windowstyles
}.
68 \wxheading{Event handling
}
71 \begin{twocollist
}\itemsep=
0pt
72 \twocolitem{{\bf EVT
\_BUTTON(id, func)
}}{Process a wxEVT
\_COMMAND\_BUTTON\_CLICKED event,
73 when the button is clicked.
}
79 \helpref{wxButton
}{wxbutton
}
83 \latexignore{\rtfignore{\wxheading{Members
}}}
86 \membersection{wxBitmapButton::wxBitmapButton
}\label{wxbitmapbuttonctor
}
88 \func{}{wxBitmapButton
}{\void}
92 \func{}{wxBitmapButton
}{
93 \param{wxWindow*
}{parent
},
94 \param{wxWindowID
}{id
},
95 \param{const wxBitmap\&
}{bitmap
},
\rtfsp
96 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
97 \param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
98 \param{long
}{style = wxBU
\_AUTODRAW},
99 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
100 \param{const wxString\&
}{name = ``button"
}}
102 Constructor, creating and showing a button.
104 \wxheading{Parameters
}
106 \docparam{parent
}{Parent window. Must not be NULL.
}
108 \docparam{id
}{Button identifier. A value of -
1 indicates a default value.
}
110 \docparam{bitmap
}{Bitmap to be displayed.
}
112 \docparam{pos
}{Button position.
}
114 \docparam{size
}{Button size. If the default size (-
1, -
1) is specified then the button is sized
115 appropriately for the bitmap.
}
117 \docparam{style
}{Window style. See
\helpref{wxBitmapButton
}{wxbitmapbutton
}.
}
119 \docparam{validator
}{Window validator.
}
121 \docparam{name
}{Window name.
}
125 The
{\it bitmap
} parameter is normally the only bitmap you need to provide, and wxWidgets will
126 draw the button correctly in its different states. If you want more control, call
127 any of the functions
\helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
},
\rtfsp
128 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
},
\rtfsp
129 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}.
131 Note that the bitmap passed is smaller than the actual button created.
135 \helpref{wxBitmapButton::Create
}{wxbitmapbuttoncreate
},
\helpref{wxValidator
}{wxvalidator
}
138 \membersection{wxBitmapButton::
\destruct{wxBitmapButton
}}\label{wxbitmapbuttondtor
}
140 \func{}{\destruct{wxBitmapButton
}}{\void}
142 Destructor, destroying the button.
145 \membersection{wxBitmapButton::Create
}\label{wxbitmapbuttoncreate
}
147 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{ id
},
\param{const wxBitmap\&
}{bitmap
},
\rtfsp
148 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
149 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator
},
\param{const wxString\&
}{name = ``button"
}}
151 Button creation function for two-step creation. For more details, see
\helpref{wxBitmapButton::wxBitmapButton
}{wxbitmapbuttonctor
}.
154 \membersection{wxBitmapButton::GetBitmapDisabled
}\label{wxbitmapbuttongetbitmapdisabled
}
156 \constfunc{const wxBitmap\&
}{GetBitmapDisabled
}{\void}
157 \func{wxBitmap\&
}{GetBitmapDisabled
}{\void}
159 Returns the bitmap for the disabled state, may be invalid.
161 \wxheading{Return value
}
163 A reference to the disabled state bitmap.
167 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}
170 \membersection{wxBitmapButton::GetBitmapFocus
}\label{wxbitmapbuttongetbitmapfocus
}
172 \constfunc{const wxBitmap\&
}{GetBitmapFocus
}{\void}
173 \func{wxBitmap\&
}{GetBitmapFocus
}{\void}
175 Returns the bitmap for the focused state, may be invalid.
177 \wxheading{Return value
}
179 A reference to the focused state bitmap.
183 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
}
186 \membersection{wxBitmapButton::GetBitmapHover
}\label{wxbitmapbuttongetbitmaphover
}
188 \constfunc{const wxBitmap\&
}{GetBitmapHover
}{\void}
189 \func{wxBitmap\&
}{GetBitmapHover
}{\void}
191 Returns the bitmap used when the mouse is over the button, may be invalid.
195 \helpref{wxBitmapButton::SetBitmapHover
}{wxbitmapbuttonsetbitmaphover
}
198 \membersection{wxBitmapButton::GetBitmapLabel
}\label{wxbitmapbuttongetbitmaplabel
}
200 \constfunc{const wxBitmap\&
}{GetBitmapLabel
}{\void}
201 \func{wxBitmap\&
}{GetBitmapLabel
}{\void}
203 Returns the label bitmap (the one passed to the constructor), always valid.
205 \wxheading{Return value
}
207 A reference to the button's label bitmap.
211 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
}
214 \membersection{wxBitmapButton::GetBitmapSelected
}\label{wxbitmapbuttongetbitmapselected
}
216 \constfunc{wxBitmap\&
}{GetBitmapSelected
}{\void}
217 \func{wxBitmap\&
}{GetBitmapSelected
}{\void}
219 Returns the bitmap for the pushed button state, may be invalid.
221 \wxheading{Return value
}
223 A reference to the selected state bitmap.
227 \helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
}
230 \membersection{wxBitmapButton::SetBitmapDisabled
}\label{wxbitmapbuttonsetbitmapdisabled
}
232 \func{void
}{SetBitmapDisabled
}{\param{const wxBitmap\&
}{bitmap
}}
234 Sets the bitmap for the disabled button appearance.
236 \wxheading{Parameters
}
238 \docparam{bitmap
}{The bitmap to set.
}
242 \helpref{wxBitmapButton::GetBitmapDisabled
}{wxbitmapbuttongetbitmapdisabled
},
\rtfsp
243 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
},
\rtfsp
244 \helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
},
\rtfsp
245 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
}
248 \membersection{wxBitmapButton::SetBitmapFocus
}\label{wxbitmapbuttonsetbitmapfocus
}
250 \func{void
}{SetBitmapFocus
}{\param{const wxBitmap\&
}{bitmap
}}
252 Sets the bitmap for the button appearance when it has the keyboard focus.
254 \wxheading{Parameters
}
256 \docparam{bitmap
}{The bitmap to set.
}
260 \helpref{wxBitmapButton::GetBitmapFocus
}{wxbitmapbuttongetbitmapfocus
},
\rtfsp
261 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
},
\rtfsp
262 \helpref{wxBitmapButton::SetBitmapSelected
}{wxbitmapbuttonsetbitmapselected
},
\rtfsp
263 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}
266 \membersection{wxBitmapButton::SetBitmapHover
}\label{wxbitmapbuttonsetbitmaphover
}
268 \func{void
}{SetBitmapHover
}{\param{const wxBitmap\&
}{bitmap
}}
270 Sets the bitmap to be shown when the mouse is over the button.
272 \newsince{2.7.0} and the hover bitmap is currently only supported in wxMSW.
276 \helpref{wxBitmapButton::GetBitmapHover
}{wxbitmapbuttongetbitmaphover
}
278 \membersection{wxBitmapButton::SetBitmapLabel
}\label{wxbitmapbuttonsetbitmaplabel
}
280 \func{void
}{SetBitmapLabel
}{\param{const wxBitmap\&
}{bitmap
}}
282 Sets the bitmap label for the button.
284 \wxheading{Parameters
}
286 \docparam{bitmap
}{The bitmap label to set.
}
290 This is the bitmap used for the unselected state, and for all other states
291 if no other bitmaps are provided.
295 \helpref{wxBitmapButton::GetBitmapLabel
}{wxbitmapbuttongetbitmaplabel
}
298 \membersection{wxBitmapButton::SetBitmapSelected
}\label{wxbitmapbuttonsetbitmapselected
}
300 \func{void
}{SetBitmapSelected
}{\param{const wxBitmap\&
}{bitmap
}}
302 Sets the bitmap for the selected (depressed) button appearance.
304 \wxheading{Parameters
}
306 \docparam{bitmap
}{The bitmap to set.
}
310 \helpref{wxBitmapButton::GetBitmapSelected
}{wxbitmapbuttongetbitmapselected
},
\rtfsp
311 \helpref{wxBitmapButton::SetBitmapLabel
}{wxbitmapbuttonsetbitmaplabel
},
\rtfsp
312 \helpref{wxBitmapButton::SetBitmapFocus
}{wxbitmapbuttonsetbitmapfocus
},
\rtfsp
313 \helpref{wxBitmapButton::SetBitmapDisabled
}{wxbitmapbuttonsetbitmapdisabled
}