Solemnly delete class GUI and rename GUIUtil.h to CGUISetting.h.
Finishes GUIutil rewrite and fixes #5575. Differential Revision: https://code.wildfiregames.com/D2233 Test on: clang 8.0.1, Jenkins This was SVN commit r22801.
This commit is contained in:
parent
0c3a610acc
commit
9c6039e4fe
@ -286,7 +286,7 @@ CGUI::CGUI(const shared_ptr<ScriptRuntime>& runtime)
|
||||
GuiScriptingInit(*m_ScriptInterface);
|
||||
m_ScriptInterface->LoadGlobalScripts();
|
||||
|
||||
m_BaseObject = new CGUIDummyObject(*this);
|
||||
m_BaseObject = new CGUIDummyObject(*this);
|
||||
}
|
||||
|
||||
CGUI::~CGUI()
|
||||
@ -1031,7 +1031,7 @@ void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
||||
else if (attr_name == "size")
|
||||
{
|
||||
CClientArea ca;
|
||||
if (!GUI<CClientArea>::ParseString(this, attr_value, ca))
|
||||
if (!ParseString<CClientArea>(this, attr_value, ca))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
|
||||
else
|
||||
Image->m_Size = ca;
|
||||
@ -1039,7 +1039,7 @@ void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
||||
else if (attr_name == "texture_size")
|
||||
{
|
||||
CClientArea ca;
|
||||
if (!GUI<CClientArea>::ParseString(this, attr_value, ca))
|
||||
if (!ParseString<CClientArea>(this, attr_value, ca))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
|
||||
else
|
||||
Image->m_TextureSize = ca;
|
||||
@ -1047,7 +1047,7 @@ void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
||||
else if (attr_name == "real_texture_placement")
|
||||
{
|
||||
CRect rect;
|
||||
if (!GUI<CRect>::ParseString(this, attr_value, rect))
|
||||
if (!ParseString<CRect>(this, attr_value, rect))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
|
||||
else
|
||||
Image->m_TexturePlacementInFile = rect;
|
||||
@ -1055,7 +1055,7 @@ void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
||||
else if (attr_name == "cell_size")
|
||||
{
|
||||
CSize size;
|
||||
if (!GUI<CSize>::ParseString(this, attr_value, size))
|
||||
if (!ParseString<CSize>(this, attr_value, size))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
|
||||
else
|
||||
Image->m_CellSize = size;
|
||||
@ -1063,7 +1063,7 @@ void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
||||
else if (attr_name == "fixed_h_aspect_ratio")
|
||||
{
|
||||
float val;
|
||||
if (!GUI<float>::ParseString(this, attr_value, val))
|
||||
if (!ParseString<float>(this, attr_value, val))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
|
||||
else
|
||||
Image->m_FixedHAspectRatio = val;
|
||||
@ -1071,7 +1071,7 @@ void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
||||
else if (attr_name == "round_coordinates")
|
||||
{
|
||||
bool b;
|
||||
if (!GUI<bool>::ParseString(this, attr_value, b))
|
||||
if (!ParseString<bool>(this, attr_value, b))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
|
||||
else
|
||||
Image->m_RoundCoordinates = b;
|
||||
@ -1090,25 +1090,25 @@ void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
||||
else if (attr_name == "z_level")
|
||||
{
|
||||
float z_level;
|
||||
if (!GUI<float>::ParseString(this, attr_value, z_level))
|
||||
if (!ParseString<float>(this, attr_value, z_level))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
|
||||
else
|
||||
Image->m_DeltaZ = z_level/100.f;
|
||||
}
|
||||
else if (attr_name == "backcolor")
|
||||
{
|
||||
if (!GUI<CGUIColor>::ParseString(this, attr_value, Image->m_BackColor))
|
||||
if (!ParseString<CGUIColor>(this, attr_value, Image->m_BackColor))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
|
||||
}
|
||||
else if (attr_name == "bordercolor")
|
||||
{
|
||||
if (!GUI<CGUIColor>::ParseString(this, attr_value, Image->m_BorderColor))
|
||||
if (!ParseString<CGUIColor>(this, attr_value, Image->m_BorderColor))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
|
||||
}
|
||||
else if (attr_name == "border")
|
||||
{
|
||||
bool b;
|
||||
if (!GUI<bool>::ParseString(this, attr_value, b))
|
||||
if (!ParseString<bool>(this, attr_value, b))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
|
||||
else
|
||||
Image->m_Border = b;
|
||||
@ -1201,7 +1201,7 @@ void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)
|
||||
else if (attr_name == "show_edge_buttons")
|
||||
{
|
||||
bool b;
|
||||
if (!GUI<bool>::ParseString(this, attr_value.FromUTF8(), b))
|
||||
if (!ParseString<bool>(this, attr_value.FromUTF8(), b))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value);
|
||||
else
|
||||
scrollbar.m_UseEdgeButtons = b;
|
||||
@ -1209,7 +1209,7 @@ void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)
|
||||
else if (attr_name == "width")
|
||||
{
|
||||
float f;
|
||||
if (!GUI<float>::ParseString(this, attr_value.FromUTF8(), f))
|
||||
if (!ParseString<float>(this, attr_value.FromUTF8(), f))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value);
|
||||
else
|
||||
scrollbar.m_Width = f;
|
||||
@ -1217,7 +1217,7 @@ void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)
|
||||
else if (attr_name == "minimum_bar_size")
|
||||
{
|
||||
float f;
|
||||
if (!GUI<float>::ParseString(this, attr_value.FromUTF8(), f))
|
||||
if (!ParseString<float>(this, attr_value.FromUTF8(), f))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value);
|
||||
else
|
||||
scrollbar.m_MinimumBarSize = f;
|
||||
@ -1225,7 +1225,7 @@ void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)
|
||||
else if (attr_name == "maximum_bar_size")
|
||||
{
|
||||
float f;
|
||||
if (!GUI<float>::ParseString(this, attr_value.FromUTF8(), f))
|
||||
if (!ParseString<float>(this, attr_value.FromUTF8(), f))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value);
|
||||
else
|
||||
scrollbar.m_MaximumBarSize = f;
|
||||
@ -1280,7 +1280,7 @@ void CGUI::Xeromyces_ReadIcon(XMBElement Element, CXeromyces* pFile)
|
||||
else if (attr_name == "size")
|
||||
{
|
||||
CSize size;
|
||||
if (!GUI<CSize>::ParseString(this, attr_value.FromUTF8(), size))
|
||||
if (!ParseString<CSize>(this, attr_value.FromUTF8(), size))
|
||||
LOGERROR("Error parsing '%s' (\"%s\") inside <icon>.", attr_name, attr_value);
|
||||
else
|
||||
icon.m_Size = size;
|
||||
@ -1288,7 +1288,7 @@ void CGUI::Xeromyces_ReadIcon(XMBElement Element, CXeromyces* pFile)
|
||||
else if (attr_name == "cell_id")
|
||||
{
|
||||
int cell_id;
|
||||
if (!GUI<int>::ParseString(this, attr_value.FromUTF8(), cell_id))
|
||||
if (!ParseString<int>(this, attr_value.FromUTF8(), cell_id))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\") inside <icon>.", attr_name, attr_value);
|
||||
else
|
||||
icon.m_CellID = cell_id;
|
||||
|
@ -292,7 +292,21 @@ public:
|
||||
*/
|
||||
void SetFocusedObject(IGUIObject* pObject);
|
||||
|
||||
/**
|
||||
* Reads a string value and modifies the given value of type T if successful.
|
||||
* Does not change the value upon conversion failure.
|
||||
*
|
||||
* @param pGUI The GUI page which may contain data relevant to the parsing
|
||||
* (for example predefined colors).
|
||||
* @param Value The value in string form, like "0 0 100% 100%"
|
||||
* @param tOutput Parsed value of type T
|
||||
* @return True at success.
|
||||
*/
|
||||
template <typename T>
|
||||
static bool ParseString(const CGUI* pGUI, const CStrW& Value, T& tOutput);
|
||||
|
||||
private:
|
||||
|
||||
//--------------------------------------------------------
|
||||
/** @name XML Reading Xeromyces specific subroutines
|
||||
*
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "GUIutil.h"
|
||||
#include "CGUISetting.h"
|
||||
|
||||
#include "gui/GUI.h"
|
||||
|
||||
@ -32,7 +32,7 @@ bool CGUISetting<T>::FromString(const CStrW& Value, const bool SendMessage)
|
||||
{
|
||||
T settingValue;
|
||||
|
||||
if (!GUI<T>::ParseString(&m_pObject.GetGUI(), Value, settingValue))
|
||||
if (!CGUI::ParseString<T>(&m_pObject.GetGUI(), Value, settingValue))
|
||||
return false;
|
||||
|
||||
m_pObject.SetSetting<T>(m_Name, settingValue, SendMessage);
|
@ -15,14 +15,16 @@
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_GUIUTIL
|
||||
#define INCLUDED_GUIUTIL
|
||||
#ifndef INCLUDED_CGUISETTINGS
|
||||
#define INCLUDED_CGUISETTINGS
|
||||
|
||||
#include "gui/IGUIObject.h"
|
||||
|
||||
class CGUI;
|
||||
template<typename T> class GUI;
|
||||
|
||||
/**
|
||||
* This setting interface allows GUI objects to call setting function functions without having to know the setting type.
|
||||
* This is fact is used for setting the value from a JS value or XML value (string) and when deleting the setting,
|
||||
* when the type of the setting value is not known in advance.
|
||||
*/
|
||||
class IGUISetting
|
||||
{
|
||||
public:
|
||||
@ -50,8 +52,6 @@ public:
|
||||
template<typename T>
|
||||
class CGUISetting : public IGUISetting
|
||||
{
|
||||
friend class GUI<T>;
|
||||
|
||||
public:
|
||||
NONCOPYABLE(CGUISetting);
|
||||
|
||||
@ -93,21 +93,4 @@ public:
|
||||
T m_pSetting;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class GUI
|
||||
{
|
||||
public:
|
||||
NONCOPYABLE(GUI);
|
||||
|
||||
/**
|
||||
* Sets a value by setting and object name using a real
|
||||
* datatype as input.
|
||||
*
|
||||
* @param Value The value in string form, like "0 0 100% 100%"
|
||||
* @param tOutput Parsed value of type T
|
||||
* @return True at success.
|
||||
*/
|
||||
static bool ParseString(const CGUI* pGUI, const CStrW& Value, T& tOutput);
|
||||
};
|
||||
|
||||
#endif // INCLUDED_GUIUTIL
|
||||
#endif // INCLUDED_CGUISETTINGS
|
@ -146,7 +146,7 @@ void CGUIString::GenerateTextCall(const CGUI& pGUI, SFeedback& Feedback, CStrInt
|
||||
// Displace the sprite
|
||||
CSize displacement;
|
||||
// Parse the value
|
||||
if (!GUI<CSize>::ParseString(&pGUI, tagAttrib.value, displacement))
|
||||
if (!CGUI::ParseString<CSize>(&pGUI, tagAttrib.value, displacement))
|
||||
LOGERROR("Error parsing 'displace' value for tag [ICON]");
|
||||
else
|
||||
SpriteCall.m_Area += displacement;
|
||||
@ -192,7 +192,7 @@ void CGUIString::GenerateTextCall(const CGUI& pGUI, SFeedback& Feedback, CStrInt
|
||||
case TextChunk::Tag::TAG_COLOR:
|
||||
TextCall.m_UseCustomColor = true;
|
||||
|
||||
if (!GUI<CGUIColor>::ParseString(&pGUI, tag.m_TagValue, TextCall.m_Color) && pObject)
|
||||
if (!CGUI::ParseString<CGUIColor>(&pGUI, tag.m_TagValue, TextCall.m_Color) && pObject)
|
||||
LOGERROR("Error parsing the value of a [color]-tag in GUI text when reading object \"%s\".", pObject->GetPresentableName().c_str());
|
||||
break;
|
||||
case TextChunk::Tag::TAG_FONT:
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include "gui/CGUIColor.h"
|
||||
#include "gui/CGUISprite.h"
|
||||
#include "gui/GUIutil.h"
|
||||
#include "graphics/TextRenderer.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "ps/Shapes.h"
|
||||
@ -29,6 +28,7 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
class CGUI;
|
||||
class CGUIString;
|
||||
struct SGenerateTextImage;
|
||||
using SGenerateTextImages = std::array<std::vector<SGenerateTextImage>, 2>;
|
||||
|
@ -208,7 +208,7 @@ bool COList::HandleAdditionalChildren(const XMBElement& child, CXeromyces* pFile
|
||||
|
||||
if (attr_name == "color")
|
||||
{
|
||||
if (!GUI<CGUIColor>::ParseString(&m_pGUI, attr_value.FromUTF8(), column.m_TextColor))
|
||||
if (!CGUI::ParseString<CGUIColor>(&m_pGUI, attr_value.FromUTF8(), column.m_TextColor))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
|
||||
}
|
||||
else if (attr_name == "id")
|
||||
@ -217,13 +217,13 @@ bool COList::HandleAdditionalChildren(const XMBElement& child, CXeromyces* pFile
|
||||
}
|
||||
else if (attr_name == "hidden")
|
||||
{
|
||||
if (!GUI<bool>::ParseString(&m_pGUI, attr_value.FromUTF8(), hidden))
|
||||
if (!CGUI::ParseString<bool>(&m_pGUI, attr_value.FromUTF8(), hidden))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
|
||||
}
|
||||
else if (attr_name == "width")
|
||||
{
|
||||
float width;
|
||||
if (!GUI<float>::ParseString(&m_pGUI, attr_value.FromUTF8(), width))
|
||||
if (!CGUI::ParseString<float>(&m_pGUI, attr_value.FromUTF8(), width))
|
||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
|
||||
else
|
||||
{
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "CGUISeries.h"
|
||||
#include "CGUIText.h"
|
||||
#include "GUIbase.h"
|
||||
#include "GUIutil.h"
|
||||
#include "IGUIButtonBehavior.h"
|
||||
#include "IGUIObject.h"
|
||||
#include "IGUIScrollBarOwner.h" // Required by IGUIScrollBar
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
#include "graphics/ShaderManager.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "gui/CGUI.h"
|
||||
#include "gui/CGUIColor.h"
|
||||
#include "gui/CGUISprite.h"
|
||||
#include "gui/GUIutil.h"
|
||||
#include "gui/GUIMatrix.h"
|
||||
#include "i18n/L10n.h"
|
||||
#include "lib/ogl.h"
|
||||
@ -159,7 +159,7 @@ void GUIRenderer::UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const
|
||||
color = &Image->m_BackColor;
|
||||
|
||||
// Check color is valid
|
||||
if (!GUI<CGUIColor>::ParseString(&pGUI, value, *color))
|
||||
if (!CGUI::ParseString<CGUIColor>(&pGUI, value, *color))
|
||||
{
|
||||
LOGERROR("GUI: Error parsing sprite 'color' (\"%s\")", utf8_from_wstring(value));
|
||||
return;
|
||||
|
@ -17,8 +17,7 @@
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "GUIutil.h"
|
||||
|
||||
#include "gui/CGUI.h"
|
||||
#include "gui/CGUIString.h"
|
||||
#include "ps/CLogger.h"
|
||||
|
||||
@ -26,7 +25,7 @@ class CGUIList;
|
||||
class CGUISeries;
|
||||
|
||||
template <>
|
||||
bool GUI<bool>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, bool& Output)
|
||||
bool CGUI::ParseString<bool>(const CGUI* UNUSED(pGUI), const CStrW& Value, bool& Output)
|
||||
{
|
||||
if (Value == L"true")
|
||||
Output = true;
|
||||
@ -39,28 +38,28 @@ bool GUI<bool>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, bool&
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<i32>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, int& Output)
|
||||
bool CGUI::ParseString<i32>(const CGUI* UNUSED(pGUI), const CStrW& Value, int& Output)
|
||||
{
|
||||
Output = Value.ToInt();
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<u32>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, u32& Output)
|
||||
bool CGUI::ParseString<u32>(const CGUI* UNUSED(pGUI), const CStrW& Value, u32& Output)
|
||||
{
|
||||
Output = Value.ToUInt();
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<float>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, float& Output)
|
||||
bool CGUI::ParseString<float>(const CGUI* UNUSED(pGUI), const CStrW& Value, float& Output)
|
||||
{
|
||||
Output = Value.ToFloat();
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<CRect>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, CRect& Output)
|
||||
bool CGUI::ParseString<CRect>(const CGUI* UNUSED(pGUI), const CStrW& Value, CRect& Output)
|
||||
{
|
||||
const unsigned int NUM_COORDS = 4;
|
||||
float coords[NUM_COORDS];
|
||||
@ -95,19 +94,19 @@ bool GUI<CRect>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, CRect
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<CClientArea>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, CClientArea& Output)
|
||||
bool CGUI::ParseString<CClientArea>(const CGUI* UNUSED(pGUI), const CStrW& Value, CClientArea& Output)
|
||||
{
|
||||
return Output.SetClientArea(Value.ToUTF8());
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<CGUIColor>::ParseString(const CGUI* pGUI, const CStrW& Value, CGUIColor& Output)
|
||||
bool CGUI::ParseString<CGUIColor>(const CGUI* pGUI, const CStrW& Value, CGUIColor& Output)
|
||||
{
|
||||
return Output.ParseString(*pGUI, Value.ToUTF8());
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<CSize>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, CSize& Output)
|
||||
bool CGUI::ParseString<CSize>(const CGUI* UNUSED(pGUI), const CStrW& Value, CSize& Output)
|
||||
{
|
||||
const unsigned int NUM_COORDS = 2;
|
||||
float coords[NUM_COORDS];
|
||||
@ -142,7 +141,7 @@ bool GUI<CSize>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, CSize
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<CPos>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, CPos& Output)
|
||||
bool CGUI::ParseString<CPos>(const CGUI* UNUSED(pGUI), const CStrW& Value, CPos& Output)
|
||||
{
|
||||
const unsigned int NUM_COORDS = 2;
|
||||
float coords[NUM_COORDS];
|
||||
@ -177,7 +176,7 @@ bool GUI<CPos>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, CPos&
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<EAlign>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, EAlign& Output)
|
||||
bool CGUI::ParseString<EAlign>(const CGUI* UNUSED(pGUI), const CStrW& Value, EAlign& Output)
|
||||
{
|
||||
if (Value == L"left")
|
||||
Output = EAlign_Left;
|
||||
@ -192,7 +191,7 @@ bool GUI<EAlign>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, EAli
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<EVAlign>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, EVAlign& Output)
|
||||
bool CGUI::ParseString<EVAlign>(const CGUI* UNUSED(pGUI), const CStrW& Value, EVAlign& Output)
|
||||
{
|
||||
if (Value == L"top")
|
||||
Output = EVAlign_Top;
|
||||
@ -207,41 +206,41 @@ bool GUI<EVAlign>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, EVA
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<CGUIString>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, CGUIString& Output)
|
||||
bool CGUI::ParseString<CGUIString>(const CGUI* UNUSED(pGUI), const CStrW& Value, CGUIString& Output)
|
||||
{
|
||||
Output.SetValue(Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<CStr>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, CStr& Output)
|
||||
bool CGUI::ParseString<CStr>(const CGUI* UNUSED(pGUI), const CStrW& Value, CStr& Output)
|
||||
{
|
||||
Output = Value.ToUTF8();
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<CStrW>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, CStrW& Output)
|
||||
bool CGUI::ParseString<CStrW>(const CGUI* UNUSED(pGUI), const CStrW& Value, CStrW& Output)
|
||||
{
|
||||
Output = Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<CGUISpriteInstance>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& Value, CGUISpriteInstance& Output)
|
||||
bool CGUI::ParseString<CGUISpriteInstance>(const CGUI* UNUSED(pGUI), const CStrW& Value, CGUISpriteInstance& Output)
|
||||
{
|
||||
Output = CGUISpriteInstance(Value.ToUTF8());
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<CGUISeries>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& UNUSED(Value), CGUISeries& UNUSED(Output))
|
||||
bool CGUI::ParseString<CGUISeries>(const CGUI* UNUSED(pGUI), const CStrW& UNUSED(Value), CGUISeries& UNUSED(Output))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GUI<CGUIList>::ParseString(const CGUI* UNUSED(pGUI), const CStrW& UNUSED(Value), CGUIList& UNUSED(Output))
|
||||
bool CGUI::ParseString<CGUIList>(const CGUI* UNUSED(pGUI), const CStrW& UNUSED(Value), CGUIList& UNUSED(Output))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ GUI Object Base - Button Behavior
|
||||
#define INCLUDED_IGUIBUTTONBEHAVIOR
|
||||
|
||||
#include "gui/GUI.h"
|
||||
#include "gui/IGUIObject.h"
|
||||
|
||||
class CGUISpriteInstance;
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "GUI.h"
|
||||
|
||||
#include "gui/CGUISetting.h"
|
||||
#include "gui/scripting/JSInterface_GUITypes.h"
|
||||
#include "gui/scripting/JSInterface_IGUIObject.h"
|
||||
#include "ps/GameSetup/Config.h"
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "gui/CGUI.h"
|
||||
#include "gui/CGUIColor.h"
|
||||
#include "gui/CGUISetting.h"
|
||||
#include "gui/CList.h"
|
||||
#include "gui/GUIManager.h"
|
||||
#include "gui/IGUIObject.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "lib/self_test.h"
|
||||
|
||||
#include "gui/GUIbase.h"
|
||||
#include "gui/GUIutil.h"
|
||||
#include "gui/CGUI.h"
|
||||
#include "ps/CLogger.h"
|
||||
|
||||
class TestGuiParseString : public CxxTest::TestSuite
|
||||
@ -68,12 +68,12 @@ public:
|
||||
TestLogger nolog;
|
||||
CRect test;
|
||||
|
||||
TS_ASSERT(GUI<CRect>::ParseString(nullptr, CStrW(L"0.0 10.0 20.0 30.0"), test));
|
||||
TS_ASSERT(CGUI::ParseString<CRect>(nullptr, CStrW(L"0.0 10.0 20.0 30.0"), test));
|
||||
TS_ASSERT_EQUALS(CRect(0.0, 10.0, 20.0, 30.0), test);
|
||||
|
||||
TS_ASSERT(!GUI<CRect>::ParseString(nullptr, CStrW(L"0 10 20"), test));
|
||||
TS_ASSERT(!GUI<CRect>::ParseString(nullptr, CStrW(L"0 10 20 30 40"), test));
|
||||
TS_ASSERT(!GUI<CRect>::ParseString(nullptr, CStrW(L"0,0 10,0 20,0 30,0"), test));
|
||||
TS_ASSERT(!CGUI::ParseString<CRect>(nullptr, CStrW(L"0 10 20"), test));
|
||||
TS_ASSERT(!CGUI::ParseString<CRect>(nullptr, CStrW(L"0 10 20 30 40"), test));
|
||||
TS_ASSERT(!CGUI::ParseString<CRect>(nullptr, CStrW(L"0,0 10,0 20,0 30,0"), test));
|
||||
}
|
||||
|
||||
void test_size()
|
||||
@ -81,12 +81,12 @@ public:
|
||||
TestLogger nolog;
|
||||
CSize test;
|
||||
|
||||
TS_ASSERT(GUI<CSize>::ParseString(nullptr, CStrW(L"0.0 10.0"), test));
|
||||
TS_ASSERT(CGUI::ParseString<CSize>(nullptr, CStrW(L"0.0 10.0"), test));
|
||||
TS_ASSERT_EQUALS(CSize(0.0, 10.0), test);
|
||||
|
||||
TS_ASSERT(!GUI<CSize>::ParseString(nullptr, CStrW(L"0"), test));
|
||||
TS_ASSERT(!GUI<CSize>::ParseString(nullptr, CStrW(L"0 10 20"), test));
|
||||
TS_ASSERT(!GUI<CSize>::ParseString(nullptr, CStrW(L"0,0 10,0"), test));
|
||||
TS_ASSERT(!CGUI::ParseString<CSize>(nullptr, CStrW(L"0"), test));
|
||||
TS_ASSERT(!CGUI::ParseString<CSize>(nullptr, CStrW(L"0 10 20"), test));
|
||||
TS_ASSERT(!CGUI::ParseString<CSize>(nullptr, CStrW(L"0,0 10,0"), test));
|
||||
}
|
||||
|
||||
void test_pos()
|
||||
@ -94,11 +94,11 @@ public:
|
||||
TestLogger nolog;
|
||||
CPos test;
|
||||
|
||||
TS_ASSERT(GUI<CPos>::ParseString(nullptr, CStrW(L"0.0 10.0"), test));
|
||||
TS_ASSERT(CGUI::ParseString<CPos>(nullptr, CStrW(L"0.0 10.0"), test));
|
||||
TS_ASSERT_EQUALS(CPos(0.0, 10.0), test);
|
||||
|
||||
TS_ASSERT(!GUI<CPos>::ParseString(nullptr, CStrW(L"0"), test));
|
||||
TS_ASSERT(!GUI<CPos>::ParseString(nullptr, CStrW(L"0 10 20"), test));
|
||||
TS_ASSERT(!GUI<CPos>::ParseString(nullptr, CStrW(L"0,0 10,0"), test));
|
||||
TS_ASSERT(!CGUI::ParseString<CPos>(nullptr, CStrW(L"0"), test));
|
||||
TS_ASSERT(!CGUI::ParseString<CPos>(nullptr, CStrW(L"0 10 20"), test));
|
||||
TS_ASSERT(!CGUI::ParseString<CPos>(nullptr, CStrW(L"0,0 10,0"), test));
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user