// Purpose: interface of wxBitmapButton
// Author: wxWidgets team
// RCS-ID: $Id$
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
@class wxBitmapButton
A bitmap button is a control that contains a bitmap.
- It may be placed on a wxDialog or a wxPanel, or indeed almost any other window.
-
- @remarks
- A bitmap button can be supplied with a single bitmap, and wxWidgets will draw
- all button states using this bitmap. If the application needs more control,
- additional bitmaps for the selected state, unpressed focused state, and greyed-out
- state may be supplied.
-
- @section bitmapbutton_states Button states
-
- This class supports bitmaps for several different states:
- @li @b normal: this is the bitmap shown in the default state, it must be always
- valid while all the other bitmaps are optional and don't have to be set.
- @li @b disabled: bitmap shown when the button is disabled.
- @li @b selected: bitmap shown when the button is pushed (e.g. while the user
- keeps the mouse button pressed on it)
- @li @b focus: bitmap shown when the button has keyboard focus but is not pressed.
- @li @b hover: bitmap shown when the mouse is over the button (but it is not pressed).
- Notice that if hover bitmap is not specified but the current platform UI uses
- hover images for the buttons (such as Windows XP or GTK+), then the focus bitmap
- is used for hover state as well. This makes it possible to set focus bitmap only
- to get reasonably good behaviour on all platforms.
+
+ Notice that since wxWidgets 2.9.1 bitmap display is supported by the base
+ wxButton class itself and the only tiny advantage of using this class is
+ that it allows to specify the bitmap in its constructor, unlike wxButton.
+ Please see the base class documentation for more information about images
+ support in wxButton.
@beginStyleTable
- @style{wxBU_AUTODRAW}
- If this is specified, the button will be drawn automatically using
- the label bitmap only, providing a 3D-look border. If this style is
- not specified, the button will be drawn without borders and using
- all provided bitmaps. Has effect only under MS Windows.
@style{wxBU_LEFT}
- Left-justifies the bitmap label. Has effect only under MS Windows.
+ Left-justifies the bitmap label.
@style{wxBU_TOP}
Aligns the bitmap label to the top of the button.
- Has effect only under MS Windows.
@style{wxBU_RIGHT}
- Right-justifies the bitmap label. Has effect only under MS Windows.
+ Right-justifies the bitmap label.
@style{wxBU_BOTTOM}
Aligns the bitmap label to the bottom of the button.
- Has effect only under MS Windows.
@endStyleTable
Note that the wxBU_EXACTFIT style supported by wxButton is not used by this
@beginEventEmissionTable{wxCommandEvent}
@event{EVT_BUTTON(id, func)}
- Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.
+ Process a @c wxEVT_BUTTON event, when the button is clicked.
@endEventTable
@library{wxcore}
@category{ctrl}
- @appearance{bitmapbutton.png}
+ @appearance{bitmapbutton}
@see wxButton
*/
Bitmap to be displayed.
@param pos
Button position.
+ If ::wxDefaultPosition is specified then a default position is chosen.
@param size
- Button size. If wxDefaultSize is specified then the button is sized
- appropriately for the bitmap.
+ Button size.
+ If ::wxDefaultSize is specified then the button is sized appropriately
+ for the bitmap.
@param style
Window style. See wxBitmapButton.
@param validator
@remarks The bitmap parameter is normally the only bitmap you need to provide,
and wxWidgets will draw the button correctly in its different states.
- If you want more control, call any of the functions SetBitmapSelected(),
+ If you want more control, call any of the functions SetBitmapPressed(),
SetBitmapFocus(), SetBitmapDisabled().
@see Create(), wxValidator
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
- /**
- Destructor, destroying the button.
- */
- virtual ~wxBitmapButton();
-
/**
Button creation function for two-step creation.
For more details, see wxBitmapButton().
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
- //@{
- /**
- Returns the bitmap for the disabled state, which may be invalid.
-
- @return A reference to the disabled state bitmap.
-
- @see SetBitmapDisabled()
- */
- const wxBitmap& GetBitmapDisabled() const;
- wxBitmap& GetBitmapDisabled();
- //@}
-
- //@{
/**
- Returns the bitmap for the focused state, which may be invalid.
+ Helper function creating a standard-looking "Close" button.
- @return A reference to the focused state bitmap.
-
- @see SetBitmapFocus()
- */
- const wxBitmap& GetBitmapFocus() const;
- wxBitmap& GetBitmapFocus();
- //@}
+ To get the best results, platform-specific code may need to be used to
+ create a small, title bar-like "Close" button. This function is
+ provided to avoid the need to test for the current platform and creates
+ the button with as native look as possible.
- //@{
- /**
- Returns the bitmap used when the mouse is over the button, which may be invalid.
-
- @see SetBitmapHover()
- */
- const wxBitmap& GetBitmapHover() const;
- wxBitmap& GetBitmapHover();
- //@}
+ @param parent The button parent window, must be non-@NULL.
+ @param winid The identifier for the new button.
+ @return The new button.
- //@{
- /**
- Returns the label bitmap (the one passed to the constructor), always valid.
-
- @return A reference to the button's label bitmap.
-
- @see SetBitmapLabel()
- */
- const wxBitmap& GetBitmapLabel() const;
- wxBitmap& GetBitmapLabel();
- //@}
-
- /**
- Returns the bitmap for the selected state.
-
- @return A reference to the selected state bitmap.
-
- @see SetBitmapSelected()
- */
- const wxBitmap& GetBitmapSelected() const;
-
- /**
- Sets the bitmap for the disabled button appearance.
-
- @param bitmap
- The bitmap to set.
-
- @see GetBitmapDisabled(), SetBitmapLabel(),
- SetBitmapSelected(), SetBitmapFocus()
- */
- virtual void SetBitmapDisabled(const wxBitmap& bitmap);
-
- /**
- Sets the bitmap for the button appearance when it has the keyboard focus.
-
- @param bitmap
- The bitmap to set.
-
- @see GetBitmapFocus(), SetBitmapLabel(),
- SetBitmapSelected(), SetBitmapDisabled()
- */
- virtual void SetBitmapFocus(const wxBitmap& bitmap);
-
- /**
- Sets the bitmap to be shown when the mouse is over the button.
-
- @since 2.7.0
-
- The hover bitmap is currently only supported in wxMSW.
-
- @see GetBitmapHover()
- */
- virtual void SetBitmapHover(const wxBitmap& bitmap);
-
- /**
- Sets the bitmap label for the button.
-
- @param bitmap
- The bitmap label to set.
-
- @remarks This is the bitmap used for the unselected state, and for all
- other states if no other bitmaps are provided.
-
- @see GetBitmapLabel()
- */
- virtual void SetBitmapLabel(const wxBitmap& bitmap);
-
- /**
- Sets the bitmap for the selected (depressed) button appearance.
-
- @param bitmap
- The bitmap to set.
- */
- virtual void SetBitmapSelected(const wxBitmap& bitmap);
+ @since 2.9.5
+ */
+ static wxBitmapButton* NewCloseButton(wxWindow* parent, wxWindowID winid);
};