Added: html TH element

This commit is contained in:
Nimetu 2015-12-18 14:29:40 +02:00
parent 5b9c9b58a6
commit f951a3c3b6
2 changed files with 15 additions and 0 deletions

View file

@ -1783,11 +1783,21 @@ namespace NLGUI
_TR.push_back(false);
}
break;
case HTML_TH:
// TH is similar to TD, just different font style
case HTML_TD:
{
// Get cells parameters
getCellsParameters (MY_HTML_TD, true);
if (element_number == HTML_TH)
{
_FontWeight.push_back(FONT_WEIGHT_BOLD);
// center if not specified otherwise. TD/TH present/value arrays have same indices
if (!(present[MY_HTML_TD_ALIGN] && value[MY_HTML_TD_ALIGN]))
_CellParams.back().Align = CGroupCell::Center;
}
CGroupTable *table = getTable();
if (table)
{
@ -2124,6 +2134,9 @@ namespace NLGUI
endParagraph();
// Add a cell
break;
case HTML_TH:
popIfNotEmpty (_FontWeight);
// no break;
case HTML_TD:
popIfNotEmpty (_CellParams);
if (!_Cells.empty())

View file

@ -481,6 +481,8 @@ namespace NLGUI
HTML_DTD->tags[HTML_TR].number_of_attributes = sizeof(tr_attr) / sizeof(HTAttr) - 1;
HTML_DTD->tags[HTML_TD].attributes = td_attr;
HTML_DTD->tags[HTML_TD].number_of_attributes = sizeof(td_attr) / sizeof(HTAttr) - 1;
HTML_DTD->tags[HTML_TH].attributes = td_attr;
HTML_DTD->tags[HTML_TH].number_of_attributes = sizeof(td_attr) / sizeof(HTAttr) - 1;
HTML_DTD->tags[HTML_IMG].attributes = img_attr;
HTML_DTD->tags[HTML_IMG].number_of_attributes = sizeof(img_attr) / sizeof(HTAttr) - 1;
HTML_DTD->tags[HTML_INPUT].attributes = input_attr;