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