wxBitmapButton Class Reference
[Controls]

#include <wx/bmpbuttn.h>

Inheritance diagram for wxBitmapButton:

Inheritance graph
[legend]

Detailed Description

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.

Button states

This class supports bitmaps for several different states:

Styles

This class supports the following styles:

Note that the wxBU_EXACTFIT style supported by wxButton is not used by this class as bitmap buttons don't have any minimal standard size by default.

Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxCommandEvent& event)
Event macros for events emitted by this class:

Library:  wxCore

Category:  Controls

Appearance:
wxMSW appearancewxGTK appearancewxMac appearance
wxMSW appearancewxGTK appearancewxMac appearance

See also:
wxButton

Public Member Functions

 wxBitmapButton ()
 Default ctor.
 wxBitmapButton (wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxBU_AUTODRAW, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxButtonNameStr)
 Constructor, creating and showing a button.
virtual ~wxBitmapButton ()
 Destructor, destroying the button.
bool Create (wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxBU_AUTODRAW, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxButtonNameStr)
 Button creation function for two-step creation.
const wxBitmapGetBitmapSelected () const
 Returns the bitmap for the selected state.
virtual void SetBitmapDisabled (const wxBitmap &bitmap)
 Sets the bitmap for the disabled button appearance.
virtual void SetBitmapFocus (const wxBitmap &bitmap)
 Sets the bitmap for the button appearance when it has the keyboard focus.
virtual void SetBitmapHover (const wxBitmap &bitmap)
 Sets the bitmap to be shown when the mouse is over the button.
virtual void SetBitmapLabel (const wxBitmap &bitmap)
 Sets the bitmap label for the button.
virtual void SetBitmapSelected (const wxBitmap &bitmap)
 Sets the bitmap for the selected (depressed) button appearance.
const wxBitmapGetBitmapDisabled () const
 Returns the bitmap for the disabled state, which may be invalid.
wxBitmapGetBitmapDisabled ()
 Returns the bitmap for the disabled state, which may be invalid.
const wxBitmapGetBitmapFocus () const
 Returns the bitmap for the focused state, which may be invalid.
wxBitmapGetBitmapFocus ()
 Returns the bitmap for the focused state, which may be invalid.
const wxBitmapGetBitmapHover () const
 Returns the bitmap used when the mouse is over the button, which may be invalid.
wxBitmapGetBitmapHover ()
 Returns the bitmap used when the mouse is over the button, which may be invalid.
const wxBitmapGetBitmapLabel () const
 Returns the label bitmap (the one passed to the constructor), always valid.
wxBitmapGetBitmapLabel ()
 Returns the label bitmap (the one passed to the constructor), always valid.

List of all members.


Constructor & Destructor Documentation

wxBitmapButton::wxBitmapButton (  ) 

Default ctor.

wxBitmapButton::wxBitmapButton ( wxWindow parent,
wxWindowID  id,
const wxBitmap bitmap,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxBU_AUTODRAW,
const wxValidator validator = wxDefaultValidator,
const wxString name = wxButtonNameStr 
)

Constructor, creating and showing a button.

Parameters:
parent Parent window. Must not be NULL.
id Button identifier. The value wxID_ANY indicates a default value.
bitmap Bitmap to be displayed.
pos Button position.
size Button size. If wxDefaultSize is specified then the button is sized appropriately for the bitmap.
style Window style. See wxBitmapButton.
validator Window validator.
name Window name.
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(), SetBitmapFocus(), SetBitmapDisabled().
See also:
Create(), wxValidator

virtual wxBitmapButton::~wxBitmapButton (  )  [virtual]

Destructor, destroying the button.


Member Function Documentation

bool wxBitmapButton::Create ( wxWindow parent,
wxWindowID  id,
const wxBitmap bitmap,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxBU_AUTODRAW,
const wxValidator validator = wxDefaultValidator,
const wxString name = wxButtonNameStr 
)

Button creation function for two-step creation.

For more details, see wxBitmapButton().

wxBitmap& wxBitmapButton::GetBitmapDisabled (  ) 

Returns the bitmap for the disabled state, which may be invalid.

Returns:
A reference to the disabled state bitmap.
See also:
SetBitmapDisabled()

const wxBitmap& wxBitmapButton::GetBitmapDisabled (  )  const

Returns the bitmap for the disabled state, which may be invalid.

Returns:
A reference to the disabled state bitmap.
See also:
SetBitmapDisabled()

wxBitmap& wxBitmapButton::GetBitmapFocus (  ) 

Returns the bitmap for the focused state, which may be invalid.

Returns:
A reference to the focused state bitmap.
See also:
SetBitmapFocus()

const wxBitmap& wxBitmapButton::GetBitmapFocus (  )  const

Returns the bitmap for the focused state, which may be invalid.

Returns:
A reference to the focused state bitmap.
See also:
SetBitmapFocus()

wxBitmap& wxBitmapButton::GetBitmapHover (  ) 

Returns the bitmap used when the mouse is over the button, which may be invalid.

See also:
SetBitmapHover()

const wxBitmap& wxBitmapButton::GetBitmapHover (  )  const

Returns the bitmap used when the mouse is over the button, which may be invalid.

See also:
SetBitmapHover()

wxBitmap& wxBitmapButton::GetBitmapLabel (  ) 

Returns the label bitmap (the one passed to the constructor), always valid.

Returns:
A reference to the button's label bitmap.
See also:
SetBitmapLabel()

const wxBitmap& wxBitmapButton::GetBitmapLabel (  )  const

Returns the label bitmap (the one passed to the constructor), always valid.

Returns:
A reference to the button's label bitmap.
See also:
SetBitmapLabel()

const wxBitmap& wxBitmapButton::GetBitmapSelected (  )  const

Returns the bitmap for the selected state.

Returns:
A reference to the selected state bitmap.
See also:
SetBitmapSelected()

virtual void wxBitmapButton::SetBitmapDisabled ( const wxBitmap bitmap  )  [virtual]

Sets the bitmap for the disabled button appearance.

Parameters:
bitmap The bitmap to set.
See also:
GetBitmapDisabled(), SetBitmapLabel(), SetBitmapSelected(), SetBitmapFocus()

virtual void wxBitmapButton::SetBitmapFocus ( const wxBitmap bitmap  )  [virtual]

Sets the bitmap for the button appearance when it has the keyboard focus.

Parameters:
bitmap The bitmap to set.
See also:
GetBitmapFocus(), SetBitmapLabel(), SetBitmapSelected(), SetBitmapDisabled()

virtual void wxBitmapButton::SetBitmapHover ( const wxBitmap bitmap  )  [virtual]

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 also:
GetBitmapHover()

virtual void wxBitmapButton::SetBitmapLabel ( const wxBitmap bitmap  )  [virtual]

Sets the bitmap label for the button.

Parameters:
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 also:
GetBitmapLabel()

virtual void wxBitmapButton::SetBitmapSelected ( const wxBitmap bitmap  )  [virtual]

Sets the bitmap for the selected (depressed) button appearance.

Parameters:
bitmap The bitmap to set.



wxWidgets logo

[ top ]