CHANGED: #1471 CInterfaceProperty is not part of the NELGUI library and is under NLGUI namespace.

--HG--
branch : gui-refactoring
This commit is contained in:
dfighter1985 2012-05-24 18:23:51 +02:00
parent 95955b72fe
commit 4284b5f4d5
11 changed files with 458 additions and 435 deletions

View file

@ -0,0 +1,57 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef INTERFACE_COMMON_H
#define INTERFACE_COMMON_H
enum THotSpot
{
Hotspot_BL = 36, // 100100,
Hotspot_BM = 34, // 100010,
Hotspot_BR = 33, // 100001,
Hotspot_ML = 20, // 010100,
Hotspot_MM = 18, // 010010
Hotspot_MR = 17, // 010001
Hotspot_TL = 12, // 001100
Hotspot_TM = 10, // 001010
Hotspot_TR = 9, // 001001
Hotspot_xR = 1, // 000001
Hotspot_xM = 2, // 000010
Hotspot_xL = 4, // 000100
Hotspot_Bx = 32, // 100000
Hotspot_Mx = 16, // 010000
Hotspot_Tx = 8, // 001000
Hotspot_TTAuto = 0, // Special For Tooltip PosRef. Auto mode. see CCtrlBase and tooltip info
};
#define DECLARE_UI_CLASS(_class_) \
virtual std::string getClassName() {return #_class_;} \
static NLMISC::IClassable *creator() {return new _class_(CViewBase::TCtorParam());}
#define REGISTER_UI_CLASS(_class_) \
class CRegisterUIClassHelper_##_class_ \
{ \
public: \
CRegisterUIClassHelper_##_class_() \
{ \
NLMISC::CClassRegistry::init(); \
NLMISC::CClassRegistry::registerClass(#_class_, _class_::creator, typeid(_class_).name()); \
} \
} RegisterUIClassHelper_##_class_;
#endif

View file

@ -0,0 +1,106 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_INTERFACE_PROPERTY_H
#define NL_INTERFACE_PROPERTY_H
#include "nel/misc/types_nl.h"
#include "nel/misc/rgba.h"
#include "nel/misc/cdb.h"
#include "nel/misc/cdb_leaf.h"
#include "nel/misc/cdb_branch.h"
namespace NLGUI
{
/**
* interface property
* class used to managed all the interface member values
* As the database contains only sint64, several methods are needed to do the conversion
* \author Nicolas Brigand
* \author Nevrax France
* \date 2002
*/
class CInterfaceProperty
{
public:
//enum defining a hot spot
/// Constructor
CInterfaceProperty()
{
_VolatileValue = NULL;
}
NLMISC::CCDBNodeLeaf* getNodePtr() const
{
return _VolatileValue;
}
void setNodePtr(NLMISC::CCDBNodeLeaf *ptr)
{
_VolatileValue = ptr;
}
bool link (const char *DBProp);
bool link( NLMISC::CCDBNodeLeaf *dbNode );
bool link( NLMISC::CCDBNodeBranch *dbNode, const std::string &leafId, NLMISC::CCDBNodeLeaf *defaultLeaf = NULL );
/// float operations
void setDouble (double value) {setSInt64((sint64&) value);}
double getDouble () const {sint64 i = getSInt64(); return (double &) i; }
void readDouble (const char* value, const std::string& id);
/// sint32 operations
void setSInt32 (sint32 value) {_VolatileValue->setValue32 (value);}
sint32 getSInt32 () const {return _VolatileValue->getValue32();}
void readSInt32(const char* value, const std::string& id);
/// sint64 operations
void setSInt64 (sint64 value) {_VolatileValue->setValue64(value);}
sint64 getSInt64 () const {return _VolatileValue->getValue64();}
void readSInt64(const char* value, const std::string& id);
/// CRGBA operations
void setRGBA (const NLMISC::CRGBA & value);
NLMISC::CRGBA getRGBA () const;
void readRGBA (const char* value, const std::string& id);
/// HotSpot operations
void readHotSpot (const char* value, const std::string& id);
/// bool operations
void setBool (bool value);
bool getBool () const;
void readBool (const char* value, const std::string& id);
// Swap the content of this 2 property (no-op if one is NULL)
void swap32(CInterfaceProperty &o);
private:
/// volatile value of the property (pointer to a leaf of the database)
NLMISC::CCDBNodeLeaf* _VolatileValue;
};
}
#endif // NL_INTERFACE_PROPERTY_H
/* End of interface_property.h */

View file

@ -0,0 +1,288 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nel/misc/rgba.h"
#include "nel/gui/interface_property.h"
#include "nel/gui/interface_common.h"
#include "nel/gui/db_manager.h"
using namespace NLMISC;
using namespace std;
namespace NLGUI
{
bool CInterfaceProperty::link( CCDBNodeLeaf *dbNode )
{
_VolatileValue = dbNode;
return (dbNode != NULL);
}
bool CInterfaceProperty::link( CCDBNodeBranch *dbNode, const string &leafId, CCDBNodeLeaf *defaultLeaf )
{
// no branch => default leaf
if( !dbNode )
{
_VolatileValue = defaultLeaf;
return false;
}
// get the leaf
_VolatileValue = dbNode->getLeaf( leafId.c_str(), false );
if( _VolatileValue )
return true;
// default
_VolatileValue = defaultLeaf;
return false;
}
bool CInterfaceProperty::link (const char *DBProp)
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(DBProp, false);
if (_VolatileValue == NULL)
{
nlinfo("prop not created : %s", DBProp);
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(DBProp);
return false;
}
return true;
}
// *****************
// sint64 operations
// *****************
void CInterfaceProperty::readSInt64(const char * ptr,const string& id)
{
string str (ptr);
//the value is volatile, and a database entry is created
if ( isdigit(*ptr) || *ptr=='-')
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
sint64 i;
fromString(ptr, i);
_VolatileValue->setValue64( i );
}
//the value is volatile and points to a db entry created elsewhere
else
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
}
// ****************
// float operations
// ****************
// ----------------------------------------------------------------------------
void CInterfaceProperty::readDouble(const char * ptr,const string& id)
{
string str (ptr);
if ( isdigit(*ptr) || *ptr=='-')
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
double buf;
fromString(ptr, buf);
sint64 i = *(sint64*)&buf;
_VolatileValue->setValue64( i );
}
else
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
}
// *****************
// sint32 operations
// *****************
// ----------------------------------------------------------------------------
void CInterfaceProperty::readSInt32 (const char *ptr, const string& id)
{
string str (ptr);
//the value is volatile, and a database entry is created
if ( isdigit(*ptr) || *ptr=='-')
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
sint32 i;
fromString(ptr, i);
_VolatileValue->setValue32( i );
}
//the value is volatile and points to a db entry created elsewhere
else
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
}
// *****************
// rgba operations
// *****************
CRGBA CInterfaceProperty::getRGBA() const
{
CRGBA rgba;
sint64 buf = getSInt64();
rgba.R = (sint8) (buf &255);
rgba.G = (sint8) ((buf>>8)&255 );
rgba.B = (sint8) ((buf>>16)&255);
rgba.A = (sint8) ((buf>>24)&255);
return rgba;
}
void CInterfaceProperty::setRGBA (const CRGBA& value)
{
setSInt64( (value.R )+ (((sint32)value.G)<<8) + (((sint32)value.B)<<16) + (((sint32)value.A)<<24));
}
void CInterfaceProperty::readRGBA (const char *value,const string& id)
{
string str (value);
if (isdigit(*value))
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
int r=0, g=0, b=0, a=255;
sscanf (value, "%d %d %d %d", &r, &g, &b, &a);
clamp (r, 0, 255);
clamp (g, 0, 255);
clamp (b, 0, 255);
clamp (a, 0, 255);
sint64 val = r+(g<<8)+(b<<16)+(a<<24);
setSInt64(val);
CRGBA rgba = getRGBA();
}
else
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
}
void CInterfaceProperty::readHotSpot (const char *ptr,const string& id)
{
string str(ptr);
if ( !strcmp(ptr,"TL") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64((sint64)Hotspot_TL );
}
else if ( !strcmp(ptr,"TM") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_TM );
}
else if ( !strcmp(ptr,"TR") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_TR );
}
else if ( !strcmp(ptr,"ML") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_ML );
}
else if ( !strcmp(ptr,"MM") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_MM );
}
else if ( !strcmp(ptr,"MR") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_MR );
}
else if ( !strcmp(ptr,"BL") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_BL );
}
else if ( !strcmp(ptr,"BM") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_BM );
}
else if ( !strcmp(ptr,"BR") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_BR );
}
else
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
void CInterfaceProperty::setBool(bool value)
{
_VolatileValue->setValue8 (value);
}
bool CInterfaceProperty::getBool() const
{
return _VolatileValue->getValue8() != 0 ? true : false;
}
void CInterfaceProperty::readBool (const char* value,const string& id)
{
string str (value);
if ( !strcmp(value,"true") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue8( (sint8)true );
}
else if ( !strcmp(value,"false") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue8( (sint8)false );
}
else if ( isdigit(*value) || *value=='-')
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
sint8 value8;
fromString(value, value8);
_VolatileValue->setValue8( value8 );
}
else
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
// ***************************************************************************
void CInterfaceProperty::swap32(CInterfaceProperty &o)
{
CCDBNodeLeaf *a= getNodePtr();
CCDBNodeLeaf *b= o.getNodePtr();
if(!a || !b)
return;
sint32 val= a->getValue32();
a->setValue32(b->getValue32());
b->setValue32(val);
}
}

View file

@ -22,7 +22,7 @@
#include "dbgroup_list_sheet.h"
#include "group_container.h"
#include "ctrl_button.h"
#include "interface_property.h"
#include "nel/gui/interface_property.h"
#include "interface_manager.h"
#include "action_handler.h"
#include "../sheet_manager.h"

View file

@ -24,7 +24,7 @@
#include "view_text.h"
#include "view_bitmap.h"
#include "ctrl_button.h"
#include "interface_property.h"
#include "nel/gui/interface_property.h"
#include "interface_manager.h"
#include "action_handler.h"

View file

@ -19,7 +19,7 @@
#ifndef RZ_INTERFACE_ANIM_H
#define RZ_INTERFACE_ANIM_H
#include "interface_property.h"
#include "nel/gui/interface_property.h"
#include "interface_group.h"
#include "interface_link.h"

View file

@ -19,7 +19,7 @@
#include "stdpch.h"
#include "interface_group.h"
#include "interface_property.h"
#include "nel/gui/interface_property.h"
#include "interface_manager.h"
#include "group_container.h"
#include "../misc.h"

View file

@ -22,8 +22,9 @@
#include "nel/misc/types_nl.h"
#include "nel/misc/string_mapper.h"
#include "nel/misc/smart_ptr.h"
#include "interface_property.h"
#include "nel/gui/interface_property.h"
#include "nel/gui/reflect.h"
#include "nel/gui/interface_common.h"
using namespace NLGUI;
@ -31,26 +32,6 @@ using namespace NLGUI;
class CInterfaceGroup;
// ----------------------------------------------------------------------------
enum THotSpot
{
Hotspot_BL = 36, // 100100,
Hotspot_BM = 34, // 100010,
Hotspot_BR = 33, // 100001,
Hotspot_ML = 20, // 010100,
Hotspot_MM = 18, // 010010
Hotspot_MR = 17, // 010001
Hotspot_TL = 12, // 001100
Hotspot_TM = 10, // 001010
Hotspot_TR = 9, // 001001
Hotspot_xR = 1, // 000001
Hotspot_xM = 2, // 000010
Hotspot_xL = 4, // 000100
Hotspot_Bx = 32, // 100000
Hotspot_Mx = 16, // 010000
Hotspot_Tx = 8, // 001000
Hotspot_TTAuto = 0, // Special For Tooltip PosRef. Auto mode. see CCtrlBase and tooltip info
};
class CInterfaceLink;
class CInterfaceElement;
@ -82,22 +63,6 @@ public:
};
#define DECLARE_UI_CLASS(_class_) \
virtual std::string getClassName() {return #_class_;} \
static NLMISC::IClassable *creator() {return new _class_(CViewBase::TCtorParam());}
#define REGISTER_UI_CLASS(_class_) \
class CRegisterUIClassHelper_##_class_ \
{ \
public: \
CRegisterUIClassHelper_##_class_() \
{ \
NLMISC::CClassRegistry::init(); \
NLMISC::CClassRegistry::registerClass(#_class_, _class_::creator, typeid(_class_).name()); \
} \
} RegisterUIClassHelper_##_class_;
/**
* class describing a localisable interface element, i.e. : an element with coordinates
* \author Nicolas Brigand

View file

@ -1,286 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "interface_property.h"
#include "interface_manager.h"
#include "nel/misc/rgba.h"
using namespace NLMISC;
using namespace std;
bool CInterfaceProperty::link( CCDBNodeLeaf *dbNode )
{
_VolatileValue = dbNode;
return (dbNode != NULL);
}
bool CInterfaceProperty::link( CCDBNodeBranch *dbNode, const string &leafId, CCDBNodeLeaf *defaultLeaf )
{
// no branch => default leaf
if( !dbNode )
{
_VolatileValue = defaultLeaf;
return false;
}
// get the leaf
_VolatileValue = dbNode->getLeaf( leafId.c_str(), false );
if( _VolatileValue )
return true;
// default
_VolatileValue = defaultLeaf;
return false;
}
bool CInterfaceProperty::link (const char *DBProp)
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(DBProp, false);
if (_VolatileValue == NULL)
{
nlinfo("prop not created : %s", DBProp);
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(DBProp);
return false;
}
return true;
}
// *****************
// sint64 operations
// *****************
void CInterfaceProperty::readSInt64(const char * ptr,const string& id)
{
string str (ptr);
//the value is volatile, and a database entry is created
if ( isdigit(*ptr) || *ptr=='-')
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
sint64 i;
fromString(ptr, i);
_VolatileValue->setValue64( i );
}
//the value is volatile and points to a db entry created elsewhere
else
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
}
// ****************
// float operations
// ****************
// ----------------------------------------------------------------------------
void CInterfaceProperty::readDouble(const char * ptr,const string& id)
{
string str (ptr);
if ( isdigit(*ptr) || *ptr=='-')
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
double buf;
fromString(ptr, buf);
sint64 i = *(sint64*)&buf;
_VolatileValue->setValue64( i );
}
else
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
}
// *****************
// sint32 operations
// *****************
// ----------------------------------------------------------------------------
void CInterfaceProperty::readSInt32 (const char *ptr, const string& id)
{
string str (ptr);
//the value is volatile, and a database entry is created
if ( isdigit(*ptr) || *ptr=='-')
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
sint32 i;
fromString(ptr, i);
_VolatileValue->setValue32( i );
}
//the value is volatile and points to a db entry created elsewhere
else
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
}
// *****************
// rgba operations
// *****************
CRGBA CInterfaceProperty::getRGBA() const
{
CRGBA rgba;
sint64 buf = getSInt64();
rgba.R = (sint8) (buf &255);
rgba.G = (sint8) ((buf>>8)&255 );
rgba.B = (sint8) ((buf>>16)&255);
rgba.A = (sint8) ((buf>>24)&255);
return rgba;
}
void CInterfaceProperty::setRGBA (const CRGBA& value)
{
setSInt64( (value.R )+ (((sint32)value.G)<<8) + (((sint32)value.B)<<16) + (((sint32)value.A)<<24));
}
void CInterfaceProperty::readRGBA (const char *value,const string& id)
{
string str (value);
if (isdigit(*value))
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
int r=0, g=0, b=0, a=255;
sscanf (value, "%d %d %d %d", &r, &g, &b, &a);
clamp (r, 0, 255);
clamp (g, 0, 255);
clamp (b, 0, 255);
clamp (a, 0, 255);
sint64 val = r+(g<<8)+(b<<16)+(a<<24);
setSInt64(val);
CRGBA rgba = getRGBA();
}
else
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
}
void CInterfaceProperty::readHotSpot (const char *ptr,const string& id)
{
string str(ptr);
if ( !strcmp(ptr,"TL") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64((sint64)Hotspot_TL );
}
else if ( !strcmp(ptr,"TM") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_TM );
}
else if ( !strcmp(ptr,"TR") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_TR );
}
else if ( !strcmp(ptr,"ML") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_ML );
}
else if ( !strcmp(ptr,"MM") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_MM );
}
else if ( !strcmp(ptr,"MR") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_MR );
}
else if ( !strcmp(ptr,"BL") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_BL );
}
else if ( !strcmp(ptr,"BM") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_BM );
}
else if ( !strcmp(ptr,"BR") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue64( (sint64)Hotspot_BR );
}
else
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
void CInterfaceProperty::setBool(bool value)
{
_VolatileValue->setValue8 (value);
}
bool CInterfaceProperty::getBool() const
{
return _VolatileValue->getValue8() != 0 ? true : false;
}
void CInterfaceProperty::readBool (const char* value,const string& id)
{
string str (value);
if ( !strcmp(value,"true") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue8( (sint8)true );
}
else if ( !strcmp(value,"false") )
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
_VolatileValue->setValue8( (sint8)false );
}
else if ( isdigit(*value) || *value=='-')
{
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(id);
sint8 value8;
fromString(value, value8);
_VolatileValue->setValue8( value8 );
}
else
_VolatileValue = NLGUI::CDBManager::getInstance()->getDbProp(str);
}
// ***************************************************************************
void CInterfaceProperty::swap32(CInterfaceProperty &o)
{
CCDBNodeLeaf *a= getNodePtr();
CCDBNodeLeaf *b= o.getNodePtr();
if(!a || !b)
return;
sint32 val= a->getValue32();
a->setValue32(b->getValue32());
b->setValue32(val);
}

View file

@ -1,107 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_INTERFACE_PROPERTY_H
#define NL_INTERFACE_PROPERTY_H
#include "nel/misc/types_nl.h"
#include "nel/misc/rgba.h"
#include "nel/misc/cdb.h"
#include "nel/misc/cdb_leaf.h"
#include "nel/misc/cdb_branch.h"
#include "../cdb_synchronised.h"
class CDBNodeProperty;
class IGetProperty;
/**
* interface property
* class used to managed all the interface member values
* As the database contains only sint64, several methods are needed to do the conversion
* \author Nicolas Brigand
* \author Nevrax France
* \date 2002
*/
class CInterfaceProperty
{
public:
//enum defining a hot spot
/// Constructor
CInterfaceProperty()
{
_VolatileValue = NULL;
}
NLMISC::CCDBNodeLeaf* getNodePtr() const
{
return _VolatileValue;
}
void setNodePtr(NLMISC::CCDBNodeLeaf *ptr)
{
_VolatileValue = ptr;
}
bool link (const char *DBProp);
bool link( NLMISC::CCDBNodeLeaf *dbNode );
bool link( NLMISC::CCDBNodeBranch *dbNode, const std::string &leafId, NLMISC::CCDBNodeLeaf *defaultLeaf = NULL );
/// float operations
void setDouble (double value) {setSInt64((sint64&) value);}
double getDouble () const {sint64 i = getSInt64(); return (double &) i; }
void readDouble (const char* value, const std::string& id);
/// sint32 operations
void setSInt32 (sint32 value) {_VolatileValue->setValue32 (value);}
sint32 getSInt32 () const {return _VolatileValue->getValue32();}
void readSInt32(const char* value, const std::string& id);
/// sint64 operations
void setSInt64 (sint64 value) {_VolatileValue->setValue64(value);}
sint64 getSInt64 () const {return _VolatileValue->getValue64();}
void readSInt64(const char* value, const std::string& id);
/// CRGBA operations
void setRGBA (const NLMISC::CRGBA & value);
NLMISC::CRGBA getRGBA () const;
void readRGBA (const char* value, const std::string& id);
/// HotSpot operations
void readHotSpot (const char* value, const std::string& id);
/// bool operations
void setBool (bool value);
bool getBool () const;
void readBool (const char* value, const std::string& id);
// Swap the content of this 2 property (no-op if one is NULL)
void swap32(CInterfaceProperty &o);
private:
/// volatile value of the property (pointer to a leaf of the database)
NLMISC::CCDBNodeLeaf* _VolatileValue;
};
#endif // NL_INTERFACE_PROPERTY_H
/* End of interface_property.h */

View file

@ -27,7 +27,7 @@
// client.
#include "time_client.h"
#include "interface_v3/interface_manager.h"
#include "interface_v3/interface_property.h"
#include "nel/gui/interface_property.h"
#include "client_cfg.h"
#include "net_manager.h"
#include "game_share/zc_shard_common.h"