]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/anybutton.h
1 /////////////////////////////////////////////////////////////////////////////
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 /////////////////////////////////////////////////////////////////////////////
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 )
15 #define wxBU_EXACTFIT 0x0001
16 #define wxBU_NOTEXT 0x0002
17 #define wxBU_AUTODRAW 0x0004
23 A class for common button functionality used as the base for the
24 various button classes.
26 class wxAnyButton
: public wxControl
33 Return the bitmap shown by the button.
35 The returned bitmap may be invalid only if the button doesn't show any
42 wxBitmap
GetBitmap() const;
45 Returns the bitmap used when the mouse is over the button, which may be
48 @see SetBitmapCurrent()
50 @since 2.9.1 (available as wxBitmapButton::GetBitmapHover() in previous
53 wxBitmap
GetBitmapCurrent() const;
56 Returns the bitmap for the disabled state, which may be invalid.
58 @see SetBitmapDisabled()
60 @since 2.9.1 (available in wxBitmapButton only in previous versions)
62 wxBitmap
GetBitmapDisabled() const;
65 Returns the bitmap for the focused state, which may be invalid.
69 @since 2.9.1 (available in wxBitmapButton only in previous versions)
71 wxBitmap
GetBitmapFocus() const;
74 Returns the bitmap for the normal state.
76 This is exactly the same as GetBitmap() but uses a name
77 backwards-compatible with wxBitmapButton.
79 @see SetBitmap(), SetBitmapLabel()
81 @since 2.9.1 (available in wxBitmapButton only in previous versions)
83 wxBitmap
GetBitmapLabel() const;
86 Returns the bitmap for the pressed state, which may be invalid.
88 @see SetBitmapPressed()
90 @since 2.9.1 (available as wxBitmapButton::GetBitmapSelected() in
93 wxBitmap
GetBitmapPressed() const;
97 Sets the bitmap to display in the button.
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
106 The bitmap to display in the button. May be invalid to remove any
107 currently displayed bitmap.
109 The position of the bitmap inside the button. By default it is
110 positioned to the left of the text, near to the left button border.
111 Other possible values include wxRIGHT, wxTOP and wxBOTTOM.
113 @see SetBitmapPosition(), SetBitmapMargins()
117 void SetBitmap(const wxBitmap
& bitmap
, wxDirection dir
= wxLEFT
);
120 Sets the bitmap to be shown when the mouse is over the button.
122 @see GetBitmapCurrent()
124 @since 2.9.1 (available as wxBitmapButton::SetBitmapHover() in previous
127 void SetBitmapCurrent(const wxBitmap
& bitmap
);
130 Sets the bitmap for the disabled button appearance.
132 @see GetBitmapDisabled(), SetBitmapLabel(),
133 SetBitmapPressed(), SetBitmapFocus()
135 @since 2.9.1 (available in wxBitmapButton only in previous versions)
137 void SetBitmapDisabled(const wxBitmap
& bitmap
);
140 Sets the bitmap for the button appearance when it has the keyboard
143 @see GetBitmapFocus(), SetBitmapLabel(),
144 SetBitmapPressed(), SetBitmapDisabled()
146 @since 2.9.1 (available in wxBitmapButton only in previous versions)
148 void SetBitmapFocus(const wxBitmap
& bitmap
);
151 Sets the bitmap label for the button.
153 @remarks This is the bitmap used for the unselected state, and for all
154 other states if no other bitmaps are provided.
156 @see SetBitmap(), GetBitmapLabel()
158 @since 2.9.1 (available in wxBitmapButton only in previous versions)
160 void SetBitmapLabel(const wxBitmap
& bitmap
);
163 Sets the bitmap for the selected (depressed) button appearance.
165 @since 2.9.1 (available as wxBitmapButton::SetBitmapSelected() in
168 void SetBitmapPressed(const wxBitmap
& bitmap
);
172 Get the margins between the bitmap and the text of the button.
174 @see SetBitmapMargins()
178 wxSize
GetBitmapMargins();
181 Set the margins between the bitmap and the text of the button.
183 This method is currently only implemented under MSW. If it is not
184 called, default margin is used around the bitmap.
186 @see SetBitmap(), SetBitmapPosition()
191 void SetBitmapMargins(wxCoord x
, wxCoord y
);
192 void SetBitmapMargins(const wxSize
& sz
);
196 Set the position at which the bitmap is displayed.
198 This method should only be called if the button does have an associated
204 Direction in which the bitmap should be positioned, one of wxLEFT,
205 wxRIGHT, wxTOP or wxBOTTOM.
207 void SetBitmapPosition(wxDirection dir
);