19#ifndef HEADER_SKIN_HPP
20#define HEADER_SKIN_HPP
27#include <dimension2d.h>
31 namespace video {
class ITexture; }
32 namespace gui {
class IGUIElement;
class IGUIFont;
class IGUISpriteBank; }
38#include "utils/leak_check.hpp"
39#include "utils/ptr_vector.hpp"
144 int m_skin_x, m_skin_y, m_skin_w, m_skin_h;
146 bool m_skin_dest_areas_inited;
147 bool m_skin_dest_areas_yflip_inited;
148 int m_skin_dest_x, m_skin_dest_y, m_skin_dest_x2, m_skin_dest_y2;
152 core::rect<s32> m_skin_dest_area_left;
153 core::rect<s32> m_skin_dest_area_center;
154 core::rect<s32> m_skin_dest_area_right;
156 core::rect<s32> m_skin_dest_area_top;
157 core::rect<s32> m_skin_dest_area_bottom;
159 core::rect<s32> m_skin_dest_area_top_left;
160 core::rect<s32> m_skin_dest_area_top_right;
161 core::rect<s32> m_skin_dest_area_bottom_left;
162 core::rect<s32> m_skin_dest_area_bottom_right;
165 core::rect<s32> m_skin_dest_area_left_yflip;
166 core::rect<s32> m_skin_dest_area_center_yflip;
167 core::rect<s32> m_skin_dest_area_right_yflip;
169 core::rect<s32> m_skin_dest_area_top_yflip;
170 core::rect<s32> m_skin_dest_area_bottom_yflip;
172 core::rect<s32> m_skin_dest_area_top_left_yflip;
173 core::rect<s32> m_skin_dest_area_top_right_yflip;
174 core::rect<s32> m_skin_dest_area_bottom_left_yflip;
175 core::rect<s32> m_skin_dest_area_bottom_right_yflip;
177 short m_skin_r, m_skin_g, m_skin_b;
181 m_skin_dest_areas_inited =
false;
182 m_skin_dest_areas_yflip_inited =
false;
204 video::ITexture* m_image;
208 int m_left_border, m_right_border, m_top_border, m_bottom_border;
209 bool m_preserve_h_aspect_ratios;
210 float m_hborder_out_portion, m_vborder_out_portion;
211 float m_horizontal_inner_padding, m_vertical_inner_padding;
212 float m_horizontal_margin, m_vertical_margin;
216 bool m_vertical_flip;
221 static const int BODY = 1;
222 static const int LEFT = 2;
223 static const int RIGHT = 4;
224 static const int TOP = 8;
225 static const int BOTTOM = 16;
226 static const int ALL = BODY+LEFT+RIGHT+TOP+BOTTOM;
228 core::rect<s32> m_source_area_left;
229 core::rect<s32> m_source_area_center;
230 core::rect<s32> m_source_area_right;
232 core::rect<s32> m_source_area_top;
233 core::rect<s32> m_source_area_bottom;
235 core::rect<s32> m_source_area_top_left;
236 core::rect<s32> m_source_area_top_right;
237 core::rect<s32> m_source_area_bottom_left;
238 core::rect<s32> m_source_area_bottom_right;
242 core::rect<s32> m_source_area_left_yflip;
243 core::rect<s32> m_source_area_center_yflip;
244 core::rect<s32> m_source_area_right_yflip;
246 core::rect<s32> m_source_area_top_yflip;
247 core::rect<s32> m_source_area_bottom_yflip;
249 core::rect<s32> m_source_area_top_left_yflip;
250 core::rect<s32> m_source_area_top_right_yflip;
251 core::rect<s32> m_source_area_bottom_left_yflip;
252 core::rect<s32> m_source_area_bottom_right_yflip;
255 void setTexture(video::ITexture* image);
256 void calculateYFlipIfNeeded();
268 class Skin :
public gui::IGUISkin
270 gui::IGUISkin* m_fallback_skin;
273 video::ITexture* m_bg_image;
274 std::vector<Widget*> m_tooltips;
275 std::vector<bool> m_tooltip_at_mouse;
280 const core::rect< s32 > &dest,
282 bool deactivated=
false,
283 const core::rect<s32>* clipRect=NULL);
287 void process3DPane(gui::IGUIElement *element,
288 const core::rect< s32 > &rect,
const bool pressed);
290 const bool pressed,
const bool focused);
292 const bool pressed,
const bool focused);
294 const bool pressed,
const bool focused);
295 void drawRibbon(
const core::rect< s32 > &rect,
Widget* widget,
296 const bool pressed,
bool focused);
298 const bool pressed,
bool focused);
300 const bool pressed,
bool focused);
302 const bool pressed,
bool focused);
303 void drawGauge(
const core::rect< s32 > &rect,
Widget* widget,
305 void drawGaugeFill(
const core::rect< s32 > &rect,
Widget* widget,
313 bool focused,
const core::rect< s32 > *clip);
315 const bool pressed,
bool focused);
316 void drawScrollbarBackground(
const core::rect< s32 > &rect);
317 void drawScrollbarThumb(
const core::rect< s32 > &rect);
318 void drawScrollbarButton(
const core::rect< s32 > &rect,
319 const bool pressed,
const bool bottomArrow);
321 void drawTooltip(
Widget* widget,
bool atMouse);
322 irr::video::SColorf getPlayerColor(
int player_id);
333 Skin(gui::IGUISkin* fallback_skin);
337 void resetBackgroundImage() { m_bg_image = NULL; }
338 static video::SColor getColor(
const std::string &name);
341 void drawBGFadeColor();
342 void drawBadgeOn(
const Widget* widget,
const core::rect<s32>& rect);
344 const core::rect< s32 > &rect,
345 float progress,
bool deactivated =
false);
348 virtual void draw2DRectangle (gui::IGUIElement *element,
349 const video::SColor &color,
350 const core::rect< s32 > &pos,
351 const core::rect< s32 > *clip);
352 virtual void draw3DButtonPanePressed(gui::IGUIElement *element,
353 const core::rect< s32 > &rect,
354 const core::rect< s32 > *clip);
355 virtual void draw3DButtonPaneStandard(gui::IGUIElement *element,
356 const core::rect< s32 > &rect,
357 const core::rect< s32 > *clip);
358 virtual void draw3DMenuPane (gui::IGUIElement *element,
359 const core::rect< s32 > &rect,
360 const core::rect< s32 > *clip);
361 virtual void draw3DSunkenPane (gui::IGUIElement *element,
362 video::SColor bgcolor,
363 bool flat,
bool fillBackGround,
364 const core::rect< s32 > &rect,
365 const core::rect< s32 > *clip);
366 virtual void draw3DTabBody (gui::IGUIElement *element,
bool border,
368 const core::rect< s32 > &rect,
369 const core::rect< s32 > *clip,
371 gui::EGUI_ALIGNMENT alignment=
372 gui::EGUIA_UPPERLEFT);
373 virtual void draw3DTabButton (gui::IGUIElement *element,
375 const core::rect< s32 > &rect,
376 const core::rect< s32 > *clip,
377 gui::EGUI_ALIGNMENT alignment=
378 gui::EGUIA_UPPERLEFT);
379 virtual void draw3DToolBar (gui::IGUIElement *element,
380 const core::rect< s32 > &rect,
381 const core::rect< s32 > *clip);
382 virtual core::rect< s32 >
383 draw3DWindowBackground(gui::IGUIElement *element,
385 video::SColor titleBarColor,
386 const core::rect< s32 > &rect,
387 const core::rect< s32 > *clip,
388 core::rect<s32>* checkClientArea=0);
390 virtual void draw2DImage(
const video::ITexture* texture,
const core::rect<s32>& destRect,
391 const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect,
392 const video::SColor*
const colors,
bool useAlphaChannelOfTexture);
394 virtual void drawIcon (gui::IGUIElement *element,
395 gui::EGUI_DEFAULT_ICON icon,
396 const core::position2di position,
397 u32 starttime, u32 currenttime,
399 const core::rect< s32 > *clip=NULL);
400 virtual video::SColor getColor (gui::EGUI_DEFAULT_COLOR color)
const;
401 virtual const wchar_t*
402 getDefaultText(gui::EGUI_DEFAULT_TEXT text)
const;
403 virtual gui::IGUIFont*
getFont(gui::EGUI_DEFAULT_FONT which=
404 gui::EGDF_DEFAULT)
const;
405 virtual u32 getIcon (gui::EGUI_DEFAULT_ICON icon)
const;
406 virtual s32 getSize (gui::EGUI_DEFAULT_SIZE size)
const;
408 virtual gui::IGUISpriteBank * getSpriteBank ()
const;
409 virtual void setColor (gui::EGUI_DEFAULT_COLOR which,
410 video::SColor newColor);
411 virtual void setDefaultText (gui::EGUI_DEFAULT_TEXT which,
412 const wchar_t* newText);
413 virtual void setFont (gui::IGUIFont *font,
414 gui::EGUI_DEFAULT_FONT which=gui::EGDF_DEFAULT);
415 virtual void setIcon (gui::EGUI_DEFAULT_ICON icon, u32 index);
416 virtual void setSize (gui::EGUI_DEFAULT_SIZE which, s32 size);
417 virtual void setSpriteBank (gui::IGUISpriteBank *bank);
421 const std::string &type);
423 video::ITexture* getImage(
const char* name);
425 gui::IGUISkin* getFallbackSkin() {
return m_fallback_skin; }
427 bool hasIconTheme()
const;
429 bool hasFont()
const;
431 const std::vector<std::string>& getNormalTTF()
const;
433 const std::vector<std::string>& getDigitTTF()
const;
435 const std::string& getColorEmojiTTF()
const;
437 std::string getThemedIcon(
const std::string& relative_path)
const;
439 float getScalingFactor(std::string params,
float height);
458 float getInnerPadding(
int wtype,
int rtype,
int axis);
459 float getValue(
int value_type,
int widget_type,
int ribbon_type,
int axis);
class containing render params for the 'drawBoxFromStretchableTexture' function see Overview of GUI s...
Definition: skin.hpp:203
int areas
bitmap containing which areas to render
Definition: skin.hpp:219
video::ITexture * getImage()
Returns the image for this BoxRenderParams.
Definition: skin.hpp:259
BoxRenderParams()
load default values
Definition: skin.cpp:445
Object used to render the GUI widgets see Overview of GUI skin for more information about skinning in...
Definition: skin.hpp:269
const BoxRenderParams & getBoxRenderParams(const std::string &type)
Returns the BoxRenderParams data structure for a given type.
Definition: skin.cpp:663
void drawRatingBar(Widget *w, const core::rect< s32 > &rect, const bool pressed, const bool focused)
Definition: skin.cpp:1131
void drawButton(Widget *w, const core::rect< s32 > &rect, const bool pressed, const bool focused)
Definition: skin.cpp:1003
void drawMessage(SkinWidgetContainer *w, const core::recti &dest, const std::string &type)
Draws a background box for an in-game notification message.
Definition: skin.cpp:675
void drawListSelection(const core::rect< s32 > &rect, Widget *widget, bool focused, const core::rect< s32 > *clip)
Definition: skin.cpp:2035
void renderSections(PtrVector< Widget > *within_vector=NULL)
recursive function to render all sections (recursion allows to easily traverse the tree of children a...
Definition: skin.cpp:2085
void drawCheckBox(const core::rect< s32 > &rect, Widget *widget, bool focused)
Definition: skin.cpp:1938
void drawListHeader(const core::rect< s32 > &rect, Widget *widget)
Definition: skin.cpp:2047
void drawProgress(Widget *w, const core::rect< s32 > &rect, const bool pressed, const bool focused)
Definition: skin.cpp:1075
void drawSpinnerBody(const core::rect< s32 > &rect, Widget *widget, const bool pressed, bool focused)
Definition: skin.cpp:1578
void drawSpinnerChild(const core::rect< s32 > &rect, Widget *widget, const bool pressed, bool focused)
Definition: skin.cpp:1763
void drawRibbonChild(const core::rect< s32 > &rect, Widget *widget, const bool pressed, bool focused)
Definition: skin.cpp:1222
void drawList(const core::rect< s32 > &rect, Widget *widget, bool focused)
Definition: skin.cpp:2022
void drawIconButton(const core::rect< s32 > &rect, Widget *widget, const bool pressed, bool focused)
Definition: skin.cpp:1806
Definition: ptr_vector.hpp:44
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33
irr::gui::ScalableFont * getFont()
Definition: engine.hpp:146
Small utility to read config file info from a XML file.
Definition: skin.cpp:57