aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dists/msvc7/scummvm.vcproj6
-rw-r--r--dists/msvc71/scummvm.vcproj6
-rw-r--r--dists/msvc8/scummvm.vcproj8
-rw-r--r--dists/msvc9/scummvm.vcproj8
-rw-r--r--gui/ThemeData.cpp136
-rw-r--r--gui/ThemeData.h117
-rw-r--r--gui/ThemeEngine.cpp223
-rw-r--r--gui/ThemeEngine.h161
-rw-r--r--gui/module.mk1
9 files changed, 286 insertions, 380 deletions
diff --git a/dists/msvc7/scummvm.vcproj b/dists/msvc7/scummvm.vcproj
index 8b4bf18644..3990c504f2 100644
--- a/dists/msvc7/scummvm.vcproj
+++ b/dists/msvc7/scummvm.vcproj
@@ -897,12 +897,6 @@
RelativePath="..\..\gui\themebrowser.h">
</File>
<File
- RelativePath="..\..\gui\ThemeData.cpp">
- </File>
- <File
- RelativePath="..\..\gui\ThemeData.h">
- </File>
- <File
RelativePath="..\..\gui\ThemeEngine.cpp">
</File>
<File
diff --git a/dists/msvc71/scummvm.vcproj b/dists/msvc71/scummvm.vcproj
index e3f5c0967e..c240aa4e14 100644
--- a/dists/msvc71/scummvm.vcproj
+++ b/dists/msvc71/scummvm.vcproj
@@ -911,12 +911,6 @@
RelativePath="..\..\gui\themebrowser.h">
</File>
<File
- RelativePath="..\..\gui\ThemeData.cpp">
- </File>
- <File
- RelativePath="..\..\gui\ThemeData.h">
- </File>
- <File
RelativePath="..\..\gui\ThemeEngine.cpp">
</File>
<File
diff --git a/dists/msvc8/scummvm.vcproj b/dists/msvc8/scummvm.vcproj
index 60852fdffe..6576091cc8 100644
--- a/dists/msvc8/scummvm.vcproj
+++ b/dists/msvc8/scummvm.vcproj
@@ -1226,14 +1226,6 @@
>
</File>
<File
- RelativePath="..\..\gui\ThemeData.cpp"
- >
- </File>
- <File
- RelativePath="..\..\gui\ThemeData.h"
- >
- </File>
- <File
RelativePath="..\..\gui\ThemeEngine.cpp"
>
</File>
diff --git a/dists/msvc9/scummvm.vcproj b/dists/msvc9/scummvm.vcproj
index 1dd324cdb0..b8b36730cc 100644
--- a/dists/msvc9/scummvm.vcproj
+++ b/dists/msvc9/scummvm.vcproj
@@ -1231,14 +1231,6 @@
>
</File>
<File
- RelativePath="..\..\gui\ThemeData.cpp"
- >
- </File>
- <File
- RelativePath="..\..\gui\ThemeData.h"
- >
- </File>
- <File
RelativePath="..\..\gui\ThemeEngine.cpp"
>
</File>
diff --git a/gui/ThemeData.cpp b/gui/ThemeData.cpp
deleted file mode 100644
index fbe5bb701d..0000000000
--- a/gui/ThemeData.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "gui/ThemeData.h"
-
-#include "graphics/VectorRenderer.h"
-
-namespace GUI {
-
-/**********************************************************
- * Data definitions for theme engine elements
- *********************************************************/
-const ThemeEngine::DrawDataInfo ThemeEngine::kDrawDataDefaults[] = {
- {kDDMainDialogBackground, "mainmenu_bg", true, kDDNone},
- {kDDSpecialColorBackground, "special_bg", true, kDDNone},
- {kDDPlainColorBackground, "plain_bg", true, kDDNone},
- {kDDDefaultBackground, "default_bg", true, kDDNone},
- {kDDTextSelectionBackground, "text_selection", false, kDDNone},
-
- {kDDWidgetBackgroundDefault, "widget_default", true, kDDNone},
- {kDDWidgetBackgroundSmall, "widget_small", true, kDDNone},
- {kDDWidgetBackgroundEditText, "widget_textedit", true, kDDNone},
- {kDDWidgetBackgroundSlider, "widget_slider", true, kDDNone},
-
- {kDDButtonIdle, "button_idle", true, kDDWidgetBackgroundSlider},
- {kDDButtonHover, "button_hover", false, kDDButtonIdle},
- {kDDButtonDisabled, "button_disabled", true, kDDNone},
-
- {kDDSliderFull, "slider_full", false, kDDNone},
- {kDDSliderHover, "slider_hover", false, kDDNone},
- {kDDSliderDisabled, "slider_disabled", true, kDDNone},
-
- {kDDCheckboxDefault, "checkbox_default", true, kDDNone},
- {kDDCheckboxDisabled, "checkbox_disabled", true, kDDNone},
- {kDDCheckboxSelected, "checkbox_selected", false, kDDCheckboxDefault},
-
- {kDDTabActive, "tab_active", false, kDDTabInactive},
- {kDDTabInactive, "tab_inactive", true, kDDNone},
- {kDDTabBackground, "tab_background", true, kDDNone},
-
- {kDDScrollbarBase, "scrollbar_base", true, kDDNone},
-
- {kDDScrollbarButtonIdle, "scrollbar_button_idle", true, kDDNone},
- {kDDScrollbarButtonHover, "scrollbar_button_hover", false, kDDScrollbarButtonIdle},
-
- {kDDScrollbarHandleIdle, "scrollbar_handle_idle", false, kDDNone},
- {kDDScrollbarHandleHover, "scrollbar_handle_hover", false, kDDScrollbarBase},
-
- {kDDPopUpIdle, "popup_idle", true, kDDNone},
- {kDDPopUpHover, "popup_hover", false, kDDPopUpIdle},
- {kDDPopUpDisabled, "popup_disabled", true, kDDNone},
-
- {kDDCaret, "caret", false, kDDNone},
- {kDDSeparator, "separator", true, kDDNone},
-};
-
-const ThemeEngine::TextDataInfo ThemeEngine::kTextDataDefaults[] = {
- {kTextDataDefault, "text_default"},
- {kTextDataHover, "text_hover"},
- {kTextDataDisabled, "text_disabled"},
- {kTextDataInverted, "text_inverted"},
- {kTextDataButton, "text_button"},
- {kTextDataButtonHover, "text_button_hover"},
- {kTextDataNormalFont, "text_normal"}
-};
-
-
-/**********************************************************
- * ThemeItem functions for drawing queues.
- *********************************************************/
-void ThemeItemDrawData::drawSelf(bool draw, bool restore) {
-
- Common::Rect extendedRect = _area;
- extendedRect.grow(_engine->kDirtyRectangleThreshold + _data->_backgroundOffset);
-
- if (restore)
- _engine->restoreBackground(extendedRect);
-
- if (draw) {
- Common::List<Graphics::DrawStep>::const_iterator step;
- for (step = _data->_steps.begin(); step != _data->_steps.end(); ++step)
- _engine->renderer()->drawStep(_area, *step, _dynamicData);
- }
-
- _engine->addDirtyRect(extendedRect);
-}
-
-void ThemeItemTextData::drawSelf(bool draw, bool restore) {
- if (_restoreBg || restore)
- _engine->restoreBackground(_area);
-
- if (draw) {
- _engine->renderer()->setFgColor(_data->_color.r, _data->_color.g, _data->_color.b);
- _engine->renderer()->drawString(_data->_fontPtr, _text, _area, _alignH, _alignV, _deltax, _ellipsis);
- }
-
- _engine->addDirtyRect(_area);
-}
-
-void ThemeItemBitmap::drawSelf(bool draw, bool restore) {
- if (restore)
- _engine->restoreBackground(_area);
-
- if (draw) {
- if (_alpha)
- _engine->renderer()->blitAlphaBitmap(_bitmap, _area);
- else
- _engine->renderer()->blitSubSurface(_bitmap, _area);
- }
-
- _engine->addDirtyRect(_area);
-}
-
-}
diff --git a/gui/ThemeData.h b/gui/ThemeData.h
deleted file mode 100644
index 18995ab477..0000000000
--- a/gui/ThemeData.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef GUI_THEME_DATA_H
-#define GUI_THEME_DATA_H
-
-#include "gui/ThemeEngine.h"
-
-namespace GUI {
-
-struct TextDrawData {
- const Graphics::Font *_fontPtr;
-
- struct {
- uint8 r, g, b;
- } _color;
-};
-
-struct WidgetDrawData {
- /** List of all the steps needed to draw this widget */
- Common::List<Graphics::DrawStep> _steps;
-
- int _textDataId;
- Graphics::TextAlign _textAlignH;
- GUI::ThemeEngine::TextAlignVertical _textAlignV;
-
- /** Extra space that the widget occupies when it's drawn.
- E.g. when taking into account rounded corners, drop shadows, etc
- Used when restoring the widget background */
- uint16 _backgroundOffset;
-
- bool _buffer;
-};
-
-class ThemeItem {
-
-public:
- ThemeItem(ThemeEngine *engine, const Common::Rect &area) :
- _engine(engine), _area(area) {}
- virtual ~ThemeItem() {}
-
- virtual void drawSelf(bool doDraw, bool doRestore) = 0;
-
-protected:
- ThemeEngine *_engine;
- Common::Rect _area;
-};
-
-class ThemeItemDrawData : public ThemeItem {
-public:
- ThemeItemDrawData(ThemeEngine *engine, const WidgetDrawData *data, const Common::Rect &area, uint32 dynData) :
- ThemeItem(engine, area), _dynamicData(dynData), _data(data) {}
-
- void drawSelf(bool draw, bool restore);
-
-protected:
- uint32 _dynamicData;
- const WidgetDrawData *_data;
-};
-
-class ThemeItemTextData : public ThemeItem {
-public:
- ThemeItemTextData(ThemeEngine *engine, const TextDrawData *data, const Common::Rect &area, const Common::String &text,
- Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV,
- bool ellipsis, bool restoreBg, int deltaX) :
- ThemeItem(engine, area), _data(data), _text(text), _alignH(alignH), _alignV(alignV),
- _ellipsis(ellipsis), _restoreBg(restoreBg), _deltax(deltaX) {}
-
- void drawSelf(bool draw, bool restore);
-
-protected:
- const TextDrawData *_data;
- Common::String _text;
- Graphics::TextAlign _alignH;
- GUI::ThemeEngine::TextAlignVertical _alignV;
- bool _ellipsis;
- bool _restoreBg;
- int _deltax;
-};
-
-class ThemeItemBitmap : public ThemeItem {
-public:
- ThemeItemBitmap(ThemeEngine *engine, const Common::Rect &area, const Graphics::Surface *bitmap, bool alpha) :
- ThemeItem(engine, area), _bitmap(bitmap), _alpha(alpha) {}
-
- void drawSelf(bool draw, bool restore);
-
-protected:
- const Graphics::Surface *_bitmap;
- bool _alpha;
-};
-
-}
-
-#endif
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 0b53ce7fe4..6c627419fa 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -41,7 +41,6 @@
#include "gui/ThemeEngine.h"
#include "gui/ThemeEval.h"
#include "gui/ThemeParser.h"
-#include "gui/ThemeData.h"
#ifdef MACOSX
#include <CoreFoundation/CoreFoundation.h>
@@ -51,6 +50,211 @@
namespace GUI {
+struct TextDrawData {
+ const Graphics::Font *_fontPtr;
+
+ struct {
+ uint8 r, g, b;
+ } _color;
+};
+
+struct WidgetDrawData {
+ /** List of all the steps needed to draw this widget */
+ Common::List<Graphics::DrawStep> _steps;
+
+ int _textDataId;
+ Graphics::TextAlign _textAlignH;
+ GUI::ThemeEngine::TextAlignVertical _textAlignV;
+
+ /** Extra space that the widget occupies when it's drawn.
+ E.g. when taking into account rounded corners, drop shadows, etc
+ Used when restoring the widget background */
+ uint16 _backgroundOffset;
+
+ bool _buffer;
+};
+
+class ThemeItem {
+
+public:
+ ThemeItem(ThemeEngine *engine, const Common::Rect &area) :
+ _engine(engine), _area(area) {}
+ virtual ~ThemeItem() {}
+
+ virtual void drawSelf(bool doDraw, bool doRestore) = 0;
+
+protected:
+ ThemeEngine *_engine;
+ Common::Rect _area;
+};
+
+class ThemeItemDrawData : public ThemeItem {
+public:
+ ThemeItemDrawData(ThemeEngine *engine, const WidgetDrawData *data, const Common::Rect &area, uint32 dynData) :
+ ThemeItem(engine, area), _dynamicData(dynData), _data(data) {}
+
+ void drawSelf(bool draw, bool restore);
+
+protected:
+ uint32 _dynamicData;
+ const WidgetDrawData *_data;
+};
+
+class ThemeItemTextData : public ThemeItem {
+public:
+ ThemeItemTextData(ThemeEngine *engine, const TextDrawData *data, const Common::Rect &area, const Common::String &text,
+ Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV,
+ bool ellipsis, bool restoreBg, int deltaX) :
+ ThemeItem(engine, area), _data(data), _text(text), _alignH(alignH), _alignV(alignV),
+ _ellipsis(ellipsis), _restoreBg(restoreBg), _deltax(deltaX) {}
+
+ void drawSelf(bool draw, bool restore);
+
+protected:
+ const TextDrawData *_data;
+ Common::String _text;
+ Graphics::TextAlign _alignH;
+ GUI::ThemeEngine::TextAlignVertical _alignV;
+ bool _ellipsis;
+ bool _restoreBg;
+ int _deltax;
+};
+
+class ThemeItemBitmap : public ThemeItem {
+public:
+ ThemeItemBitmap(ThemeEngine *engine, const Common::Rect &area, const Graphics::Surface *bitmap, bool alpha) :
+ ThemeItem(engine, area), _bitmap(bitmap), _alpha(alpha) {}
+
+ void drawSelf(bool draw, bool restore);
+
+protected:
+ const Graphics::Surface *_bitmap;
+ bool _alpha;
+};
+
+
+
+/**********************************************************
+ * Data definitions for theme engine elements
+ *********************************************************/
+struct DrawDataInfo {
+ DrawData id; //!< The actual ID of the DrawData item.
+ const char *name; //!< The name of the DrawData item as it appears in the Theme Description files
+ bool buffer; //!< Sets whether this item is buffered on the backbuffer or drawn directly to the screen.
+ DrawData parent; //!< Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover
+};
+
+/**
+ * Default values for each DrawData item.
+ */
+static const DrawDataInfo kDrawDataDefaults[] = {
+ {kDDMainDialogBackground, "mainmenu_bg", true, kDDNone},
+ {kDDSpecialColorBackground, "special_bg", true, kDDNone},
+ {kDDPlainColorBackground, "plain_bg", true, kDDNone},
+ {kDDDefaultBackground, "default_bg", true, kDDNone},
+ {kDDTextSelectionBackground, "text_selection", false, kDDNone},
+
+ {kDDWidgetBackgroundDefault, "widget_default", true, kDDNone},
+ {kDDWidgetBackgroundSmall, "widget_small", true, kDDNone},
+ {kDDWidgetBackgroundEditText, "widget_textedit", true, kDDNone},
+ {kDDWidgetBackgroundSlider, "widget_slider", true, kDDNone},
+
+ {kDDButtonIdle, "button_idle", true, kDDWidgetBackgroundSlider},
+ {kDDButtonHover, "button_hover", false, kDDButtonIdle},
+ {kDDButtonDisabled, "button_disabled", true, kDDNone},
+
+ {kDDSliderFull, "slider_full", false, kDDNone},
+ {kDDSliderHover, "slider_hover", false, kDDNone},
+ {kDDSliderDisabled, "slider_disabled", true, kDDNone},
+
+ {kDDCheckboxDefault, "checkbox_default", true, kDDNone},
+ {kDDCheckboxDisabled, "checkbox_disabled", true, kDDNone},
+ {kDDCheckboxSelected, "checkbox_selected", false, kDDCheckboxDefault},
+
+ {kDDTabActive, "tab_active", false, kDDTabInactive},
+ {kDDTabInactive, "tab_inactive", true, kDDNone},
+ {kDDTabBackground, "tab_background", true, kDDNone},
+
+ {kDDScrollbarBase, "scrollbar_base", true, kDDNone},
+
+ {kDDScrollbarButtonIdle, "scrollbar_button_idle", true, kDDNone},
+ {kDDScrollbarButtonHover, "scrollbar_button_hover", false, kDDScrollbarButtonIdle},
+
+ {kDDScrollbarHandleIdle, "scrollbar_handle_idle", false, kDDNone},
+ {kDDScrollbarHandleHover, "scrollbar_handle_hover", false, kDDScrollbarBase},
+
+ {kDDPopUpIdle, "popup_idle", true, kDDNone},
+ {kDDPopUpHover, "popup_hover", false, kDDPopUpIdle},
+ {kDDPopUpDisabled, "popup_disabled", true, kDDNone},
+
+ {kDDCaret, "caret", false, kDDNone},
+ {kDDSeparator, "separator", true, kDDNone},
+};
+
+struct TextDataInfo {
+ TextData id;
+ const char *name;
+};
+
+static const TextDataInfo kTextDataDefaults[] = {
+ {kTextDataDefault, "text_default"},
+ {kTextDataHover, "text_hover"},
+ {kTextDataDisabled, "text_disabled"},
+ {kTextDataInverted, "text_inverted"},
+ {kTextDataButton, "text_button"},
+ {kTextDataButtonHover, "text_button_hover"},
+ {kTextDataNormalFont, "text_normal"}
+};
+
+
+/**********************************************************
+ * ThemeItem functions for drawing queues.
+ *********************************************************/
+void ThemeItemDrawData::drawSelf(bool draw, bool restore) {
+
+ Common::Rect extendedRect = _area;
+ extendedRect.grow(_engine->kDirtyRectangleThreshold + _data->_backgroundOffset);
+
+ if (restore)
+ _engine->restoreBackground(extendedRect);
+
+ if (draw) {
+ Common::List<Graphics::DrawStep>::const_iterator step;
+ for (step = _data->_steps.begin(); step != _data->_steps.end(); ++step)
+ _engine->renderer()->drawStep(_area, *step, _dynamicData);
+ }
+
+ _engine->addDirtyRect(extendedRect);
+}
+
+void ThemeItemTextData::drawSelf(bool draw, bool restore) {
+ if (_restoreBg || restore)
+ _engine->restoreBackground(_area);
+
+ if (draw) {
+ _engine->renderer()->setFgColor(_data->_color.r, _data->_color.g, _data->_color.b);
+ _engine->renderer()->drawString(_data->_fontPtr, _text, _area, _alignH, _alignV, _deltax, _ellipsis);
+ }
+
+ _engine->addDirtyRect(_area);
+}
+
+void ThemeItemBitmap::drawSelf(bool draw, bool restore) {
+ if (restore)
+ _engine->restoreBackground(_area);
+
+ if (draw) {
+ if (_alpha)
+ _engine->renderer()->blitAlphaBitmap(_bitmap, _area);
+ else
+ _engine->renderer()->blitSubSurface(_bitmap, _area);
+ }
+
+ _engine->addDirtyRect(_area);
+}
+
+
+
/**********************************************************
* ThemeEngine class
*********************************************************/
@@ -1012,11 +1216,26 @@ int ThemeEngine::getCharWidth(byte c, FontStyle font) const {
return ready() ? _texts[fontStyleToData(font)]->_fontPtr->getCharWidth(c) : 0;
}
-ThemeEngine::TextData ThemeEngine::getTextData(DrawData ddId) {
+TextData ThemeEngine::getTextData(DrawData ddId) const {
return _widgets[ddId] ? (TextData)_widgets[ddId]->_textDataId : kTextDataNone;
}
+DrawData ThemeEngine::getDrawDataId(const Common::String &name) const {
+ for (int i = 0; i < kDrawDataMAX; ++i)
+ if (name.compareToIgnoreCase(kDrawDataDefaults[i].name) == 0)
+ return kDrawDataDefaults[i].id;
+
+ return kDDNone;
+}
+
+TextData ThemeEngine::getTextDataId(const Common::String &name) const {
+ for (int i = 0; i < kTextDataMAX; ++i)
+ if (name.compareToIgnoreCase(kTextDataDefaults[i].name) == 0)
+ return kTextDataDefaults[i].id;
+
+ return kTextDataNone;
+}
/**********************************************************
* External data loading
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index b5ca95685c..84e753a4f9 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -43,6 +43,7 @@ namespace GUI {
struct WidgetDrawData;
struct DrawDataInfo;
+struct TextDataInfo;
struct TextDrawData;
class Dialog;
class GuiObject;
@@ -50,6 +51,67 @@ class ThemeEval;
class ThemeItem;
class ThemeParser;
+/**
+ * DrawData sets enumeration.
+ * Each DD set corresponds to the actual looks
+ * of a widget in a given state.
+ */
+enum DrawData {
+ kDDMainDialogBackground,
+ kDDSpecialColorBackground,
+ kDDPlainColorBackground,
+ kDDDefaultBackground,
+ kDDTextSelectionBackground,
+
+ kDDWidgetBackgroundDefault,
+ kDDWidgetBackgroundSmall,
+ kDDWidgetBackgroundEditText,
+ kDDWidgetBackgroundSlider,
+
+ kDDButtonIdle,
+ kDDButtonHover,
+ kDDButtonDisabled,
+
+ kDDSliderFull,
+ kDDSliderHover,
+ kDDSliderDisabled,
+
+ kDDCheckboxDefault,
+ kDDCheckboxDisabled,
+ kDDCheckboxSelected,
+
+ kDDTabActive,
+ kDDTabInactive,
+ kDDTabBackground,
+
+ kDDScrollbarBase,
+ kDDScrollbarButtonIdle,
+ kDDScrollbarButtonHover,
+ kDDScrollbarHandleIdle,
+ kDDScrollbarHandleHover,
+
+ kDDPopUpIdle,
+ kDDPopUpHover,
+ kDDPopUpDisabled,
+
+ kDDCaret,
+ kDDSeparator,
+ kDrawDataMAX,
+ kDDNone = -1
+};
+
+enum TextData {
+ kTextDataNone = -1,
+ kTextDataDefault = 0,
+ kTextDataHover,
+ kTextDataDisabled,
+ kTextDataInverted,
+ kTextDataButton,
+ kTextDataButtonHover,
+ kTextDataNormalFont,
+ kTextDataMAX
+};
+
class ThemeEngine {
protected:
typedef Common::HashMap<Common::String, Graphics::Surface*> ImagesMap;
@@ -57,88 +119,6 @@ protected:
friend class GUI::Dialog;
friend class GUI::GuiObject;
- /**
- * DrawData sets enumeration.
- * Each DD set corresponds to the actual looks
- * of a widget in a given state.
- */
- enum DrawData {
- kDDMainDialogBackground,
- kDDSpecialColorBackground,
- kDDPlainColorBackground,
- kDDDefaultBackground,
- kDDTextSelectionBackground,
-
- kDDWidgetBackgroundDefault,
- kDDWidgetBackgroundSmall,
- kDDWidgetBackgroundEditText,
- kDDWidgetBackgroundSlider,
-
- kDDButtonIdle,
- kDDButtonHover,
- kDDButtonDisabled,
-
- kDDSliderFull,
- kDDSliderHover,
- kDDSliderDisabled,
-
- kDDCheckboxDefault,
- kDDCheckboxDisabled,
- kDDCheckboxSelected,
-
- kDDTabActive,
- kDDTabInactive,
- kDDTabBackground,
-
- kDDScrollbarBase,
- kDDScrollbarButtonIdle,
- kDDScrollbarButtonHover,
- kDDScrollbarHandleIdle,
- kDDScrollbarHandleHover,
-
- kDDPopUpIdle,
- kDDPopUpHover,
- kDDPopUpDisabled,
-
- kDDCaret,
- kDDSeparator,
- kDrawDataMAX,
- kDDNone = -1
- };
-
- /**
- * Default values for each DrawData item.
- * @see kDrawDataDefaults[] for implementation.
- */
- struct DrawDataInfo {
- DrawData id; //!< The actual ID of the DrawData item.
- const char *name; //!< The name of the DrawData item as it appears in the Theme Description files
- bool buffer; //!< Sets whether this item is buffered on the backbuffer or drawn directly to the screen.
- DrawData parent; //!< Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover
- };
-
- static const DrawDataInfo kDrawDataDefaults[];
-
-
- enum TextData {
- kTextDataNone = -1,
- kTextDataDefault = 0,
- kTextDataHover,
- kTextDataDisabled,
- kTextDataInverted,
- kTextDataButton,
- kTextDataButtonHover,
- kTextDataNormalFont,
- kTextDataMAX
- };
-
- struct TextDataInfo {
- TextData id;
- const char *name;
- };
-
- static const TextDataInfo kTextDataDefaults[];
-
public:
//! Vertical alignment of the text.
enum TextAlignVertical {
@@ -354,21 +334,12 @@ public:
* @param name The representing name, as found on Theme Description XML files.
* @see kDrawDataDefaults[]
*/
- DrawData getDrawDataId(const Common::String &name) {
- for (int i = 0; i < kDrawDataMAX; ++i)
- if (name.compareToIgnoreCase(kDrawDataDefaults[i].name) == 0)
- return kDrawDataDefaults[i].id;
+ DrawData getDrawDataId(const Common::String &name) const;
- return kDDNone;
- }
+ TextData getTextDataId(const Common::String &name) const;
- TextData getTextDataId(const Common::String &name) {
- for (int i = 0; i < kTextDataMAX; ++i)
- if (name.compareToIgnoreCase(kTextDataDefaults[i].name) == 0)
- return kTextDataDefaults[i].id;
+ TextData getTextData(DrawData ddId) const;
- return kTextDataNone;
- }
/**
* Interface for ThemeParser class: Parsed DrawSteps are added via this function.
@@ -532,8 +503,6 @@ protected:
*/
void renderDirtyScreen();
- TextData getTextData(DrawData ddId);
-
/**
* Calculates the background threshold offset of a given DrawData item.
* After fully loading all DrawSteps of a DrawData item, this function must be
diff --git a/gui/module.mk b/gui/module.mk
index 5dfb524e6b..cd0c73b1a3 100644
--- a/gui/module.mk
+++ b/gui/module.mk
@@ -23,7 +23,6 @@ MODULE_OBJS := \
themebrowser.o \
ThemeEngine.o \
ThemeEval.o \
- ThemeData.o \
ThemeLayout.o \
ThemeParser.o \
widget.o