aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorVicent Marti2008-07-19 15:49:08 +0000
committerVicent Marti2008-07-19 15:49:08 +0000
commitb5081a02ec1d72e14ced116246545e1210b8b86f (patch)
tree99e3a8cffd8eeadf07230ae1d0ae229db77a0ab6 /gui
parentcf3832fccefc00bcac4bc4d355568a66479fc926 (diff)
downloadscummvm-rg350-b5081a02ec1d72e14ced116246545e1210b8b86f.tar.gz
scummvm-rg350-b5081a02ec1d72e14ced116246545e1210b8b86f.tar.bz2
scummvm-rg350-b5081a02ec1d72e14ced116246545e1210b8b86f.zip
Changed drawdata names to a struct.
Fixed text drawing. svn-id: r33112
Diffstat (limited to 'gui')
-rw-r--r--gui/ThemeRenderer.cpp56
-rw-r--r--gui/ThemeRenderer.h15
2 files changed, 40 insertions, 31 deletions
diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp
index 10736a033f..abc05e63ab 100644
--- a/gui/ThemeRenderer.cpp
+++ b/gui/ThemeRenderer.cpp
@@ -39,41 +39,42 @@ namespace GUI {
using namespace Graphics;
-const char *ThemeRenderer::kDrawDataStrings[] = {
- "mainmenu_bg",
- "special_bg",
- "plain_bg",
- "default_bg",
-
- "widget_default",
- "widget_small",
- "widget_textedit",
- "widget_slider",
+const ThemeRenderer::DrawDataInfo ThemeRenderer::kDrawData[] = {
+ {kDDMainDialogBackground, "mainmenu_bg", true},
+ {kDDSpecialColorBackground, "special_bg", true},
+ {kDDPlainColorBackground, "plain_bg", true},
+ {kDDDefaultBackground, "default_bg", true},
- "button_idle",
- "button_hover",
- "button_disabled",
+ {kDDWidgetBackgroundDefault, "widget_default", true},
+ {kDDWidgetBackgroundSmall, "widget_small", true},
+ {kDDWidgetBackgroundEditText, "widget_textedit", true},
+ {kDDWidgetBackgroundSlider, "widget_slider", true},
- "slider_full",
- "slider_empty",
+ {kDDButtonIdle, "button_idle", true},
+ {kDDButtonHover, "button_hover", false},
+ {kDDButtonDisabled, "button_disabled", true},
- "checkbox_enabled",
- "checkbox_disabled",
+ {kDDSliderFull,"slider_full", false},
+ {kDDSliderEmpty, "slider_empty", true},
- "tab_active",
- "tab_inactive",
+ {kDDCheckboxEnabled, "checkbox_enabled", false},
+ {kDDCheckboxDisabled, "checkbox_disabled", true},
- "scrollbar_base",
- "scrollbar_handle",
+ {kDDTabActive, "tab_active", false},
+ {kDDTabInactive, "tab_inactive", true},
- "popup_idle",
- "popup_hover",
-
- "caret",
- "separator",
- "default_text"
+ {kDDScrollbarBase, "scrollbar_base", true},
+ {kDDScrollbarHandle, "scrollbar_handle", false},
+
+ {kDDPopUpIdle, "popup_idle", true},
+ {kDDPopUpHover, "popup_hover", false},
+
+ {kDDCaret, "caret", false},
+ {kDDSeparator, "separator", true},
+ {kDDDefaultText, "default_text", false}
};
+
ThemeRenderer::ThemeRenderer(Common::String themeName, GraphicsMode mode) :
_vectorRenderer(0), _system(0), _graphicsMode(kGfxDisabled),
_screen(0), _backBuffer(0), _bytesPerPixel(0), _initOk(false),
@@ -523,6 +524,7 @@ void ThemeRenderer::drawText(const Common::Rect &r, const Common::String &str, W
if (!_initOk)
return;
+ restoreBackground(r);
getFont(font)->drawString(_screen, str, r.left, r.top, r.width(), getTextColor(state), convertAligment(align), deltax, useEllipsis);
addDirtyRect(r);
}
diff --git a/gui/ThemeRenderer.h b/gui/ThemeRenderer.h
index 347cbafcc9..e01d31e00f 100644
--- a/gui/ThemeRenderer.h
+++ b/gui/ThemeRenderer.h
@@ -40,6 +40,7 @@
namespace GUI {
struct WidgetDrawData;
+struct DrawDataInfo;
struct WidgetDrawData {
/** List of all the steps needed to draw this widget */
@@ -80,7 +81,6 @@ class ThemeRenderer : public Theme {
friend class GUI::GuiObject;
/** Strings representing each value in the DrawData enum */
- static const char *kDrawDataStrings[];
/** Constant value to expand dirty rectangles, to make sure they are fully copied */
static const int kDirtyRectangleThreshold = 2;
@@ -138,7 +138,14 @@ public:
kTextColorInverted,
kTextColorMAX
};
-
+
+ struct DrawDataInfo {
+ DrawData id;
+ const char *name;
+ bool buffer;
+ };
+
+ static const DrawDataInfo kDrawData[];
ThemeRenderer(Common::String themeName, GraphicsMode mode);
~ThemeRenderer() {
@@ -195,8 +202,8 @@ public:
// custom stuff - tanoku
DrawData getDrawDataId(Common::String &name) {
for (int i = 0; i < kDrawDataMAX; ++i)
- if (name.compareToIgnoreCase(kDrawDataStrings[i]) == 0)
- return (DrawData)i;
+ if (name.compareToIgnoreCase(kDrawData[i].name) == 0)
+ return kDrawData[i].id;
return (DrawData)-1;
}