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