Cafu Engine
cf::GuiSys::GuiImplT Class Reference

This class implements a Graphical User Interface (GUI). More...

#include "GuiImpl.hpp"

Inheritance diagram for cf::GuiSys::GuiImplT:

Classes

class  InitErrorT
 A class that is thrown on GUI initialization errors. More...
 

Public Types

enum  InitFlagsT { InitFlag_InlineCode = 1, InitFlag_InGuiEditor = 2 }
 Flags for initializing a GUI from a script. More...
 

Public Member Functions

 GuiImplT (UniScriptStateT &ScriptState, GuiResourcesT &GuiRes)
 Constructor for creating a window hierarchy (=="a GUI") from the GUI script file GuiScriptName. More...
 
 GuiImplT (GuiResourcesT &GuiRes)
 Constructor for creating a window hierarchy (=="a GUI") from the GUI script file GuiScriptName. More...
 
 ~GuiImplT ()
 The destructor. More...
 
void ObsoleteForceKill ()
 A method that is needed when the obsolete, deprecated ctor above is used. More...
 
void LoadScript (const std::string &ScriptName, int Flags=0)
 Assigns the given GUI to the global "gui" and loads the given script in order to initialize it. More...
 
const MaterialManagerImplTGetMaterialManager () const
 Returns the material manager instance of this GUI. More...
 
MatSys::RenderMaterialTGetDefaultRM () const
 Returns the default RenderMaterialT that should be used for borders and backgrounds if no other material is specified for that window. More...
 
MatSys::RenderMaterialTGetPointerRM () const
 Returns the (default) RenderMaterialT for the mouse pointer. More...
 
GuiResourcesTGetGuiResources () const
 Returns the resource provider for fonts and models that are used in this GUI. More...
 
const std::string & GetScriptName () const
 Returns the name of the script file of this GUI. More...
 
UniScriptStateTGetScriptState ()
 Returns the script state of this GUI. More...
 
IntrusivePtrT< WindowTGetRootWindow () const
 Returns the root window of this GUI. More...
 
IntrusivePtrT< WindowTGetFocusWindow () const
 Returns the window in this GUI that has the keyboard input focus. More...
 
void Activate (bool doActivate=true)
 Activates or deactivates this GUI. More...
 
bool GetIsActive () const
 Returns whether this GUI is active or not. This is of importance mainly for the GuiMan, which doesn't send us events and doesn't draw us if we're not active. More...
 
void SetInteractive (bool IsInteractive_=true)
 Sets whether this GUI is interactive or not. See GetIsInteractive() for additional information. More...
 
bool GetIsInteractive () const
 Returns whether this GUI is interactive (reacts to device events) or not. This is of important mainly for the GuiMan, which doesn't send us device events if we are not interactive, and sends device events only to the top-most interactive GUI. More...
 
bool GetIsFullCover () const
 Returns whether this GUI is fullscreen and fully opaque, i.e. whether this GUI covers everything under it. If true, the GuiSys saves the rendering of the GUIs "below" this one. This can improve the GUI performance significantly if e.g. the player is at a point in the game where the world rendering FPS is low. More...
 
void GetMousePos (float &MousePosX_, float &MousePosY_) const
 Returns the position of the mouse cursor. More...
 
void SetMousePos (float MousePosX_, float MousePosY_)
 Sets the position of the mouse cursor. More...
 
float GetMouseCursorSize () const
 Returns the size of the mouse cursor. More...
 
void SetMouseCursorSize (float s)
 Sets the size of the mouse cursor. More...
 
void SetShowMouse (bool ShowMouse_)
 Sets whether this GUI shows a mouse cursor. More...
 
bool IsMouseShown () const
 Returns whether this GUI shows a mouse cursor. More...
 
void Render (bool zLayerCoating=false) const
 Renders this GUI. More...
 
bool ProcessDeviceEvent (const CaKeyboardEventT &KE)
 Processes a keyboard event by forwarding it to the window that currently has the input focus. More...
 
bool ProcessDeviceEvent (const CaMouseEventT &ME)
 Processes a mouse event by forwarding it to the window that currently has the input focus. More...
 
void DistributeClockTickEvents (float t)
 "Creates" a time tick event for each window of the GUI (no matter whether its currently visible (shown) or not) by calling its OnTimeTickEvent() methods. More...
 
const cf::TypeSys::TypeInfoTGetType () const
 
- Public Member Functions inherited from RefCountedT
unsigned int GetRefCount () const
 

Static Public Member Functions

static void InitScriptState (UniScriptStateT &ScriptState)
 Initializes the given script state for use with GuiImplT instances. More...
 
static void * CreateInstance (const cf::TypeSys::CreateParamsT &Params)
 

Static Public Attributes

static const cf::TypeSys::TypeInfoT TypeInfo
 

Additional Inherited Members

- Protected Member Functions inherited from RefCountedT
 RefCountedT (const RefCountedT &)
 
RefCountedToperator= (const RefCountedT &)
 

Detailed Description

This class implements a Graphical User Interface (GUI).

Member Enumeration Documentation

Flags for initializing a GUI from a script.

Enumerator
InitFlag_InlineCode 

Normally, the GuiScriptName parameter to the GuiImplT ctor is a filename. If this is set, it is treated as inline script code.

InitFlag_InGuiEditor 

Whether the GUI is instantiated in the GUI Editor. If set, only the static data will be loaded, initial behaviour is not run.

Constructor & Destructor Documentation

GuiImplT::GuiImplT ( cf::UniScriptStateT ScriptState,
GuiResourcesT GuiRes 
)

Constructor for creating a window hierarchy (=="a GUI") from the GUI script file GuiScriptName.

Parameters
ScriptStateThe caller will use this GUI with this script state (binds the GUI to it).
GuiResThe provider for resources (fonts and models) that are used in this GUI.
GuiImplT::GuiImplT ( GuiResourcesT GuiRes)

Constructor for creating a window hierarchy (=="a GUI") from the GUI script file GuiScriptName.

This constructor is DEPRECATED. It only exists so that code that uses it can be updated to the new constructor at a convenient time. It should not be used in any new code.

Parameters
GuiResThe provider for resources (fonts and models) that are used in this GUI.
GuiImplT::~GuiImplT ( )

The destructor.

Member Function Documentation

void GuiImplT::Activate ( bool  doActivate = true)

Activates or deactivates this GUI.

void GuiImplT::DistributeClockTickEvents ( float  t)

"Creates" a time tick event for each window of the GUI (no matter whether its currently visible (shown) or not) by calling its OnTimeTickEvent() methods.

Parameters
tThe time in seconds since the last clock-tick.
MatSys::RenderMaterialT * GuiImplT::GetDefaultRM ( ) const

Returns the default RenderMaterialT that should be used for borders and backgrounds if no other material is specified for that window.

IntrusivePtrT< WindowT > GuiImplT::GetFocusWindow ( ) const

Returns the window in this GUI that has the keyboard input focus.

GuiResourcesT& cf::GuiSys::GuiImplT::GetGuiResources ( ) const
inline

Returns the resource provider for fonts and models that are used in this GUI.

bool cf::GuiSys::GuiImplT::GetIsActive ( ) const
inline

Returns whether this GUI is active or not. This is of importance mainly for the GuiMan, which doesn't send us events and doesn't draw us if we're not active.

bool cf::GuiSys::GuiImplT::GetIsFullCover ( ) const
inline

Returns whether this GUI is fullscreen and fully opaque, i.e. whether this GUI covers everything under it. If true, the GuiSys saves the rendering of the GUIs "below" this one. This can improve the GUI performance significantly if e.g. the player is at a point in the game where the world rendering FPS is low.

bool cf::GuiSys::GuiImplT::GetIsInteractive ( ) const
inline

Returns whether this GUI is interactive (reacts to device events) or not. This is of important mainly for the GuiMan, which doesn't send us device events if we are not interactive, and sends device events only to the top-most interactive GUI.

const MaterialManagerImplT& cf::GuiSys::GuiImplT::GetMaterialManager ( ) const
inline

Returns the material manager instance of this GUI.

float cf::GuiSys::GuiImplT::GetMouseCursorSize ( ) const
inline

Returns the size of the mouse cursor.

void GuiImplT::GetMousePos ( float &  MousePosX_,
float &  MousePosY_ 
) const

Returns the position of the mouse cursor.

MatSys::RenderMaterialT * GuiImplT::GetPointerRM ( ) const

Returns the (default) RenderMaterialT for the mouse pointer.

IntrusivePtrT< WindowT > GuiImplT::GetRootWindow ( ) const

Returns the root window of this GUI.

const std::string & GuiImplT::GetScriptName ( ) const

Returns the name of the script file of this GUI.

UniScriptStateT& cf::GuiSys::GuiImplT::GetScriptState ( )
inline

Returns the script state of this GUI.

void GuiImplT::InitScriptState ( cf::UniScriptStateT ScriptState)
static

Initializes the given script state for use with GuiImplT instances.

bool cf::GuiSys::GuiImplT::IsMouseShown ( ) const
inline

Returns whether this GUI shows a mouse cursor.

void GuiImplT::LoadScript ( const std::string &  ScriptName,
int  Flags = 0 
)

Assigns the given GUI to the global "gui" and loads the given script in order to initialize it.

Parameters
ScriptNameThe file name of the script to load or inline script code (if InitFlag_InlineCode is set).
FlagsA combination of the flags in InitFlagsT.
Exceptions
Throwsan InitErrorT object on problems initializing the GUI.
void GuiImplT::ObsoleteForceKill ( )

A method that is needed when the obsolete, deprecated ctor above is used.

Without this method, it is impossible to break cycles of IntrusivePtrTs.

bool GuiImplT::ProcessDeviceEvent ( const CaKeyboardEventT KE)

Processes a keyboard event by forwarding it to the window that currently has the input focus.

The GuiMan should make the descision to call this method dependend on the result of the GetIsInteractive() method.

Parameters
KEKeyboard event to process.
Returns
true if the device has been successfully processed, false otherwise.
bool GuiImplT::ProcessDeviceEvent ( const CaMouseEventT ME)

Processes a mouse event by forwarding it to the window that currently has the input focus.

The GuiMan should make the descision to call this method dependend on the result of the GetIsInteractive() method.

Parameters
MEMouse event to process.
Returns
true if the device has been successfully processed, false otherwise.
void GuiImplT::Render ( bool  zLayerCoating = false) const

Renders this GUI.

Note that this method does not setup any of the MatSys's model, view or projection matrices: it's up to the caller to do that.

Parameters
zLayerCoatingWhether a z-layer coating should be applied to the GUI screen when finishing the rendering. This is useful whenever the z-ordering of scene elements can be imperfect, e.g. in the Map Editor. Generally, 3D world GUIs should use true, 2D GUIs should use false.
void GuiImplT::SetInteractive ( bool  IsInteractive_ = true)

Sets whether this GUI is interactive or not. See GetIsInteractive() for additional information.

void cf::GuiSys::GuiImplT::SetMouseCursorSize ( float  s)
inline

Sets the size of the mouse cursor.

void GuiImplT::SetMousePos ( float  MousePosX_,
float  MousePosY_ 
)

Sets the position of the mouse cursor.

void GuiImplT::SetShowMouse ( bool  ShowMouse_)

Sets whether this GUI shows a mouse cursor.


The documentation for this class was generated from the following files: