Changeset View
Changeset View
Standalone View
Standalone View
source/gui/CGUI.h
Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | public: | ||||
* Resolve the predefined color if it exists, otherwise throws an exception. | * Resolve the predefined color if it exists, otherwise throws an exception. | ||||
*/ | */ | ||||
const CGUIColor& GetPreDefinedColor(const CStr& name) const { return m_PreDefinedColors.at(name); } | const CGUIColor& GetPreDefinedColor(const CStr& name) const { return m_PreDefinedColors.at(name); } | ||||
GUIProxyProps* GetProxyData(const js::BaseProxyHandler* ptr) { return m_ProxyData.at(ptr).get(); } | GUIProxyProps* GetProxyData(const js::BaseProxyHandler* ptr) { return m_ProxyData.at(ptr).get(); } | ||||
shared_ptr<ScriptInterface> GetScriptInterface() { return m_ScriptInterface; }; | shared_ptr<ScriptInterface> GetScriptInterface() { return m_ScriptInterface; }; | ||||
/** | |||||
* The CGUI creates the object and adds it as a child to parent. | |||||
* To the created object, this is the same as being created on page open (same events, etc.) | |||||
*/ | |||||
IGUIObject* CreateChild(const XMBFile& file, const XMBElement& element, IGUIObject* parent); | |||||
/** | |||||
* Detach the object from its parent and delete it. | |||||
* The object must have a parent - use PopPage to delete the root page object. | |||||
*/ | |||||
void DetachAndDeleteChild(IGUIObject* child); | |||||
private: | private: | ||||
/** | /** | ||||
* The CGUI takes ownership of the child object and links the parent with the child. | * The CGUI takes ownership of the child object and links the parent with the child. | ||||
* Returns false on failure to take over ownership of the child object. | * Returns false on failure to take over ownership of the child object. | ||||
*/ | */ | ||||
bool AddObject(IGUIObject& parent, IGUIObject& child); | bool AddObject(IGUIObject& parent, IGUIObject& child); | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | private: | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the objects-tag. | * the objects-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* @param Paths Collects the set of all XML/JS files that are loaded | * @param Paths Collects the set of all XML/JS files that are loaded | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadRootObjects(XMBElement Element, CXeromyces* pFile, std::unordered_set<VfsPath>& Paths); | void Xeromyces_ReadRootObjects(const XMBFile& file, XMBElement element, std::unordered_set<VfsPath>& Paths); | ||||
/** | /** | ||||
* Reads in the root element \<sprites\> (the DOMElement). | * Reads in the root element \<sprites\> (the DOMElement). | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the sprites-tag. | * the sprites-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadRootSprites(XMBElement Element, CXeromyces* pFile); | void Xeromyces_ReadRootSprites(const XMBFile& file, XMBElement element); | ||||
/** | /** | ||||
* Reads in the root element \<styles\> (the DOMElement). | * Reads in the root element \<styles\> (the DOMElement). | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the styles-tag. | * the styles-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadRootStyles(XMBElement Element, CXeromyces* pFile); | void Xeromyces_ReadRootStyles(const XMBFile& file, XMBElement element); | ||||
/** | /** | ||||
* Reads in the root element \<setup\> (the DOMElement). | * Reads in the root element \<setup\> (the DOMElement). | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the setup-tag. | * the setup-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadRootSetup(XMBElement Element, CXeromyces* pFile); | void Xeromyces_ReadRootSetup(const XMBFile& file, XMBElement element); | ||||
// Read Subs | // Read Subs | ||||
/** | /** | ||||
* Notice! Recursive function! | * Notice! Recursive function! | ||||
* | * | ||||
* Read in an \<object\> (the XMBElement) and stores it | * Read in an \<object\> (the XMBElement) and stores it | ||||
* as a child in the pParent. | * as a child in the pParent. | ||||
Show All 9 Lines | private: | ||||
* @param pParent Parent to add this object as child in. | * @param pParent Parent to add this object as child in. | ||||
* @param NameSubst A set of substitution strings that will be | * @param NameSubst A set of substitution strings that will be | ||||
* applied to all object names within this object. | * applied to all object names within this object. | ||||
* @param Paths Output set of file paths that this GUI object | * @param Paths Output set of file paths that this GUI object | ||||
* relies on. | * relies on. | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObject* pParent, std::vector<std::pair<CStr, CStr> >& NameSubst, std::unordered_set<VfsPath>& Paths, u32 nesting_depth); | IGUIObject* Xeromyces_ReadObject(const XMBFile& file, XMBElement element, IGUIObject* pParent, std::vector<std::pair<CStr, CStr> >& NameSubst, std::unordered_set<VfsPath>& Paths, u32 nesting_depth); | ||||
/** | /** | ||||
* Reads in the element \<repeat\>, which repeats its child \<object\>s | * Reads in the element \<repeat\>, which repeats its child \<object\>s | ||||
* 'count' times, replacing the string "[n]" (or the value of the attribute | * 'count' times, replacing the string "[n]" (or the value of the attribute | ||||
* 'var' enclosed in square brackets) in its descendants' names with "[0]", | * 'var' enclosed in square brackets) in its descendants' names with "[0]", | ||||
* "[1]", etc. | * "[1]", etc. | ||||
*/ | */ | ||||
void Xeromyces_ReadRepeat(XMBElement Element, CXeromyces* pFile, IGUIObject* pParent, std::vector<std::pair<CStr, CStr> >& NameSubst, std::unordered_set<VfsPath>& Paths, u32 nesting_depth); | void Xeromyces_ReadRepeat(const XMBFile& file, XMBElement element, IGUIObject* pParent, std::vector<std::pair<CStr, CStr> >& NameSubst, std::unordered_set<VfsPath>& Paths, u32 nesting_depth); | ||||
/** | /** | ||||
* Reads in the element \<script\> (the XMBElement) and executes | * Reads in the element \<script\> (the XMBElement) and executes | ||||
* the script's code. | * the script's code. | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the script-tag. | * the script-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* @param Paths Output set of file paths that this script is loaded from. | * @param Paths Output set of file paths that this script is loaded from. | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadScript(XMBElement Element, CXeromyces* pFile, std::unordered_set<VfsPath>& Paths); | void Xeromyces_ReadScript(const XMBFile& file, XMBElement element, std::unordered_set<VfsPath>& Paths); | ||||
/** | /** | ||||
* Reads in the element \<sprite\> (the XMBElement) and stores the | * Reads in the element \<sprite\> (the XMBElement) and stores the | ||||
* result in a new CGUISprite. | * result in a new CGUISprite. | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the sprite-tag. | * the sprite-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadSprite(XMBElement Element, CXeromyces* pFile); | void Xeromyces_ReadSprite(const XMBFile& file, XMBElement element); | ||||
/** | /** | ||||
* Reads in the element \<image\> (the XMBElement) and stores the | * Reads in the element \<image\> (the XMBElement) and stores the | ||||
* result within the CGUISprite. | * result within the CGUISprite. | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the image-tag. | * the image-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* @param parent Parent sprite. | * @param parent Parent sprite. | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite& parent); | void Xeromyces_ReadImage(const XMBFile& file, XMBElement element, CGUISprite& parent); | ||||
/** | /** | ||||
* Reads in the element \<effect\> (the XMBElement) and stores the | * Reads in the element \<effect\> (the XMBElement) and stores the | ||||
* result within the SGUIImageEffects. | * result within the SGUIImageEffects. | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the image-tag. | * the image-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* @param effects Effects object to add this effect to. | * @param effects Effects object to add this effect to. | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadEffects(XMBElement Element, CXeromyces* pFile, SGUIImageEffects& effects); | void Xeromyces_ReadEffects(const XMBFile& file, XMBElement element, SGUIImageEffects& effects); | ||||
/** | /** | ||||
* Reads in the element \<style\> (the XMBElement) and stores the | * Reads in the element \<style\> (the XMBElement) and stores the | ||||
* result in m_Styles. | * result in m_Styles. | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the style-tag. | * the style-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadStyle(XMBElement Element, CXeromyces* pFile); | void Xeromyces_ReadStyle(const XMBFile& file, XMBElement element); | ||||
/** | /** | ||||
* Reads in the element \<scrollbar\> (the XMBElement) and stores the | * Reads in the element \<scrollbar\> (the XMBElement) and stores the | ||||
* result in m_ScrollBarStyles. | * result in m_ScrollBarStyles. | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the scrollbar-tag. | * the scrollbar-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile); | void Xeromyces_ReadScrollBarStyle(const XMBFile& file, XMBElement element); | ||||
/** | /** | ||||
* Reads in the element \<icon\> (the XMBElement) and stores the | * Reads in the element \<icon\> (the XMBElement) and stores the | ||||
* result in m_Icons. | * result in m_Icons. | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the scrollbar-tag. | * the scrollbar-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadIcon(XMBElement Element, CXeromyces* pFile); | void Xeromyces_ReadIcon(const XMBFile& file, XMBElement element); | ||||
/** | /** | ||||
* Reads in the element \<tooltip\> (the XMBElement) and stores the | * Reads in the element \<tooltip\> (the XMBElement) and stores the | ||||
* result as an object with the name __tooltip_#. | * result as an object with the name __tooltip_#. | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the scrollbar-tag. | * the scrollbar-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadTooltip(XMBElement Element, CXeromyces* pFile); | void Xeromyces_ReadTooltip(const XMBFile& file, XMBElement element); | ||||
/** | /** | ||||
* Reads in the element \<color\> (the XMBElement) and stores the | * Reads in the element \<color\> (the XMBElement) and stores the | ||||
* result in m_PreDefinedColors | * result in m_PreDefinedColors | ||||
* | * | ||||
* @param Element The Xeromyces object that represents | * @param Element The Xeromyces object that represents | ||||
* the scrollbar-tag. | * the scrollbar-tag. | ||||
* @param pFile The Xeromyces object for the file being read | * @param pFile The Xeromyces object for the file being read | ||||
* | * | ||||
* @see LoadXmlFile() | * @see LoadXmlFile() | ||||
*/ | */ | ||||
void Xeromyces_ReadColor(XMBElement Element, CXeromyces* pFile); | void Xeromyces_ReadColor(const XMBFile& file, XMBElement element); | ||||
//@} | //@} | ||||
private: | private: | ||||
// Variables | // Variables | ||||
//-------------------------------------------------------- | //-------------------------------------------------------- | ||||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator