]>
Commit | Line | Data |
---|---|---|
884a3e9d RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: anybutton.h | |
3 | // Purpose: interface of wxAnyButton | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id: button.h 69135 2011-09-18 04:38:01Z RD $ | |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | #define wxBU_LEFT 0x0040 | |
10 | #define wxBU_TOP 0x0080 | |
11 | #define wxBU_RIGHT 0x0100 | |
12 | #define wxBU_BOTTOM 0x0200 | |
13 | #define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM ) | |
14 | ||
15 | #define wxBU_EXACTFIT 0x0001 | |
16 | #define wxBU_NOTEXT 0x0002 | |
17 | ||
18 | ||
19 | /** | |
20 | @class wxAnyButton | |
21 | ||
22 | A class for common button functionality used as the base for the | |
23 | various button classes. | |
24 | */ | |
25 | class wxAnyButton : public wxControl | |
26 | { | |
27 | public: | |
28 | wxAnyButton(); | |
29 | ~wxAnyButton(); | |
30 | ||
31 | /** | |
32 | Return the bitmap shown by the button. | |
33 | ||
34 | The returned bitmap may be invalid only if the button doesn't show any | |
35 | images. | |
36 | ||
37 | @see SetBitmap() | |
38 | ||
39 | @since 2.9.1 | |
40 | */ | |
41 | wxBitmap GetBitmap() const; | |
42 | ||
43 | /** | |
44 | Returns the bitmap used when the mouse is over the button, which may be | |
45 | invalid. | |
46 | ||
47 | @see SetBitmapCurrent() | |
48 | ||
49 | @since 2.9.1 (available as wxBitmapButton::GetBitmapHover() in previous | |
50 | versions) | |
51 | */ | |
52 | wxBitmap GetBitmapCurrent() const; | |
53 | ||
54 | /** | |
55 | Returns the bitmap for the disabled state, which may be invalid. | |
56 | ||
57 | @see SetBitmapDisabled() | |
58 | ||
59 | @since 2.9.1 (available in wxBitmapButton only in previous versions) | |
60 | */ | |
61 | wxBitmap GetBitmapDisabled() const; | |
62 | ||
63 | /** | |
64 | Returns the bitmap for the focused state, which may be invalid. | |
65 | ||
66 | @see SetBitmapFocus() | |
67 | ||
68 | @since 2.9.1 (available in wxBitmapButton only in previous versions) | |
69 | */ | |
70 | wxBitmap GetBitmapFocus() const; | |
71 | ||
72 | /** | |
73 | Returns the bitmap for the normal state. | |
74 | ||
75 | This is exactly the same as GetBitmap() but uses a name | |
76 | backwards-compatible with wxBitmapButton. | |
77 | ||
78 | @see SetBitmap(), SetBitmapLabel() | |
79 | ||
80 | @since 2.9.1 (available in wxBitmapButton only in previous versions) | |
81 | */ | |
82 | wxBitmap GetBitmapLabel() const; | |
83 | ||
84 | /** | |
85 | Returns the bitmap for the pressed state, which may be invalid. | |
86 | ||
87 | @see SetBitmapPressed() | |
88 | ||
89 | @since 2.9.1 (available as wxBitmapButton::GetBitmapSelected() in | |
90 | previous versions) | |
91 | */ | |
92 | wxBitmap GetBitmapPressed() const; | |
93 | ||
94 | ||
95 | /** | |
96 | Sets the bitmap to display in the button. | |
97 | ||
98 | The bitmap is displayed together with the button label. This method | |
99 | sets up a single bitmap which is used in all button states, use | |
100 | SetBitmapDisabled(), SetBitmapPressed(), SetBitmapCurrent() or | |
101 | SetBitmapFocus() to change the individual images used in different | |
102 | states. | |
103 | ||
104 | @param bitmap | |
105 | The bitmap to display in the button. May be invalid to remove any | |
106 | currently displayed bitmap. | |
107 | @param dir | |
108 | The position of the bitmap inside the button. By default it is | |
109 | positioned to the left of the text, near to the left button border. | |
110 | Other possible values include wxRIGHT, wxTOP and wxBOTTOM. | |
111 | ||
112 | @see SetBitmapPosition(), SetBitmapMargins() | |
113 | ||
114 | @since 2.9.1 | |
115 | */ | |
116 | void SetBitmap(const wxBitmap& bitmap, wxDirection dir = wxLEFT); | |
117 | ||
118 | /** | |
119 | Sets the bitmap to be shown when the mouse is over the button. | |
120 | ||
121 | @see GetBitmapCurrent() | |
122 | ||
123 | @since 2.9.1 (available as wxBitmapButton::SetBitmapHover() in previous | |
124 | versions) | |
125 | */ | |
126 | void SetBitmapCurrent(const wxBitmap& bitmap); | |
127 | ||
128 | /** | |
129 | Sets the bitmap for the disabled button appearance. | |
130 | ||
131 | @see GetBitmapDisabled(), SetBitmapLabel(), | |
132 | SetBitmapPressed(), SetBitmapFocus() | |
133 | ||
134 | @since 2.9.1 (available in wxBitmapButton only in previous versions) | |
135 | */ | |
136 | void SetBitmapDisabled(const wxBitmap& bitmap); | |
137 | ||
138 | /** | |
139 | Sets the bitmap for the button appearance when it has the keyboard | |
140 | focus. | |
141 | ||
142 | @see GetBitmapFocus(), SetBitmapLabel(), | |
143 | SetBitmapPressed(), SetBitmapDisabled() | |
144 | ||
145 | @since 2.9.1 (available in wxBitmapButton only in previous versions) | |
146 | */ | |
147 | void SetBitmapFocus(const wxBitmap& bitmap); | |
148 | ||
149 | /** | |
150 | Sets the bitmap label for the button. | |
151 | ||
152 | @remarks This is the bitmap used for the unselected state, and for all | |
153 | other states if no other bitmaps are provided. | |
154 | ||
155 | @see SetBitmap(), GetBitmapLabel() | |
156 | ||
157 | @since 2.9.1 (available in wxBitmapButton only in previous versions) | |
158 | */ | |
159 | void SetBitmapLabel(const wxBitmap& bitmap); | |
160 | ||
161 | /** | |
162 | Sets the bitmap for the selected (depressed) button appearance. | |
163 | ||
164 | @since 2.9.1 (available as wxBitmapButton::SetBitmapSelected() in | |
165 | previous versions) | |
166 | */ | |
167 | void SetBitmapPressed(const wxBitmap& bitmap); | |
168 | ||
169 | ||
170 | /** | |
171 | Get the margins between the bitmap and the text of the button. | |
172 | ||
173 | @see SetBitmapMargins() | |
174 | ||
175 | @since 2.9.1 | |
176 | */ | |
177 | wxSize GetBitmapMargins(); | |
178 | ||
179 | /** | |
180 | Set the margins between the bitmap and the text of the button. | |
181 | ||
182 | This method is currently only implemented under MSW. If it is not | |
183 | called, default margin is used around the bitmap. | |
184 | ||
185 | @see SetBitmap(), SetBitmapPosition() | |
186 | ||
187 | @since 2.9.1 | |
188 | */ | |
189 | //@{ | |
190 | void SetBitmapMargins(wxCoord x, wxCoord y); | |
191 | void SetBitmapMargins(const wxSize& sz); | |
192 | //@} | |
193 | ||
194 | /** | |
195 | Set the position at which the bitmap is displayed. | |
196 | ||
197 | This method should only be called if the button does have an associated | |
198 | bitmap. | |
199 | ||
200 | @since 2.9.1 | |
201 | ||
202 | @param dir | |
203 | Direction in which the bitmap should be positioned, one of wxLEFT, | |
204 | wxRIGHT, wxTOP or wxBOTTOM. | |
205 | */ | |
206 | void SetBitmapPosition(wxDirection dir); | |
207 | }; | |
208 |