Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Private Types | Static Private Member Functions | Friends | List of all members
GUI< T > Class Template Reference

Includes static functions that needs one template argument. More...

#include <GUIutil.h>

Inheritance diagram for GUI< T >:
CInternalCGUIAccessorBase

Public Member Functions

template<>
bool ParseColor (const CStrW &Value, CColor &Output, float DefaultAlpha)
 

Static Public Member Functions

static PSRETURN GetSettingPointer (const IGUIObject *pObject, const CStr &Setting, T *&Value)
 
static PSRETURN GetSetting (const IGUIObject *pObject, const CStr &Setting, T &Value)
 Retrieves a setting by name from object pointer. More...
 
static PSRETURN SetSetting (IGUIObject *pObject, const CStr &Setting, const T &Value, const bool &SkipMessage=false)
 Sets a value by name using a real datatype as input. More...
 
static PSRETURN GetSetting (const CGUI &GUIinstance, const CStr &Object, const CStr &Setting, T &Value)
 Retrieves a setting by settings name and object name. More...
 
static PSRETURN SetSetting (CGUI &GUIinstance, const CStr &Object, const CStr &Setting, const T &Value, const bool &SkipMessage=false)
 Sets a value by setting and object name using a real datatype as input. More...
 
static const CGUISpriteInstanceFallBackSprite (const CGUISpriteInstance &prim, const CGUISpriteInstance &sec)
 This will return the value of the first sprite if it's not null, if it is null, it will return the value of the second sprite, if that one is null, then null it is. More...
 
static CColor FallBackColor (const CColor &prim, const CColor &sec)
 Same principle as FallBackSprite. More...
 
static bool ParseString (const CStrW &Value, T &tOutput)
 Sets a value by setting and object name using a real datatype as input. More...
 
static bool ParseColor (const CStrW &Value, CColor &tOutput, float DefaultAlpha)
 

Private Types

typedef void(IGUIObject::* void_Object_pFunction_argT )(const T &arg)
 
typedef void(IGUIObject::* void_Object_pFunction_argRefT )(T &arg)
 
typedef void(IGUIObject::* void_Object_pFunction )()
 

Static Private Member Functions

static void RecurseObject (int RR, IGUIObject *pObject, void_Object_pFunction_argT pFunc, const T &Argument)
 If you want to call a IGUIObject-function on not just an object, but also on ALL of their children you want to use this recursion system. More...
 
static void RecurseObject (int RR, IGUIObject *pObject, void_Object_pFunction_argRefT pFunc, T &Argument)
 Argument is reference. More...
 
static void RecurseObject (int RR, IGUIObject *pObject, void_Object_pFunction pFunc)
 With no argument. More...
 
static bool CheckIfRestricted (int RR, IGUIObject *pObject)
 Checks restrictions for the iteration, for instance if you tell the recursor to avoid all hidden objects, it will, and this function checks a certain object's restriction values. More...
 

Friends

class CGUI
 
class IGUIObject
 
class CInternalCGUIAccessorBase
 

Additional Inherited Members

- Static Protected Member Functions inherited from CInternalCGUIAccessorBase
static IGUIObjectGetObjectPointer (CGUI &GUIinstance, const CStr &Object)
 Get object pointer. More...
 
static const IGUIObjectGetObjectPointer (const CGUI &GUIinstance, const CStr &Object)
 const version More...
 
static void QueryResetting (IGUIObject *pObject)
 Wrapper for ResetStates. More...
 
static void HandleMessage (IGUIObject *pObject, SGUIMessage &message)
 

Detailed Description

template<typename T = int>
class GUI< T >

Includes static functions that needs one template argument.

int is only to please functions that doesn't even use T and are only within this class because it's convenient

Definition at line 103 of file GUIutil.h.

Member Typedef Documentation

template<typename T = int>
typedef void(IGUIObject::* GUI< T >::void_Object_pFunction)()
private

Definition at line 246 of file GUIutil.h.

template<typename T = int>
typedef void(IGUIObject::* GUI< T >::void_Object_pFunction_argRefT)(T &arg)
private

Definition at line 245 of file GUIutil.h.

template<typename T = int>
typedef void(IGUIObject::* GUI< T >::void_Object_pFunction_argT)(const T &arg)
private

Definition at line 244 of file GUIutil.h.

Member Function Documentation

template<typename T = int>
static bool GUI< T >::CheckIfRestricted ( int  RR,
IGUIObject pObject 
)
inlinestaticprivate

Checks restrictions for the iteration, for instance if you tell the recursor to avoid all hidden objects, it will, and this function checks a certain object's restriction values.

Parameters
RRWhat kind of restriction, for instance hidden or disabled
pObjectObject
Returns
true if restricted

Definition at line 341 of file GUIutil.h.

template<typename T = int>
static CColor GUI< T >::FallBackColor ( const CColor prim,
const CColor sec 
)
inlinestatic

Same principle as FallBackSprite.

Parameters
primPrimary color that should be used
secSecondary color if Primary should fail
Returns
Resulting color
See Also
FallBackSprite

Definition at line 215 of file GUIutil.h.

template<typename T = int>
static const CGUISpriteInstance& GUI< T >::FallBackSprite ( const CGUISpriteInstance prim,
const CGUISpriteInstance sec 
)
inlinestatic

This will return the value of the first sprite if it's not null, if it is null, it will return the value of the second sprite, if that one is null, then null it is.

Parameters
primPrimary sprite that should be used
secSecondary sprite if Primary should fail
Returns
Resulting string

Definition at line 200 of file GUIutil.h.

template<typename T >
PSRETURN GUI< T >::GetSetting ( const IGUIObject pObject,
const CStr &  Setting,
T Value 
)
static

Retrieves a setting by name from object pointer.

Parameters
pObjectObject pointer
SettingSetting by name
ValueStores value here, note type T!

Definition at line 344 of file GUIutil.cpp.

template<typename T = int>
static PSRETURN GUI< T >::GetSetting ( const CGUI< T > &  GUIinstance,
const CStr &  Object,
const CStr &  Setting,
T Value 
)
inlinestatic

Retrieves a setting by settings name and object name.

Parameters
GUIinstanceGUI Object const ref
ObjectObject name
SettingSetting by name
ValueStores value here, note type T!

Definition at line 147 of file GUIutil.h.

template<typename T >
template PSRETURN GUI< T >::GetSettingPointer ( const IGUIObject pObject,
const CStr &  Setting,
T *&  Value 
)
static

Definition at line 317 of file GUIutil.cpp.

template<>
bool GUI< int >::ParseColor ( const CStrW &  Value,
CColor Output,
float  DefaultAlpha 
)

Definition at line 96 of file GUIutil.cpp.

template<typename T = int>
static bool GUI< T >::ParseColor ( const CStrW &  Value,
CColor tOutput,
float  DefaultAlpha 
)
static
template<typename T = int>
static bool GUI< T >::ParseString ( const CStrW &  Value,
T tOutput 
)
inlinestatic

Sets a value by setting and object name using a real datatype as input.

This is just a wrapper for __ParseString() which really works the magic.

Parameters
ValueThe value in string form, like "0 0 100% 100%"
tOutputParsed value of type T
Returns
True at success.
See Also
__ParseString()

Definition at line 234 of file GUIutil.h.

template<typename T = int>
static void GUI< T >::RecurseObject ( int  RR,
IGUIObject pObject,
void_Object_pFunction_argT  pFunc,
const T Argument 
)
inlinestaticprivate

If you want to call a IGUIObject-function on not just an object, but also on ALL of their children you want to use this recursion system.

It recurses an object calling a function on itself and all children (and so forth).

Restrictions:
You can also set restrictions, so that if the recursion reaches an objects with certain setup, it just doesn't call the function on the object, nor it's children for that matter. i.e. it cuts that object off from the recursion tree. What setups that can cause restrictions are hardcoded and specific. Check out the defines GUIRR_* for all different setups.

Error reports are either logged or thrown out of RecurseObject. Always use it with try/catch!

Parameters
RRRecurse Restrictions, set to 0 if no restrictions
pObjectTop object, this is where the iteration starts
pFuncFunction to recurse
ArgumentArgument for pFunc of type T
Exceptions
PSERRORDepends on what pFunc might throw. PSERROR is standard. Itself doesn't throw anything.

Definition at line 274 of file GUIutil.h.

template<typename T = int>
static void GUI< T >::RecurseObject ( int  RR,
IGUIObject pObject,
void_Object_pFunction_argRefT  pFunc,
T Argument 
)
inlinestaticprivate

Argument is reference.

See Also
RecurseObject()

Definition at line 295 of file GUIutil.h.

template<typename T = int>
static void GUI< T >::RecurseObject ( int  RR,
IGUIObject pObject,
void_Object_pFunction  pFunc 
)
inlinestaticprivate

With no argument.

See Also
RecurseObject()

Definition at line 315 of file GUIutil.h.

template<typename T >
PSRETURN GUI< T >::SetSetting ( IGUIObject pObject,
const CStr &  Setting,
const T Value,
const bool &  SkipMessage = false 
)
static

Sets a value by name using a real datatype as input.

This is the official way of setting a setting, no other way should only cautiously be used!

Parameters
pObjectObject pointer
SettingSetting by name
ValueSets value to this, note type T!
SkipMessageDoes not send a GUIM_SETTINGS_UPDATED if true

Definition at line 366 of file GUIutil.cpp.

template<typename T = int>
static PSRETURN GUI< T >::SetSetting ( CGUI< T > &  GUIinstance,
const CStr &  Object,
const CStr &  Setting,
const T Value,
const bool &  SkipMessage = false 
)
inlinestatic

Sets a value by setting and object name using a real datatype as input.

This is just a wrapper so that we can type the object name and not input the actual pointer.

Parameters
GUIinstanceGUI Object, reference since we'll be changing values
ObjectObject name
SettingSetting by name
ValueSets value to this, note type T!
SkipMessageDoes not send a GUIM_SETTINGS_UPDATED if true

Definition at line 173 of file GUIutil.h.

Friends And Related Function Documentation

template<typename T = int>
friend class CGUI
friend

Definition at line 106 of file GUIutil.h.

template<typename T = int>
friend class CInternalCGUIAccessorBase
friend

Definition at line 108 of file GUIutil.h.

template<typename T = int>
friend class IGUIObject
friend

Definition at line 107 of file GUIutil.h.


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