Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/IGUIObject.h
Show First 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | protected: | ||||
* be called by user. | * be called by user. | ||||
* These functions' security are a lot | * These functions' security are a lot | ||||
* what constitutes the GUI's | * what constitutes the GUI's | ||||
*/ | */ | ||||
//-------------------------------------------------------- | //-------------------------------------------------------- | ||||
//@{ | //@{ | ||||
/** | /** | ||||
* Add a setting to m_Settings | * Registers the given setting variables with the GUI object. | ||||
* Enable XML and JS to modify the given variable. | |||||
* | * | ||||
* @param Type Setting type | * @param Type Setting type | ||||
* @param Name Setting reference name | * @param Name Setting reference name | ||||
*/ | */ | ||||
template<typename T> void AddSetting(const CStr& Name); | template<typename T> | ||||
void RegisterSetting(const CStr& Name, T& Value); | |||||
public: | public: | ||||
/** | /** | ||||
* This function is called with different messages | * This function is called with different messages | ||||
* for instance when the mouse enters the object. | * for instance when the mouse enters the object. | ||||
* | * | ||||
* @param Message GUI Message | * @param Message GUI Message | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | protected: | ||||
* have any additional children (and this function should never be called). | * have any additional children (and this function should never be called). | ||||
*/ | */ | ||||
virtual bool HandleAdditionalChildren(const XMBElement& UNUSED(child), CXeromyces* UNUSED(pFile)) | virtual bool HandleAdditionalChildren(const XMBElement& UNUSED(child), CXeromyces* UNUSED(pFile)) | ||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
/** | /** | ||||
* Allow the GUI object to process after all child items were handled. | |||||
* Useful to avoid iterator invalidation with push_back calls. | |||||
*/ | |||||
virtual void AdditionalChildrenHandled() {} | |||||
/** | |||||
* Cached size, real size m_Size is actually dependent on resolution | * Cached size, real size m_Size is actually dependent on resolution | ||||
* and can have different *real* outcomes, this is the real outcome | * and can have different *real* outcomes, this is the real outcome | ||||
* cached to avoid slow calculations in real time. | * cached to avoid slow calculations in real time. | ||||
*/ | */ | ||||
CRect m_CachedActualSize; | CRect m_CachedActualSize; | ||||
/** | /** | ||||
* Send event to this GUI object (HandleMessage and ScriptEvent) | * Send event to this GUI object (HandleMessage and ScriptEvent) | ||||
Show All 31 Lines | protected: | ||||
* | * | ||||
* @param pMouseOver Object that is currently hovered, can be nullptr too! | * @param pMouseOver Object that is currently hovered, can be nullptr too! | ||||
*/ | */ | ||||
void UpdateMouseOver(IGUIObject* const& pMouseOver); | void UpdateMouseOver(IGUIObject* const& pMouseOver); | ||||
/** | /** | ||||
* Retrieves the configured sound filename from the given setting name and plays that once. | * Retrieves the configured sound filename from the given setting name and plays that once. | ||||
*/ | */ | ||||
void PlaySound(const CStr& settingName) const; | void PlaySound(const CStrW& soundPath) const; | ||||
//@} | //@} | ||||
private: | private: | ||||
//-------------------------------------------------------- | //-------------------------------------------------------- | ||||
/** @name Internal functions */ | /** @name Internal functions */ | ||||
//-------------------------------------------------------- | //-------------------------------------------------------- | ||||
//@{ | //@{ | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | protected: | ||||
// An object can't function stand alone | // An object can't function stand alone | ||||
CGUI& m_pGUI; | CGUI& m_pGUI; | ||||
// Internal storage for registered script handlers. | // Internal storage for registered script handlers. | ||||
std::map<CStr, JS::Heap<JSObject*> > m_ScriptHandlers; | std::map<CStr, JS::Heap<JSObject*> > m_ScriptHandlers; | ||||
// Cached JSObject representing this GUI object | // Cached JSObject representing this GUI object | ||||
JS::PersistentRootedObject m_JSObject; | JS::PersistentRootedObject m_JSObject; | ||||
// Cache references to settings for performance | |||||
bool m_Enabled; | |||||
bool m_Hidden; | |||||
CClientArea m_Size; | |||||
CStr m_Style; | |||||
CStr m_Hotkey; | |||||
float m_Z; | |||||
bool m_Absolute; | |||||
bool m_Ghost; | |||||
float m_AspectRatio; | |||||
CStrW m_Tooltip; | |||||
CStr m_TooltipStyle; | |||||
}; | }; | ||||
#endif // INCLUDED_IGUIOBJECT | #endif // INCLUDED_IGUIOBJECT |
Wildfire Games · Phabricator