wxRuby Documentation Home

# Wx::BitmapButton

A bitmap button is a control that contains a bitmap.
It may be placed on a dialog box or panel, or indeed
almost any other window.

## Derived from

Button

Control

Window

EvtHandler

Object

## Remarks

A bitmap button can be supplied with a single bitmap, and Widgets will draw
all button states using this bitmap. If the application needs more
control, additional bitmaps for the selected state, unpressed focused
state, hover state and and greyed-out disabled state may be supplied.

## Window styles

`BU_AUTODRAW` | Ifthis is specified, the button will be drawn automatically using the label bitmap only, providinga 3D-look border. If this style is not specified, the button will be drawn without borders and using allprovided bitmaps. WIN32 only.
`BU_LEFT` | Left-justifies the bitmap label. WIN32 only.
`BU_TOP` | Aligns the bitmap label to the top of the button. WIN32 only.
`BU_RIGHT` | Right-justifies the bitmap label. WIN32 only.
`BU_BOTTOM` | Aligns the bitmap label to the bottom of the button. WIN32 only.

Note that `BU_EXACTFIT` supported by
Button is not used by this class as bitmap buttons
don’t have any minimal standard size by default.

See also window styles overview.

## Event handling

evt_button(id) { | event | … } | Process a EVT_COMMAND_BUTTON_CLICKED event,when the button is clicked.

## See also

Button

## Methods

- BitmapButton.new
- BitmapButton#create
- BitmapButton#get_bitmap_disabled
- BitmapButton#get_bitmap_focus
- BitmapButton#get_bitmap_hover
- BitmapButton#get_bitmap_label
- BitmapButton#get_bitmap_selected
- BitmapButton#set_bitmap_disabled
- BitmapButton#set_bitmap_focus
- BitmapButton#set_bitmap_hover
- BitmapButton#set_bitmap_label
- BitmapButton#set_bitmap_selected

### BitmapButton.new

#### Parameters

- parent Parent window. Must not be NULL.
- id Button identifier. A value of -1 indicates a default value.
- bitmap Bitmap to be displayed.
- pos Button position.
- size Button size. If the default size (-1, -1) is specified then the button is sized
  appropriately for the bitmap.
- style Window style. See BitmapButton.
- validator Window validator.
- name Window name.

#### Remarks

The bitmap parameter is normally the only bitmap you need to provide, and Widgets will
draw the button correctly in its different states. If you want more control, call
any of the functions
BitmapButton#set_bitmap_selected,
BitmapButton#set_bitmap_focus,
BitmapButton#set_bitmap_hover, BitmapButton#set_bitmap_disabled.

Note that the bitmap passed is smaller than the actual button created.

#### See also

BitmapButton#create, Validator

### BitmapButton#create

Boolean create(%(arg-type)Window% parent, Integer id, Bitmap bitmap, Point pos, Size size = DEFAULT_SIZE, Integer style = 0, Validator validator, String name = “button”)

Button creation function for two-step creation. For more details, see BitmapButton.new.

### BitmapButton#get_bitmap_disabled

Bitmap get_bitmap_disabled()

Returns the bitmap for the disabled state.

#### See also

BitmapButton#set_bitmap_disabled

### BitmapButton#get_bitmap_focus

Bitmap get_bitmap_focus()

Returns the bitmap for the focused state.

#### See also

BitmapButton#set_bitmap_focus

### BitmapButton#get_bitmap_hover

Bitmap get_bitmap_hover()

Returns the bitmap for the focused state.

#### See also

BitmapButton#set_bitmap_hover

### BitmapButton#get_bitmap_label

Bitmap get_bitmap_label()

Returns the label bitmap (the one passed to the constructor).

#### See also

BitmapButton#set_bitmap_label

### BitmapButton#get_bitmap_selected

Bitmap get_bitmap_selected()

Returns the bitmap for the selected state.

#### See also

BitmapButton#set_bitmap_selected

### BitmapButton#set_bitmap_disabled

set_bitmap_disabled(%(arg-type)Bitmap% bitmap)

Sets the bitmap for the disabled button appearance.

#### Parameters

- bitmap The bitmap to set.

#### See also

BitmapButton#get_bitmap_disabled, BitmapButton#set_bitmap_label, BitmapButton#set_bitmap_selected, BitmapButton#set_bitmap_focus

### BitmapButton#set_bitmap_focus

set_bitmap_focus(%(arg-type)Bitmap% bitmap)

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

#### Parameters

- bitmap The bitmap to set.

#### See also

BitmapButton#get_bitmap_focus, BitmapButton#set_bitmap_label, BitmapButton#set_bitmap_selected, BitmapButton#set_bitmap_disabled

### BitmapButton#set_bitmap_hover

set_bitmap_focus(%(arg-type)Bitmap% bitmap)

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

#### Parameters

- bitmap The bitmap to set.

#### See also

BitmapButton#get_bitmap_focus, BitmapButton#set_bitmap_label, BitmapButton#set_bitmap_selected, BitmapButton#set_bitmap_disabled

### BitmapButton#set_bitmap_label

set_bitmap_label(%(arg-type)Bitmap% bitmap)

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

BitmapButton#get_bitmap_label

### BitmapButton#set_bitmap_selected

set_bitmap_selected(%(arg-type)Bitmap% bitmap)

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

#### Parameters

- bitmap The bitmap to set.

#### See also

BitmapButton#get_bitmap_selected, BitmapButton#set_bitmap_label, BitmapButton#set_bitmap_focus, BitmapButton#set_bitmap_disabled

[This page automatically generated from the Textile source at 2023-06-09 00:45:34 +0000]