[Scummvm-cvs-logs] SF.net SVN: scummvm:[34935] scummvm/trunk/gui

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Nov 8 01:54:58 CET 2008


Revision: 34935
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34935&view=rev
Author:   fingolfin
Date:     2008-11-08 00:54:58 +0000 (Sat, 08 Nov 2008)

Log Message:
-----------
Moved some internal stuff from ThemeEngine.h to ThemeEngine.cpp

Modified Paths:
--------------
    scummvm/trunk/gui/ThemeEngine.cpp
    scummvm/trunk/gui/ThemeEngine.h

Modified: scummvm/trunk/gui/ThemeEngine.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEngine.cpp	2008-11-07 23:21:35 UTC (rev 34934)
+++ scummvm/trunk/gui/ThemeEngine.cpp	2008-11-08 00:54:58 UTC (rev 34935)
@@ -45,6 +45,105 @@
 
 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 @@
 	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.

Modified: scummvm/trunk/gui/ThemeEngine.h
===================================================================
--- scummvm/trunk/gui/ThemeEngine.h	2008-11-07 23:21:35 UTC (rev 34934)
+++ scummvm/trunk/gui/ThemeEngine.h	2008-11-08 00:54:58 UTC (rev 34935)
@@ -43,105 +43,10 @@
 
 struct WidgetDrawData;
 struct DrawDataInfo;
+struct TextDrawData;
 class ThemeEval;
+class ThemeItem;
 
-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 ThemeEngine : public Theme {
 protected:
 	typedef Common::HashMap<Common::String, Graphics::Surface*> ImagesMap;
@@ -321,19 +226,13 @@
 		}
 	}
 
-	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 @@
 		}
 	}
 
-	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 @@
 	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. */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list