#include <CUI_UI.h>
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_Renderer * | GetRenderer () |
| Get the renderer. | |
| virtual const CUI_Registry * | GetRegistry (void) |
| get a pointer to the registry | |
| virtual bool | SetErrorHandler (CUI_ErrorHandler *errh) |
| set the error handler | |
| virtual const CUI_ErrorHandler * | GetErrorHandler (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::FRAMEVECTOR * | FlushRegistryFrames (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_Frame * | GetFrame (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_Shader * | GetShader (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_Font * | GetFont (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_CoordSys * | GetCoordSys (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_Border * | GetBorder (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_Frame * | GetDefaultToolTipFrame () |
| 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< callbackfunc > | CALLBACKLIST |
| a list of callback functions | |
Protected Attributes | |
| FRAMEMAP | m_frames |
| List of children (these are the root frames). | |
| CUI_Frame * | m_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_Frame * | m_selected_p |
| pointer to the selected frame | |
| CUI_Frame * | m_hoverframe |
| The most specific frame under the cursor. | |
| CUI_Frame * | m_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_Renderer * | m_renderer |
| renderer to use | |
| CUI_Registry * | m_registry |
| resource registry | |
| CUI_ErrorHandler * | m_errorHandler |
| error handler | |
| IUI_Shader * | m_defaultShader |
| Default shader. | |
| IUI_Border * | m_defaultBorder |
| Default Border. | |
| CUI_CoordSys * | m_defaultCoordSys |
| Default CoordinateSystem. | |
| IUI_Font * | m_defaultFont |
| Default Font. | |
| CUI_Frame * | m_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) | |
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
|
|
destructor Does not delete frames |
|
||||||||||||||||
|
Load a UI from a buffer.
|
|
|
Load a UI from disk.
|
|
|
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. |
|
|
Render the UI.
|
|
|
Save a UI to disk. Needs to be implemented
|
|
|
Set the active frame. This frame is rendered and processes cursor input
|
|
||||||||||||
|
Set the resolution for the UI. For resolution independent coordinate systems
|
|
||||||||||||||||
|
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.
|
|
|
Update status. Processes cursor events and updates necessary flags |
|
|
List of clickable frames. For handling key input to move around them |
1.3.4