]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: bmpbuttn.h | |
3 | // Purpose: documentation for wxBitmapButton class | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxBitmapButton | |
11 | @wxheader{bmpbuttn.h} | |
7c913512 | 12 | |
23324ae1 FM |
13 | A bitmap button is a control that contains a bitmap. |
14 | It may be placed on a @ref overview_wxdialog "dialog box" or panel, or indeed | |
15 | almost any other window. | |
7c913512 | 16 | |
23324ae1 FM |
17 | @beginStyleTable |
18 | @style{wxBU_AUTODRAW}: | |
19 | If this is specified, the button will be drawn automatically using | |
20 | the label bitmap only, providing a 3D-look border. If this style is | |
21 | not specified, the button will be drawn without borders and using | |
22 | all provided bitmaps. WIN32 only. | |
23 | @style{wxBU_LEFT}: | |
24 | Left-justifies the bitmap label. WIN32 only. | |
25 | @style{wxBU_TOP}: | |
26 | Aligns the bitmap label to the top of the button. WIN32 only. | |
27 | @style{wxBU_RIGHT}: | |
28 | Right-justifies the bitmap label. WIN32 only. | |
29 | @style{wxBU_BOTTOM}: | |
30 | Aligns the bitmap label to the bottom of the button. WIN32 only. | |
31 | @endStyleTable | |
7c913512 | 32 | |
23324ae1 FM |
33 | @beginEventTable |
34 | @event{EVT_BUTTON(id\, func)}: | |
35 | Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is | |
36 | clicked. | |
37 | @endEventTable | |
7c913512 | 38 | |
23324ae1 FM |
39 | @library{wxcore} |
40 | @category{ctrl} | |
41 | @appearance{bitmapbutton.png} | |
7c913512 | 42 | |
23324ae1 FM |
43 | @seealso |
44 | wxButton | |
45 | */ | |
46 | class wxBitmapButton : public wxButton | |
47 | { | |
48 | public: | |
49 | //@{ | |
50 | /** | |
51 | Constructor, creating and showing a button. | |
52 | ||
7c913512 | 53 | @param parent |
23324ae1 FM |
54 | Parent window. Must not be @NULL. |
55 | ||
7c913512 | 56 | @param id |
23324ae1 FM |
57 | Button identifier. The value wxID_ANY indicates a default value. |
58 | ||
7c913512 | 59 | @param bitmap |
23324ae1 FM |
60 | Bitmap to be displayed. |
61 | ||
7c913512 | 62 | @param pos |
23324ae1 FM |
63 | Button position. |
64 | ||
7c913512 | 65 | @param size |
23324ae1 FM |
66 | Button size. If wxDefaultSize is specified then the button is sized |
67 | appropriately for the bitmap. | |
68 | ||
7c913512 | 69 | @param style |
23324ae1 FM |
70 | Window style. See wxBitmapButton. |
71 | ||
7c913512 | 72 | @param validator |
23324ae1 FM |
73 | Window validator. |
74 | ||
7c913512 | 75 | @param name |
23324ae1 FM |
76 | Window name. |
77 | ||
78 | @remarks The bitmap parameter is normally the only bitmap you need to | |
79 | provide, and wxWidgets will draw the button correctly | |
80 | in its different states. If you want more control, | |
81 | call any of the functions | |
82 | SetBitmapSelected(), | |
83 | SetBitmapFocus(), | |
84 | SetBitmapDisabled(). | |
85 | ||
86 | @sa Create(), wxValidator | |
87 | */ | |
88 | wxBitmapButton(); | |
7c913512 FM |
89 | wxBitmapButton(wxWindow* parent, wxWindowID id, |
90 | const wxBitmap& bitmap, | |
91 | const wxPoint& pos = wxDefaultPosition, | |
92 | const wxSize& size = wxDefaultSize, | |
93 | long style = wxBU_AUTODRAW, | |
94 | const wxValidator& validator = wxDefaultValidator, | |
95 | const wxString& name = "button"); | |
23324ae1 FM |
96 | //@} |
97 | ||
98 | /** | |
99 | Destructor, destroying the button. | |
100 | */ | |
101 | ~wxBitmapButton(); | |
102 | ||
103 | /** | |
104 | Button creation function for two-step creation. For more details, see | |
105 | wxBitmapButton(). | |
106 | */ | |
107 | bool Create(wxWindow* parent, wxWindowID id, | |
108 | const wxBitmap& bitmap, | |
109 | const wxPoint& pos, | |
110 | const wxSize& size = wxDefaultSize, | |
111 | long style = 0, | |
112 | const wxValidator& validator, | |
113 | const wxString& name = "button"); | |
114 | ||
115 | //@{ | |
116 | /** | |
117 | Returns the bitmap for the disabled state, may be invalid. | |
118 | ||
119 | @returns A reference to the disabled state bitmap. | |
120 | ||
121 | @sa SetBitmapDisabled() | |
122 | */ | |
123 | const wxBitmap GetBitmapDisabled(); | |
7c913512 | 124 | wxBitmap GetBitmapDisabled(); |
23324ae1 FM |
125 | //@} |
126 | ||
127 | //@{ | |
128 | /** | |
129 | Returns the bitmap for the focused state, may be invalid. | |
130 | ||
131 | @returns A reference to the focused state bitmap. | |
132 | ||
133 | @sa SetBitmapFocus() | |
134 | */ | |
135 | const wxBitmap GetBitmapFocus(); | |
7c913512 | 136 | wxBitmap GetBitmapFocus(); |
23324ae1 FM |
137 | //@} |
138 | ||
139 | //@{ | |
140 | /** | |
141 | Returns the bitmap used when the mouse is over the button, may be invalid. | |
142 | ||
143 | @sa SetBitmapHover() | |
144 | */ | |
145 | const wxBitmap GetBitmapHover(); | |
7c913512 | 146 | wxBitmap GetBitmapHover(); |
23324ae1 FM |
147 | //@} |
148 | ||
149 | //@{ | |
150 | /** | |
151 | Returns the label bitmap (the one passed to the constructor), always valid. | |
152 | ||
153 | @returns A reference to the button's label bitmap. | |
154 | ||
155 | @sa SetBitmapLabel() | |
156 | */ | |
157 | const wxBitmap GetBitmapLabel(); | |
7c913512 | 158 | wxBitmap GetBitmapLabel(); |
23324ae1 FM |
159 | //@} |
160 | ||
161 | /** | |
162 | Returns the bitmap for the selected state. | |
163 | ||
164 | @returns A reference to the selected state bitmap. | |
165 | ||
166 | @sa SetBitmapSelected() | |
167 | */ | |
168 | wxBitmap GetBitmapSelected(); | |
169 | ||
170 | /** | |
171 | Sets the bitmap for the disabled button appearance. | |
172 | ||
7c913512 | 173 | @param bitmap |
23324ae1 FM |
174 | The bitmap to set. |
175 | ||
176 | @sa GetBitmapDisabled(), SetBitmapLabel(), | |
177 | SetBitmapSelected(), SetBitmapFocus() | |
178 | */ | |
179 | void SetBitmapDisabled(const wxBitmap& bitmap); | |
180 | ||
181 | /** | |
182 | Sets the bitmap for the button appearance when it has the keyboard focus. | |
183 | ||
7c913512 | 184 | @param bitmap |
23324ae1 FM |
185 | The bitmap to set. |
186 | ||
187 | @sa GetBitmapFocus(), SetBitmapLabel(), | |
188 | SetBitmapSelected(), SetBitmapDisabled() | |
189 | */ | |
190 | void SetBitmapFocus(const wxBitmap& bitmap); | |
191 | ||
192 | /** | |
193 | Sets the bitmap to be shown when the mouse is over the button. | |
194 | ||
195 | This function is new since wxWidgets version 2.7.0 and the hover bitmap is | |
7c913512 | 196 | currently only supported in wxMSW. |
23324ae1 FM |
197 | |
198 | @sa GetBitmapHover() | |
199 | */ | |
200 | void SetBitmapHover(const wxBitmap& bitmap); | |
201 | ||
202 | /** | |
203 | Sets the bitmap label for the button. | |
204 | ||
7c913512 | 205 | @param bitmap |
23324ae1 FM |
206 | The bitmap label to set. |
207 | ||
208 | @remarks This is the bitmap used for the unselected state, and for all | |
209 | other states if no other bitmaps are provided. | |
210 | ||
211 | @sa GetBitmapLabel() | |
212 | */ | |
213 | void SetBitmapLabel(const wxBitmap& bitmap); | |
214 | ||
215 | /** | |
216 | Sets the bitmap for the selected (depressed) button appearance. | |
217 | ||
7c913512 | 218 | @param bitmap |
23324ae1 FM |
219 | The bitmap to set. |
220 | */ | |
221 | void SetBitmapSelected(const wxBitmap& bitmap); | |
222 | }; |