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