Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
IGUIButton.hpp
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 nirtcpp/nirtcpp.hpp
4
5#ifndef NIRT_I_GUI_BUTTON_HPP_INCLUDED
6#define NIRT_I_GUI_BUTTON_HPP_INCLUDED
7
8#include <nirtcpp/core/engine/IGUIElement.hpp>
9
10namespace nirt
11{
12
13namespace video
14{
15 class ITexture;
16} // end namespace video
17
18namespace gui
19{
20 class IGUIFont;
21 class IGUISpriteBank;
22
47
50 {
51 "buttonUp",
52 "buttonDown",
53 "buttonMouseOver",
54 "buttonMouseOff",
55 "buttonFocused",
56 "buttonNotFocused",
57 "buttonDisabled",
58 0 // count
59 };
60
89
92 {
93 "Image", // not "ImageUp" as it otherwise breaks serialization of old files
94 "ImageUpOver",
95 "ImageUpFocused",
96 "ImageUpFocusedOver",
97 "PressedImage", // not "ImageDown" as it otherwise breaks serialization of old files
98 "ImageDownOver",
99 "ImageDownFocused",
100 "ImageDownFocusedOver",
101 "ImageDisabled",
102 0 // count
103 };
104
106
109 class IGUIButton : public IGUIElement
110 {
111 public:
112
114 IGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
115 : IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {}
116
118
120 virtual void setOverrideFont(IGUIFont* font=0) = 0;
121
123
124 virtual IGUIFont* getOverrideFont(void) const = 0;
125
127
129 virtual IGUIFont* getActiveFont() const = 0;
130
132
136 virtual void setOverrideColor(video::SColor color) = 0;
137
139
140 virtual video::SColor getOverrideColor(void) const = 0;
141
143
144 virtual video::SColor getActiveColor() const = 0;
145
147
150 virtual void enableOverrideColor(bool enable) = 0;
151
153
154 virtual bool isOverrideColorEnabled(void) const = 0;
155
157
164 virtual void setImage(EGUI_BUTTON_IMAGE_STATE state, video::ITexture* image=0, const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)) = 0;
165
167
169 virtual void setImage(video::ITexture* image=0) = 0;
170
172
176 virtual void setImage(video::ITexture* image, const core::rect<s32>& sourceRect) = 0;
177
179
183 virtual void setPressedImage(video::ITexture* image=0) = 0;
184
186
189 virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& sourceRect) = 0;
190
191
193
195 virtual void setSpriteBank(IGUISpriteBank* bank=0) = 0;
196
198
207 virtual void setSprite(EGUI_BUTTON_STATE state, s32 index,
208 video::SColor color=video::SColor(255,255,255,255), bool loop=false, bool scale=false) = 0;
209
211 virtual s32 getSpriteIndex(EGUI_BUTTON_STATE state) const = 0;
212
215
217 virtual bool getSpriteLoop(EGUI_BUTTON_STATE state) const = 0;
218
220 virtual bool getSpriteScale(EGUI_BUTTON_STATE state) const = 0;
221
223
225 virtual void setIsPushButton(bool isPushButton=true) = 0;
226
228 virtual void setPressed(bool pressed=true) = 0;
229
231 virtual bool isPressed() const = 0;
232
234 virtual void setUseAlphaChannel(bool useAlphaChannel=true) = 0;
235
237 virtual bool isAlphaChannelUsed() const = 0;
238
240 virtual bool isPushButton() const = 0;
241
243 virtual void setDrawBorder(bool border=true) = 0;
244
246 virtual bool isDrawingBorder() const = 0;
247
249 virtual void setScaleImage(bool scaleImage=true) = 0;
250
252 virtual bool isScalingImage() const = 0;
253
255
256 virtual bool getClickShiftState() const = 0;
257
259
260 virtual bool getClickControlState() const = 0;
261 };
262
263
264} // end namespace gui
265} // end namespace nirt
266
267#endif
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
GUI Button interface.
Definition IGUIButton.hpp:110
virtual bool isOverrideColorEnabled(void) const =0
Checks if an override color is enabled.
virtual bool getClickShiftState() const =0
Get if the shift key was pressed in last EGET_BUTTON_CLICKED event.
virtual void enableOverrideColor(bool enable)=0
Sets if the button text should use the override color or the color in the gui skin.
virtual void setIsPushButton(bool isPushButton=true)=0
Sets if the button should behave like a push button.
virtual bool isDrawingBorder() const =0
Returns if the border and button face are being drawn using the skin.
virtual void setPressed(bool pressed=true)=0
Sets the pressed state of the button if this is a pushbutton.
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 s32 getSpriteIndex(EGUI_BUTTON_STATE state) const =0
Get the sprite-index for the given state or -1 when no sprite is set.
virtual void setPressedImage(video::ITexture *image, const core::rect< s32 > &sourceRect)=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 bool isScalingImage() const =0
Checks whether the button scales the used images.
virtual bool isAlphaChannelUsed() const =0
Returns if the alpha channel should be used for drawing background images on the button.
virtual IGUIFont * getOverrideFont(void) const =0
Gets the override font (if any)
virtual video::SColor getActiveColor() const =0
Gets the currently used text color.
virtual IGUIFont * getActiveFont() const =0
Get the font which is used right now for drawing.
virtual void setPressedImage(video::ITexture *image=0)=0
Sets a background image for the button when it is in pressed state.
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(EGUI_BUTTON_IMAGE_STATE state, video::ITexture *image=0, const core::rect< s32 > &sourceRect=core::rect< s32 >(0, 0, 0, 0))=0
Sets an image which should be displayed on the button when it is in the given state.
virtual void setOverrideColor(video::SColor color)=0
Sets another color for the button text.
virtual void setImage(video::ITexture *image, const core::rect< s32 > &sourceRect)=0
Sets a background image for the button when it is in normal state.
virtual video::SColor getOverrideColor(void) const =0
Gets the override color.
virtual bool isPressed() const =0
Returns if the button is currently pressed.
virtual bool getClickControlState() const =0
Get if the control key was pressed in last EGET_BUTTON_CLICKED event.
virtual bool getSpriteScale(EGUI_BUTTON_STATE state) const =0
Returns if the sprite in the given state is scaled.
IGUIButton(IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect< s32 > rectangle)
constructor
Definition IGUIButton.hpp:114
virtual void setSpriteBank(IGUISpriteBank *bank=0)=0
Sets the sprite bank used by the button.
virtual bool getSpriteLoop(EGUI_BUTTON_STATE state) const =0
Returns if the sprite in the given state does loop.
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...
virtual video::SColor getSpriteColor(EGUI_BUTTON_STATE state) const =0
Get the sprite color for the given state. Color is only used when a sprite is set.
virtual bool isPushButton() const =0
Returns whether the button is a push button.
virtual void setOverrideFont(IGUIFont *font=0)=0
Sets another skin independent font.
virtual void setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor color=video::SColor(255, 255, 255, 255), bool loop=false, bool scale=false)=0
Sets the animated sprite for a specific button state.
Base class of all GUI elements.
Definition IGUIElement.hpp:24
GUI Environment. Used as factory and manager of all other GUI elements.
Definition IGUIEnvironment.hpp:73
Font interface.
Definition IGUIFont.hpp:40
Sprite bank interface.
Definition IGUISpriteBank.hpp:71
Interface of a Video Driver dependent Texture.
Definition ITexture.hpp:186
Class representing a 32 bit ARGB color.
Definition SColor.hpp:317
EGUI_BUTTON_IMAGE_STATE
Definition IGUIButton.hpp:67
@ EGBIS_IMAGE_DISABLED
When not set EGBIS_IMAGE_UP or EGBIS_IMAGE_DOWN are used (depending on button state).
Definition IGUIButton.hpp:85
@ EGBIS_IMAGE_DOWN_FOCUSED_MOUSEOVER
When not set EGBIS_IMAGE_DOWN_FOCUSED is used.
Definition IGUIButton.hpp:83
@ EGBIS_IMAGE_UP_FOCUSED_MOUSEOVER
When not set EGBIS_IMAGE_UP_FOCUSED is used.
Definition IGUIButton.hpp:75
@ EGBIS_COUNT
not used, counts the number of enumerated items
Definition IGUIButton.hpp:87
@ EGBIS_IMAGE_DOWN_MOUSEOVER
When not set EGBIS_IMAGE_DOWN is used.
Definition IGUIButton.hpp:79
@ EGBIS_IMAGE_DOWN
When not set EGBIS_IMAGE_UP is used.
Definition IGUIButton.hpp:77
@ EGBIS_IMAGE_UP_MOUSEOVER
When not set EGBIS_IMAGE_UP is used.
Definition IGUIButton.hpp:71
@ EGBIS_IMAGE_UP_FOCUSED
When not set EGBIS_IMAGE_UP_MOUSEOVER is used.
Definition IGUIButton.hpp:73
@ EGBIS_IMAGE_UP
When no other states have images they will all use this one.
Definition IGUIButton.hpp:69
@ EGBIS_IMAGE_DOWN_FOCUSED
When not set EGBIS_IMAGE_DOWN_MOUSEOVER is used.
Definition IGUIButton.hpp:81
const c8 *const GUIButtonStateNames[EGBS_COUNT+1]
Names for gui button state icons.
Definition IGUIButton.hpp:49
EGUI_BUTTON_STATE
Definition IGUIButton.hpp:29
@ EGBS_BUTTON_MOUSE_OVER
The mouse cursor is over the button.
Definition IGUIButton.hpp:35
@ EGBS_BUTTON_FOCUSED
The button has the focus.
Definition IGUIButton.hpp:39
@ EGBS_BUTTON_DISABLED
The button is disabled All other states are ignored in that case.
Definition IGUIButton.hpp:43
@ EGBS_BUTTON_DOWN
The button is currently pressed down.
Definition IGUIButton.hpp:33
@ EGBS_BUTTON_NOT_FOCUSED
The button doesn't have the focus.
Definition IGUIButton.hpp:41
@ EGBS_BUTTON_MOUSE_OFF
The mouse cursor is not over the button.
Definition IGUIButton.hpp:37
@ EGBS_BUTTON_UP
The button is not pressed.
Definition IGUIButton.hpp:31
@ EGBS_COUNT
not used, counts the number of enumerated items
Definition IGUIButton.hpp:45
const c8 *const GUIButtonImageStateNames[EGBIS_COUNT+1]
Names for gui button image states.
Definition IGUIButton.hpp:91
@ EGUIET_BUTTON
A button (IGUIButton)
Definition EGUIElementTypes.hpp:20
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
signed int s32
32 bit signed variable.
Definition irrTypes.hpp:72
char c8
8 bit character variable.
Definition irrTypes.hpp:37

Nirtcpp    @cppfx.xyz

Esvcpp    esv::print