1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "BsPrerequisites.h"
6#include "Resources/BsResource.h"
7#include "GUI/BsGUIElementStyle.h"
8
9namespace bs
10{
11 /** @addtogroup GUI
12 * @{
13 */
14
15 /**
16 * Holds a set of styles that control how are GUI element types positioned and displayed in the GUI. Each element type
17 * can be assigned a specific style.
18 */
19 class BS_EXPORT BS_SCRIPT_EXPORT(m:GUI) GUISkin : public Resource
20 {
21 public:
22 /** Checks if the style with the specified name exists. */
23 BS_SCRIPT_EXPORT()
24 bool hasStyle(const String& name) const;
25
26 /**
27 * Returns a style for the specified GUI element type.
28 *
29 * @see GUIElement::getGUITypeName
30 */
31 BS_SCRIPT_EXPORT()
32 const GUIElementStyle* getStyle(const String& guiElemType) const;
33
34 /**
35 * Sets a style for the specified GUI element type.
36 *
37 * @see GUIElement::getGUITypeName
38 */
39 BS_SCRIPT_EXPORT()
40 void setStyle(const String& guiElemType, const GUIElementStyle& style);
41
42 /**
43 * Removes a style for the specified GUI element type.
44 *
45 * @see GUIElement::getGUITypeName
46 */
47 BS_SCRIPT_EXPORT()
48 void removeStyle(const String& guiElemType);
49
50 /** Returns names of all styles registered on this skin. */
51 BS_SCRIPT_EXPORT(pr:getter,n:StyleNames)
52 Vector<String> getStyleNames() const;
53
54 /** Creates an empty GUI skin and returns a handle to it. */
55 BS_SCRIPT_EXPORT(ec:GUISkin)
56 static HGUISkin create();
57
58 /** Default style that may be used when no other is available. */
59 static GUIElementStyle DefaultStyle;
60
61 public: // ***** INTERNAL ******
62 /** @name Internal
63 * @{
64 */
65
66 /**
67 * Creates an empty GUI skin and returns a pointer to it.
68 *
69 * @note Internal method. Use "create" returning handle for normal use.
70 */
71 static SPtr<GUISkin> _createPtr();
72
73 /** @} */
74 private:
75 GUISkin();
76 GUISkin(const GUISkin& skin); // Disable copying
77
78 UnorderedMap<String, GUIElementStyle> mStyles;
79
80 /************************************************************************/
81 /* SERIALIZATION */
82 /************************************************************************/
83 public:
84 friend class GUISkinRTTI;
85 static RTTITypeBase* getRTTIStatic();
86 virtual RTTITypeBase* getRTTI() const override;
87 };
88
89 /** @} */
90}