43 #ifndef INCLUDED_IGUIOBJECT
44 #define INCLUDED_IGUIOBJECT
94 #define TYPE(T) GUIST_##T,
262 PSRETURN SetSetting(
const CStr& Setting,
const CStrW& Value,
const bool& SkipMessage=
false);
333 virtual void Draw()=0;
virtual void ResetStates()
Reset internal state of this object.
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
Base class to only the class GUI.
void RegisterScriptHandler(const CStr &Action, const CStr &Code, CGUI *pGUI)
Set the script handler for a particular object-specific action.
void SetScriptHandler(const CStr &Action, JSObject *Function)
void ScriptEvent(const CStr &Action)
Execute the script for a particular action.
JSBool getProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
Dummy object used primarily for the root object or objects of type 'empty'.
void SetGUI(CGUI *const &pGUI)
const CStr & GetName() const
Get object name, name is unique.
Base settings, all objects possess these settings in their m_BaseSettings Instructions can be found i...
CStr GetPresentableName() const
The main object that represents a whole GUI page.
virtual float GetBufferedZ() const
Returns not the Z value, but the actual buffered Z value, i.e.
virtual bool HandleAdditionalChildren(const XMBElement &child, CXeromyces *pFile)
Handle additional children to the <object>-tag.
virtual InReaction ManuallyHandleEvent(const SDL_Event_ *ev)
Some objects need to handle the SDL_Event_ manually.
Includes static functions that needs one template argument.
virtual void UpdateCachedSize()
All sizes are relative to resolution, and the calculation is not wanted in real time, therefore it is cached, update the cached size with this function.
JSObject * GetJSObject()
Retrieves the JSObject representing this GUI object.
bool IsRootObject() const
IGUIObject * GetParent() const
NOTE! This will not just return m_pParent, when that is need use it! There is one exception to it...
vector_pObjects::iterator ChildrenItEnd()
vector_pObjects m_Children
void SetParent(IGUIObject *pParent)
Set parent of this object.
std::map< CStr, SGUISetting > m_Settings
Settings pool, all an object's settings are located here If a derived object has got more settings th...
EGUIMessageType
Message types.
void AddSetting(const EGUISettingType &Type, const CStr &Name)
Add a setting to m_Settings.
virtual bool MouseOver()
Checks if mouse is hovering this object.
JSBool setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
void AddChild(IGUIObject *pChild)
Notice nothing will be returned or thrown if the child hasn't been inputted into the GUI yet...
void SetName(const CStr &Name)
Get object name.
bool IsFocused() const
Check if object is focused.
void ChooseMouseOverAndClosest(IGUIObject *&pObject)
Inputs a reference pointer, checks if the new inputted object if hovered, if so, then check if this's...
CRect m_CachedActualSize
Cached size, real size m_Size is actually dependent on resolution and can have different real outcome...
Made to represent screen positions and delta values.
InReaction SendEvent(EGUIMessageType type, const CStr &EventName)
Send event to this GUI object (HandleMessage and ScriptEvent)
double m_LastClickTime[6]
std::map< CStr, IGUIObject * > map_pObjects
virtual void Draw()=0
Draws the object.
PSRETURN LogInvalidSettings(const CStr8 &Setting) const
Logs an invalid setting search and returns the correct return result.
const CGUI * GetGUI() const
JSBool getComputedSize(JSContext *cx, uintN argc, jsval *vp)
PSRETURN GetSettingType(const CStr &Setting, EGUISettingType &Type) const
Retrieves the type of a named setting.
virtual bool MouseOver()
Checks if mouse is hovering this object.
CPos GetMousePos() const
Get Mouse from CGUI.
std::vector< IGUIObject * > vector_pObjects
bool SettingExists(const CStr &Setting) const
Checks if settings exists, only available for derived classes that has this set up, that's why the base class just returns false.
A GUI Setting is anything that can be inputted from XML as <object>-attributes (with exceptions)...
void UpdateMouseOver(IGUIObject *const &pMouseOver)
Inputes the object that is currently hovered, this function updates this object accordingly (i...
PSRETURN SetSetting(const CStr &Setting, const CStrW &Value, const bool &SkipMessage=false)
Set a setting by string, regardless of what type it is.
std::map< CStr, JSObject ** > m_ScriptHandlers
vector_pObjects::iterator ChildrenItBegin()
void AddToPointersMap(map_pObjects &ObjectMap)
Adds object and its children to the map, it's name being the first part, and the second being itself...
bool m_MouseHovering
This is an array of true or false, each element is associated with a string representing a setting...
virtual void Destroy()
Calls Destroy on all children, and deallocates all memory.
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
std::map< CStr, SGUISetting > map_Settings
virtual void HandleMessage(SGUIMessage &Message)
This function is called with different messages for instance when the mouse enters the object...
void LoadStyle(CGUI &GUIinstance, const CStr &StyleName)
Loads a style.
Contains a list of values for new defaults to objects.
virtual bool MouseOverIcon()
Test if mouse position is over an icon.
virtual void Draw()
Draws the object.
void SetFocus()
Take focus!
Rectangle class used for screen rectangles.