Add rowspan and colspan attributes

This commit is contained in:
Nimetu 2014-10-14 15:26:14 +03:00
parent 36ba6552c0
commit 1af765330d
3 changed files with 46 additions and 0 deletions

View file

@ -78,6 +78,8 @@ namespace NLGUI
// The Width you want in pixel. This is the <td width="100"> parameter // The Width you want in pixel. This is the <td width="100"> parameter
sint32 WidthWanted; sint32 WidthWanted;
sint32 ColSpan;
sint32 RowSpan;
// The min height of the cell // The min height of the cell
sint32 Height; sint32 Height;

View file

@ -1519,11 +1519,19 @@ namespace NLGUI
} }
} }
} }
if (present[MY_HTML_TD_COLSPAN] && value[MY_HTML_TD_COLSPAN])
fromString(value[MY_HTML_TD_COLSPAN], _Cells.back()->ColSpan);
if (present[MY_HTML_TD_ROWSPAN] && value[MY_HTML_TD_ROWSPAN])
fromString(value[MY_HTML_TD_ROWSPAN], _Cells.back()->RowSpan);
_Cells.back()->BgColor = _CellParams.back().BgColor; _Cells.back()->BgColor = _CellParams.back().BgColor;
_Cells.back()->Align = _CellParams.back().Align; _Cells.back()->Align = _CellParams.back().Align;
_Cells.back()->VAlign = _CellParams.back().VAlign; _Cells.back()->VAlign = _CellParams.back().VAlign;
_Cells.back()->LeftMargin = _CellParams.back().LeftMargin; _Cells.back()->LeftMargin = _CellParams.back().LeftMargin;
_Cells.back()->NoWrap = _CellParams.back().NoWrap; _Cells.back()->NoWrap = _CellParams.back().NoWrap;
_Cells.back()->ColSpan = std::max(1, _Cells.back()->ColSpan);
_Cells.back()->RowSpan = std::max(1, _Cells.back()->RowSpan);
float temp; float temp;
if (present[MY_HTML_TD_WIDTH] && value[MY_HTML_TD_WIDTH]) if (present[MY_HTML_TD_WIDTH] && value[MY_HTML_TD_WIDTH])

View file

@ -44,6 +44,8 @@ namespace NLGUI
TableRatio = 0.f; TableRatio = 0.f;
WidthWanted = 0; WidthWanted = 0;
Height = 0; Height = 0;
ColSpan = 1;
RowSpan = 1;
Group = new CInterfaceGroup(CViewBase::TCtorParam()); Group = new CInterfaceGroup(CViewBase::TCtorParam());
Align = Left; Align = Left;
VAlign = Top; VAlign = Top;
@ -249,6 +251,22 @@ namespace NLGUI
AddChildW = b; AddChildW = b;
return; return;
} }
else
if (name == "colspan" )
{
sint32 i;
if (fromString( value, i ) )
ColSpan = std::max(1, i);
return;
}
else
if (name == "rowspan" )
{
sint32 i;
if (fromString( value, i ) )
RowSpan = std::max(1, i);
return;
}
else else
CInterfaceGroup::setProperty( name, value ); CInterfaceGroup::setProperty( name, value );
} }
@ -310,6 +328,8 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "ignore_max_width", BAD_CAST toString( IgnoreMaxWidth ).c_str() ); xmlSetProp( node, BAD_CAST "ignore_max_width", BAD_CAST toString( IgnoreMaxWidth ).c_str() );
xmlSetProp( node, BAD_CAST "ignore_min_width", BAD_CAST toString( IgnoreMinWidth ).c_str() ); xmlSetProp( node, BAD_CAST "ignore_min_width", BAD_CAST toString( IgnoreMinWidth ).c_str() );
xmlSetProp( node, BAD_CAST "add_child_w", BAD_CAST toString( AddChildW ).c_str() ); xmlSetProp( node, BAD_CAST "add_child_w", BAD_CAST toString( AddChildW ).c_str() );
xmlSetProp( node, BAD_CAST "colspan", BAD_CAST toString( ColSpan ).c_str() );
xmlSetProp( node, BAD_CAST "rowspan", BAD_CAST toString( RowSpan ).c_str() );
return node; return node;
} }
@ -422,6 +442,22 @@ namespace NLGUI
{ {
AddChildW = convertBool(ptr); AddChildW = convertBool(ptr);
} }
//
ptr = (char*) xmlGetProp( cur, (xmlChar*)"colspan" );
if (ptr)
{
sint32 i;
if (fromString((const char*)ptr, i))
ColSpan = std::max(1, i);
}
//
ptr = (char*) xmlGetProp( cur, (xmlChar*)"rowspan" );
if (ptr)
{
sint32 i;
if (fromString((const char*)ptr, i))
RowSpan = std::max(1, i);
}
return true; return true;
} }