This class implements a Graphical User Interface (GUI). More...
#include "GuiImpl.hpp"
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 MaterialManagerImplT & | GetMaterialManager () const |
Returns the material manager instance of this GUI. More... | |
MatSys::RenderMaterialT * | GetDefaultRM () const |
Returns the default RenderMaterialT that should be used for borders and backgrounds if no other material is specified for that window. More... | |
MatSys::RenderMaterialT * | GetPointerRM () const |
Returns the (default) RenderMaterialT for the mouse pointer. More... | |
GuiResourcesT & | GetGuiResources () 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... | |
UniScriptStateT & | GetScriptState () |
Returns the script state of this GUI. More... | |
IntrusivePtrT< WindowT > | GetRootWindow () const |
Returns the root window of this GUI. More... | |
IntrusivePtrT< WindowT > | GetFocusWindow () 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::TypeInfoT * | GetType () const |
![]() | |
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 | |
![]() | |
RefCountedT (const RefCountedT &) | |
RefCountedT & | operator= (const RefCountedT &) |
This class implements a Graphical User Interface (GUI).
Flags for initializing a GUI from a script.
Enumerator | |
---|---|
InitFlag_InlineCode |
Normally, the |
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. |
GuiImplT::GuiImplT | ( | cf::UniScriptStateT & | ScriptState, |
GuiResourcesT & | GuiRes | ||
) |
Constructor for creating a window hierarchy (=="a GUI") from the GUI script file GuiScriptName.
ScriptState | The caller will use this GUI with this script state (binds the GUI to it). |
GuiRes | The 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.
GuiRes | The provider for resources (fonts and models) that are used in this GUI. |
GuiImplT::~GuiImplT | ( | ) |
The destructor.
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.
t | The 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.
|
inline |
Returns the resource provider for fonts and models that are used in this GUI.
|
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.
|
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.
|
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.
|
inline |
Returns the material manager instance of this GUI.
|
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.
|
inline |
Returns the script state of this GUI.
|
static |
Initializes the given script state for use with GuiImplT instances.
|
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.
ScriptName | The file name of the script to load or inline script code (if InitFlag_InlineCode is set). |
Flags | A combination of the flags in InitFlagsT. |
Throws | an 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.
KE | Keyboard event to process. |
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.
ME | Mouse event to process. |
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.
zLayerCoating | Whether 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.
|
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.