tibia-client/src/framework/ui/uielementskin.h

49 lines
1.3 KiB
C
Raw Normal View History

2011-04-09 01:20:44 +02:00
#ifndef UIELEMENTSKIN_H
#define UIELEMENTSKIN_H
2011-07-13 23:12:36 +02:00
#include <global.h>
2011-04-17 21:14:24 +02:00
#include <graphics/image.h>
2011-07-17 08:56:57 +02:00
#include <ui/uielement.h>
2011-05-12 00:16:11 +02:00
#include <graphics/font.h>
2011-07-13 23:12:36 +02:00
#include <otml/otmlnode.h>
2011-04-09 01:20:44 +02:00
class UIElementSkin
{
public:
UIElementSkin(const std::string& name, UI::ElementType elementType) :
2011-04-09 01:20:44 +02:00
m_name(name),
m_elementType(elementType) { }
UIElementSkin() : m_elementType(UI::Element) { }
2011-04-10 03:13:12 +02:00
virtual ~UIElementSkin() { }
2011-04-09 01:20:44 +02:00
/// Load the skin from a FML node
2011-07-13 23:12:36 +02:00
virtual void load(OTMLNode* node);
2011-04-17 22:09:37 +02:00
/// Apply the skin to an element
2011-04-17 02:36:58 +02:00
virtual void apply(UIElement *element);
2011-04-17 22:09:37 +02:00
/// Draw the skinned element
virtual void draw(UIElement *element);
2011-04-09 01:20:44 +02:00
const std::string& getName() const { return m_name; }
const Size& getDefaultSize() const { return m_defaultSize; }
UI::ElementType getElementType() const { return m_elementType; }
ImagePtr getDefaultImage() const { return m_defaultImage; }
2011-05-12 00:16:11 +02:00
FontPtr getFont() const { return m_font; }
Color getFontColor() const { return m_fontColor; }
protected:
2011-07-13 23:12:36 +02:00
ImagePtr loadImage(OTMLNode* node);
FontPtr loadFont(OTMLNode* node);
2011-04-09 01:20:44 +02:00
private:
std::string m_name;
UI::ElementType m_elementType;
2011-04-09 01:20:44 +02:00
Size m_defaultSize;
ImagePtr m_defaultImage;
2011-05-12 00:16:11 +02:00
FontPtr m_font;
Color m_fontColor;
2011-04-09 01:20:44 +02:00
};
typedef std::shared_ptr<UIElementSkin> UIElementSkinPtr;
2011-04-17 21:14:24 +02:00
2011-04-09 01:20:44 +02:00
#endif // UIELEMENTSKIN_H