Add bordercolor attribute to table tag

--HG--
branch : html-table-rendering
This commit is contained in:
Nimetu 2014-10-13 01:10:46 +03:00
parent 2de4315027
commit 283cbe8092
5 changed files with 26 additions and 0 deletions

View file

@ -142,6 +142,7 @@ namespace NLGUI
// Table borders
sint32 Border;
NLMISC::CRGBA BorderColor;
sint32 CellPadding;
sint32 CellSpacing;

View file

@ -79,6 +79,7 @@ namespace NLGUI
HTML_ATTR(TABLE,ALIGN) = 0,
HTML_ATTR(TABLE,BGCOLOR),
HTML_ATTR(TABLE,BORDER),
HTML_ATTR(TABLE,BORDERCOLOR),
HTML_ATTR(TABLE,CELLPADDING),
HTML_ATTR(TABLE,CELLSPACING),
HTML_ATTR(TABLE,CLASS),

View file

@ -1453,6 +1453,8 @@ namespace NLGUI
getPercentage (table->ForceWidthMin, table->TableRatio, value[MY_HTML_TABLE_WIDTH]);
if (present[MY_HTML_TABLE_BORDER] && value[MY_HTML_TABLE_BORDER])
fromString(value[MY_HTML_TABLE_BORDER], table->Border);
if (present[MY_HTML_TABLE_BORDERCOLOR] && value[MY_HTML_TABLE_BORDERCOLOR])
table->BorderColor = getColor (value[MY_HTML_TABLE_BORDERCOLOR]);
if (present[MY_HTML_TABLE_CELLSPACING] && value[MY_HTML_TABLE_CELLSPACING])
fromString(value[MY_HTML_TABLE_CELLSPACING], table->CellSpacing);
if (present[MY_HTML_TABLE_CELLPADDING] && value[MY_HTML_TABLE_CELLPADDING])

View file

@ -559,6 +559,7 @@ namespace NLGUI
TableRatio = 0.f;
ForceWidthMin = 0;
Border=0;
BorderColor = CRGBA(127, 127, 127, 255);
CellPadding=0;
CellSpacing=0;
ContinuousUpdate = false;
@ -1243,6 +1244,11 @@ namespace NLGUI
return toString( Border );
}
else
if( name == "bordercolor" )
{
return toString( BorderColor );
}
else
if( name == "cellpadding" )
{
return toString( CellPadding );
@ -1279,6 +1285,14 @@ namespace NLGUI
return;
}
else
if( name == "bordercolor" )
{
CRGBA c;
if( fromString( value, c ) )
BorderColor = c;
return;
}
else
if( name == "cellpadding" )
{
sint32 i;
@ -1321,6 +1335,7 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "type", BAD_CAST "table" );
xmlSetProp( node, BAD_CAST "border", BAD_CAST toString( Border ).c_str() );
xmlSetProp( node, BAD_CAST "bordercolor", BAD_CAST toString( BorderColor ).c_str() );
xmlSetProp( node, BAD_CAST "cellpadding", BAD_CAST toString( CellPadding ).c_str() );
xmlSetProp( node, BAD_CAST "cellspacing", BAD_CAST toString( CellSpacing ).c_str() );
xmlSetProp( node, BAD_CAST "bgcolor", BAD_CAST toString( BgColor ).c_str() );
@ -1345,6 +1360,12 @@ namespace NLGUI
fromString((const char*)ptr, Border);
}
//
ptr = (char*) xmlGetProp( cur, (xmlChar*)"bordercolor" );
if (ptr)
{
BorderColor = convertColor((const char*)ptr);
}
//
ptr = (char*) xmlGetProp( cur, (xmlChar*)"cellpadding" );
if (ptr)
{

View file

@ -86,6 +86,7 @@ namespace NLGUI
HTML_ATTR(TABLE,ALIGN),
HTML_ATTR(TABLE,BGCOLOR),
HTML_ATTR(TABLE,BORDER),
HTML_ATTR(TABLE,BORDERCOLOR),
HTML_ATTR(TABLE,CELLPADDING),
HTML_ATTR(TABLE,CELLSPACING),
HTML_ATTR(TABLE,CLASS),