diff --git a/src/guiengine/engine.cpp b/src/guiengine/engine.cpp index 87e5c0d06..6c996f1a5 100644 --- a/src/guiengine/engine.cpp +++ b/src/guiengine/engine.cpp @@ -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 - Name in XML files: \c "text_align" + \subsection prop4 PROP_TEXT_ALIGN, PROP_TEXT_VALIGN + Name in XML files: \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 diff --git a/src/guiengine/screen_loader.cpp b/src/guiengine/screen_loader.cpp index 373cbed45..9139f0e76 100644 --- a/src/guiengine/screen_loader.cpp +++ b/src/guiengine/screen_loader.cpp @@ -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); diff --git a/src/guiengine/widget.hpp b/src/guiengine/widget.hpp index 16fab6c04..3eefcb724 100644 --- a/src/guiengine/widget.hpp +++ b/src/guiengine/widget.hpp @@ -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, diff --git a/src/guiengine/widgets/bubble_widget.cpp b/src/guiengine/widgets/bubble_widget.cpp index 0e51478d4..79ac9865b 100644 --- a/src/guiengine/widgets/bubble_widget.cpp +++ b/src/guiengine/widgets/bubble_widget.cpp @@ -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(); diff --git a/src/guiengine/widgets/label_widget.cpp b/src/guiengine/widgets/label_widget.cpp index 3f8e25ae1..a48961408 100644 --- a/src/guiengine/widgets/label_widget.cpp +++ b/src/guiengine/widgets/label_widget.cpp @@ -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)