Changeset View
Changeset View
Standalone View
Standalone View
source/gui/CGUI.h
/* Copyright (C) 2017 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | public: | ||||
* can be changed by tags. | * can be changed by tags. | ||||
* @param Width Width, 0 if no word-wrapping. | * @param Width Width, 0 if no word-wrapping. | ||||
* @param BufferZone space between text and edge, and space between text and images. | * @param BufferZone space between text and edge, and space between text and images. | ||||
* @param pObject Optional parameter for error output. Used *only* if error parsing fails, | * @param pObject Optional parameter for error output. Used *only* if error parsing fails, | ||||
* and we need to be able to output which object the error occurred in to aid the user. | * and we need to be able to output which object the error occurred in to aid the user. | ||||
*/ | */ | ||||
SGUIText GenerateText(const CGUIString& Text, const CStrW& Font, const float& Width, const float& BufferZone, const IGUIObject* pObject = NULL); | SGUIText GenerateText(const CGUIString& Text, const CStrW& Font, const float& Width, const float& BufferZone, const IGUIObject* pObject = NULL); | ||||
/** | /** | ||||
* Check if an icon exists | * Check if an icon exists | ||||
*/ | */ | ||||
bool IconExists(const CStr& str) const { return (m_Icons.count(str) != 0); } | bool IconExists(const CStr& str) const { return (m_Icons.count(str) != 0); } | ||||
/** | /** | ||||
* Get Icon (a copy, can never be changed) | * Get Icon (a copy, can never be changed) | ||||
*/ | */ | ||||
SGUIIcon GetIcon(const CStr& str) const { return m_Icons.find(str)->second; } | SGUIIcon GetIcon(const CStr& str) const { return m_Icons.find(str)->second; } | ||||
/** | /** | ||||
* Loads a new icon at runtime. | |||||
* Returns false if an icon of that name exists and was not overwritten, true otherwise. | |||||
*/ | |||||
bool AddIcon(const CStr& name, const CStr& sprite, const CStr& size, bool replaceExisting); | |||||
/** | |||||
* Get pre-defined color (if it exists) | * Get pre-defined color (if it exists) | ||||
* Returns false if it fails. | * Returns false if it fails. | ||||
*/ | */ | ||||
bool GetPreDefinedColor(const CStr& name, CColor& Output) const; | bool GetPreDefinedColor(const CStr& name, CColor& Output) const; | ||||
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(); }; | ||||
▲ Show 20 Lines • Show All 396 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator