2019-07-26 11:57:28 -07:00
|
|
|
/* Copyright (C) 2019 Wildfire Games.
|
2009-04-18 10:00:33 -07:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
|
*
|
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2004-06-03 11:38:14 -07:00
|
|
|
#include "precompiled.h"
|
2015-08-21 10:08:41 -07:00
|
|
|
|
2019-07-26 11:57:28 -07:00
|
|
|
#include "GUIutil.h"
|
2005-02-04 23:25:16 -08:00
|
|
|
|
2019-07-26 11:57:28 -07:00
|
|
|
#include "gui/GUI.h"
|
|
|
|
|
#include "gui/GUIManager.h"
|
2009-09-27 08:04:46 -07:00
|
|
|
#include "ps/CLogger.h"
|
2003-11-05 16:21:45 -08:00
|
|
|
|
2019-08-03 19:20:08 -07:00
|
|
|
template<typename T>
|
|
|
|
|
CGUISetting<T>::CGUISetting(IGUIObject& pObject, const CStr& Name)
|
|
|
|
|
: m_pSetting(T()), m_Name(Name), m_pObject(pObject)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
bool CGUISetting<T>::FromString(const CStrW& Value, const bool& SkipMessage)
|
|
|
|
|
{
|
|
|
|
|
T settingValue;
|
|
|
|
|
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
if (!GUI<T>::ParseString(m_pObject.GetGUI(), Value, settingValue))
|
2019-08-03 19:20:08 -07:00
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
GUI<T>::SetSetting(&m_pObject, m_Name, settingValue, SkipMessage);
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
template<>
|
|
|
|
|
bool CGUISetting<CGUIColor>::FromJSVal(JSContext* cx, JS::HandleValue Value)
|
|
|
|
|
{
|
|
|
|
|
CGUIColor settingValue;
|
|
|
|
|
if (Value.isString())
|
|
|
|
|
{
|
|
|
|
|
CStr name;
|
|
|
|
|
if (!ScriptInterface::FromJSVal(cx, Value, name))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (!settingValue.ParseString(m_pObject.GetGUI(), name))
|
|
|
|
|
{
|
|
|
|
|
JS_ReportError(cx, "Invalid color '%s'", name.c_str());
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!ScriptInterface::FromJSVal<CColor>(cx, Value, settingValue))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
GUI<CGUIColor>::SetSetting(&m_pObject, m_Name, settingValue);
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
|
2019-08-03 19:20:08 -07:00
|
|
|
template<typename T>
|
|
|
|
|
bool CGUISetting<T>::FromJSVal(JSContext* cx, JS::HandleValue Value)
|
|
|
|
|
{
|
|
|
|
|
T settingValue;
|
|
|
|
|
if (!ScriptInterface::FromJSVal<T>(cx, Value, settingValue))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
GUI<T>::SetSetting(&m_pObject, m_Name, settingValue);
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
void CGUISetting<T>::ToJSVal(JSContext* cx, JS::MutableHandleValue Value)
|
|
|
|
|
{
|
|
|
|
|
ScriptInterface::ToJSVal<T>(cx, Value, m_pSetting);
|
|
|
|
|
};
|
|
|
|
|
|
2004-05-28 21:06:50 -07:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<bool>(const CGUI* UNUSED(pGUI), const CStrW& Value, bool& Output)
|
2004-05-28 21:06:50 -07:00
|
|
|
{
|
2010-05-30 06:11:32 -07:00
|
|
|
if (Value == L"true")
|
2004-05-28 21:06:50 -07:00
|
|
|
Output = true;
|
2015-08-21 10:08:41 -07:00
|
|
|
else if (Value == L"false")
|
2004-05-28 21:06:50 -07:00
|
|
|
Output = false;
|
2015-08-21 10:08:41 -07:00
|
|
|
else
|
2004-05-28 21:06:50 -07:00
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<int>(const CGUI* UNUSED(pGUI), const CStrW& Value, int& Output)
|
2004-05-28 21:06:50 -07:00
|
|
|
{
|
|
|
|
|
Output = Value.ToInt();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-25 14:26:31 -08:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<u32>(const CGUI* UNUSED(pGUI), const CStrW& Value, u32& Output)
|
2018-02-25 14:26:31 -08:00
|
|
|
{
|
|
|
|
|
Output = Value.ToUInt();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-28 21:06:50 -07:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<float>(const CGUI* UNUSED(pGUI), const CStrW& Value, float& Output)
|
2004-05-28 21:06:50 -07:00
|
|
|
{
|
|
|
|
|
Output = Value.ToFloat();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<CRect>(const CGUI* UNUSED(pGUI), const CStrW& Value, CRect& Output)
|
2004-05-28 21:06:50 -07:00
|
|
|
{
|
2014-05-24 20:16:52 -07:00
|
|
|
const unsigned int NUM_COORDS = 4;
|
|
|
|
|
float coords[NUM_COORDS];
|
|
|
|
|
std::wstringstream stream;
|
|
|
|
|
stream.str(Value);
|
|
|
|
|
// Parse each coordinate
|
2015-08-21 10:08:41 -07:00
|
|
|
for (unsigned int i = 0; i < NUM_COORDS; ++i)
|
2004-05-28 21:06:50 -07:00
|
|
|
{
|
2014-05-24 20:16:52 -07:00
|
|
|
if (stream.eof())
|
|
|
|
|
{
|
2015-01-22 12:36:24 -08:00
|
|
|
LOGWARNING("Too few CRect parameters (min %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
2014-05-24 20:16:52 -07:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
stream >> coords[i];
|
|
|
|
|
if ((stream.rdstate() & std::wstringstream::failbit) != 0)
|
2004-05-28 21:06:50 -07:00
|
|
|
{
|
2015-01-22 12:36:24 -08:00
|
|
|
LOGWARNING("Unable to parse CRect parameters. Your input: '%s'", Value.ToUTF8().c_str());
|
2004-05-28 21:06:50 -07:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-24 20:16:52 -07:00
|
|
|
if (!stream.eof())
|
|
|
|
|
{
|
2015-01-22 12:36:24 -08:00
|
|
|
LOGWARNING("Too many CRect parameters (max %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
2014-05-24 20:16:52 -07:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-28 21:06:50 -07:00
|
|
|
// Finally the rectangle values
|
2014-05-24 20:16:52 -07:00
|
|
|
Output = CRect(coords[0], coords[1], coords[2], coords[3]);
|
|
|
|
|
|
2004-05-28 21:06:50 -07:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<CClientArea>(const CGUI* UNUSED(pGUI), const CStrW& Value, CClientArea& Output)
|
2004-05-28 21:06:50 -07:00
|
|
|
{
|
2011-02-17 12:08:20 -08:00
|
|
|
return Output.SetClientArea(Value.ToUTF8());
|
2004-05-28 21:06:50 -07:00
|
|
|
}
|
|
|
|
|
|
2005-01-03 14:23:27 -08:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<CGUIColor>(const CGUI* pGUI, const CStrW& Value, CGUIColor& Output)
|
2005-01-03 14:23:27 -08:00
|
|
|
{
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
return Output.ParseString(pGUI, Value.ToUTF8());
|
2005-01-03 14:23:27 -08:00
|
|
|
}
|
|
|
|
|
|
2004-08-30 19:09:58 -07:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<CSize>(const CGUI* UNUSED(pGUI), const CStrW& Value, CSize& Output)
|
2004-08-30 19:09:58 -07:00
|
|
|
{
|
2014-05-24 20:16:52 -07:00
|
|
|
const unsigned int NUM_COORDS = 2;
|
|
|
|
|
float coords[NUM_COORDS];
|
|
|
|
|
std::wstringstream stream;
|
|
|
|
|
stream.str(Value);
|
|
|
|
|
// Parse each coordinate
|
2015-08-21 10:08:41 -07:00
|
|
|
for (unsigned int i = 0; i < NUM_COORDS; ++i)
|
2004-08-30 19:09:58 -07:00
|
|
|
{
|
2014-05-24 20:16:52 -07:00
|
|
|
if (stream.eof())
|
|
|
|
|
{
|
2015-01-22 12:36:24 -08:00
|
|
|
LOGWARNING("Too few CSize parameters (min %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
2014-05-24 20:16:52 -07:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
stream >> coords[i];
|
|
|
|
|
if ((stream.rdstate() & std::wstringstream::failbit) != 0)
|
|
|
|
|
{
|
2015-01-22 12:36:24 -08:00
|
|
|
LOGWARNING("Unable to parse CSize parameters. Your input: '%s'", Value.ToUTF8().c_str());
|
2014-05-24 20:16:52 -07:00
|
|
|
return false;
|
|
|
|
|
}
|
2004-08-30 19:09:58 -07:00
|
|
|
}
|
|
|
|
|
|
2014-05-24 20:16:52 -07:00
|
|
|
Output.cx = coords[0];
|
|
|
|
|
Output.cy = coords[1];
|
2004-08-30 19:09:58 -07:00
|
|
|
|
2014-05-24 20:16:52 -07:00
|
|
|
if (!stream.eof())
|
2004-08-30 19:09:58 -07:00
|
|
|
{
|
2015-01-22 12:36:24 -08:00
|
|
|
LOGWARNING("Too many CSize parameters (max %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
2004-08-30 19:09:58 -07:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-21 05:37:24 -08:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<CPos>(const CGUI* UNUSED(pGUI), const CStrW& Value, CPos& Output)
|
2004-12-21 05:37:24 -08:00
|
|
|
{
|
2014-05-24 20:16:52 -07:00
|
|
|
const unsigned int NUM_COORDS = 2;
|
|
|
|
|
float coords[NUM_COORDS];
|
|
|
|
|
std::wstringstream stream;
|
|
|
|
|
stream.str(Value);
|
|
|
|
|
// Parse each coordinate
|
2015-08-21 10:08:41 -07:00
|
|
|
for (unsigned int i = 0; i < NUM_COORDS; ++i)
|
2014-05-24 20:16:52 -07:00
|
|
|
{
|
|
|
|
|
if (stream.eof())
|
|
|
|
|
{
|
2015-01-22 12:36:24 -08:00
|
|
|
LOGWARNING("Too few CPos parameters (min %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
2014-05-24 20:16:52 -07:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
stream >> coords[i];
|
|
|
|
|
if ((stream.rdstate() & std::wstringstream::failbit) != 0)
|
|
|
|
|
{
|
2015-01-22 12:36:24 -08:00
|
|
|
LOGWARNING("Unable to parse CPos parameters. Your input: '%s'", Value.ToUTF8().c_str());
|
2014-05-24 20:16:52 -07:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-04-19 12:43:05 -07:00
|
|
|
|
2014-05-24 20:16:52 -07:00
|
|
|
Output.x = coords[0];
|
|
|
|
|
Output.y = coords[1];
|
2010-04-19 12:43:05 -07:00
|
|
|
|
2014-05-24 20:16:52 -07:00
|
|
|
if (!stream.eof())
|
|
|
|
|
{
|
2015-01-22 12:36:24 -08:00
|
|
|
LOGWARNING("Too many CPos parameters (max %i). Your input: '%s'", NUM_COORDS, Value.ToUTF8().c_str());
|
2004-12-21 05:37:24 -08:00
|
|
|
return false;
|
2014-05-24 20:16:52 -07:00
|
|
|
}
|
2010-04-19 12:43:05 -07:00
|
|
|
|
|
|
|
|
return true;
|
2004-12-21 05:37:24 -08:00
|
|
|
}
|
|
|
|
|
|
2004-09-01 20:02:32 -07:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<EAlign>(const CGUI* UNUSED(pGUI), const CStrW& Value, EAlign& Output)
|
2004-09-01 20:02:32 -07:00
|
|
|
{
|
2010-05-30 06:11:32 -07:00
|
|
|
if (Value == L"left")
|
2004-09-01 20:02:32 -07:00
|
|
|
Output = EAlign_Left;
|
2015-08-21 10:08:41 -07:00
|
|
|
else if (Value == L"center")
|
2004-09-01 20:02:32 -07:00
|
|
|
Output = EAlign_Center;
|
2015-08-21 10:08:41 -07:00
|
|
|
else if (Value == L"right")
|
2004-09-01 20:02:32 -07:00
|
|
|
Output = EAlign_Right;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<EVAlign>(const CGUI* UNUSED(pGUI), const CStrW& Value, EVAlign& Output)
|
2004-09-01 20:02:32 -07:00
|
|
|
{
|
2010-05-30 06:11:32 -07:00
|
|
|
if (Value == L"top")
|
2004-09-01 20:02:32 -07:00
|
|
|
Output = EVAlign_Top;
|
2015-08-21 10:08:41 -07:00
|
|
|
else if (Value == L"center")
|
2004-09-01 20:02:32 -07:00
|
|
|
Output = EVAlign_Center;
|
2015-08-21 10:08:41 -07:00
|
|
|
else if (Value == L"bottom")
|
2004-09-01 20:02:32 -07:00
|
|
|
Output = EVAlign_Bottom;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-28 21:06:50 -07:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<CGUIString>(const CGUI* UNUSED(pGUI), const CStrW& Value, CGUIString& Output)
|
2004-05-28 21:06:50 -07:00
|
|
|
{
|
2010-05-30 06:11:32 -07:00
|
|
|
Output.SetValue(Value);
|
2004-05-28 21:06:50 -07:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-16 16:05:37 -08:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<CStr>(const CGUI* UNUSED(pGUI), const CStrW& Value, CStr& Output)
|
2004-12-16 16:05:37 -08:00
|
|
|
{
|
2011-02-17 12:08:20 -08:00
|
|
|
Output = Value.ToUTF8();
|
2004-12-16 16:05:37 -08:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-14 03:09:26 -07:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<CStrW>(const CGUI* UNUSED(pGUI), const CStrW& Value, CStrW& Output)
|
2004-10-14 03:09:26 -07:00
|
|
|
{
|
2010-05-30 06:11:32 -07:00
|
|
|
Output = Value;
|
2004-10-14 03:09:26 -07:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-15 13:24:46 -08:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<CGUISpriteInstance>(const CGUI* UNUSED(pGUI), const CStrW& Value, CGUISpriteInstance& Output)
|
2004-12-15 13:24:46 -08:00
|
|
|
{
|
2011-02-17 12:08:20 -08:00
|
|
|
Output = CGUISpriteInstance(Value.ToUTF8());
|
2004-12-15 13:24:46 -08:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-23 16:20:50 -07:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<CGUIList>(const CGUI* UNUSED(pGUI), const CStrW& UNUSED(Value), CGUIList& UNUSED(Output))
|
2005-04-23 16:20:50 -07:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-07 11:03:54 -08:00
|
|
|
template <>
|
Delete wrongful proxy CGUIManager::GetPreDefinedColor from f0d9806b3f.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
2019-08-13 11:00:41 -07:00
|
|
|
bool __ParseString<CGUISeries>(const CGUI* UNUSED(pGUI), const CStrW& UNUSED(Value), CGUISeries& UNUSED(Output))
|
2016-12-07 11:03:54 -08:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-04-23 16:20:50 -07:00
|
|
|
|
2004-12-16 16:05:37 -08:00
|
|
|
template <typename T>
|
2015-08-21 10:08:41 -07:00
|
|
|
PSRETURN GUI<T>::GetSettingPointer(const IGUIObject* pObject, const CStr& Setting, T*& Value)
|
2004-12-16 16:05:37 -08:00
|
|
|
{
|
2011-04-30 06:01:45 -07:00
|
|
|
ENSURE(pObject != NULL);
|
2004-12-16 16:05:37 -08:00
|
|
|
|
2019-08-03 19:20:08 -07:00
|
|
|
std::map<CStr, IGUISetting*>::const_iterator it = pObject->m_Settings.find(Setting);
|
2007-06-15 10:03:26 -07:00
|
|
|
if (it == pObject->m_Settings.end())
|
2009-09-27 08:04:46 -07:00
|
|
|
{
|
2015-08-21 10:08:41 -07:00
|
|
|
LOGWARNING("setting %s was not found on object %s",
|
2009-09-27 08:04:46 -07:00
|
|
|
Setting.c_str(),
|
|
|
|
|
pObject->GetPresentableName().c_str());
|
|
|
|
|
return PSRETURN_GUI_InvalidSetting;
|
|
|
|
|
}
|
2004-12-16 16:05:37 -08:00
|
|
|
|
2019-08-03 19:20:08 -07:00
|
|
|
if (it->second == nullptr)
|
2009-09-27 08:04:46 -07:00
|
|
|
return PSRETURN_GUI_InvalidSetting;
|
2004-12-16 16:05:37 -08:00
|
|
|
|
|
|
|
|
// Get value
|
2019-08-03 19:20:08 -07:00
|
|
|
Value = &(static_cast<CGUISetting<T>* >(it->second)->m_pSetting);
|
2004-12-16 16:05:37 -08:00
|
|
|
|
2009-09-27 08:04:46 -07:00
|
|
|
return PSRETURN_OK;
|
2004-12-16 16:05:37 -08:00
|
|
|
}
|
|
|
|
|
|
2019-08-19 03:32:29 -07:00
|
|
|
template <typename T>
|
|
|
|
|
bool GUI<T>::HasSetting(const IGUIObject* pObject, const CStr& Setting)
|
|
|
|
|
{
|
|
|
|
|
return pObject->m_Settings.count(Setting) != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
T& GUI<T>::GetSetting(const IGUIObject* pObject, const CStr& Setting)
|
|
|
|
|
{
|
|
|
|
|
return static_cast<CGUISetting<T>* >(pObject->m_Settings.at(Setting))->m_pSetting;
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-16 16:05:37 -08:00
|
|
|
template <typename T>
|
2015-08-21 10:08:41 -07:00
|
|
|
PSRETURN GUI<T>::GetSetting(const IGUIObject* pObject, const CStr& Setting, T& Value)
|
2004-12-16 16:05:37 -08:00
|
|
|
{
|
2010-02-03 11:43:39 -08:00
|
|
|
T* v = NULL;
|
2009-09-27 08:04:46 -07:00
|
|
|
PSRETURN ret = GetSettingPointer(pObject, Setting, v);
|
|
|
|
|
if (ret == PSRETURN_OK)
|
2004-12-16 16:05:37 -08:00
|
|
|
Value = *v;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-28 15:40:58 -07:00
|
|
|
template <typename T>
|
|
|
|
|
PSRETURN GUI<T>::SetSetting(IGUIObject* pObject, const CStr& Setting, T& Value, const bool& SkipMessage)
|
|
|
|
|
{
|
|
|
|
|
return SetSettingWrap(pObject, Setting, Value, SkipMessage,
|
|
|
|
|
[&pObject, &Setting, &Value]() {
|
2019-08-03 19:20:08 -07:00
|
|
|
static_cast<CGUISetting<T>* >(pObject->m_Settings[Setting])->m_pSetting = std::move(Value);
|
2019-07-28 15:40:58 -07:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
PSRETURN GUI<T>::SetSetting(IGUIObject* pObject, const CStr& Setting, const T& Value, const bool& SkipMessage)
|
|
|
|
|
{
|
|
|
|
|
return SetSettingWrap(pObject, Setting, Value, SkipMessage,
|
|
|
|
|
[&pObject, &Setting, &Value]() {
|
2019-08-03 19:20:08 -07:00
|
|
|
static_cast<CGUISetting<T>* >(pObject->m_Settings[Setting])->m_pSetting = Value;
|
2019-07-28 15:40:58 -07:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-27 11:20:34 -08:00
|
|
|
// Helper function for SetSetting
|
|
|
|
|
template <typename T>
|
|
|
|
|
bool IsBoolTrue(const T&)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
template <>
|
|
|
|
|
bool IsBoolTrue<bool>(const bool& v)
|
|
|
|
|
{
|
|
|
|
|
return v;
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-16 16:05:37 -08:00
|
|
|
template <typename T>
|
2019-07-28 15:40:58 -07:00
|
|
|
PSRETURN GUI<T>::SetSettingWrap(IGUIObject* pObject, const CStr& Setting, const T& Value, const bool& SkipMessage, const std::function<void()>& valueSet)
|
2004-12-16 16:05:37 -08:00
|
|
|
{
|
2011-04-30 06:01:45 -07:00
|
|
|
ENSURE(pObject != NULL);
|
2004-12-16 16:05:37 -08:00
|
|
|
|
|
|
|
|
if (!pObject->SettingExists(Setting))
|
2009-09-27 08:04:46 -07:00
|
|
|
{
|
2015-08-21 10:08:41 -07:00
|
|
|
LOGWARNING("setting %s was not found on object %s",
|
2009-09-27 08:04:46 -07:00
|
|
|
Setting.c_str(),
|
|
|
|
|
pObject->GetPresentableName().c_str());
|
|
|
|
|
return PSRETURN_GUI_InvalidSetting;
|
|
|
|
|
}
|
2004-12-16 16:05:37 -08:00
|
|
|
|
2019-07-28 15:40:58 -07:00
|
|
|
valueSet();
|
2004-12-16 16:05:37 -08:00
|
|
|
|
|
|
|
|
// Some settings needs special attention at change
|
|
|
|
|
|
|
|
|
|
// If setting was "size", we need to re-cache itself and all children
|
2004-12-19 04:20:04 -08:00
|
|
|
if (Setting == "size")
|
2004-12-16 16:05:37 -08:00
|
|
|
{
|
|
|
|
|
RecurseObject(0, pObject, &IGUIObject::UpdateCachedSize);
|
|
|
|
|
}
|
2015-08-21 10:08:41 -07:00
|
|
|
else if (Setting == "hidden")
|
2004-12-19 04:20:04 -08:00
|
|
|
{
|
|
|
|
|
// Hiding an object requires us to reset it and all children
|
2010-01-27 11:20:34 -08:00
|
|
|
if (IsBoolTrue(Value))
|
2019-07-27 19:39:52 -07:00
|
|
|
RecurseObject(0, pObject, &IGUIObject::ResetStates);
|
2004-12-19 04:20:04 -08:00
|
|
|
}
|
2004-12-16 16:05:37 -08:00
|
|
|
|
2005-02-04 23:25:16 -08:00
|
|
|
if (!SkipMessage)
|
2011-04-28 13:42:11 -07:00
|
|
|
{
|
|
|
|
|
SGUIMessage msg(GUIM_SETTINGS_UPDATED, Setting);
|
2019-07-27 19:39:52 -07:00
|
|
|
pObject->HandleMessage(msg);
|
2011-04-28 13:42:11 -07:00
|
|
|
}
|
2004-12-16 16:05:37 -08:00
|
|
|
|
2009-09-27 08:04:46 -07:00
|
|
|
return PSRETURN_OK;
|
2004-12-16 16:05:37 -08:00
|
|
|
}
|
|
|
|
|
|
2004-12-17 08:20:08 -08:00
|
|
|
// Instantiate templated functions:
|
Use NONCOPYABLE for most GUI classes and structs to have the compiler indicate unintended copies, refs 3028551b91 / D2163.
That is CChartData, CGUIList, CGUISeries, COListColumn, GUITooltip,
SGUIMessage, SSpriteCall, STextCall, SFeedback, IGUISetting,
CGUISetting, GUI, IGUIObject, IGUIScrollBar.
Drop copying GetSetting and SetSetting template functions for CGUIList,
CGUISeries, CClientArea, CGUIString.
Stop copying COListColumn.
Drop copying GUI<CClientArea>::GetSetting call in
IGUIObject::UpdateCachedSize() and four copying
GUI<CGUIString>::GetSetting calls in SetupText() functions.
Delete unused GUIRenderer IGLState class from 849f50a500 obsolete since
1f5b8f1c9a.
Differential Revision: https://code.wildfiregames.com/D2164
This was SVN commit r22638.
2019-08-09 17:04:17 -07:00
|
|
|
// These functions avoid copies by working with a pointer and move semantics.
|
2004-12-16 16:05:37 -08:00
|
|
|
#define TYPE(T) \
|
2019-08-19 03:32:29 -07:00
|
|
|
template bool GUI<T>::HasSetting(const IGUIObject* pObject, const CStr& Setting); \
|
|
|
|
|
template T& GUI<T>::GetSetting(const IGUIObject* pObject, const CStr& Setting); \
|
2015-08-21 10:08:41 -07:00
|
|
|
template PSRETURN GUI<T>::GetSettingPointer(const IGUIObject* pObject, const CStr& Setting, T*& Value); \
|
2019-07-28 15:40:58 -07:00
|
|
|
template PSRETURN GUI<T>::SetSetting(IGUIObject* pObject, const CStr& Setting, T& Value, const bool& SkipMessage); \
|
2019-08-03 19:20:08 -07:00
|
|
|
template class CGUISetting<T>; \
|
|
|
|
|
|
2004-12-16 16:05:37 -08:00
|
|
|
#include "GUItypes.h"
|
2010-02-17 16:06:50 -08:00
|
|
|
#undef TYPE
|
2004-12-16 16:05:37 -08:00
|
|
|
|
Use NONCOPYABLE for most GUI classes and structs to have the compiler indicate unintended copies, refs 3028551b91 / D2163.
That is CChartData, CGUIList, CGUISeries, COListColumn, GUITooltip,
SGUIMessage, SSpriteCall, STextCall, SFeedback, IGUISetting,
CGUISetting, GUI, IGUIObject, IGUIScrollBar.
Drop copying GetSetting and SetSetting template functions for CGUIList,
CGUISeries, CClientArea, CGUIString.
Stop copying COListColumn.
Drop copying GUI<CClientArea>::GetSetting call in
IGUIObject::UpdateCachedSize() and four copying
GUI<CGUIString>::GetSetting calls in SetupText() functions.
Delete unused GUIRenderer IGLState class from 849f50a500 obsolete since
1f5b8f1c9a.
Differential Revision: https://code.wildfiregames.com/D2164
This was SVN commit r22638.
2019-08-09 17:04:17 -07:00
|
|
|
// Copying functions - discouraged except for primitives.
|
|
|
|
|
#define TYPE(T) \
|
|
|
|
|
template PSRETURN GUI<T>::GetSetting(const IGUIObject* pObject, const CStr& Setting, T& Value); \
|
|
|
|
|
template PSRETURN GUI<T>::SetSetting(IGUIObject* pObject, const CStr& Setting, const T& Value, const bool& SkipMessage); \
|
|
|
|
|
|
|
|
|
|
#define GUITYPE_IGNORE_NONCOPYABLE
|
|
|
|
|
#include "GUItypes.h"
|
|
|
|
|
#undef GUITYPE_IGNORE_NONCOPYABLE
|
|
|
|
|
#undef TYPE
|