Irrlicht 3D Engine
IGUIButton.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __I_GUI_BUTTON_H_INCLUDED__
6 #define __I_GUI_BUTTON_H_INCLUDED__
7 
8 #include "IGUIElement.h"
9 
10 namespace irr
11 {
12 
13 namespace video
14 {
15  class ITexture;
16 } // end namespace video
17 
18 namespace gui
19 {
20  class IGUIFont;
21  class IGUISpriteBank;
22 
24  {
39  };
40 
42  const c8* const GUIButtonStateNames[] =
43  {
44  "buttonUp",
45  "buttonDown",
46  "buttonMouseOver",
47  "buttonMouseOff",
48  "buttonFocused",
49  "buttonNotFocused",
50  0,
51  0,
52  };
53 
55 
58  class IGUIButton : public IGUIElement
59  {
60  public:
61 
63  IGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
64  : IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {}
65 
67 
69  virtual void setOverrideFont(IGUIFont* font=0) = 0;
70 
72 
73  virtual IGUIFont* getOverrideFont(void) const = 0;
74 
76 
78  virtual IGUIFont* getActiveFont() const = 0;
79 
81 
82  virtual void setImage(video::ITexture* image=0) = 0;
83 
85 
87  virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
88 
90 
93  virtual void setPressedImage(video::ITexture* image=0) = 0;
94 
96 
98  virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
99 
101  virtual void setSpriteBank(IGUISpriteBank* bank=0) = 0;
102 
104 
110  virtual void setSprite(EGUI_BUTTON_STATE state, s32 index,
111  video::SColor color=video::SColor(255,255,255,255), bool loop=false) = 0;
112 
114 
116  virtual void setIsPushButton(bool isPushButton=true) = 0;
117 
119  virtual void setPressed(bool pressed=true) = 0;
120 
122  virtual bool isPressed() const = 0;
123 
125  virtual void setUseAlphaChannel(bool useAlphaChannel=true) = 0;
126 
128  virtual bool isAlphaChannelUsed() const = 0;
129 
131  virtual bool isPushButton() const = 0;
132 
134  virtual void setDrawBorder(bool border=true) = 0;
135 
137  virtual bool isDrawingBorder() const = 0;
138 
140  virtual void setScaleImage(bool scaleImage=true) = 0;
141 
143  virtual bool isScalingImage() const = 0;
144  };
145 
146 
147 } // end namespace gui
148 } // end namespace irr
149 
150 #endif
151 
irr::gui::IGUIButton::setPressedImage
virtual void setPressedImage(video::ITexture *image=0)=0
Sets a background image for the button when it is in pressed state.
irr::gui::IGUIButton::setImage
virtual void setImage(video::ITexture *image=0)=0
Sets an image which should be displayed on the button when it is in normal state.
irr::gui::IGUIButton::isPushButton
virtual bool isPushButton() const =0
Returns whether the button is a push button.
irr::gui::EGBS_BUTTON_MOUSE_OVER
@ EGBS_BUTTON_MOUSE_OVER
The mouse cursor is over the button.
Definition: IGUIButton.h:30
irr::gui::IGUIButton::getActiveFont
virtual IGUIFont * getActiveFont() const =0
Get the font which is used right now for drawing.
irr::c8
char c8
8 bit character variable.
Definition: irrTypes.h:31
irr::gui::EGBS_COUNT
@ EGBS_COUNT
not used, counts the number of enumerated items
Definition: IGUIButton.h:38
irr::gui::IGUIButton::setOverrideFont
virtual void setOverrideFont(IGUIFont *font=0)=0
Sets another skin independent font.
irr::gui::EGBS_BUTTON_MOUSE_OFF
@ EGBS_BUTTON_MOUSE_OFF
The mouse cursor is not over the button.
Definition: IGUIButton.h:32
irr::gui::IGUIButton::isDrawingBorder
virtual bool isDrawingBorder() const =0
Returns if the border and button face are being drawn using the skin.
irr::gui::IGUISpriteBank
Sprite bank interface.
Definition: IGUISpriteBank.h:45
irr::gui::IGUIButton::isPressed
virtual bool isPressed() const =0
Returns if the button is currently pressed.
irr::gui::EGBS_BUTTON_DOWN
@ EGBS_BUTTON_DOWN
The button is currently pressed down.
Definition: IGUIButton.h:28
irr::gui::IGUIButton::setSpriteBank
virtual void setSpriteBank(IGUISpriteBank *bank=0)=0
Sets the sprite bank used by the button.
irr::video::ITexture
Interface of a Video Driver dependent Texture.
Definition: ITexture.h:98
irr::s32
signed int s32
32 bit signed variable.
Definition: irrTypes.h:66
irr::gui::IGUIButton::setPressed
virtual void setPressed(bool pressed=true)=0
Sets the pressed state of the button if this is a pushbutton.
irr::gui::IGUIButton::isScalingImage
virtual bool isScalingImage() const =0
Checks whether the button scales the used images.
irr::gui::EGBS_BUTTON_FOCUSED
@ EGBS_BUTTON_FOCUSED
The button has the focus.
Definition: IGUIButton.h:34
irr::gui::IGUIButton::isAlphaChannelUsed
virtual bool isAlphaChannelUsed() const =0
Returns if the alpha channel should be used for drawing background images on the button.
irr::gui::IGUIButton::getOverrideFont
virtual IGUIFont * getOverrideFont(void) const =0
Gets the override font (if any)
irr::gui::EGUI_BUTTON_STATE
EGUI_BUTTON_STATE
Definition: IGUIButton.h:23
irr::gui::EGBS_BUTTON_NOT_FOCUSED
@ EGBS_BUTTON_NOT_FOCUSED
The button doesn't have the focus.
Definition: IGUIButton.h:36
IGUIElement.h
irr::gui::GUIButtonStateNames
const c8 *const GUIButtonStateNames[]
Names for gui button state icons.
Definition: IGUIButton.h:42
irr
Everything in the Irrlicht Engine can be found in this namespace.
Definition: aabbox3d.h:12
irr::gui::IGUIButton
GUI Button interface.
Definition: IGUIButton.h:58
irr::gui::IGUIButton::setSprite
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.
irr::core::rect< s32 >
irr::gui::IGUIButton::setDrawBorder
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)
irr::gui::IGUIButton::setScaleImage
virtual void setScaleImage(bool scaleImage=true)=0
Sets if the button should scale the button images to fit.
irr::gui::EGBS_BUTTON_UP
@ EGBS_BUTTON_UP
The button is not pressed.
Definition: IGUIButton.h:26
irr::gui::IGUIEnvironment
GUI Environment. Used as factory and manager of all other GUI elements.
Definition: IGUIEnvironment.h:70
irr::gui::EGUIET_BUTTON
@ EGUIET_BUTTON
A button (IGUIButton)
Definition: EGUIElementTypes.h:20
irr::gui::IGUIFont
Font interface.
Definition: IGUIFont.h:39
irr::video::SColor
Class representing a 32 bit ARGB color.
Definition: SColor.h:201
irr::gui::IGUIButton::setUseAlphaChannel
virtual void setUseAlphaChannel(bool useAlphaChannel=true)=0
Sets if the alpha channel should be used for drawing background images on the button (default is fals...
irr::gui::IGUIButton::IGUIButton
IGUIButton(IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect< s32 > rectangle)
constructor
Definition: IGUIButton.h:63
irr::gui::IGUIElement
Base class of all GUI elements.
Definition: IGUIElement.h:25
irr::gui::IGUIButton::setIsPushButton
virtual void setIsPushButton(bool isPushButton=true)=0
Sets if the button should behave like a push button.