aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2008-11-08 00:54:58 +0000
committerMax Horn2008-11-08 00:54:58 +0000
commit2071f606a9d3d6395eb1202d77d95500f922572b (patch)
tree21af44a0b7cf9eb286a8e0665668b7819abd9846
parent8b9311dd4e47839ce93c223e812320169af4ae1f (diff)
downloadscummvm-rg350-2071f606a9d3d6395eb1202d77d95500f922572b.tar.gz
scummvm-rg350-2071f606a9d3d6395eb1202d77d95500f922572b.tar.bz2
scummvm-rg350-2071f606a9d3d6395eb1202d77d95500f922572b.zip
Moved some internal stuff from ThemeEngine.h to ThemeEngine.cpp
svn-id: r34935
-rw-r--r--gui/ThemeEngine.cpp120
-rw-r--r--gui/ThemeEngine.h121
2 files changed, 129 insertions, 112 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 20638b827d..64e2fc373e 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -45,6 +45,105 @@ namespace GUI {
using namespace Graphics;
+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;
+ GUI::Theme::TextAlign _textAlignH;
+ GUI::Theme::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;
+
+ /** Sets whether the widget is cached beforehand. */
+ bool _cached;
+ bool _buffer;
+
+ /** Texture where the cached widget is stored. */
+ Graphics::Surface *_surfaceCache;
+
+ ~WidgetDrawData() {
+ _steps.clear();
+
+ if (_surfaceCache) {
+ _surfaceCache->free();
+ delete _surfaceCache;
+ }
+ }
+};
+
+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,
+ GUI::Theme::TextAlign alignH, GUI::Theme::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;
+ GUI::Theme::TextAlign _alignH;
+ GUI::Theme::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;
+};
+
+
+
+
const ThemeEngine::Renderer ThemeEngine::_rendererModes[] = {
{ "Disabled GFX", "none", kGfxDisabled },
{ "Standard Renderer (16bpp)", "normal_16bpp", kGfxStandard16bit },
@@ -1094,4 +1193,25 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int
return true;
}
+const Graphics::Font *ThemeEngine::getFont(FontStyle font) const {
+ return _texts[fontStyleToData(font)]->_fontPtr;
+}
+
+int ThemeEngine::getFontHeight(FontStyle font) const {
+ return ready() ? _texts[fontStyleToData(font)]->_fontPtr->getFontHeight() : 0;
+}
+
+int ThemeEngine::getStringWidth(const Common::String &str, FontStyle font) const {
+ return ready() ? _texts[fontStyleToData(font)]->_fontPtr->getStringWidth(str) : 0;
+}
+
+int ThemeEngine::getCharWidth(byte c, FontStyle font) const {
+ return ready() ? _texts[fontStyleToData(font)]->_fontPtr->getCharWidth(c) : 0;
+}
+
+ThemeEngine::TextData ThemeEngine::getTextData(DrawData ddId) {
+ return _widgets[ddId] ? (TextData)_widgets[ddId]->_textDataId : kTextDataNone;
+}
+
+
} // end of namespace GUI.
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 0b054c53f5..d0205b8c0a 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -43,104 +43,9 @@ namespace GUI {
struct WidgetDrawData;
struct DrawDataInfo;
+struct TextDrawData;
class ThemeEval;
-
-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;
- GUI::Theme::TextAlign _textAlignH;
- GUI::Theme::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;
-
- /** Sets whether the widget is cached beforehand. */
- bool _cached;
- bool _buffer;
-
- /** Texture where the cached widget is stored. */
- Graphics::Surface *_surfaceCache;
-
- ~WidgetDrawData() {
- _steps.clear();
-
- if (_surfaceCache) {
- _surfaceCache->free();
- delete _surfaceCache;
- }
- }
-};
-
-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,
- GUI::Theme::TextAlign alignH, GUI::Theme::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;
- GUI::Theme::TextAlign _alignH;
- GUI::Theme::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;
-};
-
+class ThemeItem;
class ThemeEngine : public Theme {
protected:
@@ -321,19 +226,13 @@ public:
}
}
- const Graphics::Font *getFont(FontStyle font) const { return _texts[fontStyleToData(font)]->_fontPtr; }
+ const Graphics::Font *getFont(FontStyle font) const;
- int getFontHeight(FontStyle font = kFontStyleBold) const {
- return ready() ? _texts[fontStyleToData(font)]->_fontPtr->getFontHeight() : 0;
- }
+ int getFontHeight(FontStyle font = kFontStyleBold) const;
- int getStringWidth(const Common::String &str, FontStyle font) const {
- return ready() ? _texts[fontStyleToData(font)]->_fontPtr->getStringWidth(str) : 0;
- }
+ int getStringWidth(const Common::String &str, FontStyle font) const;
- int getCharWidth(byte c, FontStyle font) const {
- return ready() ? _texts[fontStyleToData(font)]->_fontPtr->getCharWidth(c) : 0;
- }
+ int getCharWidth(byte c, FontStyle font) const;
/**
@@ -625,9 +524,7 @@ protected:
}
}
- TextData getTextData(DrawData ddId) {
- return _widgets[ddId] ? (TextData)_widgets[ddId]->_textDataId : kTextDataNone;
- }
+ TextData getTextData(DrawData ddId);
/**
* Draws a cached widget directly on the screen. Currently deprecated.
@@ -720,10 +617,10 @@ protected:
Common::List<Common::Rect> _dirtyScreen;
/** Queue with all the drawing that must be done to the Back Buffer */
- Common::List<ThemeItem*> _bufferQueue;
+ Common::List<ThemeItem *> _bufferQueue;
/** Queue with all the drawing that must be done to the screen */
- Common::List<ThemeItem*> _screenQueue;
+ Common::List<ThemeItem *> _screenQueue;
bool _initOk; /** Class and renderer properly initialized */
bool _themeOk; /** Theme data successfully loaded. */