22 #include "precompiled.h"
39 if (Value == L
"false")
50 Output = Value.ToInt();
57 Output = Value.ToFloat();
75 for (
int i=0; i<4; ++i)
85 Output =
CRect(values[0], values[1], values[2], values[3]);
92 return Output.SetClientArea(Value.ToUTF8());
104 return Output.
ParseString(Value.ToUTF8(), DefaultAlpha);
116 return Output.ParseString(Value.ToUTF8(), 255.f);
180 if (Value == L
"left")
183 if (Value == L
"center")
186 if (Value == L
"right")
200 if (Value == L
"center")
203 if (Value == L
"bottom")
216 Output.SetValue(Value);
224 Output = Value.ToUTF8();
257 m.
Scale(1.0f, -1.f, 1.0f);
261 proj.
SetOrtho(0.f, (
float)
g_xres, 0.f, (
float)g_yres, -1.f, 1000.f);
300 template<> void CheckType<T>(const IGUIObject* obj, const CStr& setting) { \
301 std::map<CStr, SGUISetting>::const_iterator it = obj->m_Settings.find(setting); \
302 if (it == obj->m_Settings.end() || it->second.m_Type != GUIST_##T) \
306 DEBUG_DISPLAY_ERROR(L"FATAL ERROR: Inconsistent types in GUI"); \
316 template <
typename T>
321 std::map<CStr, SGUISetting>::const_iterator it = pObject->
m_Settings.find(Setting);
324 LOGWARNING(L
"setting %hs was not found on object %hs",
330 if (it->second.m_pSetting == NULL)
334 CheckType<T>(pObject, Setting);
338 Value = (
T*)(it->second.m_pSetting);
343 template <
typename T>
347 PSRETURN ret = GetSettingPointer(pObject, Setting, v);
354 template <
typename T>
365 template <
typename T>
367 const T &Value,
const bool& SkipMessage)
373 LOGWARNING(L
"setting %hs was not found on object %hs",
380 CheckType<T>(pObject, Setting);
384 *(
T*)pObject->m_Settings[Setting].m_pSetting = Value;
391 if (Setting ==
"size")
396 if (Setting ==
"hidden")
400 QueryResetting(pObject);
406 HandleMessage(pObject, msg);
414 template PSRETURN GUI<T>::GetSettingPointer(const IGUIObject *pObject, const CStr& Setting, T* &Value); \
415 template PSRETURN GUI<T>::GetSetting(const IGUIObject *pObject, const CStr& Setting, T &Value); \
416 template PSRETURN GUI<T>::SetSetting(IGUIObject *pObject, const CStr& Setting, const T &Value, const bool& SkipMessage);
417 #define GUITYPE_IGNORE_CGUISpriteInstance
419 #undef GUITYPE_IGNORE_CGUISpriteInstance
void Translate(float x, float y, float z)
bool __ParseString< CGUIList >(const CStrW &Value, CGUIList &Output)
virtual void ResetStates()
Reset internal state of this object.
bool __ParseString< CGUIString >(const CStrW &Value, CGUIString &Output)
Made to represent a screen size, should in philosophy be made of unsigned ints, but for the sake of c...
bool __ParseString< EVAlign >(const CStrW &Value, EVAlign &Output)
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
static IGUIObject * GetObjectPointer(CGUI &GUIinstance, const CStr &Object)
Get object pointer.
CMatrix3D GetDefaultGuiMatrix()
bool __ParseString< CRect >(const CStrW &Value, CRect &Output)
const PSRETURN PSRETURN_OK
bool IsBoolTrue(const T &)
bool __ParseString< CColor >(const CStrW &Value, CColor &Output)
static void HandleMessage(IGUIObject *pObject, SGUIMessage &message)
static PSRETURN GetSetting(const IGUIObject *pObject, const CStr &Setting, T &Value)
Retrieves a setting by name from object pointer.
bool __ParseString< CStr >(const CStrW &Value, CStr &Output)
bool __ParseString< CGUISpriteInstance >(const CStrW &Value, CGUISpriteInstance &Output)
bool IsBoolTrue< bool >(const bool &v)
bool GetArgFloat(size_t arg, float &ret)
bool GetPreDefinedColor(const CStr &name, CColor &output)
See CGUI::GetPreDefinedColor; applies to the currently active page.
Base settings, all objects possess these settings in their m_BaseSettings Instructions can be found i...
bool __ParseString< CPos >(const CStrW &Value, CPos &Output)
CStr GetPresentableName() const
bool ParseString(const CStr8 &Value, float DefaultAlpha)
The main object that represents a whole GUI page.
static void QueryResetting(IGUIObject *pObject)
Wrapper for ResetStates.
virtual void UpdateCachedSize()
All sizes are relative to resolution, and the calculation is not wanted in real time, therefore it is cached, update the cached size with this function.
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
bool __ParseString< int >(const CStrW &Value, int &Output)
bool __ParseString< EAlign >(const CStrW &Value, EAlign &Output)
bool __ParseString< CSize >(const CStrW &Value, CSize &Output)
static bool ParseColor(const CStrW &Value, CColor &tOutput, float DefaultAlpha)
std::map< CStr, SGUISetting > m_Settings
Settings pool, all an object's settings are located here If a derived object has got more settings th...
void Scale(float x_scale, float y_scale, float z_scale)
bool __ParseString< float >(const CStrW &Value, float &Output)
#define T(string_literal)
bool __ParseString< bool >(const CStrW &Value, bool &Output)
Made to represent screen positions and delta values.
bool ParseString(const CParser &parser, const std::string &line)
bool __ParseString< CClientArea >(const CStrW &Value, CClientArea &Output)
static CParser & Get(const char *str)
map_pObjects m_pAllObjects
Just pointers for fast name access, each object is really constructed within its parent for easy recu...
bool SettingExists(const CStr &Setting) const
Checks if settings exists, only available for derived classes that has this set up, that's why the base class just returns false.
const PSRETURN PSRETURN_GUI_InvalidSetting
bool __ParseString< CStrW >(const CStrW &Value, CStrW &Output)
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.
void SetOrtho(float l, float r, float b, float t, float n, float f)
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 yo...
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
virtual void HandleMessage(SGUIMessage &Message)
This function is called with different messages for instance when the mouse enters the object...
String class, substitute for CStr, but that parses the tags and builds up a list of all text that wil...
static PSRETURN GetSettingPointer(const IGUIObject *pObject, const CStr &Setting, T *&Value)
Rectangle class used for screen rectangles.
Client Area is a rectangle relative to a parent rectangle.