|
0 A.D. | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
GUI object such as a button or an input-box. Abstract data type !
Field Summary | |
protected 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. |
protected vector_pObjects |
m_Children
|
private JSObject* |
m_JSObject
|
protected double[ 6 ] |
m_LastClickTime
|
protected bool |
m_MouseHovering
This is an array of true or false, each element is associated with a string representing a setting. |
protected CStr |
m_Name
|
private CGUI* |
m_pGUI
|
protected IGUIObject* |
m_pParent
|
private std::map< CStr, JSObject** > |
m_ScriptHandlers
|
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(). |
Constructor Summary | |
IGUIObject()
|
|
virtual ~IGUIObject()
|
Method Summary | |
void |
AddChild( IGUIObject* pChild )
Notice nothing will be returned or thrown if the child hasn't been inputted into the GUI yet. |
protected void |
AddSetting( const EGUISettingType& Type, const CStr& Name )
Add a setting to m_Settings |
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. |
void |
CheckSettingsValidity()
Should be called every time the settings has been updated will also send a message GUIM_SETTINGS_UPDATED, so that if a derived object wants to add things to be updated, they add it in that message part, this is a better solution than making this virtual, since the updates that the base class does, are the most essential. |
vector_pObjects::iterator |
ChildrenItBegin()
|
vector_pObjects::iterator |
ChildrenItEnd()
|
private 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. |
protected virtual void |
Destroy()
Calls Destroy on all children, and deallocates all memory. |
protected virtual void |
Draw()= 0
Draws the object. |
protected virtual float |
GetBufferedZ() const
Returns not the Z value, but the actual buffered Z value, i. |
protected const CGUI* |
GetGUI() const
|
JSObject* |
GetJSObject()
Retrieves the JSObject representing this GUI object. |
protected CPos |
GetMousePos() const
Get Mouse from CGUI. |
const CStr& |
GetName() const
Get object name |
protected 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. |
CStr |
GetPresentableName() const
|
PS_RESULT |
GetSettingType( const CStr& Setting, EGUISettingType& Type ) const
Retrieves the type of a named setting. |
protected virtual bool |
HandleAdditionalChildren( const XMBElement& UNUSED( child ), CXeromyces* UNUSED( pFile ) )
Handle additional children to the |
protected virtual void |
HandleMessage( const SGUIMessage& UNUSED( Message ) )
This function is called with different messages for instance when the mouse enters the object. |
protected bool |
IsFocused() const
Check if object is focused. |
private bool |
IsRootObject() const
|
protected void |
LoadStyle( CGUI& GUIinstance, const CStr& StyleName )
Loads a style. |
protected void |
LoadStyle( const SGUIStyle& Style )
Loads a style. |
protected virtual InReaction |
ManuallyHandleEvent( const SDL_Event_* UNUSED( ev ) )
Some objects need to handle the SDL_Event_ manually. |
virtual bool |
MouseOver()
Get object name, name is unique |
void |
RegisterScriptHandler( const CStr& Action, const CStr& Code, CGUI* pGUI )
Set the script handler for a particular object-specific action |
protected virtual void |
ResetStates()
|
protected void |
ScriptEvent( const CStr& Action )
Execute the script for a particular action. |
protected void |
SetFocus()
Take focus! |
protected void |
SetGUI( CGUI* const& pGUI )
|
void |
SetName( const CStr& Name )
|
protected void |
SetParent( IGUIObject* pParent )
|
protected void |
SetScriptHandler( const CStr& Action, JSObject* Function )
|
PS_RESULT |
SetSetting( const CStr& Setting, const CStr& Value, const bool& SkipMessage = false )
Set a setting by string, regardless of what type it is. |
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 |
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. |
private void |
UpdateMouseOver( IGUIObject* const& pMouseOver )
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). |
Field Detail |
protected CRect m_CachedActualSize;
protected vector_pObjects m_Children;
private JSObject* m_JSObject;
protected double m_LastClickTime[ 6 ];
protected bool m_MouseHovering;
protected CStr m_Name;
private CGUI* m_pGUI;
protected IGUIObject* m_pParent;
private std::map< CStr, JSObject** > m_ScriptHandlers;
public std::map< CStr, SGUISetting > m_Settings;
SetupSettings()
Constructor Detail |
public IGUIObject();
public virtual ~IGUIObject();
Method Detail |
public void AddChild( IGUIObject* pChild );
pChild
- Child to addPS_RESULT
- from CGUI::UpdateObjects().protected void AddSetting( const EGUISettingType& Type, const CStr& Name );
Type
- Setting type
Name
- Setting reference namepublic void AddToPointersMap( map_pObjects& ObjectMap );
ObjectMap
- Adds this to the map_pObjects.PS_NEEDS_NAME
- Name is missing
PS_NAME_AMBIGUITY
- Name is already takenpublic void CheckSettingsValidity();
TODO
- not quite settled yet.public vector_pObjects::iterator ChildrenItBegin();
public vector_pObjects::iterator ChildrenItEnd();
private void ChooseMouseOverAndClosest( IGUIObject*& pObject );
pObject
- Object pointer, can be either the old one, or
the new one.protected virtual void Destroy();
protected virtual void Draw()= 0;
PS_RESULT
- 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.protected virtual float GetBufferedZ() const;
protected const CGUI* GetGUI() const;
public JSObject* GetJSObject();
protected CPos GetMousePos() const;
public const CStr& GetName() const;
protected IGUIObject* GetParent() const;
public CStr GetPresentableName() const;
public PS_RESULT GetSettingType( const CStr& Setting, EGUISettingType& Type ) const;
Setting
- Setting by name
Type
- Stores an EGUISettingTypeprotected virtual bool HandleAdditionalChildren( const XMBElement& UNUSED( child ), CXeromyces* UNUSED( pFile ) );
protected virtual void HandleMessage( const SGUIMessage& UNUSED( Message ) );
Message
- GUI Messageprotected bool IsFocused() const;
private bool IsRootObject() const;
protected void LoadStyle( CGUI& GUIinstance, const CStr& StyleName );
GUIinstance
- Reference to the GUI
StyleName
- Style by nameprotected void LoadStyle( const SGUIStyle& Style );
Style
- The style object.protected virtual InReaction ManuallyHandleEvent( const SDL_Event_* UNUSED( ev ) );
public virtual bool MouseOver();
public void RegisterScriptHandler( const CStr& Action, const CStr& Code, CGUI* pGUI );
Action
- Name of action
Code
- Javascript code to execute when the action occurs
pGUI
- GUI instance to associate the script withprotected virtual void ResetStates();
protected void ScriptEvent( const CStr& Action );
Action
- Name of actionprotected void SetFocus();
protected void SetGUI( CGUI* const& pGUI );
public void SetName( const CStr& Name );
protected void SetParent( IGUIObject* pParent );
protected void SetScriptHandler( const CStr& Action, JSObject* Function );
public PS_RESULT SetSetting( const CStr& Setting, const CStr& Value, const bool& SkipMessage = false );
Setting
- Setting by name
Value
- Value to set topublic bool SettingExists( const CStr& Setting ) const;
Setting
- setting namepublic void UpdateCachedSize();
private void UpdateMouseOver( IGUIObject* const& pMouseOver );
pMouseOver
- Object that is currently hovered,
can OF COURSE be NULL too!
|
0 A.D.
Generated on September 04, 2007 at 18:13 CppDoc v2.4.0 |
|||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |