mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-28 01:56:24 +00:00
CHANGED: #1471 Implemented property setting for CGgroupFrame.
This commit is contained in:
parent
b18b005e88
commit
fb19686b06
2 changed files with 86 additions and 50 deletions
|
@ -41,11 +41,13 @@ namespace NLGUI
|
||||||
CGroupFrame(const TCtorParam ¶m);
|
CGroupFrame(const TCtorParam ¶m);
|
||||||
|
|
||||||
std::string getProperty( const std::string &name ) const;
|
std::string getProperty( const std::string &name ) const;
|
||||||
|
void setProperty( const std::string &name, const std::string &value );
|
||||||
|
|
||||||
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||||
virtual void draw ();
|
virtual void draw ();
|
||||||
|
|
||||||
void copyOptionFrom(const CGroupFrame &other);
|
void copyOptionFrom(const CGroupFrame &other);
|
||||||
|
void setupOptions();
|
||||||
|
|
||||||
|
|
||||||
void setColorAsString(const std::string & col);
|
void setColorAsString(const std::string & col);
|
||||||
|
|
|
@ -64,6 +64,34 @@ namespace NLGUI
|
||||||
return CInterfaceGroup::getProperty( name );
|
return CInterfaceGroup::getProperty( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGroupFrame::setProperty( const std::string &name, const std::string &value )
|
||||||
|
{
|
||||||
|
if( name == "display" )
|
||||||
|
{
|
||||||
|
bool b;
|
||||||
|
if( fromString( value, b ) )
|
||||||
|
_DisplayFrame = b;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "color" )
|
||||||
|
{
|
||||||
|
CRGBA c;
|
||||||
|
if( fromString( value, c ) )
|
||||||
|
_Color = c;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "options" )
|
||||||
|
{
|
||||||
|
_Options = value;
|
||||||
|
setupOptions();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
CInterfaceGroup::setProperty( name, value );
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
bool CGroupFrame::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
bool CGroupFrame::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||||
{
|
{
|
||||||
|
@ -95,12 +123,9 @@ namespace NLGUI
|
||||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||||
|
|
||||||
ptr = (char*) xmlGetProp( cur, (xmlChar*)"options" );
|
ptr = (char*) xmlGetProp( cur, (xmlChar*)"options" );
|
||||||
CInterfaceOptions *pIO = NULL;
|
|
||||||
|
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
_Options = std::string( ptr );
|
_Options = std::string( ptr );
|
||||||
pIO = CWidgetManager::getInstance()->getOptions(ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The first type in display type struct is the default display type
|
// The first type in display type struct is the default display type
|
||||||
|
@ -126,52 +151,7 @@ namespace NLGUI
|
||||||
_DispTypes.push_back(dt);
|
_DispTypes.push_back(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pIO != NULL)
|
setupOptions();
|
||||||
{
|
|
||||||
_DispTypeDefined= true;
|
|
||||||
|
|
||||||
// Look if we find the type...
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0; i < _DispTypes.size(); ++i)
|
|
||||||
if (_DispTypes[i].Name == string((const char*)ptr))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (i == _DispTypes.size())
|
|
||||||
{
|
|
||||||
SDisplayType dt;
|
|
||||||
dt.Name = string((const char*)ptr);
|
|
||||||
// get texture ids.
|
|
||||||
dt.BorderIds[TextTL]= rVR.getTextureIdFromName (pIO->getValStr("tx_tl"));
|
|
||||||
dt.BorderIds[TextTM]= rVR.getTextureIdFromName (pIO->getValStr("tx_t"));
|
|
||||||
dt.BorderIds[TextTR]= rVR.getTextureIdFromName (pIO->getValStr("tx_tr"));
|
|
||||||
// middle
|
|
||||||
dt.BorderIds[TextML]= rVR.getTextureIdFromName (pIO->getValStr("tx_l"));
|
|
||||||
dt.BorderIds[TextMM]= rVR.getTextureIdFromName (pIO->getValStr("tx_blank"));
|
|
||||||
dt.BorderIds[TextMR]= rVR.getTextureIdFromName (pIO->getValStr("tx_r"));
|
|
||||||
// bottom
|
|
||||||
dt.BorderIds[TextBL]= rVR.getTextureIdFromName (pIO->getValStr("tx_bl"));
|
|
||||||
dt.BorderIds[TextBM]= rVR.getTextureIdFromName (pIO->getValStr("tx_b"));
|
|
||||||
dt.BorderIds[TextBR]= rVR.getTextureIdFromName (pIO->getValStr("tx_br"));
|
|
||||||
|
|
||||||
// Tile
|
|
||||||
dt.TileBorder[TextTM] = (uint8)pIO->getValSInt32("tile_t");
|
|
||||||
dt.TileBorder[TextML] = (uint8)pIO->getValSInt32("tile_l");
|
|
||||||
dt.TileBorder[TextMM] = (uint8)pIO->getValSInt32("tile_blank");
|
|
||||||
dt.TileBorder[TextMR] = (uint8)pIO->getValSInt32("tile_r");
|
|
||||||
dt.TileBorder[TextBM] = (uint8)pIO->getValSInt32("tile_b");
|
|
||||||
|
|
||||||
// get size
|
|
||||||
rVR.getTextureSizeFromId (dt.BorderIds[TextTL], dt.LeftBorder, dt.TopBorder);
|
|
||||||
rVR.getTextureSizeFromId (dt.BorderIds[TextBR], dt.RightBorder, dt.BottomBorder);
|
|
||||||
_DispTypes.push_back(dt);
|
|
||||||
}
|
|
||||||
_DispType = (uint8)i;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_DispType = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -262,6 +242,60 @@ namespace NLGUI
|
||||||
_DispType = other._DispType;
|
_DispType = other._DispType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGroupFrame::setupOptions()
|
||||||
|
{
|
||||||
|
CViewRenderer &rVR = *(CViewRenderer::getInstance());
|
||||||
|
|
||||||
|
CInterfaceOptions *pIO = NULL;
|
||||||
|
pIO = CWidgetManager::getInstance()->getOptions( _Options );
|
||||||
|
|
||||||
|
if( pIO != NULL )
|
||||||
|
{
|
||||||
|
_DispTypeDefined= true;
|
||||||
|
|
||||||
|
// Look if we find the type...
|
||||||
|
uint32 i;
|
||||||
|
for (i = 0; i < _DispTypes.size(); ++i)
|
||||||
|
if (_DispTypes[i].Name == _Options )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (i == _DispTypes.size())
|
||||||
|
{
|
||||||
|
SDisplayType dt;
|
||||||
|
dt.Name = _Options;
|
||||||
|
// get texture ids.
|
||||||
|
dt.BorderIds[TextTL]= rVR.getTextureIdFromName (pIO->getValStr("tx_tl"));
|
||||||
|
dt.BorderIds[TextTM]= rVR.getTextureIdFromName (pIO->getValStr("tx_t"));
|
||||||
|
dt.BorderIds[TextTR]= rVR.getTextureIdFromName (pIO->getValStr("tx_tr"));
|
||||||
|
// middle
|
||||||
|
dt.BorderIds[TextML]= rVR.getTextureIdFromName (pIO->getValStr("tx_l"));
|
||||||
|
dt.BorderIds[TextMM]= rVR.getTextureIdFromName (pIO->getValStr("tx_blank"));
|
||||||
|
dt.BorderIds[TextMR]= rVR.getTextureIdFromName (pIO->getValStr("tx_r"));
|
||||||
|
// bottom
|
||||||
|
dt.BorderIds[TextBL]= rVR.getTextureIdFromName (pIO->getValStr("tx_bl"));
|
||||||
|
dt.BorderIds[TextBM]= rVR.getTextureIdFromName (pIO->getValStr("tx_b"));
|
||||||
|
dt.BorderIds[TextBR]= rVR.getTextureIdFromName (pIO->getValStr("tx_br"));
|
||||||
|
|
||||||
|
// Tile
|
||||||
|
dt.TileBorder[TextTM] = (uint8)pIO->getValSInt32("tile_t");
|
||||||
|
dt.TileBorder[TextML] = (uint8)pIO->getValSInt32("tile_l");
|
||||||
|
dt.TileBorder[TextMM] = (uint8)pIO->getValSInt32("tile_blank");
|
||||||
|
dt.TileBorder[TextMR] = (uint8)pIO->getValSInt32("tile_r");
|
||||||
|
dt.TileBorder[TextBM] = (uint8)pIO->getValSInt32("tile_b");
|
||||||
|
|
||||||
|
// get size
|
||||||
|
rVR.getTextureSizeFromId (dt.BorderIds[TextTL], dt.LeftBorder, dt.TopBorder);
|
||||||
|
rVR.getTextureSizeFromId (dt.BorderIds[TextBR], dt.RightBorder, dt.BottomBorder);
|
||||||
|
_DispTypes.push_back(dt);
|
||||||
|
}
|
||||||
|
_DispType = (uint8)i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_DispType = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CGroupFrame::setColorAsString(const string & col)
|
void CGroupFrame::setColorAsString(const string & col)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue