From 1c7a0e4ff261a0f4dc3bebe7494ebcefec74e52c Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 5 Aug 2012 19:59:34 +0200 Subject: [PATCH] CHANGED: #1471 Implemented property setting for CGgroupCell. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/group_table.h | 1 + code/nel/src/gui/group_table.cpp | 95 ++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/code/nel/include/nel/gui/group_table.h b/code/nel/include/nel/gui/group_table.h index e5d2029e2..23fed8edf 100644 --- a/code/nel/include/nel/gui/group_table.h +++ b/code/nel/include/nel/gui/group_table.h @@ -58,6 +58,7 @@ namespace NLGUI virtual sint32 getMinUsedW() const; std::string getProperty( const std::string &name ) const; + void setProperty( const std::string &name, const std::string &value ); // to be called by CGroupTable bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup, uint columnIndex, uint rowIndex); diff --git a/code/nel/src/gui/group_table.cpp b/code/nel/src/gui/group_table.cpp index d2f2bb822..ad340c571 100644 --- a/code/nel/src/gui/group_table.cpp +++ b/code/nel/src/gui/group_table.cpp @@ -152,6 +152,101 @@ namespace NLGUI return CInterfaceGroup::getProperty( name ); } + void CGroupCell::setProperty( const std::string &name, const std::string &value ) + { + if( name == "align" ) + { + if( value == "right" ) + Align = Right; + else + if( value == "center" ) + Align = Center; + else + if( value == "left" ) + Align = Left; + + return; + } + else + if( name == "valign" ) + { + if( value == "top" ) + VAlign = Top; + else + if( value == "middle" ) + VAlign = Middle; + else + if( value == "bottom" ) + VAlign = Bottom; + + return; + } + else + if( name == "left_margin" ) + { + sint32 i; + if( fromString( value, i ) ) + LeftMargin = i; + return; + } + else + if( name == "nowrap" ) + { + bool b; + if( fromString( value, b ) ) + NoWrap = b; + return; + } + else + if( name == "bgcolor" ) + { + CRGBA c; + if( fromString( value, c ) ) + BgColor = c; + return; + } + else + if( name == "width" ) + { + convertPixelsOrRatio( value.c_str(), WidthWanted, TableRatio ); + return; + } + else + if( name == "height" ) + { + sint32 i; + if( fromString( value, i ) ) + Height = i; + return; + } + else + if( name == "ignore_max_width" ) + { + bool b; + if( fromString( value, b ) ) + IgnoreMaxWidth = b; + return; + } + else + if( name == "ignore_min_width" ) + { + bool b; + if( fromString( value, b ) ) + IgnoreMinWidth = b; + return; + } + else + if( name == "add_child_w" ) + { + bool b; + if( fromString( value, b ) ) + AddChildW = b; + return; + } + else + CInterfaceGroup::setProperty( name, value ); + } + // ---------------------------------------------------------------------------- bool CGroupCell::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup, uint columnIndex, uint rowIndex) {