diff options
| author | Vicent Marti | 2008-07-10 20:36:02 +0000 |
|---|---|---|
| committer | Vicent Marti | 2008-07-10 20:36:02 +0000 |
| commit | a90be07c3e93014174a3b4f3fa0be25aad227859 (patch) | |
| tree | 72b41efdbe6245167332d35908110d63ecb2183b /gui | |
| parent | e0aad7f4be66a9e30f0226c17c9d2bd0a8138898 (diff) | |
| download | scummvm-rg350-a90be07c3e93014174a3b4f3fa0be25aad227859.tar.gz scummvm-rg350-a90be07c3e93014174a3b4f3fa0be25aad227859.tar.bz2 scummvm-rg350-a90be07c3e93014174a3b4f3fa0be25aad227859.zip | |
Support for Vertical text alignement.
svn-id: r32995
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/ThemeDefaultXML.cpp | 6 | ||||
| -rw-r--r-- | gui/ThemeParser.cpp | 23 | ||||
| -rw-r--r-- | gui/ThemeRenderer.cpp | 5 | ||||
| -rw-r--r-- | gui/theme.h | 7 |
4 files changed, 26 insertions, 15 deletions
diff --git a/gui/ThemeDefaultXML.cpp b/gui/ThemeDefaultXML.cpp index 3793fcc82b..da40d64731 100644 --- a/gui/ThemeDefaultXML.cpp +++ b/gui/ThemeDefaultXML.cpp @@ -51,17 +51,17 @@ bool ThemeRenderer::loadDefaultXML() { "</drawdata>" "<drawdata id = 'button_idle' cache = false>" - "<text align = 'center' color = '255, 0, 0' />" + "<text vertical_align = 'center' horizontal_align = 'center' color = '255, 255, 255' />" "<drawstep func = 'roundedsq' radius = '8' stroke = 0 fill = 'gradient' gradient_start = '206, 121, 99' gradient_end = '173, 40, 8' size = 'auto' shadow = 3 />" "</drawdata>" "<drawdata id = 'button_hover' cache = false>" - "<text align = 'center' color = '255, 0, 0' />" + "<text vertical_align = 'center' horizontal_align = 'center' color = '255, 255, 255' />" "<drawstep func = 'roundedsq' radius = '8' fill = 'gradient' gradient_start = '206, 121, 99' gradient_end = '173, 40, 8' size = 'auto' shadow = 3 />" "</drawdata>" "<drawdata id = 'checkbox_disabled' cache = false>" - "<text align = 'center' color = '255, 0, 0' />" + "<text vertical_align = 'center' horizontal_align = 'center' color = '255, 0, 0' />" "<drawstep func = 'square' fill = 'gradient' gradient_start = '206, 121, 99' gradient_end = '173, 40, 8' size = 'auto' shadow = 0 />" "</drawdata>" diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index eae131af50..7f02c1eb57 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -146,17 +146,24 @@ bool ThemeParser::parserCallback_text() { Graphics::TextStep step; - if (tNode->values.contains("align") == false) - return parserError("Text inside widgets requires an alignement key."); + if (tNode->values.contains("horizontal_align") == false || tNode->values.contains("vertical_align") == false) + return parserError("Text inside widgets requires proper alignment keys."); - if (tNode->values["align"] == "left") - step.align = GUI::Theme::kTextAlignLeft; - else if (tNode->values["align"] == "right") - step.align = GUI::Theme::kTextAlignRight; - else if (tNode->values["align"] == "center") - step.align = GUI::Theme::kTextAlignCenter; + if (tNode->values["horizontal_align"] == "left") + step.alignHorizontal = GUI::Theme::kTextAlignLeft; + else if (tNode->values["horizontal_align"] == "right") + step.alignHorizontal = GUI::Theme::kTextAlignRight; + else if (tNode->values["horizontal_align"] == "center") + step.alignHorizontal = GUI::Theme::kTextAlignCenter; else return parserError("Invalid value for text alignment."); + if (tNode->values["vertical_align"] == "top") + step.alignVertical = GUI::Theme::kTextAlignVTop; + else if (tNode->values["vertical_align"] == "center") + step.alignVertical = GUI::Theme::kTextAlignVCenter; + else if (tNode->values["vertical_align"] == "bottom") + step.alignVertical = GUI::Theme::kTextAlignVBottom; + else return parserError("Invalid value for text alignment."); if (tNode->values.contains("color")) { int red, green, blue; diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp index ca686b8583..0fd7afbaf5 100644 --- a/gui/ThemeRenderer.cpp +++ b/gui/ThemeRenderer.cpp @@ -302,10 +302,7 @@ void ThemeRenderer::drawButton(const Common::Rect &r, const Common::String &str, dd = kDDButtonDisabled; drawDD(dd, r); - drawDDText(dd, r, str); - if (hasWidgetText(dd)) - _vectorRenderer->textStep(str, r, _widgets[dd]->_textStep); - + drawDDText(dd, r, str); addDirtyRect(r); debugWidgetPosition(r); diff --git a/gui/theme.h b/gui/theme.h index 320d2544e0..e9ce8bb01d 100644 --- a/gui/theme.h +++ b/gui/theme.h @@ -92,6 +92,13 @@ public: kTextAlignCenter, //! Text should be centered kTextAlignRight //! Text should be aligned to the right }; + + //! Vertical alignment of the text. + enum TextAlignVertical { + kTextAlignVBottom, + kTextAlignVCenter, + kTextAlignVTop + }; //! Widget background type enum WidgetBackground { |
