Add text_valign="top" support to GUI engine

This commit is contained in:
auria.mg 2018-02-24 21:49:49 -05:00
parent 8d565fba11
commit 7b903a09ba
5 changed files with 13 additions and 5 deletions

View File

@ -309,11 +309,12 @@ namespace GUIEngine
For icon buttons. A different icon to show when the item is focused.
\n
\subsection prop4 PROP_TEXT_ALIGN
<em> Name in XML files: </em> \c "text_align"
\subsection prop4 PROP_TEXT_ALIGN, PROP_TEXT_VALIGN
<em> Name in XML files: </em> \c "text_align", "text_valign"
used exclusively by label components. Value can be "right" or "center" (left
used if not specified).
used if not specified) for "text_align", or "top"/"center"/"bottom" for
valign.
\n
\subsection prop5 PROP_WORD_WRAP

View File

@ -210,6 +210,7 @@ if(prop_name != NULL) widget.m_properties[prop_flag] = core::stringc(prop_name).
READ_PROPERTY(icon, PROP_ICON);
READ_PROPERTY(focus_icon, PROP_FOCUS_ICON);
READ_PROPERTY(text_align, PROP_TEXT_ALIGN);
READ_PROPERTY(text_valign, PROP_TEXT_VALIGN);
READ_PROPERTY(min_value, PROP_MIN_VALUE);
READ_PROPERTY(max_value, PROP_MAX_VALUE);
READ_PROPERTY(square_items, PROP_SQUARE);

View File

@ -98,6 +98,7 @@ namespace GUIEngine
PROP_ICON,
PROP_FOCUS_ICON,
PROP_TEXT_ALIGN,
PROP_TEXT_VALIGN,
PROP_MIN_VALUE,
PROP_MAX_VALUE,
PROP_MAX_WIDTH,

View File

@ -76,7 +76,9 @@ void BubbleWidget::replaceText()
else if (m_properties[PROP_TEXT_ALIGN] == "right") align = EGUIA_LOWERRIGHT;
else if (translations->isRTLText(message)) align = EGUIA_LOWERRIGHT;
EGUI_ALIGNMENT valign = EGUIA_CENTER ; //TODO: make label v-align configurable through XML file?
EGUI_ALIGNMENT valign = EGUIA_CENTER;
if (m_properties[PROP_TEXT_VALIGN] == "top") valign = EGUIA_UPPERLEFT;
if (m_properties[PROP_TEXT_VALIGN] == "bottom") valign = EGUIA_LOWERRIGHT;
// find expanded bubble size
int text_height = irrwidget->getTextHeight();

View File

@ -66,7 +66,10 @@ void LabelWidget::add()
EGUI_ALIGNMENT align = EGUIA_UPPERLEFT;
if (m_properties[PROP_TEXT_ALIGN] == "center") align = EGUIA_CENTER;
else if (m_properties[PROP_TEXT_ALIGN] == "right") align = EGUIA_LOWERRIGHT;
EGUI_ALIGNMENT valign = EGUIA_CENTER ; //TODO: make label v-align configurable through XML file?
EGUI_ALIGNMENT valign = EGUIA_CENTER ;
if (m_properties[PROP_TEXT_VALIGN] == "top") valign = EGUIA_UPPERLEFT;
if (m_properties[PROP_TEXT_VALIGN] == "bottom") valign = EGUIA_LOWERRIGHT;
IGUIStaticText* irrwidget;
if (m_scroll_speed != 0)