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