Irrlicht 3D Engine: irr::gui::IGUIButton Class Reference

| Irrlicht 3D Engine |

Public Member Functions
irr::gui::IGUIButton Class Reference

GUI Button interface. More...

`#include <IGUIButton.h>`

Inheritance diagram for irr::gui::IGUIButton:

List of all members.

## Public Member Functions

- IGUIButton (IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect< s32 > rectangle)
    constructor
- virtual IGUIFont * getActiveFont () const =0
    Get the font which is used right now for drawing.
- virtual IGUIFont * getOverrideFont (void) const =0
    Gets the override font (if any)
- virtual bool isAlphaChannelUsed () const =0
    Returns if the alpha channel should be used for drawing background images on the button.
- virtual bool isDrawingBorder () const =0
    Returns if the border and button face are being drawn using the skin.
- virtual bool isPressed () const =0
    Returns if the button is currently pressed.
- virtual bool isPushButton () const =0
    Returns whether the button is a push button.
- virtual bool isScalingImage () const =0
    Checks whether the button scales the used images.
- virtual void setDrawBorder (bool border=true)=0
    Sets if the button should use the skin to draw its border and button face (default is true)
- virtual void setImage (video::ITexture *image=0)=0
    Sets an image which should be displayed on the button when it is in normal state.
- virtual void setImage (video::ITexture *image, const core::rect< s32 > &pos)=0
    Sets a background image for the button when it is in normal state.
- virtual void setIsPushButton (bool isPushButton=true)=0
    Sets if the button should behave like a push button.
- virtual void setOverrideFont (IGUIFont *font=0)=0
    Sets another skin independent font.
- virtual void setPressed (bool pressed=true)=0
    Sets the pressed state of the button if this is a pushbutton.
- virtual void setPressedImage (video::ITexture *image=0)=0
    Sets a background image for the button when it is in pressed state.
- virtual void setPressedImage (video::ITexture *image, const core::rect< s32 > &pos)=0
    Sets an image which should be displayed on the button when it is in pressed state.
- virtual void setScaleImage (bool scaleImage=true)=0
    Sets if the button should scale the button images to fit.
- virtual void setSprite (EGUI_BUTTON_STATE state, s32 index, video::SColor color=video::SColor(255, 255, 255, 255), bool loop=false)=0
    Sets the animated sprite for a specific button state.
- virtual void setSpriteBank (IGUISpriteBank *bank=0)=0
    Sets the sprite bank used by the button.
- virtual void setUseAlphaChannel (bool useAlphaChannel=true)=0
    Sets if the alpha channel should be used for drawing background images on the button (default is false)

## Detailed Description

GUI Button interface.

This element can create the following events of type EGUI_EVENT_TYPE:
  - EGET_BUTTON_CLICKED

Definition at line 58 of file IGUIButton.h.

## Constructor & Destructor Documentation

irr::gui::IGUIButton::IGUIButton | ( | IGUIEnvironment * | environment,
|  | IGUIElement * | parent,
|  | s32 | id,
|  | core::rect< s32 > | rectangle
| ) |  | `[inline]`

constructor

Definition at line 63 of file IGUIButton.h.

## Member Function Documentation

virtual IGUIFont* irr::gui::IGUIButton::getActiveFont | ( |  | ) | const`[pure virtual]`

Get the font which is used right now for drawing.

Currently this is the override font when one is set and the font of the active skin otherwise

virtual IGUIFont* irr::gui::IGUIButton::getOverrideFont | ( | void |  | ) | const`[pure virtual]`

Gets the override font (if any)

Returns:
  The override font (may be 0)

virtual bool irr::gui::IGUIButton::isAlphaChannelUsed | ( |  | ) | const`[pure virtual]`

Returns if the alpha channel should be used for drawing background images on the button.

virtual bool irr::gui::IGUIButton::isDrawingBorder | ( |  | ) | const`[pure virtual]`

Returns if the border and button face are being drawn using the skin.

virtual bool irr::gui::IGUIButton::isPressed | ( |  | ) | const`[pure virtual]`

Returns if the button is currently pressed.

virtual bool irr::gui::IGUIButton::isPushButton | ( |  | ) | const`[pure virtual]`

Returns whether the button is a push button.

virtual bool irr::gui::IGUIButton::isScalingImage | ( |  | ) | const`[pure virtual]`

Checks whether the button scales the used images.

virtual void irr::gui::IGUIButton::setDrawBorder | ( | bool | border = `true` | ) | `[pure virtual]`

Sets if the button should use the skin to draw its border and button face (default is true)

virtual void irr::gui::IGUIButton::setImage | ( | video::ITexture * | image = `0` | ) | `[pure virtual]`

Sets an image which should be displayed on the button when it is in normal state.

Parameters:

  image,: | Image to be displayed

virtual void irr::gui::IGUIButton::setImage | ( | video::ITexture * | image,
|  | const core::rect< s32 > & | pos
| ) |  | `[pure virtual]`

Sets a background image for the button when it is in normal state.

Parameters:

  image,: | Texture containing the image to be displayed
  pos,: | Position in the texture, where the image is located

virtual void irr::gui::IGUIButton::setIsPushButton | ( | bool | isPushButton = `true` | ) | `[pure virtual]`

Sets if the button should behave like a push button.

Which means it can be in two states: Normal or Pressed. With a click on the button, the user can change the state of the button.

virtual void irr::gui::IGUIButton::setOverrideFont | ( | IGUIFont * | font = `0` | ) | `[pure virtual]`

Sets another skin independent font.

If this is set to zero, the button uses the font of the skin.

Parameters:

  font,: | New font to set.

virtual void irr::gui::IGUIButton::setPressed | ( | bool | pressed = `true` | ) | `[pure virtual]`

Sets the pressed state of the button if this is a pushbutton.

virtual void irr::gui::IGUIButton::setPressedImage | ( | video::ITexture * | image = `0` | ) | `[pure virtual]`

Sets a background image for the button when it is in pressed state.

If no images is specified for the pressed state via setPressedImage(), this image is also drawn in pressed state.

Parameters:

  image,: | Image to be displayed

virtual void irr::gui::IGUIButton::setPressedImage | ( | video::ITexture * | image,
|  | const core::rect< s32 > & | pos
| ) |  | `[pure virtual]`

Sets an image which should be displayed on the button when it is in pressed state.

Parameters:

  image,: | Texture containing the image to be displayed
  pos,: | Position in the texture, where the image is located

virtual void irr::gui::IGUIButton::setScaleImage | ( | bool | scaleImage = `true` | ) | `[pure virtual]`

Sets if the button should scale the button images to fit.

virtual void irr::gui::IGUIButton::setSprite | ( | EGUI_BUTTON_STATE | state,
|  | s32 | index,
|  | video::SColor | color = `video::SColor(255, 255, 255, 255)`,
|  | bool | loop = `false`
| ) |  | `[pure virtual]`

Sets the animated sprite for a specific button state.

Parameters:

  index,: | Number of the sprite within the sprite bank, use -1 for no sprite
  state,: | State of the button to set the sprite for
  index,: | The sprite number from the current sprite bank
  color,: | The color of the sprite
  loop,: | True if the animation should loop, false if not

virtual void irr::gui::IGUIButton::setSpriteBank | ( | IGUISpriteBank * | bank = `0` | ) | `[pure virtual]`

Sets the sprite bank used by the button.

virtual void irr::gui::IGUIButton::setUseAlphaChannel | ( | bool | useAlphaChannel = `true` | ) | `[pure virtual]`

Sets if the alpha channel should be used for drawing background images on the button (default is false)

The documentation for this class was generated from the following file:

- IGUIButton.h