Pyrogenesis
13997
|
Base settings, all objects possess these settings in their m_BaseSettings Instructions can be found in the documentations. More...
#include <IGUIObject.h>
Public Member Functions | |
IGUIObject () | |
virtual | ~IGUIObject () |
virtual bool | MouseOver () |
Checks if mouse is hovering this object. More... | |
virtual bool | MouseOverIcon () |
Test if mouse position is over an icon. More... | |
Leaf Functions | |
const CStr & | GetName () const |
Get object name, name is unique. More... | |
void | SetName (const CStr &Name) |
Get object name. More... | |
CStr | GetPresentableName () const |
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. More... | |
void | AddChild (IGUIObject *pChild) |
Notice nothing will be returned or thrown if the child hasn't been inputted into the GUI yet. More... | |
Iterate | |
vector_pObjects::iterator | ChildrenItBegin () |
vector_pObjects::iterator | ChildrenItEnd () |
Settings Management | |
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. More... | |
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. More... | |
PSRETURN | SetSetting (const CStr &Setting, const CStrW &Value, const bool &SkipMessage=false) |
Set a setting by string, regardless of what type it is. More... | |
PSRETURN | GetSettingType (const CStr &Setting, EGUISettingType &Type) const |
Retrieves the type of a named setting. More... | |
void | RegisterScriptHandler (const CStr &Action, const CStr &Code, CGUI *pGUI) |
Set the script handler for a particular object-specific action. More... | |
JSObject * | GetJSObject () |
Retrieves the JSObject representing this GUI object. More... | |
Friends | |
class | CGUI |
class | CInternalCGUIAccessorBase |
class | IGUIScrollBar |
class | GUITooltip |
JSBool | JSI_IGUIObject::getProperty (JSContext *cx, JSObject *obj, jsid id, jsval *vp) |
JSBool | JSI_IGUIObject::setProperty (JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp) |
JSBool | JSI_IGUIObject::getComputedSize (JSContext *cx, uintN argc, jsval *vp) |
Called by CGUI and friends | |
Methods that the CGUI will call using its friendship, these should not be called by user. These functions' security are a lot what constitutes the GUI's | |
CRect | m_CachedActualSize |
Cached size, real size m_Size is actually dependent on resolution and can have different real outcomes, this is the real outcome cached to avoid slow calculations in real time. More... | |
virtual void | HandleMessage (SGUIMessage &Message) |
This function is called with different messages for instance when the mouse enters the object. More... | |
CGUI * | GetGUI () |
const CGUI * | GetGUI () const |
void | SetFocus () |
Take focus! More... | |
void | AddSetting (const EGUISettingType &Type, const CStr &Name) |
Add a setting to m_Settings. More... | |
virtual void | Destroy () |
Calls Destroy on all children, and deallocates all memory. More... | |
virtual void | Draw ()=0 |
Draws the object. More... | |
virtual InReaction | ManuallyHandleEvent (const SDL_Event_ *ev) |
Some objects need to handle the SDL_Event_ manually. More... | |
void | LoadStyle (CGUI &GUIinstance, const CStr &StyleName) |
Loads a style. More... | |
void | LoadStyle (const SGUIStyle &Style) |
Loads a style. More... | |
virtual float | GetBufferedZ () const |
Returns not the Z value, but the actual buffered Z value, i.e. More... | |
void | SetGUI (CGUI *const &pGUI) |
void | SetParent (IGUIObject *pParent) |
Set parent of this object. More... | |
virtual void | ResetStates () |
Reset internal state of this object. More... | |
bool | IsFocused () const |
Check if object is focused. More... | |
IGUIObject * | GetParent () const |
NOTE! This will not just return m_pParent, when that is need use it! There is one exception to it, when the parent is the top-node (the object that isn't a real object), this will return NULL, so that the top-node's children are seemingly parentless. More... | |
CPos | GetMousePos () const |
Get Mouse from CGUI. More... | |
virtual bool | HandleAdditionalChildren (const XMBElement &child, CXeromyces *pFile) |
Handle additional children to the <object>-tag. More... | |
InReaction | SendEvent (EGUIMessageType type, const CStr &EventName) |
Send event to this GUI object (HandleMessage and ScriptEvent) More... | |
void | ScriptEvent (const CStr &Action) |
Execute the script for a particular action. More... | |
void | ScriptEvent (const CStr &Action, const CScriptValRooted &Argument) |
Execute the script for a particular action. More... | |
void | SetScriptHandler (const CStr &Action, JSObject *Function) |
void | UpdateMouseOver (IGUIObject *const &pMouseOver) |
Inputes the object that is currently hovered, this function updates this object accordingly (i.e. More... | |
Internal functions | |
CStr | m_Name |
vector_pObjects | m_Children |
IGUIObject * | m_pParent |
double | m_LastClickTime [6] |
bool | m_MouseHovering |
This is an array of true or false, each element is associated with a string representing a setting. More... | |
std::map< CStr, SGUISetting > | m_Settings |
Settings pool, all an object's settings are located here If a derived object has got more settings that the base settings, it's because they have a new version of the function SetupSettings(). More... | |
CGUI * | m_pGUI |
std::map< CStr, JSObject ** > | m_ScriptHandlers |
JSObject * | m_JSObject |
void | ChooseMouseOverAndClosest (IGUIObject *&pObject) |
Inputs a reference pointer, checks if the new inputted object if hovered, if so, then check if this's Z value is greater than the inputted object... More... | |
bool | IsRootObject () const |
PSRETURN | LogInvalidSettings (const CStr8 &Setting) const |
Logs an invalid setting search and returns the correct return result. More... | |
Base settings, all objects possess these settings in their m_BaseSettings Instructions can be found in the documentations.
GUI object such as a button or an input-box. Abstract data type !
Definition at line 140 of file IGUIObject.h.
IGUIObject::IGUIObject | ( | ) |
Definition at line 43 of file IGUIObject.cpp.
|
virtual |
Definition at line 70 of file IGUIObject.cpp.
void IGUIObject::AddChild | ( | IGUIObject * | pChild | ) |
Notice nothing will be returned or thrown if the child hasn't been inputted into the GUI yet.
This is because that's were all is checked. Now we're just linking two objects, but it's when we're inputting them into the GUI we'll check validity! Notice also when adding it to the GUI this function will inevitably have been called by CGUI::AddObject which will catch the throw and return the error code. i.e. The user will never put in the situation wherein a throw must be caught, the GUI's internal error handling will be completely transparent to the interfacially sequential model.
pChild | Child to add |
PSERROR_GUI | from CGUI::UpdateObjects(). |
Definition at line 104 of file IGUIObject.cpp.
|
protected |
Add a setting to m_Settings.
Type | Setting type |
Name | Setting reference name |
Definition at line 172 of file IGUIObject.cpp.
void IGUIObject::AddToPointersMap | ( | map_pObjects & | ObjectMap | ) |
Adds object and its children to the map, it's name being the first part, and the second being itself.
ObjectMap | Adds this to the map_pObjects. |
PSERROR_GUI_ObjectNeedsName | Name is missing |
PSERROR_GUI_NameAmbiguity | Name is already taken |
Definition at line 138 of file IGUIObject.cpp.
|
inline |
Definition at line 225 of file IGUIObject.h.
|
inline |
Definition at line 226 of file IGUIObject.h.
|
private |
Inputs a reference pointer, checks if the new inputted object if hovered, if so, then check if this's Z value is greater than the inputted object...
If so then the object is closer and we'll replace the pointer with this. Also Notice input can be NULL, which means the Z value demand is out. NOTICE you can't input NULL as const so you'll have to set an object to NULL.
pObject | Object pointer, can be either the old one, or the new one. |
Definition at line 303 of file IGUIObject.cpp.
|
protectedvirtual |
Calls Destroy on all children, and deallocates all memory.
MEGA TODO Should it destroy it's children?
Reimplemented in CMiniMap.
Definition at line 161 of file IGUIObject.cpp.
|
protectedpure virtual |
Draws the object.
PSERROR | if any. But this will mostlikely be very rare since if an object is drawn unsuccessfully it'll probably only output in the Error log, and not disrupt the whole GUI drawing. |
Implemented in CGUIDummyObject, CInput, CList, CText, CDropDown, CCheckBox, CButton, CImage, IGUIScrollBarOwner, CProgressBar, CTooltip, and CMiniMap.
|
protectedvirtual |
Returns not the Z value, but the actual buffered Z value, i.e.
if it's defined relative, then it will check its parent's Z value and add the relativity.
Reimplemented in CDropDown.
Definition at line 406 of file IGUIObject.cpp.
|
inline |
Definition at line 388 of file IGUIObject.h.
|
inline |
Definition at line 389 of file IGUIObject.h.
JSObject * IGUIObject::GetJSObject | ( | ) |
Retrieves the JSObject representing this GUI object.
Definition at line 522 of file IGUIObject.cpp.
|
protected |
Get Mouse from CGUI.
Definition at line 207 of file IGUIObject.cpp.
|
inline |
Get object name, name is unique.
Definition at line 181 of file IGUIObject.h.
|
protected |
NOTE! This will not just return m_pParent, when that is need use it! There is one exception to it, when the parent is the top-node (the object that isn't a real object), this will return NULL, so that the top-node's children are seemingly parentless.
Definition at line 323 of file IGUIObject.cpp.
CStr IGUIObject::GetPresentableName | ( | ) | const |
Definition at line 536 of file IGUIObject.cpp.
PSRETURN IGUIObject::GetSettingType | ( | const CStr & | Setting, |
EGUISettingType & | Type | ||
) | const |
Retrieves the type of a named setting.
Setting | Setting by name |
Type | Stores an EGUISettingType |
Definition at line 285 of file IGUIObject.cpp.
|
inlineprotectedvirtual |
Handle additional children to the <object>-tag.
In IGUIObject, this function does nothing. In CList and CDropDown, it handles the <item>, used to build the data.
Returning false means the object doesn't recognize the child. Should be reported. Notice 'false' is default, because an object not using this function, should not have any additional children (and this function should never be called).
Reimplemented in CList.
Definition at line 426 of file IGUIObject.h.
|
inlinevirtual |
This function is called with different messages for instance when the mouse enters the object.
Message | GUI Message |
Reimplemented in CList, CInput, CText, CDropDown, CCheckBox, CProgressBar, IGUIScrollBarOwner, IGUITextOwner, CButton, IGUIButtonBehavior, CRadioButton, CTooltip, and CMiniMap.
Definition at line 322 of file IGUIObject.h.
|
protected |
Check if object is focused.
Definition at line 554 of file IGUIObject.cpp.
|
private |
Definition at line 559 of file IGUIObject.cpp.
|
protected |
Loads a style.
GUIinstance | Reference to the GUI |
StyleName | Style by name |
Definition at line 375 of file IGUIObject.cpp.
|
protected |
|
private |
Logs an invalid setting search and returns the correct return result.
Definition at line 564 of file IGUIObject.cpp.
|
inlineprotectedvirtual |
Some objects need to handle the SDL_Event_ manually.
For instance the input box.
Only the object with focus will have this function called.
Returns either IN_PASS or IN_HANDLED. If IN_HANDLED, then the key won't be passed on and processed by other handlers. This is used for keys that the GUI uses.
Reimplemented in CList, CInput, and CDropDown.
Definition at line 345 of file IGUIObject.h.
|
virtual |
Checks if mouse is hovering this object.
The mouse position is cached in CGUI.
This function checks if the mouse is hovering the rectangle that the base setting "size" makes. Although it is virtual, so one could derive an object from CButton, which changes only this to checking the circle that "size" makes.
Reimplemented in CGUIDummyObject, and CDropDown.
Definition at line 194 of file IGUIObject.cpp.
|
virtual |
Test if mouse position is over an icon.
Reimplemented in IGUITextOwner, and CText.
Definition at line 202 of file IGUIObject.cpp.
void IGUIObject::RegisterScriptHandler | ( | const CStr & | Action, |
const CStr & | Code, | ||
CGUI * | pGUI | ||
) |
Set the script handler for a particular object-specific action.
Action | Name of action |
Code | Javascript code to execute when the action occurs |
pGUI | GUI instance to associate the script with |
Definition at line 430 of file IGUIObject.cpp.
|
inlineprotectedvirtual |
Reset internal state of this object.
Reimplemented in IGUIButtonBehavior, IGUIScrollBarOwner, CInput, CList, CText, CCheckBox, and CButton.
Definition at line 381 of file IGUIObject.h.
|
protected |
Execute the script for a particular action.
Does nothing if no script has been registered for that action. The mouse coordinates will be passed as the first argument.
Action | Name of action |
Definition at line 480 of file IGUIObject.cpp.
|
protected |
Execute the script for a particular action.
Does nothing if no script has been registered for that action.
Action | Name of action |
Argument | Argument to pass to action |
Definition at line 504 of file IGUIObject.cpp.
|
protected |
Send event to this GUI object (HandleMessage and ScriptEvent)
type | Type of GUI message to be handled |
EventName | String representation of event name |
Definition at line 466 of file IGUIObject.cpp.
void IGUIObject::SetFocus | ( | ) |
Take focus!
Definition at line 549 of file IGUIObject.cpp.
|
inlineprotected |
Definition at line 371 of file IGUIObject.h.
|
inline |
Get object name.
Definition at line 184 of file IGUIObject.h.
|
inlineprotected |
Set parent of this object.
Definition at line 376 of file IGUIObject.h.
|
protected |
Definition at line 452 of file IGUIObject.cpp.
PSRETURN IGUIObject::SetSetting | ( | const CStr & | Setting, |
const CStrW & | Value, | ||
const bool & | SkipMessage = false |
||
) |
Set a setting by string, regardless of what type it is.
example a CRect(10,10,20,20) would be "10 10 20 20"
Setting | Setting by name |
Value | Value to set to |
SkipMessage | Does not send a GUIM_SETTINGS_UPDATED if true |
Definition at line 260 of file IGUIObject.cpp.
bool IGUIObject::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.
Setting | setting name |
Definition at line 239 of file IGUIObject.cpp.
|
virtual |
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.
Reimplemented in CInput, and IGUITextOwner.
Definition at line 336 of file IGUIObject.cpp.
|
protected |
Inputes the object that is currently hovered, this function updates this object accordingly (i.e.
if it's the object being inputted one thing happens, and not, another).
pMouseOver | Object that is currently hovered, can OF COURSE be NULL too! |
Definition at line 212 of file IGUIObject.cpp.
|
friend |
Definition at line 142 of file IGUIObject.h.
|
friend |
Definition at line 143 of file IGUIObject.h.
|
friend |
Definition at line 145 of file IGUIObject.h.
|
friend |
Definition at line 144 of file IGUIObject.h.
|
friend |
|
friend |
|
friend |
|
protected |
Cached size, real size m_Size is actually dependent on resolution and can have different real outcomes, this is the real outcome cached to avoid slow calculations in real time.
Definition at line 434 of file IGUIObject.h.
|
protected |
Definition at line 516 of file IGUIObject.h.
|
private |
Definition at line 560 of file IGUIObject.h.
|
protected |
Definition at line 522 of file IGUIObject.h.
|
protected |
This is an array of true or false, each element is associated with a string representing a setting.
Number of elements is equal to number of settings.
A true means the setting has been manually set in the file when read. This is important to know because I don't want to force the user to include its <styles>-XML-files first, so somehow the GUI needs to know which settings were set, and which is meant to
Definition at line 539 of file IGUIObject.h.
|
protected |
Definition at line 512 of file IGUIObject.h.
|
private |
Definition at line 554 of file IGUIObject.h.
|
protected |
Definition at line 519 of file IGUIObject.h.
|
private |
Definition at line 557 of file IGUIObject.h.
std::map<CStr, SGUISetting> IGUIObject::m_Settings |
Settings pool, all an object's settings are located here If a derived object has got more settings that the base settings, it's because they have a new version of the function SetupSettings().
Definition at line 550 of file IGUIObject.h.