~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to source/Irrlicht/CGUISkin.h

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2002-2011 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 __C_GUI_SKIN_H_INCLUDED__
 
6
#define __C_GUI_SKIN_H_INCLUDED__
 
7
 
 
8
#include "IrrCompileConfig.h"
 
9
#ifdef _IRR_COMPILE_WITH_GUI_
 
10
 
 
11
#include "IGUISkin.h"
 
12
#include "irrString.h"
 
13
 
 
14
namespace irr
 
15
{
 
16
namespace video
 
17
{
 
18
        class IVideoDriver;
 
19
}
 
20
namespace gui
 
21
{
 
22
 
 
23
        class CGUISkin : public IGUISkin
 
24
        {
 
25
        public:
 
26
 
 
27
                CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver);
 
28
 
 
29
                //! destructor
 
30
                virtual ~CGUISkin();
 
31
 
 
32
                //! returns default color
 
33
                virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const;
 
34
 
 
35
                //! sets a default color
 
36
                virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor);
 
37
 
 
38
                //! returns size for the given size type
 
39
                virtual s32 getSize(EGUI_DEFAULT_SIZE size) const;
 
40
 
 
41
                //! sets a default size
 
42
                virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size);
 
43
 
 
44
                //! returns the default font
 
45
                virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const;
 
46
 
 
47
                //! sets a default font
 
48
                virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT);
 
49
 
 
50
                //! sets the sprite bank used for drawing icons
 
51
                virtual void setSpriteBank(IGUISpriteBank* bank);
 
52
 
 
53
                //! gets the sprite bank used for drawing icons
 
54
                virtual IGUISpriteBank* getSpriteBank() const;
 
55
 
 
56
                //! Returns a default icon
 
57
                /** Returns the sprite index within the sprite bank */
 
58
                virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const;
 
59
 
 
60
                //! Sets a default icon
 
61
                /** Sets the sprite index used for drawing icons like arrows,
 
62
                close buttons and ticks in checkboxes
 
63
                \param icon: Enum specifying which icon to change
 
64
                \param index: The sprite index used to draw this icon */
 
65
                virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index);
 
66
 
 
67
                //! Returns a default text.
 
68
                /** For example for Message box button captions:
 
69
                "OK", "Cancel", "Yes", "No" and so on. */
 
70
                virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const;
 
71
 
 
72
                //! Sets a default text.
 
73
                /** For example for Message box button captions:
 
74
                "OK", "Cancel", "Yes", "No" and so on. */
 
75
                virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText);
 
76
 
 
77
                //! draws a standard 3d button pane
 
78
                /** Used for drawing for example buttons in normal state.
 
79
                It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
 
80
                EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
 
81
                \param rect: Defining area where to draw.
 
82
                \param clip: Clip area.
 
83
                \param element: Pointer to the element which wishes to draw this. This parameter
 
84
                is usually not used by ISkin, but can be used for example by more complex
 
85
                implementations to find out how to draw the part exactly. */
 
86
                virtual void draw3DButtonPaneStandard(IGUIElement* element,
 
87
                                const core::rect<s32>& rect,
 
88
                                const core::rect<s32>* clip=0);
 
89
 
 
90
                //! draws a pressed 3d button pane
 
91
                /** Used for drawing for example buttons in pressed state.
 
92
                It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
 
93
                EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
 
94
                \param rect: Defining area where to draw.
 
95
                \param clip: Clip area.
 
96
                \param element: Pointer to the element which wishes to draw this. This parameter
 
97
                is usually not used by ISkin, but can be used for example by more complex
 
98
                implementations to find out how to draw the part exactly. */
 
99
                virtual void draw3DButtonPanePressed(IGUIElement* element,
 
100
                                const core::rect<s32>& rect,
 
101
                                const core::rect<s32>* clip=0);
 
102
 
 
103
                //! draws a sunken 3d pane
 
104
                /** Used for drawing the background of edit, combo or check boxes.
 
105
                \param element: Pointer to the element which wishes to draw this. This parameter
 
106
                is usually not used by ISkin, but can be used for example by more complex
 
107
                implementations to find out how to draw the part exactly.
 
108
                \param bgcolor: Background color.
 
109
                \param flat: Specifies if the sunken pane should be flat or displayed as sunken
 
110
                deep into the ground.
 
111
                \param rect: Defining area where to draw.
 
112
                \param clip: Clip area. */
 
113
                virtual void draw3DSunkenPane(IGUIElement* element,
 
114
                                video::SColor bgcolor, bool flat,
 
115
                                bool fillBackGround,
 
116
                                const core::rect<s32>& rect,
 
117
                                const core::rect<s32>* clip=0);
 
118
 
 
119
                //! draws a window background
 
120
                /** Used for drawing the background of dialogs and windows.
 
121
                \param element: Pointer to the element which wishes to draw this. This parameter
 
122
                is usually not used by ISkin, but can be used for example by more complex
 
123
                implementations to find out how to draw the part exactly.
 
124
                \param titleBarColor: Title color.
 
125
                \param drawTitleBar: True to enable title drawing.
 
126
                \param rect: Defining area where to draw.
 
127
                \param clip: Clip area.
 
128
                \param checkClientArea: When set to non-null the function will not draw anything,
 
129
                but will instead return the clientArea which can be used for drawing by the calling window.
 
130
                That is the area without borders and without titlebar.
 
131
                \return Returns rect where it would be good to draw title bar text. This will
 
132
                work even when checkClientArea is set to a non-null value.*/
 
133
                virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
 
134
                                bool drawTitleBar, video::SColor titleBarColor,
 
135
                                const core::rect<s32>& rect,
 
136
                                const core::rect<s32>* clip,
 
137
                                core::rect<s32>* checkClientArea);
 
138
 
 
139
                //! draws a standard 3d menu pane
 
140
                /** Used for drawing for menus and context menus.
 
141
                It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
 
142
                EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
 
143
                \param element: Pointer to the element which wishes to draw this. This parameter
 
144
                is usually not used by ISkin, but can be used for example by more complex
 
145
                implementations to find out how to draw the part exactly.
 
146
                \param rect: Defining area where to draw.
 
147
                \param clip: Clip area. */
 
148
                virtual void draw3DMenuPane(IGUIElement* element,
 
149
                                const core::rect<s32>& rect,
 
150
                                const core::rect<s32>* clip=0);
 
151
 
 
152
                //! draws a standard 3d tool bar
 
153
                /** Used for drawing for toolbars and menus.
 
154
                \param element: Pointer to the element which wishes to draw this. This parameter
 
155
                is usually not used by ISkin, but can be used for example by more complex
 
156
                implementations to find out how to draw the part exactly.
 
157
                \param rect: Defining area where to draw.
 
158
                \param clip: Clip area. */
 
159
                virtual void draw3DToolBar(IGUIElement* element,
 
160
                                const core::rect<s32>& rect,
 
161
                                const core::rect<s32>* clip=0);
 
162
 
 
163
                //! draws a tab button
 
164
                /** Used for drawing for tab buttons on top of tabs.
 
165
                \param element: Pointer to the element which wishes to draw this. This parameter
 
166
                is usually not used by ISkin, but can be used for example by more complex
 
167
                implementations to find out how to draw the part exactly.
 
168
                \param active: Specifies if the tab is currently active.
 
169
                \param rect: Defining area where to draw.
 
170
                \param clip: Clip area. */
 
171
                virtual void draw3DTabButton(IGUIElement* element, bool active,
 
172
                        const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT);
 
173
 
 
174
                //! draws a tab control body
 
175
                /** \param element: Pointer to the element which wishes to draw this. This parameter
 
176
                is usually not used by ISkin, but can be used for example by more complex
 
177
                implementations to find out how to draw the part exactly.
 
178
                \param border: Specifies if the border should be drawn.
 
179
                \param background: Specifies if the background should be drawn.
 
180
                \param rect: Defining area where to draw.
 
181
                \param clip: Clip area. */
 
182
                virtual void draw3DTabBody(IGUIElement* element, bool border, bool background,
 
183
                        const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT);
 
184
 
 
185
                //! draws an icon, usually from the skin's sprite bank
 
186
                /** \param element: Pointer to the element which wishes to draw this icon.
 
187
                This parameter is usually not used by IGUISkin, but can be used for example
 
188
                by more complex implementations to find out how to draw the part exactly.
 
189
                \param icon: Specifies the icon to be drawn.
 
190
                \param position: The position to draw the icon
 
191
                \param starttime: The time at the start of the animation
 
192
                \param currenttime: The present time, used to calculate the frame number
 
193
                \param loop: Whether the animation should loop or not
 
194
                \param clip: Clip area. */
 
195
                virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
 
196
                                const core::position2di position,
 
197
                                u32 starttime=0, u32 currenttime=0,
 
198
                                bool loop=false, const core::rect<s32>* clip=0);
 
199
 
 
200
 
 
201
                //! draws a 2d rectangle.
 
202
                /** \param element: Pointer to the element which wishes to draw this icon.
 
203
                This parameter is usually not used by IGUISkin, but can be used for example
 
204
                by more complex implementations to find out how to draw the part exactly.
 
205
                \param color: Color of the rectangle to draw. The alpha component specifies how
 
206
                transparent the rectangle will be.
 
207
                \param pos: Position of the rectangle.
 
208
                \param clip: Pointer to rectangle against which the rectangle will be clipped.
 
209
                If the pointer is null, no clipping will be performed. */
 
210
                virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color,
 
211
                                const core::rect<s32>& pos, const core::rect<s32>* clip = 0);
 
212
 
 
213
 
 
214
                //! get the type of this skin
 
215
                virtual EGUI_SKIN_TYPE getType() const;
 
216
 
 
217
                //! Writes attributes of the object.
 
218
                //! Implement this to expose the attributes of your scene node animator for
 
219
                //! scripting languages, editors, debuggers or xml serialization purposes.
 
220
                virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
 
221
 
 
222
                //! Reads attributes of the object.
 
223
                //! Implement this to set the attributes of your scene node animator for
 
224
                //! scripting languages, editors, debuggers or xml deserialization purposes.
 
225
                virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
 
226
 
 
227
        private:
 
228
 
 
229
                video::SColor Colors[EGDC_COUNT];
 
230
                s32 Sizes[EGDS_COUNT];
 
231
                u32 Icons[EGDI_COUNT];
 
232
                IGUIFont* Fonts[EGDF_COUNT];
 
233
                IGUISpriteBank* SpriteBank;
 
234
                core::stringw Texts[EGDT_COUNT];
 
235
                video::IVideoDriver* Driver;
 
236
                bool UseGradient;
 
237
 
 
238
                EGUI_SKIN_TYPE Type;
 
239
        };
 
240
 
 
241
 
 
242
} // end namespace gui
 
243
} // end namespace irr
 
244
 
 
245
#endif // _IRR_COMPILE_WITH_GUI_
 
246
 
 
247
#endif
 
248
 
 
249