Changeset View
Changeset View
Standalone View
Standalone View
source/gui/CGUI.h
Show First 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | public: | ||||
bool HasStyle(const CStr& name) const { return (m_Styles.count(name) != 0); } | bool HasStyle(const CStr& name) const { return (m_Styles.count(name) != 0); } | ||||
/** | /** | ||||
* Get Style if it exists, otherwise throws an exception. | * Get Style if it exists, otherwise throws an exception. | ||||
*/ | */ | ||||
const SGUIStyle& GetStyle(const CStr& name) const { return m_Styles.at(name); } | const SGUIStyle& GetStyle(const CStr& name) const { return m_Styles.at(name); } | ||||
/** | /** | ||||
* Get pre-defined color (if it exists) | * Check if a predefined color of that name exists. | ||||
* Returns false if it fails. | |||||
*/ | */ | ||||
bool GetPreDefinedColor(const CStr& name, CGUIColor& Output) const; | bool HasPreDefinedColor(const CStr& name) const { return (m_PreDefinedColors.count(name) != 0); } | ||||
/** | |||||
* Resolve the predefined color if it exists, otherwise throws an exception. | |||||
*/ | |||||
const CGUIColor& GetPreDefinedColor(const CStr& name) const { return m_PreDefinedColors.at(name); } | |||||
shared_ptr<ScriptInterface> GetScriptInterface() { return m_ScriptInterface; }; | shared_ptr<ScriptInterface> GetScriptInterface() { return m_ScriptInterface; }; | ||||
JS::Value GetGlobalObject() { return m_ScriptInterface->GetGlobalObject(); }; | JS::Value GetGlobalObject() { return m_ScriptInterface->GetGlobalObject(); }; | ||||
/** | /** | ||||
* Updates the object pointers, needs to be called each | * Updates the object pointers, needs to be called each | ||||
* time an object has been added or removed. | * time an object has been added or removed. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | private: | ||||
* Indicates which buttons are pressed (bit 0 = LMB, | * Indicates which buttons are pressed (bit 0 = LMB, | ||||
* bit 1 = RMB, bit 2 = MMB) | * bit 1 = RMB, bit 2 = MMB) | ||||
*/ | */ | ||||
unsigned int m_MouseButtons; | unsigned int m_MouseButtons; | ||||
// Tooltip | // Tooltip | ||||
GUITooltip m_Tooltip; | GUITooltip m_Tooltip; | ||||
/** | |||||
* This is a bank of custom colors, it is simply a look up table that | |||||
* will return a color object when someone inputs the name of that | |||||
* color. Of course the colors have to be declared in XML, there are | |||||
* no hard-coded values. | |||||
*/ | |||||
std::map<CStr, CGUIColor> m_PreDefinedColors; | |||||
//@} | //@} | ||||
//-------------------------------------------------------- | //-------------------------------------------------------- | ||||
/** @name Objects */ | /** @name Objects */ | ||||
//-------------------------------------------------------- | //-------------------------------------------------------- | ||||
//@{ | //@{ | ||||
/** | /** | ||||
* Base Object, all its children are considered parentless | * Base Object, all its children are considered parentless | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | private: | ||||
std::map<CStr, std::vector<IGUIObject*> > m_HotkeyObjects; | std::map<CStr, std::vector<IGUIObject*> > m_HotkeyObjects; | ||||
//-------------------------------------------------------- | //-------------------------------------------------------- | ||||
// Databases | // Databases | ||||
// These are loaded from XML files and marked as noncopyable and const to | // These are loaded from XML files and marked as noncopyable and const to | ||||
// rule out unintentional modification and copy, especially during Draw calls. | // rule out unintentional modification and copy, especially during Draw calls. | ||||
//-------------------------------------------------------- | //-------------------------------------------------------- | ||||
// Colors | |||||
std::map<CStr, const CGUIColor> m_PreDefinedColors; | |||||
// Sprites | // Sprites | ||||
std::map<CStr, const CGUISprite*> m_Sprites; | std::map<CStr, const CGUISprite*> m_Sprites; | ||||
// Styles | // Styles | ||||
std::map<CStr, const SGUIStyle> m_Styles; | std::map<CStr, const SGUIStyle> m_Styles; | ||||
// Scroll-bar styles | // Scroll-bar styles | ||||
std::map<CStr, const SGUIScrollBarStyle> m_ScrollBarStyles; | std::map<CStr, const SGUIScrollBarStyle> m_ScrollBarStyles; | ||||
// Icons | // Icons | ||||
std::map<CStr, const SGUIIcon> m_Icons; | std::map<CStr, const SGUIIcon> m_Icons; | ||||
}; | }; | ||||
#endif // INCLUDED_CGUI | #endif // INCLUDED_CGUI |
Wildfire Games · Phabricator