|
|
@ -29,11 +29,14 @@
|
|
|
|
using namespace std;
|
|
|
|
using namespace std;
|
|
|
|
using namespace NLMISC;
|
|
|
|
using namespace NLMISC;
|
|
|
|
|
|
|
|
|
|
|
|
CStringMapper *_UIStringMapper = NULL;
|
|
|
|
namespace NLGUI
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
CInterfaceElement::~CInterfaceElement()
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CStringMapper *_UIStringMapper = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
CInterfaceElement::~CInterfaceElement()
|
|
|
|
|
|
|
|
{
|
|
|
|
if (_Links) // remove any link that point to that element
|
|
|
|
if (_Links) // remove any link that point to that element
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for(TLinkVect::iterator it = _Links->begin(); it != _Links->end(); ++it)
|
|
|
|
for(TLinkVect::iterator it = _Links->begin(); it != _Links->end(); ++it)
|
|
|
@ -42,38 +45,38 @@ CInterfaceElement::~CInterfaceElement()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete _Links;
|
|
|
|
delete _Links;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::parseError(CInterfaceGroup * parentGroup, const char *reason)
|
|
|
|
void CInterfaceElement::parseError(CInterfaceGroup * parentGroup, const char *reason)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string tmp = string("cannot parse view:")+getId()+", parent:"+parentGroup->getId();
|
|
|
|
string tmp = string("cannot parse view:")+getId()+", parent:"+parentGroup->getId();
|
|
|
|
nlinfo(tmp.c_str());
|
|
|
|
nlinfo(tmp.c_str());
|
|
|
|
if (reason)
|
|
|
|
if (reason)
|
|
|
|
nlinfo("reason : %s", reason);
|
|
|
|
nlinfo("reason : %s", reason);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CInterfaceElement::setIdRecurse(const std::string &newID)
|
|
|
|
void CInterfaceElement::setIdRecurse(const std::string &newID)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string baseId = _Parent ? _Parent->getId() : "ui";
|
|
|
|
std::string baseId = _Parent ? _Parent->getId() : "ui";
|
|
|
|
setId(baseId + ":" + newID);
|
|
|
|
setId(baseId + ":" + newID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
std::string CInterfaceElement::getShortId() const
|
|
|
|
std::string CInterfaceElement::getShortId() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string::size_type last = _Id.find_last_of(':');
|
|
|
|
std::string::size_type last = _Id.find_last_of(':');
|
|
|
|
if (last != std::string::npos)
|
|
|
|
if (last != std::string::npos)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return _Id.substr(last + 1);
|
|
|
|
return _Id.substr(last + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return _Id;
|
|
|
|
return _Id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
bool CInterfaceElement::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
|
|
|
bool CInterfaceElement::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// parse the basic properties
|
|
|
|
// parse the basic properties
|
|
|
|
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"id" ));
|
|
|
|
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"id" ));
|
|
|
|
if (ptr)
|
|
|
|
if (ptr)
|
|
|
@ -125,15 +128,15 @@ bool CInterfaceElement::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
|
|
|
if (ptr) fromString((const char*)ptr, _H);
|
|
|
|
if (ptr) fromString((const char*)ptr, _H);
|
|
|
|
|
|
|
|
|
|
|
|
// snapping
|
|
|
|
// snapping
|
|
|
|
// ptr = (char*) xmlGetProp( cur, (xmlChar*)"snap" );
|
|
|
|
// ptr = (char*) xmlGetProp( cur, (xmlChar*)"snap" );
|
|
|
|
// _Snap = 1;
|
|
|
|
// _Snap = 1;
|
|
|
|
// if (ptr)
|
|
|
|
// if (ptr)
|
|
|
|
// fromString((const char*)ptr, _Snap);
|
|
|
|
// fromString((const char*)ptr, _Snap);
|
|
|
|
// if (_Snap <= 0)
|
|
|
|
// if (_Snap <= 0)
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
// parseError(parentGroup, "snap must be > 0" );
|
|
|
|
// parseError(parentGroup, "snap must be > 0" );
|
|
|
|
// return false;
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
ptr = (char*) xmlGetProp( cur, (xmlChar*) "posref" );
|
|
|
|
ptr = (char*) xmlGetProp( cur, (xmlChar*) "posref" );
|
|
|
|
_ParentPosRef = Hotspot_BL;
|
|
|
|
_ParentPosRef = Hotspot_BL;
|
|
|
@ -215,7 +218,7 @@ bool CInterfaceElement::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// snapSize();
|
|
|
|
// snapSize();
|
|
|
|
|
|
|
|
|
|
|
|
ptr= (char*) xmlGetProp (cur, (xmlChar*)"global_color");
|
|
|
|
ptr= (char*) xmlGetProp (cur, (xmlChar*)"global_color");
|
|
|
|
if(ptr)
|
|
|
|
if(ptr)
|
|
|
@ -230,31 +233,31 @@ bool CInterfaceElement::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
|
|
|
if(ptr) _AvoidResizeParent= convertBool(ptr);
|
|
|
|
if(ptr) _AvoidResizeParent= convertBool(ptr);
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::setSizeRef(const std::string &sizeref)
|
|
|
|
void CInterfaceElement::setSizeRef(const std::string &sizeref)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
parseSizeRef(sizeref.c_str());
|
|
|
|
parseSizeRef(sizeref.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
std::string CInterfaceElement::getSizeRefAsString() const
|
|
|
|
std::string CInterfaceElement::getSizeRefAsString() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return "IMPLEMENT ME!";
|
|
|
|
return "IMPLEMENT ME!";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::parseSizeRef(const char *sizeRefStr)
|
|
|
|
void CInterfaceElement::parseSizeRef(const char *sizeRefStr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
parseSizeRef(sizeRefStr, _SizeRef, _SizeDivW, _SizeDivH);
|
|
|
|
parseSizeRef(sizeRefStr, _SizeRef, _SizeDivW, _SizeDivH);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::parseSizeRef(const char *sizeRefStr, sint32 &sizeRef, sint32 &sizeDivW, sint32 &sizeDivH)
|
|
|
|
void CInterfaceElement::parseSizeRef(const char *sizeRefStr, sint32 &sizeRef, sint32 &sizeDivW, sint32 &sizeDivH)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlassert(sizeRefStr);
|
|
|
|
nlassert(sizeRefStr);
|
|
|
|
|
|
|
|
|
|
|
|
sizeRef = 0;
|
|
|
|
sizeRef = 0;
|
|
|
@ -289,11 +292,11 @@ void CInterfaceElement::parseSizeRef(const char *sizeRefStr, sint32 &sizeRef, si
|
|
|
|
|
|
|
|
|
|
|
|
++seekPtr;
|
|
|
|
++seekPtr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::updateCoords()
|
|
|
|
void CInterfaceElement::updateCoords()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_XReal = _X;
|
|
|
|
_XReal = _X;
|
|
|
|
_YReal = _Y;
|
|
|
|
_YReal = _Y;
|
|
|
|
_WReal = getW();
|
|
|
|
_WReal = getW();
|
|
|
@ -356,33 +359,33 @@ void CInterfaceElement::updateCoords()
|
|
|
|
_XReal -= _WReal/2;
|
|
|
|
_XReal -= _WReal/2;
|
|
|
|
if (hs & Hotspot_xR)
|
|
|
|
if (hs & Hotspot_xR)
|
|
|
|
_XReal -= _WReal;
|
|
|
|
_XReal -= _WReal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::getCorner(sint32 &px, sint32 &py, THotSpot hs)
|
|
|
|
void CInterfaceElement::getCorner(sint32 &px, sint32 &py, THotSpot hs)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
px = _XReal;
|
|
|
|
px = _XReal;
|
|
|
|
py = _YReal;
|
|
|
|
py = _YReal;
|
|
|
|
if (hs & 1) px += _WReal;
|
|
|
|
if (hs & 1) px += _WReal;
|
|
|
|
if (hs & 2) px += _WReal >> 1;
|
|
|
|
if (hs & 2) px += _WReal >> 1;
|
|
|
|
if (hs & 8) py += _HReal;
|
|
|
|
if (hs & 8) py += _HReal;
|
|
|
|
if (hs & 16) py += _HReal >> 1;
|
|
|
|
if (hs & 16) py += _HReal >> 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::move (sint32 dx, sint32 dy)
|
|
|
|
void CInterfaceElement::move (sint32 dx, sint32 dy)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_X += dx;
|
|
|
|
_X += dx;
|
|
|
|
_Y += dy;
|
|
|
|
_Y += dy;
|
|
|
|
invalidateCoords();
|
|
|
|
invalidateCoords();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
/*void CInterfaceElement::resizeBR (sint32 sizeW, sint32 sizeH)
|
|
|
|
/*void CInterfaceElement::resizeBR (sint32 sizeW, sint32 sizeH)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 i = i / 0;
|
|
|
|
uint32 i = i / 0;
|
|
|
|
THotSpot hs = _PosRef;
|
|
|
|
THotSpot hs = _PosRef;
|
|
|
|
|
|
|
|
|
|
|
@ -427,12 +430,12 @@ void CInterfaceElement::move (sint32 dx, sint32 dy)
|
|
|
|
// DO NOT TREAT THE MIDDLE HOTSPOT CASE
|
|
|
|
// DO NOT TREAT THE MIDDLE HOTSPOT CASE
|
|
|
|
|
|
|
|
|
|
|
|
invalidateCoords();
|
|
|
|
invalidateCoords();
|
|
|
|
}*/
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
/*void CInterfaceElement::snapSize()
|
|
|
|
/*void CInterfaceElement::snapSize()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sint32 snap = _Snap;
|
|
|
|
sint32 snap = _Snap;
|
|
|
|
nlassert(snap > 0);
|
|
|
|
nlassert(snap > 0);
|
|
|
|
if (snap > 1)
|
|
|
|
if (snap > 1)
|
|
|
@ -440,48 +443,48 @@ void CInterfaceElement::move (sint32 dx, sint32 dy)
|
|
|
|
_W = _W - (_W % snap);
|
|
|
|
_W = _W - (_W % snap);
|
|
|
|
_H = _H - (_H % snap);
|
|
|
|
_H = _H - (_H % snap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::setW (sint32 w)
|
|
|
|
void CInterfaceElement::setW (sint32 w)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_W = w;
|
|
|
|
_W = w;
|
|
|
|
// sint32 snap = _Snap;
|
|
|
|
// sint32 snap = _Snap;
|
|
|
|
// nlassert(snap > 0);
|
|
|
|
// nlassert(snap > 0);
|
|
|
|
// if (snap > 1)
|
|
|
|
// if (snap > 1)
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
// _W = _W - (_W % snap);
|
|
|
|
// _W = _W - (_W % snap);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::setH (sint32 h)
|
|
|
|
void CInterfaceElement::setH (sint32 h)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_H = h;
|
|
|
|
_H = h;
|
|
|
|
// sint32 snap = _Snap;
|
|
|
|
// sint32 snap = _Snap;
|
|
|
|
// nlassert(snap > 0);
|
|
|
|
// nlassert(snap > 0);
|
|
|
|
// if (snap > 1)
|
|
|
|
// if (snap > 1)
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
// _H = _H - (_H % snap);
|
|
|
|
// _H = _H - (_H % snap);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CInterfaceGroup* CInterfaceElement::getRootWindow ()
|
|
|
|
CInterfaceGroup* CInterfaceElement::getRootWindow ()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_Parent == NULL)
|
|
|
|
if (_Parent == NULL)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
if (_Parent->getParent() == NULL)
|
|
|
|
if (_Parent->getParent() == NULL)
|
|
|
|
return dynamic_cast<CInterfaceGroup*>(this);
|
|
|
|
return dynamic_cast<CInterfaceGroup*>(this);
|
|
|
|
return _Parent->getRootWindow();
|
|
|
|
return _Parent->getRootWindow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
uint CInterfaceElement::getParentDepth() const
|
|
|
|
uint CInterfaceElement::getParentDepth() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint depth= 0;
|
|
|
|
uint depth= 0;
|
|
|
|
CInterfaceGroup *parent= _Parent;
|
|
|
|
CInterfaceGroup *parent= _Parent;
|
|
|
|
while(parent!=NULL)
|
|
|
|
while(parent!=NULL)
|
|
|
@ -490,11 +493,11 @@ uint CInterfaceElement::getParentDepth() const
|
|
|
|
depth++;
|
|
|
|
depth++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return depth;
|
|
|
|
return depth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
bool CInterfaceElement::isActiveThroughParents() const
|
|
|
|
bool CInterfaceElement::isActiveThroughParents() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!getActive())
|
|
|
|
if(!getActive())
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
if(_Parent == NULL)
|
|
|
|
if(_Parent == NULL)
|
|
|
@ -505,12 +508,12 @@ bool CInterfaceElement::isActiveThroughParents() const
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return _Parent->isActiveThroughParents();
|
|
|
|
return _Parent->isActiveThroughParents();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::relativeSInt64Read (CInterfaceProperty &rIP, const string &prop, const char *val,
|
|
|
|
void CInterfaceElement::relativeSInt64Read (CInterfaceProperty &rIP, const string &prop, const char *val,
|
|
|
|
const string &defVal)
|
|
|
|
const string &defVal)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (val == NULL)
|
|
|
|
if (val == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rIP.readSInt64 (defVal.c_str(), _Id+":"+prop);
|
|
|
|
rIP.readSInt64 (defVal.c_str(), _Id+":"+prop);
|
|
|
@ -550,13 +553,13 @@ void CInterfaceElement::relativeSInt64Read (CInterfaceProperty &rIP, const strin
|
|
|
|
rIP.readSInt64 (val+decal, _Id+":"+prop);
|
|
|
|
rIP.readSInt64 (val+decal, _Id+":"+prop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::relativeSInt32Read (CInterfaceProperty &rIP, const string &prop, const char *val,
|
|
|
|
void CInterfaceElement::relativeSInt32Read (CInterfaceProperty &rIP, const string &prop, const char *val,
|
|
|
|
const string &defVal)
|
|
|
|
const string &defVal)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (val == NULL)
|
|
|
|
if (val == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rIP.readSInt32 (defVal.c_str(), _Id+":"+prop);
|
|
|
|
rIP.readSInt32 (defVal.c_str(), _Id+":"+prop);
|
|
|
@ -596,13 +599,13 @@ void CInterfaceElement::relativeSInt32Read (CInterfaceProperty &rIP, const strin
|
|
|
|
rIP.readSInt32 (val+decal, _Id+":"+prop);
|
|
|
|
rIP.readSInt32 (val+decal, _Id+":"+prop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::relativeBoolRead (CInterfaceProperty &rIP, const string &prop, const char *val,
|
|
|
|
void CInterfaceElement::relativeBoolRead (CInterfaceProperty &rIP, const string &prop, const char *val,
|
|
|
|
const string &defVal)
|
|
|
|
const string &defVal)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (val == NULL)
|
|
|
|
if (val == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rIP.readBool (defVal.c_str(), _Id+":"+prop);
|
|
|
|
rIP.readBool (defVal.c_str(), _Id+":"+prop);
|
|
|
@ -636,12 +639,12 @@ void CInterfaceElement::relativeBoolRead (CInterfaceProperty &rIP, const string
|
|
|
|
rIP.readBool (val+decal, _Id+":"+prop);
|
|
|
|
rIP.readBool (val+decal, _Id+":"+prop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::relativeRGBARead(CInterfaceProperty &rIP,const std::string &prop,const char *val,const std::string &defVal)
|
|
|
|
void CInterfaceElement::relativeRGBARead(CInterfaceProperty &rIP,const std::string &prop,const char *val,const std::string &defVal)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (val == NULL)
|
|
|
|
if (val == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rIP.readRGBA (defVal.c_str(), _Id+":"+prop);
|
|
|
|
rIP.readRGBA (defVal.c_str(), _Id+":"+prop);
|
|
|
@ -681,12 +684,12 @@ void CInterfaceElement::relativeRGBARead(CInterfaceProperty &rIP,const std::stri
|
|
|
|
rIP.readRGBA (val+decal, _Id+":"+prop);
|
|
|
|
rIP.readRGBA (val+decal, _Id+":"+prop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
THotSpot CInterfaceElement::convertHotSpot (const char *ptr)
|
|
|
|
THotSpot CInterfaceElement::convertHotSpot (const char *ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( !strnicmp(ptr,"TL",2) )
|
|
|
|
if ( !strnicmp(ptr,"TL",2) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Hotspot_TL;
|
|
|
|
return Hotspot_TL;
|
|
|
@ -725,11 +728,11 @@ THotSpot CInterfaceElement::convertHotSpot (const char *ptr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return Hotspot_BL;
|
|
|
|
return Hotspot_BL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::convertHotSpotCouple (const char *ptr, THotSpot &parentPosRef, THotSpot &posRef)
|
|
|
|
void CInterfaceElement::convertHotSpotCouple (const char *ptr, THotSpot &parentPosRef, THotSpot &posRef)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlassert(ptr);
|
|
|
|
nlassert(ptr);
|
|
|
|
|
|
|
|
|
|
|
|
// *** first hotspot
|
|
|
|
// *** first hotspot
|
|
|
@ -748,35 +751,35 @@ void CInterfaceElement::convertHotSpotCouple (const char *ptr, THotSpot &parent
|
|
|
|
ptr++;
|
|
|
|
ptr++;
|
|
|
|
// convert second
|
|
|
|
// convert second
|
|
|
|
posRef = convertHotSpot (ptr);
|
|
|
|
posRef = convertHotSpot (ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
NLMISC::CRGBA CInterfaceElement::convertColor (const char *ptr)
|
|
|
|
NLMISC::CRGBA CInterfaceElement::convertColor (const char *ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return NLMISC::CRGBA::stringToRGBA(ptr);
|
|
|
|
return NLMISC::CRGBA::stringToRGBA(ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
bool CInterfaceElement::convertBool (const char *ptr)
|
|
|
|
bool CInterfaceElement::convertBool (const char *ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string str= ptr;
|
|
|
|
string str= ptr;
|
|
|
|
NLMISC::strlwr(str);
|
|
|
|
NLMISC::strlwr(str);
|
|
|
|
return str=="true"?true:false;
|
|
|
|
return str=="true"?true:false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
NLMISC::CVector CInterfaceElement::convertVector (const char *ptr)
|
|
|
|
NLMISC::CVector CInterfaceElement::convertVector (const char *ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
float x = 0.0f, y = 0.0f, z = 0.0f;
|
|
|
|
float x = 0.0f, y = 0.0f, z = 0.0f;
|
|
|
|
|
|
|
|
|
|
|
|
sscanf (ptr, "%f %f %f", &x, &y, &z);
|
|
|
|
sscanf (ptr, "%f %f %f", &x, &y, &z);
|
|
|
|
|
|
|
|
|
|
|
|
return CVector(x,y,z);
|
|
|
|
return CVector(x,y,z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::convertPixelsOrRatio(const char *ptr, sint32 &pixels, float &ratio)
|
|
|
|
void CInterfaceElement::convertPixelsOrRatio(const char *ptr, sint32 &pixels, float &ratio)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string value = ptr;
|
|
|
|
std::string value = ptr;
|
|
|
|
if (!value.empty())
|
|
|
|
if (!value.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -792,12 +795,12 @@ void CInterfaceElement::convertPixelsOrRatio(const char *ptr, sint32 &pixels, fl
|
|
|
|
fromString(value, pixels);
|
|
|
|
fromString(value, pixels);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::addLink(CInterfaceLink *link)
|
|
|
|
void CInterfaceElement::addLink(CInterfaceLink *link)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlassert(link != NULL);
|
|
|
|
nlassert(link != NULL);
|
|
|
|
if (!_Links)
|
|
|
|
if (!_Links)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -814,12 +817,12 @@ void CInterfaceElement::addLink(CInterfaceLink *link)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_Links->push_back(linkPtr);
|
|
|
|
_Links->push_back(linkPtr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::removeLink(CInterfaceLink *link)
|
|
|
|
void CInterfaceElement::removeLink(CInterfaceLink *link)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlassert(link != NULL);
|
|
|
|
nlassert(link != NULL);
|
|
|
|
if (!_Links)
|
|
|
|
if (!_Links)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -838,21 +841,21 @@ void CInterfaceElement::removeLink(CInterfaceLink *link)
|
|
|
|
delete _Links;
|
|
|
|
delete _Links;
|
|
|
|
_Links = NULL;
|
|
|
|
_Links = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CInterfaceElement* CInterfaceElement::getMasterGroup() const
|
|
|
|
CInterfaceElement* CInterfaceElement::getMasterGroup() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(getParent()==NULL)
|
|
|
|
if(getParent()==NULL)
|
|
|
|
return const_cast<CInterfaceElement*>(this);
|
|
|
|
return const_cast<CInterfaceElement*>(this);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return getParent()->getMasterGroup();
|
|
|
|
return getParent()->getMasterGroup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CInterfaceGroup* CInterfaceElement::getParentContainer()
|
|
|
|
CInterfaceGroup* CInterfaceElement::getParentContainer()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CInterfaceElement *parent = this;
|
|
|
|
CInterfaceElement *parent = this;
|
|
|
|
while (parent)
|
|
|
|
while (parent)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -863,46 +866,46 @@ CInterfaceGroup* CInterfaceElement::getParentContainer()
|
|
|
|
parent = parent->getParent();
|
|
|
|
parent = parent->getParent();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
bool CInterfaceElement::isIn(sint x, sint y) const
|
|
|
|
bool CInterfaceElement::isIn(sint x, sint y) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return (x >= _XReal) &&
|
|
|
|
return (x >= _XReal) &&
|
|
|
|
(x < (_XReal + _WReal))&&
|
|
|
|
(x < (_XReal + _WReal))&&
|
|
|
|
(y > _YReal) &&
|
|
|
|
(y > _YReal) &&
|
|
|
|
(y <= (_YReal+ _HReal));
|
|
|
|
(y <= (_YReal+ _HReal));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
bool CInterfaceElement::isIn(sint x, sint y, uint width, uint height) const
|
|
|
|
bool CInterfaceElement::isIn(sint x, sint y, uint width, uint height) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return (x + (sint) width) >= _XReal &&
|
|
|
|
return (x + (sint) width) >= _XReal &&
|
|
|
|
(y + (sint) height) > _YReal &&
|
|
|
|
(y + (sint) height) > _YReal &&
|
|
|
|
x < (_XReal + _WReal) &&
|
|
|
|
x < (_XReal + _WReal) &&
|
|
|
|
y <= (_YReal + _HReal);
|
|
|
|
y <= (_YReal + _HReal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
bool CInterfaceElement::isIn(const CInterfaceElement &other) const
|
|
|
|
bool CInterfaceElement::isIn(const CInterfaceElement &other) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return isIn(other._XReal, other._YReal, other._WReal, other._HReal);
|
|
|
|
return isIn(other._XReal, other._YReal, other._WReal, other._HReal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CInterfaceElement::setActive (bool state)
|
|
|
|
void CInterfaceElement::setActive (bool state)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_Active != state)
|
|
|
|
if (_Active != state)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_Active = state;
|
|
|
|
_Active = state;
|
|
|
|
invalidateCoords();
|
|
|
|
invalidateCoords();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::invalidateCoords(uint8 numPass)
|
|
|
|
void CInterfaceElement::invalidateCoords(uint8 numPass)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Get the "Root Group" ie the 1st son of the master group of us (eg "ui:interface:rootgroup" )
|
|
|
|
// Get the "Root Group" ie the 1st son of the master group of us (eg "ui:interface:rootgroup" )
|
|
|
|
CInterfaceGroup *parent= getParent();
|
|
|
|
CInterfaceGroup *parent= getParent();
|
|
|
|
// if our parent is NULL, then we are the master group (error!)
|
|
|
|
// if our parent is NULL, then we are the master group (error!)
|
|
|
@ -928,17 +931,17 @@ void CInterfaceElement::invalidateCoords(uint8 numPass)
|
|
|
|
uint8 &val= static_cast<CInterfaceElement*>(parent)->_InvalidCoords;
|
|
|
|
uint8 &val= static_cast<CInterfaceElement*>(parent)->_InvalidCoords;
|
|
|
|
val= max(val, numPass);
|
|
|
|
val= max(val, numPass);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::checkCoords()
|
|
|
|
void CInterfaceElement::checkCoords()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
bool CInterfaceElement::isSonOf(const CInterfaceElement *other) const
|
|
|
|
bool CInterfaceElement::isSonOf(const CInterfaceElement *other) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const CInterfaceElement *currElem = this;
|
|
|
|
const CInterfaceElement *currElem = this;
|
|
|
|
do
|
|
|
|
do
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -947,17 +950,17 @@ bool CInterfaceElement::isSonOf(const CInterfaceElement *other) const
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (currElem);
|
|
|
|
while (currElem);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::resetInvalidCoords()
|
|
|
|
void CInterfaceElement::resetInvalidCoords()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_InvalidCoords= 0;
|
|
|
|
_InvalidCoords= 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::updateAllLinks()
|
|
|
|
void CInterfaceElement::updateAllLinks()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_Links)
|
|
|
|
if (_Links)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for(TLinkVect::iterator it = _Links->begin(); it != _Links->end(); ++it)
|
|
|
|
for(TLinkVect::iterator it = _Links->begin(); it != _Links->end(); ++it)
|
|
|
@ -965,11 +968,11 @@ void CInterfaceElement::updateAllLinks()
|
|
|
|
(*it)->update();
|
|
|
|
(*it)->update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::copyOptionFrom(const CInterfaceElement &other)
|
|
|
|
void CInterfaceElement::copyOptionFrom(const CInterfaceElement &other)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_Active = other._Active;
|
|
|
|
_Active = other._Active;
|
|
|
|
_InvalidCoords = other._InvalidCoords;
|
|
|
|
_InvalidCoords = other._InvalidCoords;
|
|
|
|
_XReal = other._XReal;
|
|
|
|
_XReal = other._XReal;
|
|
|
@ -988,22 +991,22 @@ void CInterfaceElement::copyOptionFrom(const CInterfaceElement &other)
|
|
|
|
_ModulateGlobalColor = other._ModulateGlobalColor;
|
|
|
|
_ModulateGlobalColor = other._ModulateGlobalColor;
|
|
|
|
_RenderLayer = other._RenderLayer;
|
|
|
|
_RenderLayer = other._RenderLayer;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::center()
|
|
|
|
void CInterfaceElement::center()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// center the pc
|
|
|
|
// center the pc
|
|
|
|
CViewRenderer &vr = *CViewRenderer::getInstance();
|
|
|
|
CViewRenderer &vr = *CViewRenderer::getInstance();
|
|
|
|
uint32 sw, sh;
|
|
|
|
uint32 sw, sh;
|
|
|
|
vr.getScreenSize(sw, sh);
|
|
|
|
vr.getScreenSize(sw, sh);
|
|
|
|
setX(sw / 2 - getWReal() / 2);
|
|
|
|
setX(sw / 2 - getWReal() / 2);
|
|
|
|
setY(sh / 2 + getHReal() / 2);
|
|
|
|
setY(sh / 2 + getHReal() / 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::renderWiredQuads(TRenderWired type, const std::string &uiFilter)
|
|
|
|
void CInterfaceElement::renderWiredQuads(TRenderWired type, const std::string &uiFilter)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CCtrlBase *ctrlBase = dynamic_cast<CCtrlBase*>(this);
|
|
|
|
CCtrlBase *ctrlBase = dynamic_cast<CCtrlBase*>(this);
|
|
|
|
CInterfaceGroup *groupBase = dynamic_cast<CInterfaceGroup*>(this);
|
|
|
|
CInterfaceGroup *groupBase = dynamic_cast<CInterfaceGroup*>(this);
|
|
|
|
if (
|
|
|
|
if (
|
|
|
@ -1022,11 +1025,11 @@ void CInterfaceElement::renderWiredQuads(TRenderWired type, const std::string &u
|
|
|
|
drawHotSpot(_PosRef, CRGBA::Red);
|
|
|
|
drawHotSpot(_PosRef, CRGBA::Red);
|
|
|
|
if (_Parent) _Parent->drawHotSpot(_ParentPosRef, CRGBA::Blue);
|
|
|
|
if (_Parent) _Parent->drawHotSpot(_ParentPosRef, CRGBA::Blue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::drawHotSpot(THotSpot hs, CRGBA col)
|
|
|
|
void CInterfaceElement::drawHotSpot(THotSpot hs, CRGBA col)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const sint32 radius = 2;
|
|
|
|
const sint32 radius = 2;
|
|
|
|
sint32 px, py;
|
|
|
|
sint32 px, py;
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -1058,11 +1061,11 @@ void CInterfaceElement::drawHotSpot(THotSpot hs, CRGBA col)
|
|
|
|
CViewRenderer &vr = *CViewRenderer::getInstance();
|
|
|
|
CViewRenderer &vr = *CViewRenderer::getInstance();
|
|
|
|
vr.drawFilledQuad(px - radius, py - radius, radius * 2, radius * 2, col);
|
|
|
|
vr.drawFilledQuad(px - radius, py - radius, radius * 2, radius * 2, col);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::invalidateContent()
|
|
|
|
void CInterfaceElement::invalidateContent()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CInterfaceElement *elm = this;
|
|
|
|
CInterfaceElement *elm = this;
|
|
|
|
while (elm)
|
|
|
|
while (elm)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1072,79 +1075,79 @@ void CInterfaceElement::invalidateContent()
|
|
|
|
// Get the parent
|
|
|
|
// Get the parent
|
|
|
|
elm = elm->getParent();
|
|
|
|
elm = elm->getParent();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::visit(CInterfaceElementVisitor *visitor)
|
|
|
|
void CInterfaceElement::visit(CInterfaceElementVisitor *visitor)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlassert(visitor);
|
|
|
|
nlassert(visitor);
|
|
|
|
visitor->visit(this);
|
|
|
|
visitor->visit(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::serialConfig(NLMISC::IStream &f)
|
|
|
|
void CInterfaceElement::serialConfig(NLMISC::IStream &f)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (f.isReading())
|
|
|
|
if (f.isReading())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw NLMISC::ENewerStream(f);
|
|
|
|
throw NLMISC::ENewerStream(f);
|
|
|
|
nlassert(0);
|
|
|
|
nlassert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::onFrameUpdateWindowPos(sint dx, sint dy)
|
|
|
|
void CInterfaceElement::onFrameUpdateWindowPos(sint dx, sint dy)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_XReal+= dx;
|
|
|
|
_XReal+= dx;
|
|
|
|
_YReal+= dy;
|
|
|
|
_YReal+= dy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::dummySet(sint32 /* value */)
|
|
|
|
void CInterfaceElement::dummySet(sint32 /* value */)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlwarning("Element can't be written.");
|
|
|
|
nlwarning("Element can't be written.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::dummySet(const std::string &/* value */)
|
|
|
|
void CInterfaceElement::dummySet(const std::string &/* value */)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlwarning("Element can't be written.");
|
|
|
|
nlwarning("Element can't be written.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
int CInterfaceElement::luaUpdateCoords(CLuaState &ls)
|
|
|
|
int CInterfaceElement::luaUpdateCoords(CLuaState &ls)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CLuaIHM::checkArgCount(ls, "updateCoords", 0);
|
|
|
|
CLuaIHM::checkArgCount(ls, "updateCoords", 0);
|
|
|
|
updateCoords();
|
|
|
|
updateCoords();
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
int CInterfaceElement::luaInvalidateCoords(CLuaState &ls)
|
|
|
|
int CInterfaceElement::luaInvalidateCoords(CLuaState &ls)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CLuaIHM::checkArgCount(ls, "updateCoords", 0);
|
|
|
|
CLuaIHM::checkArgCount(ls, "updateCoords", 0);
|
|
|
|
invalidateCoords();
|
|
|
|
invalidateCoords();
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
int CInterfaceElement::luaInvalidateContent(CLuaState &ls)
|
|
|
|
int CInterfaceElement::luaInvalidateContent(CLuaState &ls)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CLuaIHM::checkArgCount(ls, "invalidateContent", 0);
|
|
|
|
CLuaIHM::checkArgCount(ls, "invalidateContent", 0);
|
|
|
|
invalidateContent();
|
|
|
|
invalidateContent();
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
int CInterfaceElement::luaCenter(CLuaState &ls)
|
|
|
|
int CInterfaceElement::luaCenter(CLuaState &ls)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CLuaIHM::checkArgCount(ls, "center", 0);
|
|
|
|
CLuaIHM::checkArgCount(ls, "center", 0);
|
|
|
|
center();
|
|
|
|
center();
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
int CInterfaceElement::luaSetPosRef(CLuaState &ls)
|
|
|
|
int CInterfaceElement::luaSetPosRef(CLuaState &ls)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CLuaIHM::checkArgCount(ls, "setPosRef", 1);
|
|
|
|
CLuaIHM::checkArgCount(ls, "setPosRef", 1);
|
|
|
|
CLuaIHM::check(ls, ls.isString(1), "setPosRef() requires a string in param 1");
|
|
|
|
CLuaIHM::check(ls, ls.isString(1), "setPosRef() requires a string in param 1");
|
|
|
|
|
|
|
|
|
|
|
@ -1161,11 +1164,11 @@ int CInterfaceElement::luaSetPosRef(CLuaState &ls)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
int CInterfaceElement::luaSetParentPos(CLuaState &ls)
|
|
|
|
int CInterfaceElement::luaSetParentPos(CLuaState &ls)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CLuaIHM::checkArgCount(ls, "setParentPos", 1);
|
|
|
|
CLuaIHM::checkArgCount(ls, "setParentPos", 1);
|
|
|
|
CInterfaceElement *ie = CLuaIHM::getUIOnStack(ls, 1);
|
|
|
|
CInterfaceElement *ie = CLuaIHM::getUIOnStack(ls, 1);
|
|
|
|
if(ie)
|
|
|
|
if(ie)
|
|
|
@ -1173,13 +1176,13 @@ int CInterfaceElement::luaSetParentPos(CLuaState &ls)
|
|
|
|
setParentPos(ie);
|
|
|
|
setParentPos(ie);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
CInterfaceElement *CInterfaceElement::clone()
|
|
|
|
CInterfaceElement *CInterfaceElement::clone()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NLMISC::CMemStream dupStream;
|
|
|
|
NLMISC::CMemStream dupStream;
|
|
|
|
nlassert(!dupStream.isReading());
|
|
|
|
nlassert(!dupStream.isReading());
|
|
|
|
CInterfaceGroup *oldParent = _Parent;
|
|
|
|
CInterfaceGroup *oldParent = _Parent;
|
|
|
@ -1214,11 +1217,11 @@ CInterfaceElement *CInterfaceElement::clone()
|
|
|
|
_ParentSize = oldParentSize;
|
|
|
|
_ParentSize = oldParentSize;
|
|
|
|
//
|
|
|
|
//
|
|
|
|
return begunThisCloneWarHas;
|
|
|
|
return begunThisCloneWarHas;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::serial(NLMISC::IStream &f)
|
|
|
|
void CInterfaceElement::serial(NLMISC::IStream &f)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
f.serialPolyPtr(_Parent);
|
|
|
|
f.serialPolyPtr(_Parent);
|
|
|
|
f.serial(_Id);
|
|
|
|
f.serial(_Id);
|
|
|
|
f.serial(_Active);
|
|
|
|
f.serial(_Active);
|
|
|
@ -1235,12 +1238,12 @@ void CInterfaceElement::serial(NLMISC::IStream &f)
|
|
|
|
f.serial(_RenderLayer);
|
|
|
|
f.serial(_RenderLayer);
|
|
|
|
f.serial(_AvoidResizeParent);
|
|
|
|
f.serial(_AvoidResizeParent);
|
|
|
|
nlassert(_Links == NULL); // not supported
|
|
|
|
nlassert(_Links == NULL); // not supported
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CInterfaceElement::serialAH(NLMISC::IStream &f, IActionHandler *&ah)
|
|
|
|
void CInterfaceElement::serialAH(NLMISC::IStream &f, IActionHandler *&ah)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string ahName;
|
|
|
|
std::string ahName;
|
|
|
|
if (f.isReading())
|
|
|
|
if (f.isReading())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1252,9 +1255,10 @@ void CInterfaceElement::serialAH(NLMISC::IStream &f, IActionHandler *&ah)
|
|
|
|
ahName = CAHManager::getInstance()->getActionHandlerName(ah);
|
|
|
|
ahName = CAHManager::getInstance()->getActionHandlerName(ah);
|
|
|
|
f.serial(ahName);
|
|
|
|
f.serial(ahName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|