aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/include/IGUIButton.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/include/IGUIButton.h')
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIButton.h151
1 files changed, 151 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/include/IGUIButton.h b/src/others/irrlicht-1.8.1/include/IGUIButton.h
new file mode 100644
index 0000000..1da880e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIButton.h
@@ -0,0 +1,151 @@
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
10namespace irr
11{
12
13namespace video
14{
15 class ITexture;
16} // end namespace video
17
18namespace gui
19{
20 class IGUIFont;
21 class IGUISpriteBank;
22
23 enum EGUI_BUTTON_STATE
24 {
25 //! The button is not pressed
26 EGBS_BUTTON_UP=0,
27 //! The button is currently pressed down
28 EGBS_BUTTON_DOWN,
29 //! The mouse cursor is over the button
30 EGBS_BUTTON_MOUSE_OVER,
31 //! The mouse cursor is not over the button
32 EGBS_BUTTON_MOUSE_OFF,
33 //! The button has the focus
34 EGBS_BUTTON_FOCUSED,
35 //! The button doesn't have the focus
36 EGBS_BUTTON_NOT_FOCUSED,
37 //! not used, counts the number of enumerated items
38 EGBS_COUNT
39 };
40
41 //! Names for gui button state icons
42 const c8* const GUIButtonStateNames[] =
43 {
44 "buttonUp",
45 "buttonDown",
46 "buttonMouseOver",
47 "buttonMouseOff",
48 "buttonFocused",
49 "buttonNotFocused",
50 0,
51 0,
52 };
53
54 //! GUI Button interface.
55 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
56 \li EGET_BUTTON_CLICKED
57 */
58 class IGUIButton : public IGUIElement
59 {
60 public:
61
62 //! constructor
63 IGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
64 : IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {}
65
66 //! Sets another skin independent font.
67 /** If this is set to zero, the button uses the font of the skin.
68 \param font: New font to set. */
69 virtual void setOverrideFont(IGUIFont* font=0) = 0;
70
71 //! Gets the override font (if any)
72 /** \return The override font (may be 0) */
73 virtual IGUIFont* getOverrideFont(void) const = 0;
74
75 //! Get the font which is used right now for drawing
76 /** Currently this is the override font when one is set and the
77 font of the active skin otherwise */
78 virtual IGUIFont* getActiveFont() const = 0;
79
80 //! Sets an image which should be displayed on the button when it is in normal state.
81 /** \param image: Image to be displayed */
82 virtual void setImage(video::ITexture* image=0) = 0;
83
84 //! Sets a background image for the button when it is in normal state.
85 /** \param image: Texture containing the image to be displayed
86 \param pos: Position in the texture, where the image is located */
87 virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
88
89 //! Sets a background image for the button when it is in pressed state.
90 /** If no images is specified for the pressed state via
91 setPressedImage(), this image is also drawn in pressed state.
92 \param image: Image to be displayed */
93 virtual void setPressedImage(video::ITexture* image=0) = 0;
94
95 //! Sets an image which should be displayed on the button when it is in pressed state.
96 /** \param image: Texture containing the image to be displayed
97 \param pos: Position in the texture, where the image is located */
98 virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
99
100 //! Sets the sprite bank used by the button
101 virtual void setSpriteBank(IGUISpriteBank* bank=0) = 0;
102
103 //! Sets the animated sprite for a specific button state
104 /** \param index: Number of the sprite within the sprite bank, use -1 for no sprite
105 \param state: State of the button to set the sprite for
106 \param index: The sprite number from the current sprite bank
107 \param color: The color of the sprite
108 \param loop: True if the animation should loop, false if not
109 */
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
113 //! Sets if the button should behave like a push button.
114 /** Which means it can be in two states: Normal or Pressed. With a click on the button,
115 the user can change the state of the button. */
116 virtual void setIsPushButton(bool isPushButton=true) = 0;
117
118 //! Sets the pressed state of the button if this is a pushbutton
119 virtual void setPressed(bool pressed=true) = 0;
120
121 //! Returns if the button is currently pressed
122 virtual bool isPressed() const = 0;
123
124 //! Sets if the alpha channel should be used for drawing background images on the button (default is false)
125 virtual void setUseAlphaChannel(bool useAlphaChannel=true) = 0;
126
127 //! Returns if the alpha channel should be used for drawing background images on the button
128 virtual bool isAlphaChannelUsed() const = 0;
129
130 //! Returns whether the button is a push button
131 virtual bool isPushButton() const = 0;
132
133 //! Sets if the button should use the skin to draw its border and button face (default is true)
134 virtual void setDrawBorder(bool border=true) = 0;
135
136 //! Returns if the border and button face are being drawn using the skin
137 virtual bool isDrawingBorder() const = 0;
138
139 //! Sets if the button should scale the button images to fit
140 virtual void setScaleImage(bool scaleImage=true) = 0;
141
142 //! Checks whether the button scales the used images
143 virtual bool isScalingImage() const = 0;
144 };
145
146
147} // end namespace gui
148} // end namespace irr
149
150#endif
151