# CEGUI::PushButton Class Reference

Base class to provide logic for push button type widgets. More...

Inheritance diagram for CEGUI::PushButton:

[legend]
Collaboration diagram for CEGUI::PushButton:

[legend]
List of all members.

## Public Member Functions

| PushButton (const String &type, const String &name)
| Constructor for base PushButton class.
virtual | ~PushButton (void)
| Destructor for PushButton class.
bool | isStandardImageryEnabled (void) const
| return whether or not rendering of the standard imagery is enabled.
bool | isCustomImageryAutoSized (void) const
| Return whether of not custom button image areas are auto-scaled to the size of the button.
const RenderableImage * | getNormalImage (void) const
| returns a pointer to a read-only RenderableImage object holding the details of the image set to render for the button in the normal state, or 0 if no image is currently set for this state.
const RenderableImage * | getHoverImage (void) const
| returns a pointer to a read-only RenderableImage object holding the details of the image set to render for the button in the highlighted state, or 0 if no image is currently set for this state.
const RenderableImage * | getPushedImage (void) const
| returns a pointer to a read-only RenderableImage object holding the details of the image set to render for the button in the pushed state, or 0 if no image is currently set for this state.
const RenderableImage * | getDisabledImage (void) const
| returns a pointer to a read-only RenderableImage object holding the details of the image set to render for the button in the disabled state, or 0 if no image is currently set for this state.
float | getTextXOffset (void) const
| get the offset that is used to shift of the text in the x-direction this is useful if the button-images are not symmetrical and the text shouldn't be completely centered
void | setStandardImageryEnabled (bool setting)
| set whether or not to render the standard imagery for the button
void | setCustomImageryAutoSized (bool setting)
| Set whether to auto re-size custom image areas when the button is sized.
void | setNormalImage (const RenderableImage *image)
| set the details of the image to render for the button in the normal state.
void | setHoverImage (const RenderableImage *image)
| set the details of the image to render for the button in the highlighted state.
void | setPushedImage (const RenderableImage *image)
| set the details of the image to render for the button in the pushed state.
void | setDisabledImage (const RenderableImage *image)
| set the details of the image to render for the button in the disabled state.
void | setTextXOffset (float offset)
| set the offset to use for a shift of the text in the x-direction this is useful if the button-images are not symmetrical and the text shouldn't be completely centered

## Static Public Attributes

static const String | EventNamespace
| Namespace for global events.
static const String | EventClicked
| The button was clicked.

## Protected Member Functions

virtual void | onClicked (WindowEventArgs &e)
| handler invoked internally when the button is clicked.
virtual void | onMouseButtonUp (MouseEventArgs &e)
| Handler called when a mouse button has been released within this window's area.
virtual void | onSized (WindowEventArgs &e)
| Handler called when the window's size changes.
void | addPushButtonEvents (void)
| Add button specific events.
virtual bool | testClassName_impl (const String &class_name) const
| Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.

## Protected Attributes

bool | d_autoscaleImages
| when true custom images will be scaled to the same size as the button
bool | d_useStandardImagery
| true if button standard imagery should be drawn.
bool | d_useNormalImage
| true if an image should be drawn for the normal state.
bool | d_useHoverImage
| true if an image should be drawn for the highlighted state.
bool | d_usePushedImage
| true if an image should be drawn for the pushed state.
bool | d_useDisabledImage
| true if an image should be drawn for the disabled state.
RenderableImage | d_normalImage
| RenderableImage used when rendering an image in the normal state.
RenderableImage | d_hoverImage
| RenderableImage used when rendering an image in the highlighted state.
RenderableImage | d_pushedImage
| RenderableImage used when rendering an image in the pushed state.
RenderableImage | d_disabledImage
| RenderableImage used when rendering an image in the disabled state.
float | d_textXOffset
| offset applied to the x co-ordinate of the text label.

## Detailed Description

Base class to provide logic for push button type widgets.

## Member Function Documentation

const RenderableImage * CEGUI::PushButton::getDisabledImage | ( | void |  | ) | const

returns a pointer to a read-only RenderableImage object holding the details of the image set to render for the button in the disabled state, or 0 if no image is currently set for this state.

Returns:
  Pointer to a const RenderableImage object with all the details for the image.

const RenderableImage * CEGUI::PushButton::getHoverImage | ( | void |  | ) | const

returns a pointer to a read-only RenderableImage object holding the details of the image set to render for the button in the highlighted state, or 0 if no image is currently set for this state.

Returns:
  Pointer to a const RenderableImage object with all the details for the image.

const RenderableImage * CEGUI::PushButton::getNormalImage | ( | void |  | ) | const

returns a pointer to a read-only RenderableImage object holding the details of the image set to render for the button in the normal state, or 0 if no image is currently set for this state.

Returns:
  Pointer to a const RenderableImage object with all the details for the image.

const RenderableImage * CEGUI::PushButton::getPushedImage | ( | void |  | ) | const

returns a pointer to a read-only RenderableImage object holding the details of the image set to render for the button in the pushed state, or 0 if no image is currently set for this state.

Returns:
  Pointer to a const RenderableImage object with all the details for the image.

float CEGUI::PushButton::getTextXOffset | ( | void |  | ) | const

get the offset that is used to shift of the text in the x-direction this is useful if the button-images are not symmetrical and the text shouldn't be completely centered

Returns:
  the offset relative to the button-size

bool CEGUI::PushButton::isCustomImageryAutoSized | ( | void |  | ) | const

Return whether of not custom button image areas are auto-scaled to the size of the button.

Returns:
  true if client specified custom image areas are re-sized when the button size changes. false if image areas will remain unchanged when the button is sized.

bool CEGUI::PushButton::isStandardImageryEnabled | ( | void |  | ) | const

return whether or not rendering of the standard imagery is enabled.

Returns:
  true if the standard button imagery will be rendered, false if no standard rendering will be performed.

void CEGUI::PushButton::onMouseButtonUp | ( | MouseEventArgs & | e | ) | `[protected, virtual]`

Handler called when a mouse button has been released within this window's area.

Parameters:

  | e | MouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::ButtonBase.

void CEGUI::PushButton::onSized | ( | WindowEventArgs & | e | ) | `[protected, virtual]`

Handler called when the window's size changes.

Parameters:

  | e | WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'.

Reimplemented from CEGUI::Window.

void CEGUI::PushButton::setCustomImageryAutoSized | ( | bool | setting | ) |

Set whether to auto re-size custom image areas when the button is sized.

Parameters:

  | setting | true to have custom image areas auto-sized. false to have system leave image areas untouched.

Returns:
  Nothing.

void CEGUI::PushButton::setDisabledImage | ( | const RenderableImage * | image | ) |

set the details of the image to render for the button in the disabled state.

Parameters:

  | image | RenderableImage object with all the details for the image. Note that an internal copy of the Renderable image is made and ownership of image remains with client code. If this parameter is NULL, rendering of an image for this button state is disabled.

Returns:
  Nothing.

void CEGUI::PushButton::setHoverImage | ( | const RenderableImage * | image | ) |

set the details of the image to render for the button in the highlighted state.

Parameters:

  | image | RenderableImage object with all the details for the image. Note that an internal copy of the Renderable image is made and ownership of image remains with client code. If this parameter is NULL, rendering of an image for this button state is disabled.

Returns:
  Nothing.

void CEGUI::PushButton::setNormalImage | ( | const RenderableImage * | image | ) |

set the details of the image to render for the button in the normal state.

Parameters:

  | image | RenderableImage object with all the details for the image. Note that an internal copy of the Renderable image is made and ownership of image remains with client code. If this parameter is NULL, rendering of an image for this button state is disabled.

Returns:
  Nothing.

void CEGUI::PushButton::setPushedImage | ( | const RenderableImage * | image | ) |

set the details of the image to render for the button in the pushed state.

Parameters:

  | image | RenderableImage object with all the details for the image. Note that an internal copy of the Renderable image is made and ownership of image remains with client code. If this parameter is NULL, rendering of an image for this button state is disabled.

Returns:
  Nothing.

void CEGUI::PushButton::setStandardImageryEnabled | ( | bool | setting | ) |

set whether or not to render the standard imagery for the button

Parameters:

  | setting | true to have the standard button imagery drawn, false to have no standard imagery drawn.

Returns:
  Nothing.

void CEGUI::PushButton::setTextXOffset | ( | float | offset | ) |

set the offset to use for a shift of the text in the x-direction this is useful if the button-images are not symmetrical and the text shouldn't be completely centered

Parameters:

  | offset | The offset to use. This is relative to the button-width

Returns:
  Nothing.

virtual bool CEGUI::PushButton::testClassName_impl | ( | const String & | class_name | ) | const`[inline, protected, virtual]`

Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.

Parameters:

  | class_name | The class name that is to be checked.

Returns:
  true if this window was inherited from class_name. false if not.

Reimplemented from CEGUI::ButtonBase.

Reimplemented in CEGUI::Thumb.