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