Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CUI_UI Class Reference

Interface to the entire UI. More...

#include <CUI_UI.h>

List of all members.

Public Types

typedef bool(* callbackfunc )(int id, int numparam, void *param)
 callback function type


Public Member Functions

 CUI_UI (int xres=0, int yres=0, char *file=NULL)
 constructor

virtual ~CUI_UI ()
 destructor

virtual bool UpdateCursor (float x, float y, unsigned short state)
 Update the cursors position and state.

virtual bool ProcessKey (unsigned long key)
 Process an incoming key.

virtual bool SetResolution (unsigned int x, unsigned int y)
 Set the resolution for the UI.

virtual bool SaveUI (char *filename)
 Save a UI to disk.

virtual bool LoadUI (char *filename)
 Load a UI from disk.

virtual bool LoadUI (char *docBytes, unsigned long byteCount, const char *bufferName)
 Load a UI from a buffer.

virtual bool Render (double dtime)
 Render the UI.

virtual bool UpdateStatus ()
 Update status.

virtual bool SetRenderer (IUI_Renderer *renderer)
 Set the renderer.

virtual IUI_RendererGetRenderer ()
 Get the renderer.

virtual const CUI_RegistryGetRegistry (void)
 get a pointer to the registry

virtual bool SetErrorHandler (CUI_ErrorHandler *errh)
 set the error handler

virtual const CUI_ErrorHandlerGetErrorHandler (void)
 get a pointer to the error handler

virtual void ReportError (CUI_ErrorHandler::errorType errtype, char *message)
 process an error

virtual bool Select (CUI_Frame *frame)
 explicitly select a certain frame

virtual bool SelectNext (void)
 select next clickable frame

virtual bool SelectPrevious (void)
 select previous clickable frame

virtual bool AddRootFrame (const char *name, CUI_Frame *frame, callbackfunc callback=NULL)
 Add a root frame to the UI.

virtual bool SetActiveRootFrame (const char *name)
 Set the active frame.

virtual bool SetCallbackFunc (const char *rootname, callbackfunc callback=NULL)
 set the callback function for a specific root frame

virtual bool ActivateFrame (CUI_Frame *frame, bool active)
 activate/deactivate a frame

virtual bool EnableFrame (CUI_Frame *frame, bool enable)
 enable/disable a frame

virtual CUI_Registry::FRAMEVECTORFlushRegistryFrames (CUI_Registry::FRAMEVECTOR *vec=NULL)
 Flush the registry's frames (call-through to registry).

virtual CUI_Registry::SHADERVECTOR * FlushRegistryShaders (CUI_Registry::SHADERVECTOR *vec=NULL)
 Flush the registry's shaders (call-through to registry).

virtual CUI_Registry::FONTVECTOR * FlushRegistryFonts (CUI_Registry::FONTVECTOR *vec=NULL)
 Flush the registry's fonts (call-through to registry).

virtual CUI_Registry::COORDSYSVECTOR * FlushRegistryCoordSys (CUI_Registry::COORDSYSVECTOR *vec=NULL)
 Flush the registry's coordsys (call-through to registry).

virtual CUI_Registry::BORDERVECTOR * FlushRegistryBorders (CUI_Registry::BORDERVECTOR *vec=NULL)
 Flush the registry's borders (call-through to registry).

virtual bool AddFrame (CUI_Frame *frame)
 add a frame - goes through registry

virtual CUI_FrameGetFrame (unsigned long id)
 get a frame - goes through registry

virtual bool AddShader (const char *name, IUI_Shader *shader)
 add a shader - goes through registry

virtual IUI_ShaderGetShader (const char *name)
 get a shader - goes through registry

virtual bool AddFont (const char *name, IUI_Font *font)
 add a font - goes through registry

virtual IUI_FontGetFont (const char *name)
 get a font - goes through registry

virtual bool AddCoordSys (const char *name, CUI_CoordSys *coordsys)
 add a coordinate system - goes through registry

virtual CUI_CoordSysGetCoordSys (const char *name)
 get a coordinate system - goes through registry

virtual bool AddBorder (const char *name, IUI_Border *border)
 add a border - goes through registry

virtual IUI_BorderGetBorder (const char *name)
 get a border - goes through registry

virtual bool CallbackFunc (int id, int numparam, void *param)
 wrapper to global callback function

virtual CUI_FrameGetDefaultToolTipFrame ()
 Get default tooltip frame.

virtual bool SetDefaultToolTipFrame (CUI_Frame *frame)
 Set the default tooltip frame.

virtual bool SetFrameAnimation (bool anim)
 Set frame animation flag.

virtual bool GetFrameAnimation ()
 Get status of frame animation flag.

virtual void Delete (unsigned char *ptr)
 Deleting ui allocated memory (try to use coding style rather than this if possible.


Protected Types

typedef std::map< std::string,
CUI_Frame *, std::less< std::string > > 
FRAMEMAP
typedef std::list< CUI_Frame * > FRAMELIST
typedef std::list< callbackfuncCALLBACKLIST
 a list of callback functions


Protected Attributes

FRAMEMAP m_frames
 List of children (these are the root frames).

CUI_Framem_activeframe
 The currently active frame.

CALLBACKLIST m_callbackList
 the callback functions for the root frames

callbackfunc m_activecallback
 The current button callback function.

FRAMELIST m_clickableFrames
 List of clickable frames.

unsigned int m_selected
 which frame is selected

CUI_Framem_selected_p
 pointer to the selected frame

CUI_Framem_hoverframe
 The most specific frame under the cursor.

CUI_Framem_clickframe
 The most specific frame being clicked on.

float m_cursorx
 X position of the cursor (screen space).

float m_cursory
 Y position of the cursor (screen space).

float m_lastcursorx
 previous X position of the cursor (screen space)

float m_lastcursory
 previous Y position of the cursor (screen space)

unsigned int m_resolutionx
 X resolution of the UI (pixels).

unsigned int m_resolutiony
 Y resolution of the UI (pixels).

unsigned short m_cursorstate
 current cursor button states

IUI_Rendererm_renderer
 renderer to use

CUI_Registrym_registry
 resource registry

CUI_ErrorHandlerm_errorHandler
 error handler

IUI_Shaderm_defaultShader
 Default shader.

IUI_Borderm_defaultBorder
 Default Border.

CUI_CoordSysm_defaultCoordSys
 Default CoordinateSystem.

IUI_Fontm_defaultFont
 Default Font.

CUI_Framem_toolTipFrame
 Default tooltip frame.

bool m_displayToolTip
 Should the tooltip frame be displayed?

bool m_newToolTip
 Is this a different tool tip than last frame?

bool m_frameAnimation
 enable/disable frame animation (using frame counter in Animate() function)


Detailed Description

Interface to the entire UI.

Each root frame denotes a seperate interface. For example, if you wanted to just have a single screen with a single interface, you would only have one root frame. If you wanted to have sub-menus that were seperate screens, you would have a root frame for each. There will be an example application to show how best to handle this.

For now, you have to either build a UI in code and save it, or write one by hand. At somepoint I (or possibly someone else) may write a simple resource editor.

Mouse wheel input can be added later


Constructor & Destructor Documentation

CUI_UI::~CUI_UI  )  [virtual]
 

destructor

Does not delete frames


Member Function Documentation

bool CUI_UI::LoadUI char *  docBytes,
unsigned long  byteCount,
const char *  bufferName
[virtual]
 

Load a UI from a buffer.

Parameters:
docBytes An array ascii text data to be parsed
byteCount The number of bytes in the array
bufferName A name identifier for the buffer (filename it came from)

bool CUI_UI::LoadUI char *  filename  )  [virtual]
 

Load a UI from disk.

Parameters:
filename file to load from

bool CUI_UI::ProcessKey unsigned long  key  )  [virtual]
 

Process an incoming key.

Passes it off to the selected frame (if applicable) and based on the return from that, decides what to do with it.

bool CUI_UI::Render double  dtime  )  [virtual]
 

Render the UI.

Parameters:
dtime current time (for animation)

bool CUI_UI::SaveUI char *  filename  )  [virtual]
 

Save a UI to disk.

Needs to be implemented

Parameters:
filename file to save to

bool CUI_UI::SetActiveRootFrame const char *  name  )  [virtual]
 

Set the active frame.

This frame is rendered and processes cursor input

Parameters:
frame pointer to the frame

bool CUI_UI::SetResolution unsigned int  x,
unsigned int  y
[virtual]
 

Set the resolution for the UI.

For resolution independent coordinate systems

Parameters:
x X resolution (in pixels)
y Y resolution (in pixels)

bool CUI_UI::UpdateCursor float  x,
float  y,
unsigned short  state
[virtual]
 

Update the cursors position and state.

This function assumes that the incoming coordinates are within a coordinate system defined by the resolution of the window with 0,0 in the upper left corner. This is the default for window positions in win32.

Parameters:
x X position in screen space
y Y position in screen space
state Button State
See also:
UI_LBUTTONDOWN

UI_RBUTTONDOWN

UI_MBUTTONDOWN

Returns:
true if a clickable gui element is being clicked on

bool CUI_UI::UpdateStatus  )  [virtual]
 

Update status.

Processes cursor events and updates necessary flags


Member Data Documentation

FRAMELIST CUI_UI::m_clickableFrames [protected]
 

List of clickable frames.

For handling key input to move around them


The documentation for this class was generated from the following files:
Generated on Mon Sep 29 23:07:04 2003 for glGUI by doxygen 1.3.4