Changeset View
Changeset View
Standalone View
Standalone View
source/gui/IGUIObject.h
Show First 20 Lines • Show All 247 Lines • ▼ Show 20 Lines | public: | ||||
*/ | */ | ||||
virtual void CreateJSObject(); | virtual void CreateJSObject(); | ||||
/** | /** | ||||
* Retrieves the JSObject representing this GUI object. | * Retrieves the JSObject representing this GUI object. | ||||
*/ | */ | ||||
JSObject* GetJSObject(); | JSObject* GetJSObject(); | ||||
/** | |||||
* This informs the GUI Object which settings will be available. | |||||
* This is public because it is accessed from the ConstructObject function. | |||||
*/ | |||||
virtual void AddSettings(); | |||||
//@} | //@} | ||||
protected: | protected: | ||||
//-------------------------------------------------------- | //-------------------------------------------------------- | ||||
/** @name Called by CGUI and friends | /** @name Called by CGUI and friends | ||||
* | * | ||||
* Methods that the CGUI will call using | * Methods that the CGUI will call using | ||||
* its friendship, these should not | * its friendship, these should not | ||||
* 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 | * Add a setting to m_Settings | ||||
* | * | ||||
* @param Type Setting type | * @param Type Setting type | ||||
* @param Name Setting reference name | * @param Name Setting reference name | ||||
*/ | */ | ||||
void AddSetting(const EGUISettingType& Type, const CStr& Name); | void AddSetting(const EGUISettingType& Type, const CStr& Name); | ||||
/** | |||||
* Calls Destroy on all children, and deallocates all memory. | |||||
* MEGA TODO Should it destroy it's children? | |||||
*/ | |||||
virtual void Destroy(); | |||||
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. | ||||
* | * | ||||
* This function has to be implemented as long as AddSettings calls this from the base constructor, | |||||
* because the derived class was not constructed when the base class constructor is called and thus calls this. | |||||
* | |||||
* @param Message GUI Message | * @param Message GUI Message | ||||
*/ | */ | ||||
virtual void HandleMessage(SGUIMessage& UNUSED(Message)) {} | //virtual void HandleMessage(SGUIMessage& UNUSED(Message)) {} | ||||
virtual void HandleMessage(SGUIMessage& Message) = 0; | |||||
protected: | protected: | ||||
/** | /** | ||||
* Draws the object. | * Draws the object. | ||||
* | * | ||||
* @throws PSERROR if any. But this will mostlikely be | * @throws PSERROR if any. But this will mostlikely be | ||||
* very rare since if an object is drawn unsuccessfully | * very rare since if an object is drawn unsuccessfully | ||||
* it'll probably only output in the Error log, and not | * it'll probably only output in the Error log, and not | ||||
▲ Show 20 Lines • Show All 240 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
class CGUIDummyObject : public IGUIObject | class CGUIDummyObject : public IGUIObject | ||||
{ | { | ||||
GUI_OBJECT(CGUIDummyObject) | GUI_OBJECT(CGUIDummyObject) | ||||
public: | public: | ||||
CGUIDummyObject(CGUI* pGUI) : IGUIObject(pGUI) {} | CGUIDummyObject(CGUI* pGUI) : IGUIObject(pGUI) {} | ||||
virtual void Draw() {} | virtual void Draw() override {} | ||||
// Empty can never be hovered. It is only a category. | // Empty can never be hovered. It is only a category. | ||||
virtual bool MouseOver() { return false; } | virtual bool MouseOver() override { return false; } | ||||
virtual void HandleMessage(SGUIMessage& UNUSED(Message)) override {} | |||||
}; | }; | ||||
#endif // INCLUDED_IGUIOBJECT | #endif // INCLUDED_IGUIOBJECT |
Wildfire Games · Phabricator