Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

gui
Class CGUI

Singleton
   |
   +--CGUI

   in CGUI.h
   in CGUI.cpp

class CGUI
extends Singleton

The main object that includes the whole GUI. Is singleton and accessed by g_GUI. No interfacial functions throws.


Inner Classes, Typedefs, and Enums
typedef CGUI::ConstructObjectFunction
          
 
Field Summary
private IGUIObject* m_BaseObject
          Base Object, all its children are considered parentless because this is not a real object per se.
private int16_t m_Errors
          
private IGUIObject* m_FocusedObject
          Focused object! Say an input box that is selected.
private std::map< CStr, SGUIIcon > m_Icons
          
private int m_InternalNameNumber
          Number of object that has been given name automatically.
private unsigned int m_MouseButtons
          Used when reading in XML files TODO Gee: Used?
private CPos m_MousePos
          don't want to pass this around with the ChooseMouseOverAndClosest broadcast - we'd need to pack this and pNearest in a struct
private std::map< CStr, CGUI::ConstructObjectFunction > m_ObjectTypes
          Function pointers to functions that constructs IGUIObjects by name.
private map_pObjects m_pAllObjects
          Just pointers for fast name access, each object is really constructed within its parent for easy recursive management.
private std::map< CStr, CColor > m_PreDefinedColors
          This is a bank of custom colors, it is simply a look up table that will return a color object when someone inputs the name of that color.
private JSObject* m_ScriptObject
          An JSObject* under which all GUI JavaScript things will be created, so that they can be garbage-collected when the GUI shuts down.
private std::map< CStr, SGUIScrollBarStyle > m_ScrollBarStyles
          
private std::map< CStr, CGUISprite > m_Sprites
          
private std::map< CStr, SGUIStyle > m_Styles
          
private GUITooltip m_Tooltip
          
 
Constructor Summary
CGUI()
          
~CGUI()
          
 
Method Summary
private void AddObject( IGUIObject* pObject )
          Adds an object to the GUI's object database Private, since you can only add objects through XML files.
 void AddObjectType( const CStr& str, CGUI::ConstructObjectFunction pFunc )
          The GUI needs to have all object types inputted and their constructors.
private IGUIObject* ConstructObject( const CStr& str )
          You input the name of the object type, and let's say you input "button", then it will construct a CGUIObjet* as a CButton.
 void Destroy()
          Clean up, call this to clean up all memory allocated within the GUI.
 void Draw()
          Displays the whole GUI
 void DrawSprite( CGUISpriteInstance& Sprite, int CellID, const float& Z, const CRect& Rect, const CRect& UNUSED( Clipping ) )
          Draw GUI Sprite
 void DrawText( SGUIText& Text, const CColor& DefaultColor, const CPos& pos, const float& z, const CRect& clipping )
          Draw a SGUIText object
 IGUIObject* FindObjectByName( const CStr& Name ) const
          Returns the GUI object with the desired name, or NULL if no match is found,
 SGUIText GenerateText( const CGUIString& Text, const CStr& Font, const float& Width, const float& BufferZone, const IGUIObject* pObject = NULL )
          Generate a SGUIText object from the inputted string.
private IGUIObject* GetFocusedObject()
          Get Focused Object.
 SGUIIcon GetIcon( const CStr& str ) const
          Get Icon (a copy, can never be changed)
 bool GetPreDefinedColor( const CStr& name, CColor& Output )
          Get pre-defined color (if it exists) Returns false if it fails.
 JSObject* GetScriptObject()
          Returns the JSObject* associated with the GUI
 InReaction HandleEvent( const SDL_Event_* ev )
          The replacement of Process(), handles an SDL_Event_
 bool IconExists( const CStr& str ) const
          Check if an icon exists
 void Initialize()
          Initializes the GUI, needs to be called before the GUI is used
 void LoadXmlFile( const string& Filename )
          
 void LoadXmlFile( const std::string& Filename )
          Load a GUI XML file into the GUI.
 bool ObjectExists( const CStr& Name ) const
          Checks if object exists and return true or false accordingly
 void Process()
          Deprecated. Will be removed
private void ReportParseError( const char* str,... )
          Report XML Reading Error, should be called from within the Xerces_* functions.
 void SendEventToAll( const CStr& EventName )
          Sends a specified event to every object
 void TickObjects()
          Performs processing that should happen every frame (including the "Tick" event)
private void UpdateObjects()
          Updates the object pointers, needs to be called each time an object has been added or removed.
 void UpdateResolution()
          Update Resolution, should be called every time the resolution of the OpenGL screen has been changed, this is because it needs to re-cache all its actual sizes Needs no input since screen resolution is global.
private void Xeromyces_ReadColor( XMBElement Element, CXeromyces* pFile )
          Reads in the element (the XMBElement) and stores the result in m_PreDefinedColors
private void Xeromyces_ReadEffects( XMBElement Element, CXeromyces* pFile, SGUIImageEffects& effects )
          
private void Xeromyces_ReadIcon( XMBElement Element, CXeromyces* pFile )
          Reads in the element (the XMBElement) and stores the result in m_Icons.
private void Xeromyces_ReadImage( XMBElement Element, CXeromyces* pFile, CGUISprite& parent )
          Reads in the element (the XMBElement) and stores the result within the CGUISprite.
private void Xeromyces_ReadObject( XMBElement Element, CXeromyces* pFile, IGUIObject* pParent )
          Notice! Recursive function! Read in an (the XMBElement) and stores it as a child in the pParent.
private void Xeromyces_ReadRootObjects( XMBElement Element, CXeromyces* pFile )
          Reads in the root element \ (the DOMElement).
private void Xeromyces_ReadRootSetup( XMBElement Element, CXeromyces* pFile )
          Reads in the root element \ (the DOMElement).
private void Xeromyces_ReadRootSprites( XMBElement Element, CXeromyces* pFile )
          Reads in the root element \ (the DOMElement).
private void Xeromyces_ReadRootStyles( XMBElement Element, CXeromyces* pFile )
          Reads in the root element (the DOMElement).
private void Xeromyces_ReadScript( XMBElement Element, CXeromyces* pFile )
          Reads in the element