Added html HR element

This commit is contained in:
Nimetu 2015-12-18 14:29:40 +02:00
parent 000adc4670
commit 5b9c9b58a6
3 changed files with 82 additions and 1 deletions

View file

@ -2032,6 +2032,43 @@ namespace NLGUI
endParagraph();
}
break;
case HTML_HR:
{
newParagraph(0);
CInterfaceGroup *sep = CWidgetManager::getInstance()->getParser()->createGroupInstance("html_hr", "", NULL, 0);
if (sep)
{
CStyleParams style;
style.TextColor = CRGBA(120, 120, 120, 255);
style.Height = 0;
style.Width = 0;
if (present[HTML_HR_STYLE] && value[HTML_HR_STYLE])
getStyleParams(value[HTML_HR_STYLE], style);
CViewBitmap *bitmap = dynamic_cast<CViewBitmap*>(sep->getView("hr"));
if (bitmap)
{
bitmap->setColor(style.TextColor);
if (style.Width > 0)
{
clamp(style.Width, 1, 32000);
bitmap->setW(style.Width);
bitmap->setSizeRef(CInterfaceElement::none);
}
if (style.Height > 0)
{
clamp(style.Height, 1, 1000);
bitmap->setH(style.Height);
}
}
getParagraph()->addChild(sep);
endParagraph();
}
}
break;
}
}
}

View file

@ -955,6 +955,27 @@
highlight_over="255 255 255 128"
force_inside_screen="true"
/>
<!-- html <hr> element -->
<template name="html_hr"
keep="true">
<group id="sep_gr"
posref="ML ML"
sizeref="w"
w="0"
h="0"
child_resize_h="true"
child_resize_hmargin="12">
<view type="bitmap"
id="hr"
posref="MM MM"
sizeref="w"
w="-2"
h="2"
inherit_gc_alpha="true"
scale="true"
texture="blank.tga"
global_color="false" />
</group>
</template>
</interface_config>

View file

@ -6927,4 +6927,27 @@
</group>
</group>
</template>
<!-- html <hr> element -->
<!-- html <hr> element -->
<template name="html_hr"
keep="true">
<group id="sep_gr"
posref="ML ML"
sizeref="w"
w="0"
h="0"
child_resize_h="true"
child_resize_hmargin="12">
<view type="bitmap"
id="hr"
posref="MM MM"
sizeref="w"
w="-2"
h="2"
inherit_gc_alpha="true"
scale="true"
texture="blank.tga"
global_color="false" />
</group>
</template>
</interface_config>