# wxBitmapButton Class Reference
[Controls]

`#include <wx/bmpbuttn.h>`

Inheritance diagram for wxBitmapButton:
[legend]

## Detailed Description

A bitmap button is a control that contains a bitmap.

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.

## Styles

This class supports the following styles:

- wxBU_LEFT:
  Left-justifies the bitmap label.
- wxBU_TOP:
  Aligns the bitmap label to the top of the button.
- wxBU_RIGHT:
  Right-justifies the bitmap label.
- wxBU_BOTTOM:
  Aligns the bitmap label to the bottom of the button.

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:

- EVT_BUTTON(id, func):
  Process a `wxEVT_COMMAND_BUTTON_CLICKED` event, when the button is clicked.

##

Library: wxCore

Category: Controls
Appearance:

wxMSW appearance | wxGTK appearance | wxMac 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.
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.

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. If wxDefaultPosition is specified then a default position is chosen.
  | 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 SetBitmapPressed(), SetBitmapFocus(), SetBitmapDisabled().

See also:
  Create(), wxValidator

## 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().

|  | [ top ]