changeset 697:ecaa4d98f05f tip

Abstracted the GUI code and refactored the GUIChan-specific code into its own module. * Most of the GUIChan code has been refactored into its own gui/guichan module. However, references to the GuiFont class still persist in the Engine and GuiManager code and these will need further refactoring. * GuiManager is now an abstract base class which specific implementations (e.g. GUIChan) should subclass. * The GUIChan GUI code is now a concrete implementation of GuiManager, most of which is in the new GuiChanGuiManager class. * The GUI code in the Console class has been refactored out of the Console and into the GUIChan module as its own GuiChanConsoleWidget class. The rest of the Console class related to executing commands was left largely unchanged. * Existing client code may need to downcast the GuiManager pointer received from FIFE::Engine::getGuiManager() to GuiChanGuiManager, since not all functionality is represented in the GuiManager abstract base class. Python client code can use the new GuiChanGuiManager.castTo static method for this purpose.
author M. George Hansen <technopolitica@gmail.com>
date Sat, 18 Jun 2011 00:28:40 -1000
parents e201abd8c807
children
files engine/core/controller/engine.cpp engine/core/controller/engine.h engine/core/controller/engine.i engine/core/gui/base/gui_font.cpp engine/core/gui/base/gui_font.h engine/core/gui/base/gui_font.i engine/core/gui/base/gui_image.cpp engine/core/gui/base/gui_image.h engine/core/gui/base/gui_image.i engine/core/gui/base/gui_imageloader.cpp engine/core/gui/base/gui_imageloader.h engine/core/gui/base/opengl/opengl_gui_graphics.cpp engine/core/gui/base/opengl/opengl_gui_graphics.h engine/core/gui/base/sdl/sdl_gui_graphics.cpp engine/core/gui/base/sdl/sdl_gui_graphics.h engine/core/gui/console.cpp engine/core/gui/console.h engine/core/gui/console.i engine/core/gui/console/commandline.cpp engine/core/gui/console/commandline.h engine/core/gui/console/console.cpp engine/core/gui/console/console.h engine/core/gui/console/console.i engine/core/gui/guichan/commandline.cpp engine/core/gui/guichan/commandline.h engine/core/gui/guichan/gui_font.cpp engine/core/gui/guichan/gui_font.h engine/core/gui/guichan/gui_font.i engine/core/gui/guichan/gui_image.cpp engine/core/gui/guichan/gui_image.h engine/core/gui/guichan/gui_image.i engine/core/gui/guichan/gui_imageloader.cpp engine/core/gui/guichan/gui_imageloader.h engine/core/gui/guichan/guichanguimanager.cpp engine/core/gui/guichan/guichanguimanager.h engine/core/gui/guichan/guichanguimanager.i engine/core/gui/guichan/guilistener.i engine/core/gui/guichan/opengl/opengl_gui_graphics.cpp engine/core/gui/guichan/opengl/opengl_gui_graphics.h engine/core/gui/guichan/sdl/sdl_gui_graphics.cpp engine/core/gui/guichan/sdl/sdl_gui_graphics.h engine/core/gui/guichan/widgets/clicklabel.cpp engine/core/gui/guichan/widgets/clicklabel.h engine/core/gui/guichan/widgets/icon2.cpp engine/core/gui/guichan/widgets/icon2.hpp engine/core/gui/guichan/widgets/percentagebar.cpp engine/core/gui/guichan/widgets/percentagebar.hpp engine/core/gui/guichan/widgets/togglebutton.cpp engine/core/gui/guichan/widgets/togglebutton.h engine/core/gui/guichan/widgets/twobutton.cpp engine/core/gui/guichan/widgets/twobutton.h engine/core/gui/guichan/widgets/utf8textbox.cpp engine/core/gui/guichan/widgets/utf8textbox.h engine/core/gui/guichan/widgets/utf8textfield.cpp engine/core/gui/guichan/widgets/utf8textfield.h engine/core/gui/guichan/widgets/widgets.i engine/core/gui/guilistener.i engine/core/gui/guimanager.cpp engine/core/gui/guimanager.h engine/core/gui/guimanager.i engine/core/gui/widgets/clicklabel.cpp engine/core/gui/widgets/clicklabel.h engine/core/gui/widgets/icon2.cpp engine/core/gui/widgets/icon2.hpp engine/core/gui/widgets/percentagebar.cpp engine/core/gui/widgets/percentagebar.hpp engine/core/gui/widgets/togglebutton.cpp engine/core/gui/widgets/togglebutton.h engine/core/gui/widgets/twobutton.cpp engine/core/gui/widgets/twobutton.h engine/core/gui/widgets/utf8textbox.cpp engine/core/gui/widgets/utf8textbox.h engine/core/gui/widgets/utf8textfield.cpp engine/core/gui/widgets/utf8textfield.h engine/core/gui/widgets/widgets.i engine/python/fife/extensions/pychan/compat.py tests/core_tests/test_gui.cpp
diffstat 77 files changed, 5118 insertions(+), 4695 deletions(-) [+]
line wrap: on
line diff
--- a/engine/core/controller/engine.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ b/engine/core/controller/engine.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -35,8 +35,9 @@
 #include "util/log/logger.h"
 #include "util/time/timemanager.h"
 #include "audio/soundmanager.h"
-#include "gui/console/console.h"
-#include "gui/guimanager.h"
+#include "gui/console.h"
+#include "gui/guichan/guichanguimanager.h"
+#include "gui/guichan/gui_font.h"
 #include "vfs/vfs.h"
 #include "vfs/vfsdirectory.h"
 #include "vfs/directoryprovider.h"
@@ -53,10 +54,7 @@
 #ifdef HAVE_OPENGL
 #include "video/opengl/fife_opengl.h"
 #include "video/opengl/renderbackendopengl.h"
-#include "gui/base/opengl/opengl_gui_graphics.h"
 #endif
-#include "gui/base/sdl/sdl_gui_graphics.h"
-#include "gui/base/gui_font.h"
 #include "video/sdl/renderbackendsdl.h"
 #include "video/fonts/abstractfont.h"
 #include "loaders/native/video_loaders/subimage_loader.h"
@@ -76,7 +74,6 @@
 #include "view/renderers/genericrenderer.h"
 #include "view/renderers/lightrenderer.h"
 #include "video/image.h"
-#include "gui/console/console.h"
 #include "engine.h"
 
 #ifdef USE_COCOA
@@ -104,7 +101,6 @@
 		m_soundclippool(0),
 		m_vfs(0),
 		m_model(0),
-		m_gui_graphics(0),
 		m_logmanager(0),
 		m_cursor(0),
 		m_prerender_callback(0),
@@ -145,8 +141,7 @@
 
 		Image* screen = m_renderbackend->setScreenMode(mode);
 
-		m_guimanager->resizeTopContainer(0,0,mode.getWidth(), mode.getHeight());
-		m_guimanager->getConsole()->reLayout();
+		m_guimanager->resize(0, 0, mode.getWidth(), mode.getHeight());
 
 		std::vector<IEngineChangeListener*>::iterator i = m_changelisteners.begin();
 		while (i != m_changelisteners.end()) {
@@ -256,30 +251,30 @@
 		FL_LOG(_log, "Main screen created");
 
 #ifdef HAVE_OPENGL
-		if( rbackend != "SDL" ) {
-			m_gui_graphics = new OpenGLGuiGraphics(*m_imagepool);
-		}
-
 		if (m_settings.getLightingModel() != 0) {
 			m_renderbackend->setLightingModel(m_settings.getLightingModel());
 		}
-
 #endif
-		if( rbackend == "SDL" ) {
-			m_gui_graphics = new SdlGuiGraphics(*m_imagepool);
-		}
 		FL_LOG(_log, "Constructing GUI manager");
-		m_guimanager = new GUIManager(*m_imagepool);
+		// TODO M. George Hansen 2011-06-15: There needs to be a plugin-like
+		// 	mechanism to select which GuiManager subclass to use.
+		m_guimanager = new GuiChanGuiManager(*m_imagepool);
 		FL_LOG(_log, "Events bind to GUI manager");
 		m_eventmanager->addSdlEventListener(m_guimanager);
 
 		FL_LOG(_log, "Creating default font");
+		// FIXME M. George Hansen 2011-06-17: A font has to be created before
+		// 	the GuiManager is initialized (at least for GuiChan). This is not
+		// 	obvious if you just look at the code.
 		m_defaultfont = m_guimanager->setDefaultFont(
 			m_settings.getDefaultFontPath(),
 			m_settings.getDefaultFontSize(),
-			m_settings.getDefaultFontGlyphs());
+			m_settings.getDefaultFontGlyphs()
+		);
+
 		FL_LOG(_log, "Initializing GUI manager");
-		m_guimanager->init(m_gui_graphics, m_renderbackend->getScreenWidth(), m_renderbackend->getScreenHeight());
+		m_guimanager->init(m_renderbackend, m_renderbackend->getScreenWidth(),
+				m_renderbackend->getScreenHeight());
 		FL_LOG(_log, "GUI manager initialized");
 		SDL_EnableUNICODE(1);
 
@@ -322,7 +317,6 @@
 		delete m_model;
 		delete m_soundmanager;
 		delete m_guimanager;
-		delete m_gui_graphics;
 
 		// Note the dependancy between image and animation pools
 		// as animations reference images they have to be deleted
--- a/engine/core/controller/engine.h	Fri Jun 10 23:37:46 2011 -1000
+++ b/engine/core/controller/engine.h	Sat Jun 18 00:28:40 2011 -1000
@@ -52,7 +52,7 @@
 
 	class SoundManager;
 	class RenderBackend;
-	class GUIManager;
+	class GuiManager;
 	class VFS;
 	class VFSSourceFactory;
 	class EventManager;
@@ -66,7 +66,8 @@
 	class SoundClipPool;
 	class RendererBase;
 	class Image;
-
+	class FontManager;
+	class GuiManager;
 
 	class IEngineChangeListener {
 	public:
@@ -158,7 +159,7 @@
 
 		/** Provides access point to the GuiManager
 		 */
-		GUIManager* getGuiManager() const { return m_guimanager; }
+		GuiManager* getGuiManager() const { return m_guimanager; }
 
 		/** Provides access point to the ImagePool
 		 */
@@ -210,7 +211,7 @@
 		void preInit();
 
 		RenderBackend* m_renderbackend;
-		GUIManager* m_guimanager;
+		GuiManager* m_guimanager;
 		EventManager* m_eventmanager;
 		SoundManager* m_soundmanager;
 		TimeManager* m_timemanager;
@@ -219,7 +220,6 @@
 		SoundClipPool* m_soundclippool;
 		VFS* m_vfs;
 		Model* m_model;
-		gcn::Graphics* m_gui_graphics;
 		LogManager* m_logmanager;
 		GuiFont* m_defaultfont;
 		Cursor* m_cursor;
--- a/engine/core/controller/engine.i	Fri Jun 10 23:37:46 2011 -1000
+++ b/engine/core/controller/engine.i	Sat Jun 18 00:28:40 2011 -1000
@@ -54,7 +54,7 @@
 	class SoundManager;
 	class EventManager;
 	class TimeManager;
-	class GUIManager;
+	class GuiManager;
 	class ImagePool;
 	class AnimationPool;
 	class SoundClipPool;
@@ -165,7 +165,7 @@
 		SoundManager* getSoundManager();
 		EventManager* getEventManager();
 		TimeManager* getTimeManager();
-		GUIManager* getGuiManager();
+		GuiManager* getGuiManager();
 		ImagePool* getImagePool();
 		AnimationPool* getAnimationPool();
 		SoundClipPool* getSoundClipPool();
--- a/engine/core/gui/base/gui_font.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "util/structures/rect.h"
-#include "video/image.h"
-#include "video/renderbackend.h"
-
-#include "gui_font.h"
-
-namespace FIFE {
-	GuiFont::GuiFont(AbstractFont* font): m_font(font) {
-		assert(font);
-	}
-
-	GuiFont::~GuiFont() {
-		delete m_font;
-	}
-
-	int GuiFont::getStringIndexAt(const std::string& text, int x) const {
-		return m_font->getStringIndexAt(text, x);
-	}
-
-	void GuiFont::drawString(gcn::Graphics* graphics, const std::string& text, int x, int y) {
-		if (text == "") {
-			return;
-		}
-
-		int yoffset = getRowSpacing() / 2;
-
-		const gcn::ClipRectangle& clip = graphics->getCurrentClipArea();
-		FIFE::Rect rect;
-		rect.x = x + clip.xOffset;
-		rect.y = y + clip.yOffset + yoffset;
-		rect.w = getWidth(text);
-		rect.h = getHeight();
-
-		if (!rect.intersects(Rect(clip.x,clip.y,clip.width,clip.height)) ) {
-			return;
-		}
-
-		Image* image = getAsImage(text);
-		image->render(rect);
-	}
-
-	void GuiFont::drawMultiLineString(gcn::Graphics* graphics, const std::string& text, int x, int y) {
-		if (text == "") {
-			return;
-		}
-
-		int yoffset = getRowSpacing() / 2;
-
-		const gcn::ClipRectangle& clip = graphics->getCurrentClipArea();
-
-		Image* image = getAsImageMultiline(text);
-
-		FIFE::Rect rect;
-		rect.x = x + clip.xOffset;
-		rect.y = y + clip.yOffset + yoffset;
-		rect.w = image->getWidth();
-		rect.h = image->getHeight();
-		if (!rect.intersects(Rect(clip.x,clip.y,clip.width,clip.height)) ) {
-			return;
-		}
-		image->render(rect);
-	}
-
-	void GuiFont::setRowSpacing (int spacing) {
-		m_font->setRowSpacing(spacing);
-	}
-
-	int GuiFont::getRowSpacing() const {
-		return m_font->getRowSpacing();
-	}
-
-	void GuiFont::setGlyphSpacing(int spacing) {
-		m_font->setGlyphSpacing(spacing);
-	}
-
-	int GuiFont::getGlyphSpacing() const {
-		return m_font->getGlyphSpacing();
-	}
-
-	void GuiFont::setAntiAlias(bool antiAlias) {
-		m_font->setAntiAlias(antiAlias);
-	}
-
-	bool GuiFont::isAntiAlias() {
-		return m_font->isAntiAlias();
-	}
-
-	Image* GuiFont::getAsImage(const std::string& text) {
-		return m_font->getAsImage(text);
-	}
-
-	Image* GuiFont::getAsImageMultiline(const std::string& text) {
-		return m_font->getAsImageMultiline(text);
-	}
-
-	std::string GuiFont::splitTextToWidth (const std::string& text, int render_width) {
-		return m_font->splitTextToWidth(text,render_width);
-	}
-
-	void GuiFont::setColor(uint8_t r,uint8_t g,uint8_t b, uint8_t a) {
-		m_font->setColor(r, g, b, a);
-	}
-
-	SDL_Color GuiFont::getColor() const {
-		return m_font->getColor();
-	}
-
-	int GuiFont::getWidth(const std::string& text) const {
-		return m_font->getWidth(text);
-	}
-
-	int GuiFont::getHeight() const {
-		return m_font->getHeight();
-	}
-
-	void GuiFont::invalidate() {
-		m_font->invalidate();
-	}
-}
--- a/engine/core/gui/base/gui_font.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef FIFE_GUI_FONT_H
-#define FIFE_GUI_FONT_H
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/font.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "video/fonts/abstractfont.h"
-
-
-namespace FIFE {
-
-	class GuiFont : public gcn::Font, public AbstractFont {
-	public:
-		/** Constructor
-		 *  Takes the ownership of given font
-		 */
-		GuiFont(AbstractFont* font);
-		virtual ~GuiFont();
-
-		int getStringIndexAt(const std::string& text, int x) const;
-		void drawString(gcn::Graphics* graphics, const std::string& text, int x, int y);
-		void drawMultiLineString(gcn::Graphics* graphics, const std::string& text, int x, int y);
-		std::string splitTextToWidth (const std::string& text, int render_width);
-
-		void setRowSpacing (int spacing);
-		int getRowSpacing() const;
-		void setGlyphSpacing(int spacing);
-		int getGlyphSpacing() const;
-		void setAntiAlias(bool antiAlias);
-		bool isAntiAlias();
-		Image* getAsImage(const std::string& text);
-		Image* getAsImageMultiline(const std::string& text);
-		void setColor(uint8_t r,uint8_t g,uint8_t b, uint8_t a = 255);
-		SDL_Color getColor() const;
-		int getWidth(const std::string& text) const;
-		int getHeight() const;
-		void invalidate();
-
-	private:
-		AbstractFont* m_font;
-	};
-}
-
-#endif
--- a/engine/core/gui/base/gui_font.i	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2010 by the FIFE team                              *
- *   http://www.fifengine.net                                              *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-%module fife
-%{
-#include <guichan/font.hpp>
-#include "gui/base/gui_font.h"
-#include "video/fonts/abstractfont.h"
-%}
-
-%include "video/fonts/fonts.i"
-
-namespace gcn {
-	class Graphics;
-	class Font
-	{
-	public:
-		virtual ~Font(){ }
-		virtual int getWidth(const std::string& text) const = 0;
-		virtual int getHeight() const = 0;
-	};
-}
-
-namespace FIFE {
-	class Image;
-	
-	%feature("notabstract") GuiFont;
-	class GuiFont : public gcn::Font, public AbstractFont {
-	public:
-		GuiFont(AbstractFont* font);
-		virtual ~GuiFont();
-		
-		int getStringIndexAt(const std::string& text, int x);
-		void drawString(gcn::Graphics* graphics, const std::string& text, int x, int y);
-
-		void setRowSpacing (int spacing);
-		int getRowSpacing() const;
-		void setGlyphSpacing(int spacing);
-		int getGlyphSpacing() const;
-		void setAntiAlias(bool antiAlias);
-		bool isAntiAlias();
-		Image* getAsImage(const std::string& text);
-		void setColor(uint8_t r,uint8_t g,uint8_t b, uint8_t a = 255);
-		SDL_Color getColor() const;
-		int getWidth(const std::string& text) const;
-		int getHeight() const;
-	};
-}
--- a/engine/core/gui/base/gui_image.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-// Standard C++ library includes
-
-// 3rd party library includes
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "video/imagepool.h"
-#include "util/log/logger.h"
-
-#include "gui_image.h"
-
-namespace FIFE {
-	static Logger _log(LM_GUI);
-
-	GuiImage::GuiImage(): gcn::Image(), m_poolid(Pool::INVALID_ID), m_pool(NULL) {
-	}
-
-	GuiImage::GuiImage(int id, ImagePool& pool): gcn::Image(), m_poolid(id), m_pool(&pool) {
-		 m_pool->getImage(m_poolid);
-	}
-
-	GuiImage::~GuiImage() {
-// 		 m_pool->release(m_poolid,true);
-	}
-
-	void GuiImage::free() {
-		// the imagepool should do this; should we tell it?
-	}
-
-	int GuiImage::getWidth() const {
-		if(m_poolid==Pool::INVALID_ID)
-			return 0;
-		return m_pool->getImage(m_poolid).getWidth();
-	}
-
-	int GuiImage::getHeight() const {
-		if(m_poolid==Pool::INVALID_ID)
-			return 0;
-		return m_pool->getImage(m_poolid).getHeight();
-	}
-
-	gcn::Color GuiImage::getPixel(int x, int y) {
-		FL_PANIC(_log, "GuiImage::getPixel, not implemented");
-		return gcn::Color();
-	}
-
-	void GuiImage::putPixel(int x, int y, const gcn::Color& color) {
-		FL_PANIC(_log, "GuiImage::putPixel, not implemented");
-	}
-
-	void GuiImage::convertToDisplayFormat() {
-		// empty on purpose
-		// Since we don't need any conversions - this is just a proxy.
-	}
-}
--- a/engine/core/gui/base/gui_image.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef FIFE_GUI_IMAGE_H
-#define FIFE_GUI_IMAGE_H
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/color.hpp>
-#include <guichan/image.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-
-
-namespace FIFE {
-	class ImagePool;
-
-	class GuiImage : public gcn::Image {
-	public:
-		GuiImage();
-		GuiImage(int id, ImagePool& pool);
-		~GuiImage();
-		void free();
-		int getWidth() const;
-		int getHeight() const;
-		gcn::Color getPixel(int x, int y);
-		void putPixel(int x, int y, const gcn::Color& color);
-		void convertToDisplayFormat();
-		int getPoolId() const { return m_poolid; }
-	protected:
-		int m_poolid;
-		ImagePool* m_pool;
-	};
-}
-
-#endif
--- a/engine/core/gui/base/gui_image.i	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-%module fife
-%{
-#include <guichan/image.hpp>
-#include "gui/base/gui_image.h"
-%}
-
-%rename(GcnImage) gcn::Image;
-namespace gcn {
-	class Image
-	{
-	public:
-		Image();
-		virtual ~Image();
-		static Image* load(const std::string& filename, bool convertToDisplayFormat = true);
-		virtual int getWidth() const = 0;
-		virtual int getHeight() const = 0;
-	};
-}
-
-namespace FIFE {
-
-	class GuiImage: public gcn::Image {
-	public:
-		GuiImage();
-		GuiImage(int id, ImagePool& pool);
-		int getWidth() const;
-		int getHeight() const;
-	};
-}
--- a/engine/core/gui/base/gui_imageloader.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-// Standard C++ library includes
-
-// 3rd party library includes
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-
-#include "gui_imageloader.h"
-#include "video/imagepool.h"
-
-namespace FIFE {
-	GuiImageLoader::GuiImageLoader(ImagePool& pool): m_pool(pool) {
-	}
-
-	gcn::Image* GuiImageLoader::load(const std::string& filename, bool convertToDisplayFormat) {
-		int id = m_pool.addResourceFromFile(filename);
-		return new GuiImage(id, m_pool);
-	}
-}
--- a/engine/core/gui/base/gui_imageloader.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef FIFE_GUI_IMAGELOADER_H
-#define FIFE_GUI_IMAGELOADER_H
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/imageloader.hpp>
-#include <guichan/image.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "video/imagepool.h"
-
-#include "gui_image.h"
-
-namespace FIFE {
-
-	/* Image Loader.
-	 */
-	class GuiImageLoader : public gcn::ImageLoader {
-	public:
-		GuiImageLoader(ImagePool& pool);
-      		gcn::Image* load(const std::string& filename, bool convertToDisplayFormat = true);
-	private:
-		ImagePool& m_pool;
-	};
-
-}
-
-#endif
--- a/engine/core/gui/base/opengl/opengl_gui_graphics.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/opengl.hpp>
-#include <guichan/font.hpp>
-#include <guichan/exception.hpp>
-
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src dir
-#include "video/image.h"
-#include "gui/base/gui_image.h"
-#include "util/structures/rect.h"
-#include "video/opengl/fife_opengl.h"
-
-#include "opengl_gui_graphics.h"
-
-namespace FIFE {
-	OpenGLGuiGraphics::OpenGLGuiGraphics(ImagePool& pool): m_pool(pool) {
-		mTarget = SDL_GetVideoSurface();
-		assert(mTarget);
-		setTargetPlane(mTarget->w, mTarget->h);
-
-	}
-
-	void OpenGLGuiGraphics::drawImage(const gcn::Image* image, int srcX, int srcY, int dstX, int dstY, int width, int height) {
-		const GuiImage* g_img = dynamic_cast<const GuiImage*>(image);
-		assert(g_img);
-		Image& fifeimg = m_pool.getImage(g_img->getPoolId());
-		const gcn::ClipRectangle& clip = getCurrentClipArea();
-		Rect rect(dstX, dstY, width, height);
-		rect.x += clip.xOffset;
-		rect.y += clip.yOffset;
-		GLEnable flag(GL_TEXTURE_2D);
-		fifeimg.render(rect, mTarget);
-	}
-
-	void OpenGLGuiGraphics::drawText(const std::string& text, int x, int y,
-			unsigned int alignment) {
-		if (mFont == NULL)
-		{
-			throw GCN_EXCEPTION("No font set.");
-		}
-
-		GLEnable flag(GL_TEXTURE_2D);
-		switch (alignment)
-		{
-			case LEFT:
-				mFont->drawString(this, text, x, y);
-				break;
-			case CENTER:
-				mFont->drawString(this, text, x - mFont->getWidth(text) / 2, y);
-				break;
-			case RIGHT:
-				mFont->drawString(this, text, x - mFont->getWidth(text), y);
-				break;
-			default:
-				throw GCN_EXCEPTION("Unknown alignment.");
-		}
-	}
-
-	void OpenGLGuiGraphics::drawPoint(int x, int y) {
-		GLDisable flag(GL_TEXTURE_2D);
-		gcn::OpenGLGraphics::drawPoint(x, y);
-	}
-
-	void OpenGLGuiGraphics::drawLine(int x1, int y1, int x2, int y2) {
-		GLDisable flag(GL_TEXTURE_2D);
-		gcn::OpenGLGraphics::drawLine(x1, y1, x2, y2);
-	}
-
-	void OpenGLGuiGraphics::drawRectangle(const gcn::Rectangle& rectangle) {
-		GLDisable flag(GL_TEXTURE_2D);
-		gcn::OpenGLGraphics::drawRectangle(rectangle);
-	}
-}
--- a/engine/core/gui/base/opengl/opengl_gui_graphics.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef FIFE_GUI_OPENGL_GRAPHICS_H
-#define FIFE_GUI_OPENGL_GRAPHICS_H
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/opengl/openglgraphics.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src dir
-#include "video/imagepool.h"
-
-namespace FIFE {
-	/** Overrides Guichan Graphics to enable usage of normal fife images & related facilities
-	 */
-	class OpenGLGuiGraphics: public gcn::OpenGLGraphics {
-	public:
-		/** Constructor
-		 */
-		OpenGLGuiGraphics(ImagePool& pool);
-		virtual void drawImage(const gcn::Image* image, int srcX, int srcY, int dstX, int dstY, int width, int height);
-
-		virtual void drawText(const std::string& text, int x, int y, unsigned int alignment);
-		virtual void drawPoint(int x, int y);
-		virtual void drawLine(int x1, int y1, int x2, int y2);
-		virtual void drawRectangle(const gcn::Rectangle& rectangle);
-
-	private:
-		SDL_Surface* mTarget;
-		ImagePool& m_pool;
-	};
-}
-
-#endif
--- a/engine/core/gui/base/sdl/sdl_gui_graphics.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <SDL.h>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src dir
-#include "gui/base/gui_image.h"
-#include "util/structures/rect.h"
-#include "video/image.h"
-
-#include "sdl_gui_graphics.h"
-
-namespace FIFE {
-	SdlGuiGraphics::SdlGuiGraphics(ImagePool& pool): m_pool(pool) {
-		setTarget(SDL_GetVideoSurface());
-	}
-
-	void SdlGuiGraphics::drawImage(const gcn::Image* image, int srcX, int srcY, int dstX, int dstY, int width, int height) {
-		const GuiImage* g_img = dynamic_cast<const GuiImage*>(image);
-		assert(g_img);
-		Image& fifeimg = m_pool.getImage(g_img->getPoolId());
-		const gcn::ClipRectangle& clip = getCurrentClipArea();
-		Rect rect(dstX, dstY, width, height);
-		rect.x += clip.xOffset;
-		rect.y += clip.yOffset;
-		fifeimg.render(rect, mTarget);
-	}
-}
--- a/engine/core/gui/base/sdl/sdl_gui_graphics.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef FIFE_GUI_SDL_GRAPHICS_H
-#define FIFE_GUI_SDL_GRAPHICS_H
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/sdl/sdlgraphics.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src dir
-#include "video/imagepool.h"
-
-namespace FIFE {
-	/** Overrides Guichan Graphics to enable usage of normal fife images & related facilities
-	 */
-	class SdlGuiGraphics: public gcn::SDLGraphics {
-	public:
-		/** Constructor
-		 */
-		SdlGuiGraphics(ImagePool& pool);
-		virtual void drawImage(const gcn::Image* image, int srcX, int srcY, int dstX, int dstY, int width, int height);
-
-	private:
-		ImagePool& m_pool;
-	};
-}
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/console.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,85 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+#include <cassert>
+
+// 3rd party library includes
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/regex.hpp>
+#include <boost/tokenizer.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "video/renderbackend.h"
+#include "util/time/timemanager.h"
+#include "util/log/logger.h"
+#include "util/base/exception.h"
+#include "gui/guimanager.h"
+
+#include "console.h"
+
+namespace FIFE {
+	static Logger _log(LM_CONSOLE);
+
+	Console::Console() :
+		m_consoleexec(0) {
+	}
+
+	Console::~Console() {
+	}
+
+	std::string Console::execute(std::string cmd) {
+		FL_DBG(_log, LMsg("in execute with command ") << cmd);
+		if (cmd.empty())
+			return "";
+
+		// run the command
+		std::string resp;
+		if (!m_consoleexec) {
+			FL_WARN(_log,
+				LMsg("ConsoleExecuter not bound, but command received: ") <<
+				cmd.c_str());
+			resp = "";
+		} else {
+			try {
+				resp = m_consoleexec->onConsoleCommand(cmd);
+			} catch (const FIFE::Exception& e) {
+				FL_WARN(_log, LMsg("Console caught exception: ") << e.what());
+				resp = e.what();
+			}
+		}
+
+		return resp;
+	}
+
+	void Console::setConsoleExecuter(ConsoleExecuter* const consoleexec) {
+		m_consoleexec = consoleexec;
+	}
+
+	void Console::removeConsoleExecuter() {
+		m_consoleexec = NULL;
+	}
+}
+/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/console.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,100 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef FIFE_GUI_CONSOLE_H
+#define FIFE_GUI_CONSOLE_H
+
+// Standard C++ library includes
+#include <string>
+
+// 3rd party library includes
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+
+namespace FIFE {
+	/**
+	* Console executer is listener interface for console activity
+	*/
+	class ConsoleExecuter {
+		public:
+			/** Destructor
+			 */
+			virtual ~ConsoleExecuter() {}
+
+			/** Called when console tools button is clicked
+			 */
+			virtual void onToolsClick() = 0;
+
+			/** Called when user has typed command to console and pressed enter
+			 * @return response from executer
+			 */
+			virtual std::string onConsoleCommand(const std::string& command) = 0;
+	};
+
+	/** Ingame Console
+	 */
+	class Console {
+		public:
+			/** Constructor
+			 */
+			Console();
+
+			/** Destructor
+			 */
+			virtual ~Console();
+
+			/** Execute a command
+			 * Normally just sends the command to runString()
+			 * Checks whether the cmd is just one token
+			 * and print it's value rather than throw an
+			 * useless error.
+			 *
+			 * @param cmd String representing the command to execute.
+			 *
+			 * @return Output from the command.
+			 *
+			 * @todo generalize the generated command and the regexp used.
+			 */
+			std::string execute(std::string cmd);
+
+			/** Get the executer for the console.
+			 */
+			ConsoleExecuter* getConsoleExecuter() const {
+				return m_consoleexec;
+			}
+
+			/** Sets executer for the console
+			 */
+			void setConsoleExecuter(ConsoleExecuter* const consoleexec);
+
+			/** Removes executer for the console
+			 */
+			void removeConsoleExecuter();
+
+		private:
+			ConsoleExecuter* m_consoleexec;
+	};
+}
+#endif
+/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/console.i	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,42 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+%module fife
+%{
+#include "gui/console.h"
+%}
+
+namespace FIFE {
+	%feature("director") ConsoleExecuter;
+	class ConsoleExecuter {
+	public:
+		virtual ~ConsoleExecuter() {}
+		virtual void onToolsClick() = 0;
+		virtual std::string onConsoleCommand(const std::string& command) = 0;
+	};
+
+	class Console {
+	public:
+		std::string execute(std::string cmd);
+		void setConsoleExecuter(ConsoleExecuter* const consoleexec);
+		void removeConsoleExecuter();
+	};
+}
--- a/engine/core/gui/console/commandline.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-// Standard C++ library includes
-#include <cassert>
-
-// 3rd party library includes
-#include <boost/bind.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "util/time/timeevent.h"
-#include "util/time/timemanager.h"
-
-#include "commandline.h"
-
-namespace FIFE {
-	using namespace gcn;
-
-
-	CommandLine::CommandLine() : gcn::UTF8TextField(), m_history_position(0) {
-
-		m_blinkTimer.setInterval(500);
-		m_blinkTimer.setCallback(boost::bind(&CommandLine::toggleCaretVisible,this));
-		m_blinkTimer.start();
-
-		m_suppressBlinkTimer.setInterval(2000);
-		m_suppressBlinkTimer
-			.setCallback(boost::bind(&CommandLine::startBlinking,this));
-	}
-
-	CommandLine::~CommandLine() {
-	}
-
-	void CommandLine::toggleCaretVisible() {
-		m_caretVisible = !m_caretVisible;
-	}
-
-	void CommandLine::stopBlinking() {
-		m_suppressBlinkTimer.start();
-		m_blinkTimer.stop();
-		m_caretVisible = true;
-	}
-
-	void CommandLine::startBlinking() {
-		m_suppressBlinkTimer.stop();
-		m_blinkTimer.start();
-	}
-
-	void CommandLine::keyPressed(gcn::KeyEvent &keyEvent) {
-		gcn::Key key = keyEvent.getKey();
-		int keyType = key.getValue();
-		
-		if (keyType == Key::LEFT && mCaretPosition > 0)
-		{
-			UTF8TextField::keyPressed(keyEvent);
-		}
-		else if (keyType == Key::RIGHT && mCaretPosition < mText.size())
-		{
-			UTF8TextField::keyPressed(keyEvent);
-		}
-		else if (keyType == Key::DOWN && !m_history.empty())
-		{
-			if( m_history_position < m_history.size() ) {
-				
-				if( ++m_history_position == m_history.size() ) {
-					setText( m_cmdline ); 
-				} else {
-					setText( m_history[m_history_position] ); 
-				}
-			};
-		}
-		else if (keyType == Key::UP && !m_history.empty())
-		{
-			if( m_history_position > 0 ) {
-				if( m_history_position == m_history.size() ) {
-					m_cmdline = mText; 
-				}
-				--m_history_position;
-				setText( m_history[m_history_position] ); 
-			};
-		}
-		else if (keyType == Key::DELETE && mCaretPosition < mText.size())
-		{
-			UTF8TextField::keyPressed(keyEvent);
-		}
-		else if (keyType  == Key::BACKSPACE && mCaretPosition > 0)
-		{
-			UTF8TextField::keyPressed(keyEvent);
-		}
-		else if (keyType == Key::ENTER)
-		{
-			if( mText != "" ) {
-				if(m_callback) {
-					m_callback( mText );
-				}
-				m_history.push_back( mText ); 
-				m_history_position = m_history.size();
-				setText("");
-			}
-		}
-		else if (keyType == Key::HOME)
-		{
-			mCaretPosition = 0;
-		}    
-		else if (keyType == Key::END)
-		{
-			mCaretPosition = mText.size();
-		}    
-		else if (key.isCharacter())
-		{
-			UTF8TextField::keyPressed(keyEvent);
-		}
-		stopBlinking();
-		fixScroll();
-	}
-
-	void CommandLine::drawCaret(gcn::Graphics * graphics, int x) {
-		if( !m_caretVisible )
-			return;
-
-		graphics->setColor(getForegroundColor());
-		graphics->drawLine(x, getHeight() - 2, x, 1);
-		graphics->drawLine(x+1, getHeight() - 2, x+1, 1);
-	}
-
-
-	void CommandLine::setCallback(const type_callback& cb) {
-		m_callback = cb;
-	}
-
-}
-/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- a/engine/core/gui/console/commandline.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef FIFE_GUICHAN_ADDON_COMMANDLINE_H
-#define FIFE_GUICHAN_ADDON_COMMANDLINE_H
-
-// Standard C++ library includes
-#include <string>
-#include <vector>
-
-// 3rd party library includes
-#include <boost/function.hpp>
-#include <guichan.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "util/time/timer.h"
-#include "gui/widgets/utf8textfield.h"
-
-namespace FIFE {
-
-	/** A Command line widget
-	 */
-	class CommandLine : public gcn::UTF8TextField {
-		public:
-			typedef boost::function1<void,std::string> type_callback;
-
-			/** Constructor
-			 */
-			CommandLine();
-
-			/** Destructor
-			 */
-			~CommandLine();
-
-			void keyPressed(gcn::KeyEvent& keyEvent);
-			virtual void drawCaret(gcn::Graphics * graphics, int x);
-
-			/** Set callback on pressing the ENTER key
-			 */
-			void setCallback(const type_callback& cb);
-
-			/** Toggle the caret visibility
-			 */
-			void toggleCaretVisible();
-
-			/** Start blinking the caret
-			 */
-			void startBlinking();
-
-			/** Stop blinking the caret for a few seconds
-			 */
-			void stopBlinking();
-		private:
-			type_callback m_callback;
-			std::vector<std::string> m_history;
-			size_t m_history_position;
-			std::string m_cmdline;
-			bool m_caretVisible;
-			Timer m_blinkTimer;
-			Timer m_suppressBlinkTimer;
-	};
-}
-#endif
-/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- a/engine/core/gui/console/console.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,309 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-// Standard C++ library includes
-#include <cassert>
-
-// 3rd party library includes
-#include <boost/bind.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/regex.hpp>
-#include <boost/tokenizer.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "video/renderbackend.h"
-#include "util/time/timemanager.h"
-#include "util/log/logger.h"
-#include "util/base/exception.h"
-#include "gui/guimanager.h"
-#include "gui/base/gui_font.h"
-#include "gui/widgets/utf8textbox.h"
-
-#include "commandline.h"
-#include "console.h"
-
-namespace FIFE {
-	const unsigned  Console::m_maxOutputRows = 50;
-	static Logger _log(LM_CONSOLE);
-
-	Console::Console()
-		: gcn::Container(),
-		m_consoleexec(0),
-		m_input(new CommandLine()),
-		m_output(new gcn::UTF8TextBox()),
-		m_outputscrollarea(new gcn::ScrollArea(m_output)),
-		m_status(new gcn::Label()),
-		m_toolsbutton(new gcn::Button("Tools"))
-		{
-		reLayout();
-
-		add(m_outputscrollarea);
-		add(m_input);
-		add(m_status);
-		add(m_toolsbutton);
-
-		setOpaque(true);
-
-		m_input->setCallback( std::bind1st( std::mem_fun(&Console::execute), this) );
-		m_prompt = "-- ";
-
-		m_isAttached = false;
-
-		m_fpsTimer.setInterval(500);
-		m_fpsTimer.setCallback( boost::bind(&Console::updateCaption, this) );
-
-		m_hiding = true;
-
-		m_animationTimer.setInterval(20);
-		m_animationTimer.setCallback( boost::bind(&Console::updateAnimation, this) );
-
-		m_toolsbutton->addActionListener(this);
-		m_toolsbutton->setFocusable(false);
-		m_input->addFocusListener(this);
-
-		GuiFont* font = GUIManager::instance()->createFont();
-		font->setColor(255,255,255);
-		setIOFont(font);
-	}
-
-	void Console::reLayout() {
-		Image* screen = RenderBackend::instance()->getScreenImage();
-		assert(screen);
-
-		int w, h, b, input_h, bbar_h, button_w;
-		w = screen->getWidth() * 4/5;
-		h = screen->getHeight() * 4/5;
-		b = 0;
-		input_h = getFont()->getHeight();
-		bbar_h = input_h;
-		button_w = 80;
-
-		gcn::Color black(0x00,0,0,0xff);
-		gcn::Color white(0xff,0xff,0xff,0xff);
-		gcn::Color dark(50,60,50,0xff);
-
-		setSize(w, h);
-		setPosition((screen->getWidth() - w) / 2,-h);
-		setFrameSize(0);
-
-		setForegroundColor(white);
-		setBackgroundColor(black);
-		setBaseColor(dark);
-
-		setSize(w, h);
-
-		m_outputscrollarea->setSize(w - 2*b, h - input_h - 3*b - bbar_h);
-		m_outputscrollarea->setPosition(b,0);
-
-		m_input->setPosition(b, h - input_h - b - bbar_h);
-		m_input->setSize(w - 2*b, input_h);
-
-		m_status->setPosition(b, h - b - bbar_h);
-		m_status->setSize(w - 2*b, bbar_h);
-
-		m_toolsbutton->setPosition(w - button_w, h - b - bbar_h);
-		m_toolsbutton->setSize(button_w, bbar_h);
-
-		m_output->setBackgroundColor(black);
-		m_output->setFocusable(false);
-
-		m_outputscrollarea->setBackgroundColor(black);
-		m_outputscrollarea->setBaseColor(dark);
-
-		m_input->setForegroundColor(white);
-		m_input->setBackgroundColor(black);
-
-		m_status->setForegroundColor(white);
-		m_status->setBackgroundColor(black);
-
-		m_toolsbutton->setForegroundColor(white);
-		m_toolsbutton->setBackgroundColor(black);
-		m_toolsbutton->setBaseColor(dark);
-
-		m_hiddenPos = -h;
-		m_animationDelta = h/6;
-	}
-
-	Console::~Console() {
-		doHide();
-
-		remove(m_input);
-		remove(m_outputscrollarea);
-		remove(m_status);
-
-		delete m_output;
-		delete m_input;
-		delete m_outputscrollarea;
-		delete m_status;
-		delete m_toolsbutton;
-	}
-
-	void Console::updateCaption() {
-		std::string caption = "FIFE Console - FPS: ";
-		float fps = 1e3/double(TimeManager::instance()->getAverageFrameTime());
-		caption += boost::lexical_cast<std::string>(fps);
-		m_status->setCaption( caption );
-	}
-
-	void Console::updateAnimation() {
-	    if (m_hiding){
-		setPosition(getX(), getY() - m_animationDelta);
-		if (getY() <= m_hiddenPos){
-		    doHide();
-			m_animationTimer.stop();
-		}
-	    }else{
-		setPosition(getX(), getY() + m_animationDelta);
-		if (getY() >= 0){
-		    setPosition(getX(), 0);
-			m_animationTimer.stop();
-		}
-	}
-	}
-
-	void Console::clear() {
-		m_output->setText("");
-	}
-
-	void Console::doShow() {
-		if (m_isAttached)
-			return;
-		m_isAttached = true;
-		GUIManager::instance()->add(this);
-		GUIManager::instance()->getTopContainer()->moveToTop(this);
-		// Assure the input field is focused when shown.
-		m_input->requestFocus();
-
-		m_fpsTimer.start();
-	}
-
-	void Console::doHide() {
-		if (!m_isAttached)
-			return;
-		m_isAttached = false;
-		GUIManager::instance()->remove(this);
-		m_fpsTimer.stop();
-	}
-
-	void Console::show() {
-		if(m_hiding) {
-			m_hiding = false;
-			doShow();
-			m_animationTimer.start();
-		}
-	}
-
-	void Console::hide() {
-		if(!m_hiding) {
-			m_hiding = true;
-			m_animationTimer.start();
-		}
-	}
-
-	void Console::toggleShowHide() {
-		m_hiding = !m_hiding;
-		if(!m_hiding)
-			doShow();
-		m_animationTimer.start();
-	}
-
-	void Console::execute(std::string cmd) {
- 		FL_DBG(_log, LMsg("in execute with command ") << cmd);
-		if (cmd.empty())
-			return;
-
-		// copy input to output
-		println(m_prompt + cmd);
-
-		// run the command
-		try {
-			if (m_consoleexec) {
-				std::string resp = m_consoleexec->onConsoleCommand(cmd);
-				println(resp);
-			} else {
-				FL_WARN(_log, LMsg("ConsoleExecuter not bind, but command received: ") << cmd.c_str());
-			}
-		}
-		catch (const FIFE::Exception & e) {
-			FL_WARN(_log, LMsg("Console caught exception: ") << e.what());
-			println(e.what());
-		}
-	}
-
-	void Console::println(const std::string & s) {
-		assert(m_output);
-
-		// Add the text in rows
-		boost::char_separator<char> separator("\n");
-		typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
-		tokenizer tokens(s,separator);
-		for(tokenizer::iterator i = tokens.begin(); i != tokens.end(); ++i) {
-			m_output->addRow(*i);
-		}
-
-		// Assure the maximum number of rows
-		if( m_output->getNumberOfRows() > m_maxOutputRows ) {
-			unsigned rows = m_output->getNumberOfRows();
-			int delta_rows = rows - m_maxOutputRows;
-			std::vector<std::string> rows_text;
-			for(size_t i=delta_rows; i != rows; ++i) {
-				rows_text.push_back(m_output->getTextRow(i));
-			}
-			m_output->setText("");
-			for(size_t i=0; i != rows_text.size(); ++i) {
-				m_output->addRow(rows_text[i]);
-			}
-		}
-
-		// Assure the new text is visible
-		gcn::Rectangle rect(0,m_output->getHeight(),0,0);
-		m_outputscrollarea->showWidgetPart(m_output,rect);
-	}
-
-	void Console::action(const gcn::ActionEvent & event) {
-		if (m_consoleexec) {
-			m_consoleexec->onToolsClick();
-		} else {
-			FL_WARN(_log, "ConsoleExecuter not bind, but tools button clicked");
-		}
-	}
-
-	void Console::setConsoleExecuter(ConsoleExecuter* const consoleexec) {
-		m_consoleexec = consoleexec;
-	}
-
-	void Console::removeConsoleExecuter() {
-		m_consoleexec = NULL;
-	}
-
-	void Console::setIOFont(GuiFont* font) {
-		m_input->setFont(font);
-		m_output->setFont(font);
-	}
-
-	void Console::focusLost(const gcn::Event& ) {
-		hide();
-	}
-}
-/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- a/engine/core/gui/console/console.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef FIFE_GUICHAN_ADDON_CONSOLE_H
-#define FIFE_GUICHAN_ADDON_CONSOLE_H
-
-// Standard C++ library includes
-#include <string>
-
-// 3rd party library includes
-#include <guichan.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "util/time/timer.h"
-
-namespace FIFE {
-
-	class CommandLine;
-	class GuiFont;
-
-	/**
-	* Console executer is listener interface for console activity
-	*/
-	class ConsoleExecuter {
-		public:
-			/** Destructor
-			 */
-			virtual ~ConsoleExecuter() {}
-
-			/** Called when console tools button is clicked
-			 */
-			virtual void onToolsClick() = 0;
-
-			/** Called when user has typed command to console and pressed enter
-			 * @return response from executer
-			 */
-			virtual std::string onConsoleCommand(const std::string& command) = 0;
-	};
-
-
-	/** Ingame Console
-	 */
-	class Console : public gcn::Container, public gcn::ActionListener, public gcn::FocusListener {
-		public:
-			/** Constructor
-			 */
-			Console();
-
-			/** Destructor
-			 */
-			virtual ~Console();
-
-			/** Print one or more lines to the console output
-			 */
-			void println(const std::string & s);
-
-			/** Show the console
-			 * Adds the Console to the guichan toplevel container
-			 * and pushes an input Context so that keys are not send to the
-			 * rest of the game.
-			 */
-			void show();
-
-			/** Hide the console
-			 * Removes itself from the toplevel container
-			 * and pops it's input context
-			 */
-			void hide();
-
-			/** Clear the console output
-			 */
-			void clear();
-
-			/** Toggle the console
-			 * Toggles whether the Console is shown or not.
-			 * Calls show() or hide() respectively.
-			 */
-			void toggleShowHide();
-
-			/** Execute a command
-			 * Normally just sends the command to runString()
-			 * Checks whether the cmd is just one token
-			 * and print it's value rather than throw an
-			 * useless error.
-			 *
-			 * @todo generalize the generated command and the regexp used.
-			 */
-			void execute(std::string cmd);
-
-			/** Update the FPS caption
-			 *  @note Is a timer callback.
-			 */
-			void updateCaption();
-
-			/** Update the scroll in/out animation.
-			 *  @note Is a timer callback.
-			 */
-			void updateAnimation();
-
-			/** Callback from guichan to respond to button press
-			 */
-			void action(const gcn::ActionEvent & event);
-
-			/** Sets executer for the console
-			 */
-			void setConsoleExecuter(ConsoleExecuter* const consoleexec);
-
-			/** Removes executer for the console
-			 */
-			void removeConsoleExecuter();
-
-			/** Layouts the console to match e.g. font changes
-			 */
-			void reLayout();
-
-			/** Sets the font used for the input and output areas
-			 */
-			void setIOFont(GuiFont* font);
-
-			/** Hide if we loose focus
-			*/
-			void focusLost(const gcn::Event& event);
-		private:
-
-			bool m_isAttached;
-			ConsoleExecuter* m_consoleexec;
-			
-			CommandLine*      m_input;
-			gcn::TextBox*     m_output;
-			gcn::ScrollArea*  m_outputscrollarea;
-			gcn::Label*       m_status;
-			gcn::Button*      m_toolsbutton;
-			static const unsigned m_maxOutputRows;
-
-			std::string m_prompt;
-
-			int m_hiddenPos;
-			int m_animationDelta;
-
-			bool m_hiding;
-
-			Timer m_fpsTimer;
-			Timer m_animationTimer;
-
-			void doShow();
-			void doHide();
-	};
-}
-#endif
-/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- a/engine/core/gui/console/console.i	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-%module fife
-%{
-#include "gui/console/console.h"
-%}
-
-namespace FIFE {
-	%feature("director") ConsoleExecuter;
-	class ConsoleExecuter {
-	public:
-		virtual ~ConsoleExecuter() {}
-		virtual void onToolsClick() = 0;
-		virtual std::string onConsoleCommand(const std::string& command) = 0;
-	};
-
-	class Console {
-	public:
-		void show();
-		void hide();
-		void clear();
-		void toggleShowHide();
-    void println( const std::string & s );
-		void setConsoleExecuter(ConsoleExecuter* const consoleexec);
-		void removeConsoleExecuter();
-	};
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/commandline.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,153 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+#include <cassert>
+
+// 3rd party library includes
+#include <boost/bind.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "util/time/timeevent.h"
+#include "util/time/timemanager.h"
+
+#include "commandline.h"
+
+namespace FIFE {
+	using namespace gcn;
+
+
+	CommandLine::CommandLine() : gcn::UTF8TextField(), m_history_position(0) {
+
+		m_blinkTimer.setInterval(500);
+		m_blinkTimer.setCallback(boost::bind(&CommandLine::toggleCaretVisible,this));
+		m_blinkTimer.start();
+
+		m_suppressBlinkTimer.setInterval(2000);
+		m_suppressBlinkTimer
+			.setCallback(boost::bind(&CommandLine::startBlinking,this));
+	}
+
+	CommandLine::~CommandLine() {
+	}
+
+	void CommandLine::toggleCaretVisible() {
+		m_caretVisible = !m_caretVisible;
+	}
+
+	void CommandLine::stopBlinking() {
+		m_suppressBlinkTimer.start();
+		m_blinkTimer.stop();
+		m_caretVisible = true;
+	}
+
+	void CommandLine::startBlinking() {
+		m_suppressBlinkTimer.stop();
+		m_blinkTimer.start();
+	}
+
+	void CommandLine::keyPressed(gcn::KeyEvent &keyEvent) {
+		gcn::Key key = keyEvent.getKey();
+		int keyType = key.getValue();
+		
+		if (keyType == Key::LEFT && mCaretPosition > 0)
+		{
+			UTF8TextField::keyPressed(keyEvent);
+		}
+		else if (keyType == Key::RIGHT && mCaretPosition < mText.size())
+		{
+			UTF8TextField::keyPressed(keyEvent);
+		}
+		else if (keyType == Key::DOWN && !m_history.empty())
+		{
+			if( m_history_position < m_history.size() ) {
+				
+				if( ++m_history_position == m_history.size() ) {
+					setText( m_cmdline ); 
+				} else {
+					setText( m_history[m_history_position] ); 
+				}
+			};
+		}
+		else if (keyType == Key::UP && !m_history.empty())
+		{
+			if( m_history_position > 0 ) {
+				if( m_history_position == m_history.size() ) {
+					m_cmdline = mText; 
+				}
+				--m_history_position;
+				setText( m_history[m_history_position] ); 
+			};
+		}
+		else if (keyType == Key::DELETE && mCaretPosition < mText.size())
+		{
+			UTF8TextField::keyPressed(keyEvent);
+		}
+		else if (keyType  == Key::BACKSPACE && mCaretPosition > 0)
+		{
+			UTF8TextField::keyPressed(keyEvent);
+		}
+		else if (keyType == Key::ENTER)
+		{
+			if( mText != "" ) {
+				if(m_callback) {
+					m_callback( mText );
+				}
+				m_history.push_back( mText ); 
+				m_history_position = m_history.size();
+				setText("");
+			}
+		}
+		else if (keyType == Key::HOME)
+		{
+			mCaretPosition = 0;
+		}    
+		else if (keyType == Key::END)
+		{
+			mCaretPosition = mText.size();
+		}    
+		else if (key.isCharacter())
+		{
+			UTF8TextField::keyPressed(keyEvent);
+		}
+		stopBlinking();
+		fixScroll();
+	}
+
+	void CommandLine::drawCaret(gcn::Graphics * graphics, int x) {
+		if( !m_caretVisible )
+			return;
+
+		graphics->setColor(getForegroundColor());
+		graphics->drawLine(x, getHeight() - 2, x, 1);
+		graphics->drawLine(x+1, getHeight() - 2, x+1, 1);
+	}
+
+
+	void CommandLine::setCallback(const type_callback& cb) {
+		m_callback = cb;
+	}
+
+}
+/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/commandline.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,86 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef FIFE_GUICHAN_ADDON_COMMANDLINE_H
+#define FIFE_GUICHAN_ADDON_COMMANDLINE_H
+
+// Standard C++ library includes
+#include <string>
+#include <vector>
+
+// 3rd party library includes
+#include <boost/function.hpp>
+#include <guichan.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "util/time/timer.h"
+
+#include "widgets/utf8textfield.h"
+
+namespace FIFE {
+
+	/** A Command line widget
+	 */
+	class CommandLine : public gcn::UTF8TextField {
+		public:
+			typedef boost::function1<void,std::string> type_callback;
+
+			/** Constructor
+			 */
+			CommandLine();
+
+			/** Destructor
+			 */
+			~CommandLine();
+
+			void keyPressed(gcn::KeyEvent& keyEvent);
+			virtual void drawCaret(gcn::Graphics * graphics, int x);
+
+			/** Set callback on pressing the ENTER key
+			 */
+			void setCallback(const type_callback& cb);
+
+			/** Toggle the caret visibility
+			 */
+			void toggleCaretVisible();
+
+			/** Start blinking the caret
+			 */
+			void startBlinking();
+
+			/** Stop blinking the caret for a few seconds
+			 */
+			void stopBlinking();
+		private:
+			type_callback m_callback;
+			std::vector<std::string> m_history;
+			size_t m_history_position;
+			std::string m_cmdline;
+			bool m_caretVisible;
+			Timer m_blinkTimer;
+			Timer m_suppressBlinkTimer;
+	};
+}
+#endif
+/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/gui_font.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,149 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "util/structures/rect.h"
+#include "video/image.h"
+#include "video/renderbackend.h"
+
+#include "gui_font.h"
+
+namespace FIFE {
+	GuiFont::GuiFont(AbstractFont* font): m_font(font) {
+		assert(font);
+	}
+
+	GuiFont::~GuiFont() {
+		delete m_font;
+	}
+
+	int GuiFont::getStringIndexAt(const std::string& text, int x) const {
+		return m_font->getStringIndexAt(text, x);
+	}
+
+	void GuiFont::drawString(gcn::Graphics* graphics, const std::string& text, int x, int y) {
+		if (text == "") {
+			return;
+		}
+
+		int yoffset = getRowSpacing() / 2;
+
+		const gcn::ClipRectangle& clip = graphics->getCurrentClipArea();
+		FIFE::Rect rect;
+		rect.x = x + clip.xOffset;
+		rect.y = y + clip.yOffset + yoffset;
+		rect.w = getWidth(text);
+		rect.h = getHeight();
+
+		if (!rect.intersects(Rect(clip.x,clip.y,clip.width,clip.height)) ) {
+			return;
+		}
+
+		Image* image = getAsImage(text);
+		image->render(rect);
+	}
+
+	void GuiFont::drawMultiLineString(gcn::Graphics* graphics, const std::string& text, int x, int y) {
+		if (text == "") {
+			return;
+		}
+
+		int yoffset = getRowSpacing() / 2;
+
+		const gcn::ClipRectangle& clip = graphics->getCurrentClipArea();
+
+		Image* image = getAsImageMultiline(text);
+
+		FIFE::Rect rect;
+		rect.x = x + clip.xOffset;
+		rect.y = y + clip.yOffset + yoffset;
+		rect.w = image->getWidth();
+		rect.h = image->getHeight();
+		if (!rect.intersects(Rect(clip.x,clip.y,clip.width,clip.height)) ) {
+			return;
+		}
+		image->render(rect);
+	}
+
+	void GuiFont::setRowSpacing (int spacing) {
+		m_font->setRowSpacing(spacing);
+	}
+
+	int GuiFont::getRowSpacing() const {
+		return m_font->getRowSpacing();
+	}
+
+	void GuiFont::setGlyphSpacing(int spacing) {
+		m_font->setGlyphSpacing(spacing);
+	}
+
+	int GuiFont::getGlyphSpacing() const {
+		return m_font->getGlyphSpacing();
+	}
+
+	void GuiFont::setAntiAlias(bool antiAlias) {
+		m_font->setAntiAlias(antiAlias);
+	}
+
+	bool GuiFont::isAntiAlias() {
+		return m_font->isAntiAlias();
+	}
+
+	Image* GuiFont::getAsImage(const std::string& text) {
+		return m_font->getAsImage(text);
+	}
+
+	Image* GuiFont::getAsImageMultiline(const std::string& text) {
+		return m_font->getAsImageMultiline(text);
+	}
+
+	std::string GuiFont::splitTextToWidth (const std::string& text, int render_width) {
+		return m_font->splitTextToWidth(text,render_width);
+	}
+
+	void GuiFont::setColor(uint8_t r,uint8_t g,uint8_t b, uint8_t a) {
+		m_font->setColor(r, g, b, a);
+	}
+
+	SDL_Color GuiFont::getColor() const {
+		return m_font->getColor();
+	}
+
+	int GuiFont::getWidth(const std::string& text) const {
+		return m_font->getWidth(text);
+	}
+
+	int GuiFont::getHeight() const {
+		return m_font->getHeight();
+	}
+
+	void GuiFont::invalidate() {
+		m_font->invalidate();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/gui_font.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,71 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef FIFE_GUI_FONT_H
+#define FIFE_GUI_FONT_H
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/font.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "video/fonts/abstractfont.h"
+
+
+namespace FIFE {
+
+	class GuiFont : public gcn::Font, public AbstractFont {
+	public:
+		/** Constructor
+		 *  Takes the ownership of given font
+		 */
+		GuiFont(AbstractFont* font);
+		virtual ~GuiFont();
+
+		int getStringIndexAt(const std::string& text, int x) const;
+		void drawString(gcn::Graphics* graphics, const std::string& text, int x, int y);
+		void drawMultiLineString(gcn::Graphics* graphics, const std::string& text, int x, int y);
+		std::string splitTextToWidth (const std::string& text, int render_width);
+
+		void setRowSpacing (int spacing);
+		int getRowSpacing() const;
+		void setGlyphSpacing(int spacing);
+		int getGlyphSpacing() const;
+		void setAntiAlias(bool antiAlias);
+		bool isAntiAlias();
+		Image* getAsImage(const std::string& text);
+		Image* getAsImageMultiline(const std::string& text);
+		void setColor(uint8_t r,uint8_t g,uint8_t b, uint8_t a = 255);
+		SDL_Color getColor() const;
+		int getWidth(const std::string& text) const;
+		int getHeight() const;
+		void invalidate();
+
+	private:
+		AbstractFont* m_font;
+	};
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/gui_font.i	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,66 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2010 by the FIFE team                              *
+ *   http://www.fifengine.net                                              *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+%module fife
+%{
+#include <guichan/font.hpp>
+#include "gui/guichan/gui_font.h"
+#include "video/fonts/abstractfont.h"
+%}
+
+%include "video/fonts/fonts.i"
+
+namespace gcn {
+	class Graphics;
+	class Font
+	{
+	public:
+		virtual ~Font(){ }
+		virtual int getWidth(const std::string& text) const = 0;
+		virtual int getHeight() const = 0;
+	};
+}
+
+namespace FIFE {
+	class Image;
+	
+	%feature("notabstract") GuiFont;
+	class GuiFont : public gcn::Font, public AbstractFont {
+	public:
+		GuiFont(AbstractFont* font);
+		virtual ~GuiFont();
+		
+		int getStringIndexAt(const std::string& text, int x);
+		void drawString(gcn::Graphics* graphics, const std::string& text, int x, int y);
+
+		void setRowSpacing (int spacing);
+		int getRowSpacing() const;
+		void setGlyphSpacing(int spacing);
+		int getGlyphSpacing() const;
+		void setAntiAlias(bool antiAlias);
+		bool isAntiAlias();
+		Image* getAsImage(const std::string& text);
+		void setColor(uint8_t r,uint8_t g,uint8_t b, uint8_t a = 255);
+		SDL_Color getColor() const;
+		int getWidth(const std::string& text) const;
+		int getHeight() const;
+	};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/gui_image.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,78 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+
+// 3rd party library includes
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "video/imagepool.h"
+#include "util/log/logger.h"
+
+#include "gui_image.h"
+
+namespace FIFE {
+	static Logger _log(LM_GUI);
+
+	GuiImage::GuiImage(): gcn::Image(), m_poolid(Pool::INVALID_ID), m_pool(NULL) {
+	}
+
+	GuiImage::GuiImage(int id, ImagePool& pool): gcn::Image(), m_poolid(id), m_pool(&pool) {
+		 m_pool->getImage(m_poolid);
+	}
+
+	GuiImage::~GuiImage() {
+// 		 m_pool->release(m_poolid,true);
+	}
+
+	void GuiImage::free() {
+		// the imagepool should do this; should we tell it?
+	}
+
+	int GuiImage::getWidth() const {
+		if(m_poolid==Pool::INVALID_ID)
+			return 0;
+		return m_pool->getImage(m_poolid).getWidth();
+	}
+
+	int GuiImage::getHeight() const {
+		if(m_poolid==Pool::INVALID_ID)
+			return 0;
+		return m_pool->getImage(m_poolid).getHeight();
+	}
+
+	gcn::Color GuiImage::getPixel(int x, int y) {
+		FL_PANIC(_log, "GuiImage::getPixel, not implemented");
+		return gcn::Color();
+	}
+
+	void GuiImage::putPixel(int x, int y, const gcn::Color& color) {
+		FL_PANIC(_log, "GuiImage::putPixel, not implemented");
+	}
+
+	void GuiImage::convertToDisplayFormat() {
+		// empty on purpose
+		// Since we don't need any conversions - this is just a proxy.
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/gui_image.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,58 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef FIFE_GUI_IMAGE_H
+#define FIFE_GUI_IMAGE_H
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/color.hpp>
+#include <guichan/image.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+
+
+namespace FIFE {
+	class ImagePool;
+
+	class GuiImage : public gcn::Image {
+	public:
+		GuiImage();
+		GuiImage(int id, ImagePool& pool);
+		~GuiImage();
+		void free();
+		int getWidth() const;
+		int getHeight() const;
+		gcn::Color getPixel(int x, int y);
+		void putPixel(int x, int y, const gcn::Color& color);
+		void convertToDisplayFormat();
+		int getPoolId() const { return m_poolid; }
+	protected:
+		int m_poolid;
+		ImagePool* m_pool;
+	};
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/gui_image.i	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+%module fife
+%{
+#include <guichan/image.hpp>
+#include "gui/guichan/gui_image.h"
+%}
+
+%rename(GcnImage) gcn::Image;
+namespace gcn {
+	class Image
+	{
+	public:
+		Image();
+		virtual ~Image();
+		static Image* load(const std::string& filename, bool convertToDisplayFormat = true);
+		virtual int getWidth() const = 0;
+		virtual int getHeight() const = 0;
+	};
+}
+
+namespace FIFE {
+
+	class GuiImage: public gcn::Image {
+	public:
+		GuiImage();
+		GuiImage(int id, ImagePool& pool);
+		int getWidth() const;
+		int getHeight() const;
+	};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/gui_imageloader.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,42 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+
+// 3rd party library includes
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+
+#include "gui_imageloader.h"
+#include "video/imagepool.h"
+
+namespace FIFE {
+	GuiImageLoader::GuiImageLoader(ImagePool& pool): m_pool(pool) {
+	}
+
+	gcn::Image* GuiImageLoader::load(const std::string& filename, bool convertToDisplayFormat) {
+		int id = m_pool.addResourceFromFile(filename);
+		return new GuiImage(id, m_pool);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/gui_imageloader.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,53 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef FIFE_GUI_IMAGELOADER_H
+#define FIFE_GUI_IMAGELOADER_H
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/imageloader.hpp>
+#include <guichan/image.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "video/imagepool.h"
+
+#include "gui_image.h"
+
+namespace FIFE {
+
+	/* Image Loader.
+	 */
+	class GuiImageLoader : public gcn::ImageLoader {
+	public:
+		GuiImageLoader(ImagePool& pool);
+      		gcn::Image* load(const std::string& filename, bool convertToDisplayFormat = true);
+	private:
+		ImagePool& m_pool;
+	};
+
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/guichanguimanager.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,699 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+#include <iostream>
+#include <cassert>
+
+// 3rd party library includes
+#include <boost/filesystem/convenience.hpp>
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/regex.hpp>
+#include <boost/tokenizer.hpp>
+#include <guichan/sdl/sdlinput.hpp>
+#include <guichan/key.hpp>
+#include <guichan/focushandler.hpp>
+#include <guichan.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "util/base/exception.h"
+#include "util/log/logger.h"
+#include "video/renderbackend.h"
+#include "gui/console.h"
+#include "video/fonts/fontbase.h"
+#include "video/fonts/truetypefont.h"
+#include "video/fonts/subimagefont.h"
+#include "video/renderbackend.h"
+#include "eventchannel/key/ec_key.h"
+#include "eventchannel/key/ec_keyevent.h"
+#include "eventchannel/mouse/ec_mouseevent.h"
+#include "util/time/timemanager.h"
+#include "util/log/logger.h"
+#include "util/base/exception.h"
+
+#include "commandline.h"
+#include "gui_font.h"
+#include "gui_imageloader.h"
+#include "guichanguimanager.h"
+#ifdef HAVE_OPENGL
+#include "opengl/opengl_gui_graphics.h"
+#endif
+#include "sdl/sdl_gui_graphics.h"
+#include "widgets/utf8textbox.h"
+
+namespace FIFE {
+	static Logger _log(LM_GUI);
+
+	const unsigned GuiChanConsoleWidget::m_maxOutputRows = 50;
+
+	GuiChanConsoleWidget::GuiChanConsoleWidget() :
+		gcn::Container(),
+		m_input(new CommandLine()),
+		m_output(new gcn::UTF8TextBox()),
+		m_outputscrollarea(new gcn::ScrollArea(m_output)),
+		m_status(new gcn::Label()),
+		m_toolsbutton(new gcn::Button("Tools")) {
+
+		reLayout();
+		add(m_outputscrollarea);
+		add(m_input);
+		add(m_status);
+		add(m_toolsbutton);
+
+		setOpaque(true);
+
+		m_input->setCallback(std::bind1st(std::mem_fun(&Console::execute),
+				m_console));
+		m_prompt = "-- ";
+
+		m_isAttached = false;
+
+		m_fpsTimer.setInterval(500);
+		m_fpsTimer.setCallback(
+				boost::bind(&GuiChanConsoleWidget::updateCaption, this));
+
+		m_hiding = true;
+
+		m_animationTimer.setInterval(20);
+		m_animationTimer.setCallback(
+				boost::bind(&GuiChanConsoleWidget::updateAnimation, this));
+
+		m_toolsbutton->addActionListener(this);
+		m_toolsbutton->setFocusable(false);
+		m_input->addFocusListener(this);
+
+		GuiFont* font = GuiChanGuiManager::instance()->createFont();
+		font->setColor(255, 255, 255);
+		setIOFont(font);
+	}
+
+	void GuiChanConsoleWidget::reLayout() {
+		Image* screen = RenderBackend::instance()->getScreenImage();
+		assert(screen);
+
+		int w, h, b, input_h, bbar_h, button_w;
+		w = screen->getWidth() * 4 / 5;
+		h = screen->getHeight() * 4 / 5;
+		b = 0;
+		input_h = getFont()->getHeight();
+		bbar_h = input_h;
+		button_w = 80;
+
+		gcn::Color black(0x00, 0, 0, 0xff);
+		gcn::Color white(0xff, 0xff, 0xff, 0xff);
+		gcn::Color dark(50, 60, 50, 0xff);
+
+		setSize(w, h);
+		setPosition((screen->getWidth() - w) / 2, -h);
+		setFrameSize(0);
+
+		setForegroundColor(white);
+		setBackgroundColor(black);
+		setBaseColor(dark);
+
+		setSize(w, h);
+
+		m_outputscrollarea->setSize(w - 2 * b, h - input_h - 3 * b - bbar_h);
+		m_outputscrollarea->setPosition(b, 0);
+
+		m_input->setPosition(b, h - input_h - b - bbar_h);
+		m_input->setSize(w - 2 * b, input_h);
+
+		m_status->setPosition(b, h - b - bbar_h);
+		m_status->setSize(w - 2 * b, bbar_h);
+
+		m_toolsbutton->setPosition(w - button_w, h - b - bbar_h);
+		m_toolsbutton->setSize(button_w, bbar_h);
+
+		m_output->setBackgroundColor(black);
+		m_output->setFocusable(false);
+
+		m_outputscrollarea->setBackgroundColor(black);
+		m_outputscrollarea->setBaseColor(dark);
+
+		m_input->setForegroundColor(white);
+		m_input->setBackgroundColor(black);
+
+		m_status->setForegroundColor(white);
+		m_status->setBackgroundColor(black);
+
+		m_toolsbutton->setForegroundColor(white);
+		m_toolsbutton->setBackgroundColor(black);
+		m_toolsbutton->setBaseColor(dark);
+
+		m_hiddenPos = -h;
+		m_animationDelta = h / 6;
+	}
+
+	GuiChanConsoleWidget::~GuiChanConsoleWidget() {
+		doHide();
+
+		remove(m_input);
+		remove(m_outputscrollarea);
+		remove(m_status);
+
+		delete m_output;
+		delete m_input;
+		delete m_outputscrollarea;
+		delete m_status;
+		delete m_toolsbutton;
+	}
+
+	void GuiChanConsoleWidget::updateCaption() {
+		std::string caption = "FIFE Console - FPS: ";
+		float fps = 1e3 / double(TimeManager::instance()->getAverageFrameTime());
+		caption += boost::lexical_cast<std::string>(fps);
+		m_status->setCaption(caption);
+	}
+
+	void GuiChanConsoleWidget::updateAnimation() {
+		if (m_hiding) {
+			setPosition(getX(), getY() - m_animationDelta);
+			if (getY() <= m_hiddenPos) {
+				doHide();
+				m_animationTimer.stop();
+			}
+		} else {
+			setPosition(getX(), getY() + m_animationDelta);
+			if (getY() >= 0) {
+				setPosition(getX(), 0);
+				m_animationTimer.stop();
+			}
+		}
+	}
+
+	void GuiChanConsoleWidget::clear() {
+		m_output->setText("");
+	}
+
+	void GuiChanConsoleWidget::doShow() {
+		if (m_isAttached)
+			return;
+		m_isAttached = true;
+		GuiChanGuiManager::instance()->add(this);
+		GuiChanGuiManager::instance()->getTopContainer()->moveToTop(this);
+		// Assure the input field is focused when shown.
+		m_input->requestFocus();
+
+		m_fpsTimer.start();
+	}
+
+	void GuiChanConsoleWidget::doHide() {
+		if (!m_isAttached)
+			return;
+		m_isAttached = false;
+		GuiChanGuiManager::instance()->remove(this);
+		m_fpsTimer.stop();
+	}
+
+	void GuiChanConsoleWidget::show() {
+		if (m_hiding) {
+			m_hiding = false;
+			doShow();
+			m_animationTimer.start();
+		}
+	}
+
+	void GuiChanConsoleWidget::hide() {
+		if (!m_hiding) {
+			m_hiding = true;
+			m_animationTimer.start();
+		}
+	}
+
+	void GuiChanConsoleWidget::toggleShowHide() {
+		m_hiding = !m_hiding;
+		if (!m_hiding)
+			doShow();
+		m_animationTimer.start();
+	}
+
+	void GuiChanConsoleWidget::println(const std::string& s) {
+		assert(m_output);
+
+		// Add the text in rows
+		boost::char_separator<char> separator("\n");
+		typedef boost::tokenizer< boost::char_separator<char> > tokenizer;
+		tokenizer tokens(s, separator);
+		for (tokenizer::iterator i = tokens.begin(); i != tokens.end(); ++i) {
+			m_output->addRow(*i);
+		}
+
+		// Assure the maximum number of rows
+		if (m_output->getNumberOfRows() > m_maxOutputRows) {
+			unsigned rows = m_output->getNumberOfRows();
+			int delta_rows = rows - m_maxOutputRows;
+			std::vector<std::string> rows_text;
+			for (size_t i = delta_rows; i != rows; ++i) {
+				rows_text.push_back(m_output->getTextRow(i));
+			}
+			m_output->setText("");
+			for (size_t i = 0; i != rows_text.size(); ++i) {
+				m_output->addRow(rows_text[i]);
+			}
+		}
+
+		// Assure the new text is visible
+		gcn::Rectangle rect(0, m_output->getHeight(), 0, 0);
+		m_outputscrollarea->showWidgetPart(m_output, rect);
+	}
+
+	void GuiChanConsoleWidget::action(const gcn::ActionEvent& event) {
+		if (m_console) {
+			m_console->getConsoleExecuter()->onToolsClick();
+		} else {
+			FL_WARN(_log, "Console not bound, but tools button clicked");
+		}
+	}
+
+	void GuiChanConsoleWidget::setIOFont(GuiFont* font) {
+		m_input->setFont(font);
+		m_output->setFont(font);
+	}
+
+	void GuiChanConsoleWidget::focusLost(const gcn::Event&) {
+		hide();
+	}
+
+
+	GuiChanGuiManager::GuiChanGuiManager(ImagePool& pool) :
+		GuiManager(pool),
+		m_gui_graphics(0),
+		m_gcn_gui(new gcn::Gui()),
+		m_focushandler(0),
+		m_gcn_topcontainer(new gcn::Container()),
+		m_image_loader(new GuiImageLoader(pool)),
+		m_input(new gcn::SDLInput()),
+		m_widgets(),
+		m_console_widget(0),
+		m_had_mouse(false),
+		m_fontpath(),
+		m_fontglyphs(),
+		m_fontsize(),
+		m_logic_executed(false) {
+
+		m_gcn_gui->setInput(m_input);
+		gcn::Image::setImageLoader(m_image_loader);
+
+		m_gcn_gui->setTop(m_gcn_topcontainer);
+		m_focushandler = m_gcn_topcontainer->_getFocusHandler();
+
+		m_gcn_topcontainer->setOpaque(false);
+		m_gcn_topcontainer->setFocusable(false);
+	}
+
+	GuiChanGuiManager::~GuiChanGuiManager() {
+		delete m_console_widget;
+		delete m_gcn_topcontainer;
+		delete m_image_loader;
+		delete m_input;
+		delete m_gcn_gui;
+		delete m_gui_graphics;
+	}
+
+	bool GuiChanGuiManager::onSdlEvent(SDL_Event& evt) {
+		if (!m_input) {
+			FL_WARN(_log, "GuiChanGuiManager, GuichanGUI->getInput == 0 ... discarding events!");
+			return false;
+		}
+
+		switch(evt.type) {
+			case SDL_MOUSEBUTTONDOWN:
+			case SDL_MOUSEBUTTONUP:
+				if( m_gcn_topcontainer->getWidgetAt(evt.button.x,evt.button.y) ) {
+					m_input->pushInput(evt);
+					return true;
+				}
+				m_focushandler->focusNone();
+				return false;
+
+			case SDL_MOUSEMOTION:
+				if( m_gcn_topcontainer->getWidgetAt(evt.button.x,evt.button.y) ) {
+					m_had_mouse = true;
+					m_input->pushInput(evt);
+					return true;
+				}
+				if( m_had_mouse ) {
+					// We only keep the mouse if a widget/window has requested
+					// dragging.
+					m_had_mouse = bool(m_focushandler->getDraggedWidget());
+					m_input->pushInput(evt);
+					return true;
+				}
+				return false;
+
+			case SDL_KEYDOWN:
+			case SDL_KEYUP:
+				if(m_focushandler->getFocused()) {
+					m_input->pushInput(evt);
+					return true;
+				}
+				return false;
+
+			case SDL_ACTIVEEVENT:
+				// Actually Guichan doesn't care (it should!)
+				// so at least don't swallow mouse_focus events up.
+				return false;
+
+			default:
+				return false;
+		}
+	}
+
+	void GuiChanGuiManager::resize(unsigned int x, unsigned int y,
+			unsigned int width, unsigned int height) {
+		m_gcn_topcontainer->setDimension(gcn::Rectangle(x, y, width, height));
+		if (m_console_widget) {
+			m_console_widget->reLayout();
+		}
+	}
+
+	gcn::Gui* GuiChanGuiManager::getGuiChanGui() const {
+		return m_gcn_gui;
+	}
+
+	void GuiChanGuiManager::add(gcn::Widget* widget) {
+		if( !m_widgets.count(widget) ) {
+			m_gcn_topcontainer->add(widget);
+			m_widgets.insert(widget);
+		}
+	}
+
+	void GuiChanGuiManager::remove(gcn::Widget* widget) {
+		if( m_widgets.count(widget) ) {
+			m_widgets.erase(widget);
+			m_gcn_topcontainer->remove(widget);
+		}
+	}
+
+	void GuiChanGuiManager::init(RenderBackend* render_backend, int screenWidth,
+			int screenHeight) {
+		GuiManager::init(render_backend, screenWidth, screenHeight);
+
+#ifdef HAVE_OPENGL
+		if(render_backend->getName() != "SDL") {
+			m_gui_graphics = new OpenGLGuiGraphics(getImagePool());
+		}
+#endif
+		if(render_backend->getName() == "SDL") {
+			m_gui_graphics = new SdlGuiGraphics(getImagePool());
+		}
+
+		m_gcn_gui->setGraphics(m_gui_graphics);
+
+		m_console_widget = new GuiChanConsoleWidget();
+		resize(0, 0, screenWidth, screenHeight);
+	}
+
+	void GuiChanGuiManager::turn() {
+		if (!m_logic_executed)
+			m_gcn_gui->logic();
+		m_logic_executed = false;
+		m_gcn_gui->draw();
+	}
+
+	void GuiChanGuiManager::showConsole() {
+		if (!m_console_visible) {
+			m_console_widget->show();
+			m_console_visible = true;
+		}
+	}
+
+	void GuiChanGuiManager::hideConsole() {
+		if(m_console_visible) {
+			m_console_widget->hide();
+			m_console_visible = false;
+		}
+	}
+
+	GuiFont* GuiChanGuiManager::setDefaultFont(const std::string& path,
+			unsigned int size, const std::string& glyphs) {
+		printf("made it!");
+		GuiFont* default_font = GuiManager::setDefaultFont(path, size, glyphs);
+		gcn::Widget::setGlobalFont(default_font);
+		if (m_console_widget) {
+			m_console_widget->reLayout();
+		}
+		return default_font;
+	}
+
+	KeyEvent GuiChanGuiManager::translateKeyEvent(const gcn::KeyEvent& gcnevt) {
+		KeyEvent keyevt;
+		if(gcnevt.getType() == gcn::KeyEvent::PRESSED)
+			keyevt.setType(KeyEvent::PRESSED);
+		else if(gcnevt.getType() == gcn::KeyEvent::RELEASED)
+			keyevt.setType(KeyEvent::RELEASED);
+		else
+			throw EventException("Invalid event type in fillKeyEvent");
+		keyevt.setShiftPressed(gcnevt.isShiftPressed());
+		keyevt.setControlPressed(gcnevt.isControlPressed());
+		keyevt.setAltPressed(gcnevt.isAltPressed());
+		keyevt.setMetaPressed(gcnevt.isMetaPressed());
+		keyevt.setNumericPad(gcnevt.isNumericPad());
+
+		// Convert from guichan keyval to FIFE keyval
+		int keyval = gcnevt.getKey().getValue();
+		keyval = convertGuichanKeyToFifeKey(keyval);
+
+		keyevt.setKey(Key(static_cast<Key::KeyType>(keyval), keyval));
+
+		return keyevt;
+	}
+
+	MouseEvent GuiChanGuiManager::translateMouseEvent(const gcn::MouseEvent& gcnevt) {
+		MouseEvent mouseevt;
+		mouseevt.setShiftPressed(gcnevt.isShiftPressed());
+		mouseevt.setControlPressed(gcnevt.isControlPressed());
+		mouseevt.setAltPressed(gcnevt.isAltPressed());
+		mouseevt.setMetaPressed(gcnevt.isMetaPressed());
+		mouseevt.setX(gcnevt.getX());
+		mouseevt.setY(gcnevt.getY());
+
+		switch(gcnevt.getType()) {
+			case gcn::MouseEvent::PRESSED:
+				mouseevt.setType(MouseEvent::PRESSED);
+				break;
+			case gcn::MouseEvent::RELEASED:
+				mouseevt.setType(MouseEvent::RELEASED);
+				break;
+			case gcn::MouseEvent::MOVED:
+				mouseevt.setType(MouseEvent::MOVED);
+				break;
+			case gcn::MouseEvent::CLICKED:
+				mouseevt.setType(MouseEvent::CLICKED);
+				break;
+			case gcn::MouseEvent::ENTERED:
+				mouseevt.setType(MouseEvent::ENTERED);
+				break;
+			case gcn::MouseEvent::EXITED:
+				mouseevt.setType(MouseEvent::EXITED);
+				break;
+			case gcn::MouseEvent::DRAGGED:
+				mouseevt.setType(MouseEvent::DRAGGED);
+				break;
+			case gcn::MouseEvent::WHEEL_MOVED_DOWN:
+				mouseevt.setType(MouseEvent::WHEEL_MOVED_DOWN);
+				break;
+			case gcn::MouseEvent::WHEEL_MOVED_UP:
+				mouseevt.setType(MouseEvent::WHEEL_MOVED_UP);
+				break;
+			default:
+				mouseevt.setType(MouseEvent::UNKNOWN_EVENT);
+		}
+
+		switch(gcnevt.getButton()) {
+			case gcn::MouseInput::LEFT:
+				mouseevt.setButton(MouseEvent::LEFT);
+				break;
+			case gcn::MouseInput::RIGHT:
+				mouseevt.setButton(MouseEvent::RIGHT);
+				break;
+			case gcn::MouseInput::MIDDLE:
+				mouseevt.setButton(MouseEvent::MIDDLE);
+				break;
+			default:
+				mouseevt.setButton(MouseEvent::UNKNOWN_BUTTON);
+				break;
+		}
+		return mouseevt;
+	}
+
+	int GuiChanGuiManager::convertGuichanKeyToFifeKey(int value) {
+		switch (value) {
+			case gcn::Key::TAB:
+				value = Key::TAB;
+				break;
+			case gcn::Key::LEFT_ALT:
+				value = Key::LEFT_ALT;
+				break;
+			case gcn::Key::RIGHT_ALT:
+				value = Key::RIGHT_ALT;
+				break;
+			case gcn::Key::LEFT_SHIFT:
+				value = Key::LEFT_SHIFT;
+				break;
+			case gcn::Key::RIGHT_SHIFT:
+				value = Key::RIGHT_SHIFT;
+				break;
+			case gcn::Key::LEFT_CONTROL:
+				value = Key::LEFT_CONTROL;
+				break;
+			case gcn::Key::RIGHT_CONTROL:
+				value = Key::RIGHT_CONTROL;
+				break;
+			case gcn::Key::BACKSPACE:
+				value = Key::BACKSPACE;
+				break;
+			case gcn::Key::PAUSE:
+				value = Key::PAUSE;
+				break;
+			case gcn::Key::SPACE:
+				value = Key::SPACE;
+				break;
+			case gcn::Key::ESCAPE:
+				value = Key::ESCAPE;
+				break;
+			case gcn::Key::DELETE:
+				value = Key::DELETE;
+				break;
+			case gcn::Key::INSERT:
+				value = Key::INSERT;
+				break;
+			case gcn::Key::HOME:
+				value = Key::HOME;
+				break;
+			case gcn::Key::END:
+				value = Key::END;
+				break;
+			case gcn::Key::PAGE_UP:
+				value = Key::PAGE_UP;
+				break;
+			case gcn::Key::PRINT_SCREEN:
+				value = Key::PRINT_SCREEN;
+				break;
+			case gcn::Key::PAGE_DOWN:
+				value = Key::PAGE_DOWN;
+				break;
+			case gcn::Key::F1:
+				value = Key::F1;
+				break;
+			case gcn::Key::F2:
+				value = Key::F2;
+				break;
+			case gcn::Key::F3:
+				value = Key::F3;
+				break;
+			case gcn::Key::F4:
+				value = Key::F4;
+				break;
+			case gcn::Key::F5:
+				value = Key::F5;
+				break;
+			case gcn::Key::F6:
+				value = Key::F6;
+				break;
+			case gcn::Key::F7:
+				value = Key::F7;
+				break;
+			case gcn::Key::F8:
+				value = Key::F8;
+				break;
+			case gcn::Key::F9:
+				value = Key::F9;
+				break;
+			case gcn::Key::F10:
+				value = Key::F10;
+				break;
+			case gcn::Key::F11:
+				value = Key::F11;
+				break;
+			case gcn::Key::F12:
+				value = Key::F12;
+				break;
+			case gcn::Key::F13:
+				value = Key::F13;
+				break;
+			case gcn::Key::F14:
+				value = Key::F14;
+				break;
+			case gcn::Key::F15:
+				value = Key::F15;
+				break;
+			case gcn::Key::NUM_LOCK:
+				value = Key::NUM_LOCK;
+				break;
+			case gcn::Key::CAPS_LOCK:
+				value = Key::CAPS_LOCK;
+				break;
+			case gcn::Key::SCROLL_LOCK:
+				value = Key::SCROLL_LOCK;
+				break;
+			case gcn::Key::RIGHT_META:
+				value = Key::RIGHT_META;
+				break;
+			case gcn::Key::LEFT_META:
+				value = Key::LEFT_META;
+				break;
+			case gcn::Key::LEFT_SUPER:
+				value = Key::LEFT_SUPER;
+				break;
+			case gcn::Key::RIGHT_SUPER:
+				value = Key::RIGHT_SUPER;
+				break;
+			case gcn::Key::ALT_GR:
+				value = Key::ALT_GR;
+				break;
+			case gcn::Key::UP:
+				value = Key::UP;
+				break;
+			case gcn::Key::DOWN:
+				value = Key::DOWN;
+				break;
+			case gcn::Key::LEFT:
+				value = Key::LEFT;
+				break;
+			case gcn::Key::RIGHT:
+				value = Key::RIGHT;
+				break;
+			case gcn::Key::ENTER:
+				value = Key::ENTER;
+				break;
+
+			default:
+				// Convert from unicode to lowercase letters
+				if (value >= 1 && value <= 26) {
+					// Control characters
+					value = value - 1 + 'a';
+				} else if (value >= 'A' && value <= 'Z') {
+					value = value - 'A' + 'a';
+				}
+
+				// FIXME: Accented characters (á) will not get converted properly.
+				break;
+		}
+
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/guichanguimanager.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,262 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef FIFE_GUI_GUICHAN_GUICHANGUIMANAGER_H
+#define FIFE_GUI_GUICHAN_GUICHANGUIMANAGER_H
+
+// Standard C++ library includes
+#include <set>
+
+// 3rd party library includes
+#include <guichan.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "gui/guimanager.h"
+#include "util/time/timer.h"
+
+namespace gcn {
+
+	class Gui;
+	class Container;
+	class Widget;
+	class SDLInput;
+	class FocusHandler;
+
+}
+
+namespace FIFE {
+
+	class ImagePool;
+	class GuiImageLoader;
+	class Console;
+	class KeyEvent;
+	class MouseEvent;
+	class AbstractFont;
+	class GuiFont;
+	class CommandLine;
+
+	class GuiChanConsoleWidget:
+			public gcn::Container,
+			public gcn::ActionListener,
+			public gcn::FocusListener {
+	public:
+		/** Constructor
+		 */
+		GuiChanConsoleWidget();
+
+		/** Destructor
+		 */
+		virtual ~GuiChanConsoleWidget();
+
+		/** Print one or more lines to the console output
+		 */
+		void println(const std::string& s);
+
+		/** Show the console
+		 * Adds the Console to the guichan toplevel container
+		 * and pushes an input Context so that keys are not send to the
+		 * rest of the game.
+		 */
+		void show();
+
+		/** Hide the console
+		 * Removes itself from the toplevel container
+		 * and pops it's input context
+		 */
+		void hide();
+
+		/** Toggle the console
+		 * Toggles whether the Console is shown or not.
+		 * Calls show() or hide() respectively.
+		 */
+		void toggleShowHide();
+
+		/** Clear the console output
+		 */
+		void clear();
+
+		/** Update the FPS caption
+		 *  @note Is a timer callback.
+		 */
+		void updateCaption();
+
+		/** Update the scroll in/out animation.
+		 *  @note Is a timer callback.
+		 */
+		void updateAnimation();
+
+		/** Callback from guichan to respond to button press
+		 */
+		void action(const gcn::ActionEvent & event);
+
+		/** Layouts the console to match e.g. font changes
+		 */
+		void reLayout();
+
+		/** Sets the font used for the input and output areas
+		 */
+		void setIOFont(GuiFont* font);
+
+		/** Hide if we loose focus
+		 */
+		void focusLost(const gcn::Event& event);
+
+	private:
+		bool m_isAttached;
+		bool m_hiding;
+
+		std::string m_prompt;
+
+		Console* m_console;
+		CommandLine* m_input;
+		gcn::TextBox* m_output;
+		gcn::ScrollArea* m_outputscrollarea;
+		gcn::Label* m_status;
+		gcn::Button* m_toolsbutton;
+
+		int m_hiddenPos;
+		int m_animationDelta;
+		static const unsigned m_maxOutputRows;
+
+		Timer m_fpsTimer;
+		Timer m_animationTimer;
+
+		void doShow();
+		void doHide();
+	};
+
+	/* GUI Manager.
+	 *
+	 * This class controls the GUI system in FIFE.
+	 */
+	class GuiChanGuiManager: public GuiManager, public DynamicSingleton<
+			GuiChanGuiManager> {
+	public:
+		/** Constructor.
+		 */
+		GuiChanGuiManager(ImagePool& pool);
+		/** Destructor.
+		 */
+		virtual ~GuiChanGuiManager();
+
+		/** Gets the member pointer to the Guichan GUI.
+		 *
+		 * @return The member pointer to the Guichan GUI.
+		 */
+		gcn::Gui* getGuiChanGui() const;
+
+		/** Performs the GUI logic and draws the GUI accordingly.
+		 *
+		 * This will be called each frame.
+		 */
+		void turn();
+
+		/** Inits the GUI Manager.
+		 * @param graphics backend specific grapchics object to use
+		 * @param screenWidth width for the gui top container
+		 * @param screenHeight height for the gui top container
+		 */
+		void init(RenderBackend* render_backend, int screenWidth,
+				int screenHeight);
+
+		/** Resizes the top container.
+		 *
+		 * @param x The new starting X coordinate.
+		 * @param y The new starting Y coordinate.
+		 * @param width The new width.
+		 * @param height The new height.
+		 */
+		void resize(unsigned int x, unsigned int y, unsigned int width,
+				unsigned int height);
+
+		/** Adds a new widget.
+		 *
+		 * @param A pointer to the widget to add.
+		 */
+		void add(gcn::Widget* widget);
+		/** Removes a widget.
+		 *
+		 * @param A pointer to the widget to remove.
+		 */
+		void remove(gcn::Widget* widget);
+		/** Gets the top container.
+		 *
+		 * @return The top container.
+		 */
+		gcn::Container* getTopContainer() const {
+			return m_gcn_topcontainer;
+		}
+
+		/** Display the in-game FIFE console. */
+		void showConsole();
+
+		/** Hide the in-game FIFE console. */
+		void hideConsole();
+
+		/** Set the global font properties.
+		 */
+		GuiFont* setDefaultFont(const std::string& path, unsigned int size,
+				const std::string& glyphs);
+
+		bool onSdlEvent(SDL_Event& evt);
+
+		KeyEvent translateKeyEvent(const gcn::KeyEvent& evt);
+		MouseEvent translateMouseEvent(const gcn::MouseEvent& evt);
+
+	protected:
+		static int convertGuichanKeyToFifeKey(int value);
+
+	private:
+		// The GuiChan graphics renderer.
+		gcn::Graphics* m_gui_graphics;
+		// The GuiChan GUI.
+		gcn::Gui* m_gcn_gui;
+		// Focus handler for input management.
+		gcn::FocusHandler* m_focushandler;
+		// The top container of the GUI.
+		gcn::Container* m_gcn_topcontainer;
+		// The imageloader.
+		GuiImageLoader* m_image_loader;
+		// The input controller.
+		gcn::SDLInput *m_input;
+		// Added widgets.
+		std::set<gcn::Widget*> m_widgets;
+		// Console widget.
+		GuiChanConsoleWidget* m_console_widget;
+
+		// Used to accept mouse motion events that leave widget space
+		bool m_had_mouse;
+
+		// default font settings
+		std::string m_fontpath;
+		std::string m_fontglyphs;
+		int m_fontsize;
+
+		// true, if guichan logic has already been executed for this round
+		bool m_logic_executed;
+	};
+
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/guichanguimanager.i	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,90 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+%module fife
+%{
+#include <guichan.hpp>
+#include "gui/guimanager.h"
+#include "gui/guichan/guichanguimanager.h"
+%}
+
+namespace FIFE {
+	class GuiChanConsoleWidget {
+	public:
+		GuiChanConsoleWidget();
+
+		virtual ~GuiChanConsoleWidget();
+
+		void println(const std::string& s);
+		void show();
+		void hide();
+		void toggleShowHide();
+		void clear();
+		void updateCaption();
+		void updateAnimation();
+		void reLayout();
+
+		void setIOFont(GuiFont* font);
+
+		void action(const gcn::ActionEvent & event);
+		void focusLost(const gcn::Event& event);
+	};
+
+	class GuiChanGuiManager {
+	public:
+		GuiChanGuiManager(ImagePool& pool);
+		virtual ~GuiChanGuiManager();
+
+		gcn::Gui* getGuiChanGui() const;
+
+		void turn();
+		void init(RenderBackend* render_backend, int screenWidth,
+				int screenHeight);
+		void resize(unsigned int x, unsigned int y, unsigned int width,
+				unsigned int height);
+		void add(gcn::Widget* widget);
+		void remove(gcn::Widget* widget);
+
+		gcn::Container* getTopContainer() const {
+			return m_gcn_topcontainer;
+		}
+
+		void showConsole();
+		void hideConsole();
+
+		GuiFont* setDefaultFont(const std::string& path, unsigned int size,
+				const std::string& glyphs);
+
+		bool onSdlEvent(SDL_Event& evt);
+
+		KeyEvent translateKeyEvent(const gcn::KeyEvent& evt);
+		MouseEvent translateMouseEvent(const gcn::MouseEvent& evt);
+
+		/** Hack to downcast the GuiManager pointer for GuiChan clients.
+		 * Should be removed once the GuiManager's interface is established.
+		 */
+		%extend {
+			static GuiChanGuiManager* castTo(GuiManager* gui_manager) {
+				return dynamic_cast<FIFE::GuiChanGuiManager*>(gui_manager);
+			}
+		}
+	};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/guilistener.i	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,69 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+%module fife
+%{
+#include <guichan.hpp>
+#include <guichan/actionevent.hpp>
+#include <guichan/keyevent.hpp>
+%}
+
+namespace gcn {
+
+	%feature("director") MouseListener;
+	class MouseListener {
+	public:
+		virtual ~MouseListener();
+
+		virtual void mouseEntered(gcn::MouseEvent& mouseEvent);
+		virtual void mouseExited(gcn::MouseEvent& mouseEvent);
+		virtual void mousePressed(gcn::MouseEvent& mouseEvent);
+		virtual void mouseReleased(gcn::MouseEvent& mouseEvent);
+		virtual void mouseClicked(gcn::MouseEvent& mouseEvent);
+		virtual void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent);
+		virtual void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent);
+		virtual void mouseMoved(gcn::MouseEvent& mouseEvent);
+		virtual void mouseDragged(gcn::MouseEvent& mouseEvent);
+	protected:
+		MouseListener() { }
+	};
+
+	%feature("director") KeyListener;
+	class KeyListener {
+	public:
+		virtual ~KeyListener();
+
+		virtual void keyPressed(gcn::KeyEvent& keyEvent);
+		virtual void keyReleased(gcn::KeyEvent& keyEvent);
+
+	protected:
+		KeyListener() { }
+	};
+
+	%feature("director") ActionListener;
+	class ActionListener {
+	public:
+		virtual ~ActionListener() { }
+		virtual void action(const gcn::ActionEvent& actionEvent) = 0;
+	};
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/opengl/opengl_gui_graphics.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,98 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/opengl.hpp>
+#include <guichan/font.hpp>
+#include <guichan/exception.hpp>
+
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src dir
+#include "video/image.h"
+#include "gui/guichan/gui_image.h"
+#include "util/structures/rect.h"
+#include "video/opengl/fife_opengl.h"
+
+#include "opengl_gui_graphics.h"
+
+namespace FIFE {
+	OpenGLGuiGraphics::OpenGLGuiGraphics(ImagePool& pool): m_pool(pool) {
+		mTarget = SDL_GetVideoSurface();
+		assert(mTarget);
+		setTargetPlane(mTarget->w, mTarget->h);
+
+	}
+
+	void OpenGLGuiGraphics::drawImage(const gcn::Image* image, int srcX, int srcY, int dstX, int dstY, int width, int height) {
+		const GuiImage* g_img = dynamic_cast<const GuiImage*>(image);
+		assert(g_img);
+		Image& fifeimg = m_pool.getImage(g_img->getPoolId());
+		const gcn::ClipRectangle& clip = getCurrentClipArea();
+		Rect rect(dstX, dstY, width, height);
+		rect.x += clip.xOffset;
+		rect.y += clip.yOffset;
+		GLEnable flag(GL_TEXTURE_2D);
+		fifeimg.render(rect, mTarget);
+	}
+
+	void OpenGLGuiGraphics::drawText(const std::string& text, int x, int y,
+			unsigned int alignment) {
+		if (mFont == NULL)
+		{
+			throw GCN_EXCEPTION("No font set.");
+		}
+
+		GLEnable flag(GL_TEXTURE_2D);
+		switch (alignment)
+		{
+			case LEFT:
+				mFont->drawString(this, text, x, y);
+				break;
+			case CENTER:
+				mFont->drawString(this, text, x - mFont->getWidth(text) / 2, y);
+				break;
+			case RIGHT:
+				mFont->drawString(this, text, x - mFont->getWidth(text), y);
+				break;
+			default:
+				throw GCN_EXCEPTION("Unknown alignment.");
+		}
+	}
+
+	void OpenGLGuiGraphics::drawPoint(int x, int y) {
+		GLDisable flag(GL_TEXTURE_2D);
+		gcn::OpenGLGraphics::drawPoint(x, y);
+	}
+
+	void OpenGLGuiGraphics::drawLine(int x1, int y1, int x2, int y2) {
+		GLDisable flag(GL_TEXTURE_2D);
+		gcn::OpenGLGraphics::drawLine(x1, y1, x2, y2);
+	}
+
+	void OpenGLGuiGraphics::drawRectangle(const gcn::Rectangle& rectangle) {
+		GLDisable flag(GL_TEXTURE_2D);
+		gcn::OpenGLGraphics::drawRectangle(rectangle);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/opengl/opengl_gui_graphics.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,56 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef FIFE_GUI_OPENGL_GRAPHICS_H
+#define FIFE_GUI_OPENGL_GRAPHICS_H
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/opengl/openglgraphics.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src dir
+#include "video/imagepool.h"
+
+namespace FIFE {
+	/** Overrides Guichan Graphics to enable usage of normal fife images & related facilities
+	 */
+	class OpenGLGuiGraphics: public gcn::OpenGLGraphics {
+	public:
+		/** Constructor
+		 */
+		OpenGLGuiGraphics(ImagePool& pool);
+		virtual void drawImage(const gcn::Image* image, int srcX, int srcY, int dstX, int dstY, int width, int height);
+
+		virtual void drawText(const std::string& text, int x, int y, unsigned int alignment);
+		virtual void drawPoint(int x, int y);
+		virtual void drawLine(int x1, int y1, int x2, int y2);
+		virtual void drawRectangle(const gcn::Rectangle& rectangle);
+
+	private:
+		SDL_Surface* mTarget;
+		ImagePool& m_pool;
+	};
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/sdl/sdl_gui_graphics.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,51 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <SDL.h>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src dir
+#include "gui/guichan/gui_image.h"
+#include "util/structures/rect.h"
+#include "video/image.h"
+
+#include "sdl_gui_graphics.h"
+
+namespace FIFE {
+	SdlGuiGraphics::SdlGuiGraphics(ImagePool& pool): m_pool(pool) {
+		setTarget(SDL_GetVideoSurface());
+	}
+
+	void SdlGuiGraphics::drawImage(const gcn::Image* image, int srcX, int srcY, int dstX, int dstY, int width, int height) {
+		const GuiImage* g_img = dynamic_cast<const GuiImage*>(image);
+		assert(g_img);
+		Image& fifeimg = m_pool.getImage(g_img->getPoolId());
+		const gcn::ClipRectangle& clip = getCurrentClipArea();
+		Rect rect(dstX, dstY, width, height);
+		rect.x += clip.xOffset;
+		rect.y += clip.yOffset;
+		fifeimg.render(rect, mTarget);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/sdl/sdl_gui_graphics.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef FIFE_GUI_SDL_GRAPHICS_H
+#define FIFE_GUI_SDL_GRAPHICS_H
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/sdl/sdlgraphics.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src dir
+#include "video/imagepool.h"
+
+namespace FIFE {
+	/** Overrides Guichan Graphics to enable usage of normal fife images & related facilities
+	 */
+	class SdlGuiGraphics: public gcn::SDLGraphics {
+	public:
+		/** Constructor
+		 */
+		SdlGuiGraphics(ImagePool& pool);
+		virtual void drawImage(const gcn::Image* image, int srcX, int srcY, int dstX, int dstY, int width, int height);
+
+	private:
+		ImagePool& m_pool;
+	};
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/clicklabel.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,195 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+#include <cassert>
+
+// 3rd party library includes
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "gui/guichan/gui_font.h"
+#include "util/base/exception.h"
+#include "video/image.h" 
+
+#include "clicklabel.h"
+
+namespace gcn {
+	ClickLabel::ClickLabel()  {
+		mGuiFont = static_cast<FIFE::GuiFont*> (getFont());
+// 		setAlignment(Graphics::LEFT);
+		setTextWrapping(false);
+		setFrameSize(0);
+		addMouseListener(this);
+		addKeyListener(this);
+		addFocusListener(this);
+
+	}
+	
+	ClickLabel::ClickLabel(const std::string& caption) {
+		mGuiFont = static_cast<FIFE::GuiFont*> (getFont());
+// 		setAlignment(Graphics::LEFT);
+		setTextWrapping(false);
+		setCaption(caption);
+		setFrameSize(0);
+		addMouseListener(this);
+		addKeyListener(this);
+		addFocusListener(this);
+
+		wrapText();
+	}
+	
+	ClickLabel::~ClickLabel() {
+	}
+	
+	void ClickLabel::setCaption(const std::string& caption) {
+		mCaption = caption;
+		mGuiFont = static_cast<FIFE::GuiFont*> (getFont());
+		wrapText();
+	}
+
+	const std::string& ClickLabel::getCaption() const {
+		return mCaption;
+	}
+
+	void ClickLabel::setWidth(int width) {
+		Widget::setWidth(width);
+		wrapText();
+	}
+	
+	void ClickLabel::draw(Graphics* graphics) {
+
+		if (mGuiFont != static_cast<FIFE::GuiFont*> (getFont())) {
+			mGuiFont = static_cast<FIFE::GuiFont*> (getFont());
+			wrapText();
+			adjustSize();
+		}
+
+		int textX = 0;
+		int textY = 0;
+
+		graphics->setColor(getBackgroundColor());
+		graphics->fillRectangle(Rectangle(1, 1, getDimension().width-1, getHeight() - 1));
+		if (mGuiFont) {
+			if( isTextWrapping() ) {
+				mGuiFont->drawMultiLineString(graphics, mWrappedText, textX, textY);
+			} else {
+				mGuiFont->drawMultiLineString(graphics, mCaption, textX, textY);
+			}
+		}
+	}
+
+	void ClickLabel::setTextWrapping(bool textWrapping) {
+		bool wrappingEnabled = !mTextWrapping && textWrapping;
+		mTextWrapping = textWrapping;
+		if (wrappingEnabled) {
+			wrapText();
+		}
+	}
+
+	bool ClickLabel::isTextWrapping() const {
+		return mTextWrapping;
+	}
+
+	void  ClickLabel::adjustSize() {
+		if (mGuiFont) {
+			FIFE::Image* image;
+			if( isTextWrapping() ) {
+				image = mGuiFont->getAsImageMultiline(mWrappedText);
+			} else {
+				image = mGuiFont->getAsImageMultiline(mCaption);
+			}
+			setWidth( image->getWidth() );
+			setHeight( image->getHeight() );
+		}
+	}
+
+	void ClickLabel::wrapText() {
+		if( isTextWrapping() && mGuiFont ) {
+			mWrappedText = mGuiFont->splitTextToWidth(mCaption,getWidth());
+		}
+	}
+
+
+	void ClickLabel::mousePressed(MouseEvent& mouseEvent)
+	{
+		if (mouseEvent.getButton() == MouseEvent::LEFT) {
+			mMousePressed = true;
+			mouseEvent.consume();
+		}
+	}
+	
+	void ClickLabel::mouseExited(MouseEvent& mouseEvent)
+	{
+		mHasMouse = false;
+	}
+	
+	void ClickLabel::mouseEntered(MouseEvent& mouseEvent)
+	{
+		mHasMouse = true;
+	}
+	
+	void ClickLabel::mouseReleased(MouseEvent& mouseEvent)
+	{
+		if (mouseEvent.getButton() == MouseEvent::LEFT && mMousePressed && mHasMouse) {
+			mMousePressed = false;
+			distributeActionEvent();
+			mouseEvent.consume();
+		} else if (mouseEvent.getButton() == MouseEvent::LEFT) {
+			mMousePressed = false;
+			mouseEvent.consume();
+		}
+	}
+	
+	void ClickLabel::mouseDragged(MouseEvent& mouseEvent)
+	{
+		mouseEvent.consume();
+	}
+	
+	void ClickLabel::keyPressed(KeyEvent& keyEvent)
+	{
+		Key key = keyEvent.getKey();
+	
+		if (key.getValue() == Key::ENTER || key.getValue() == Key::SPACE) {
+			mKeyPressed = true;
+			keyEvent.consume();
+		}
+	}
+	
+	void ClickLabel::keyReleased(KeyEvent& keyEvent)
+	{
+		Key key = keyEvent.getKey();
+	
+		if ((key.getValue() == Key::ENTER || key.getValue() == Key::SPACE) && mKeyPressed) {
+			mKeyPressed = false;
+			distributeActionEvent();
+			keyEvent.consume();
+		}
+	}
+	
+	void ClickLabel::focusLost(const Event& event)
+	{
+		mMousePressed = false;
+		mKeyPressed = false;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/clicklabel.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,98 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef FIFE_GUI_WIDGETS_CLICKLABEL_H
+#define FIFE_GUI_WIDGETS_CLICKLABEL_H
+
+// Standard C++ library includes
+#include <string>
+
+// 3rd party library includes
+#include <guichan.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+
+namespace FIFE {
+	class GuiFont;
+}
+
+namespace gcn {
+	
+	class ClickLabel : public Widget, public MouseListener, public KeyListener, public FocusListener {
+	public:
+		ClickLabel();
+		ClickLabel(const std::string& caption);
+		virtual ~ClickLabel();
+
+		virtual void setWidth(int width);
+		virtual void setCaption(const std::string& caption);
+		virtual const std::string& getCaption() const;
+
+		virtual void draw(Graphics* graphics);
+
+		virtual void adjustSize();
+
+		void setTextWrapping(bool);
+		bool isTextWrapping() const;
+
+		// Inherited from FocusListener
+	
+		virtual void focusLost(const Event& event);
+	
+	
+		// Inherited from MouseListener
+	
+		virtual void mousePressed(MouseEvent& mouseEvent);
+	
+		virtual void mouseReleased(MouseEvent& mouseEvent);
+	
+		virtual void mouseEntered(MouseEvent& mouseEvent);
+	
+		virtual void mouseExited(MouseEvent& mouseEvent);
+	
+		virtual void mouseDragged(MouseEvent& mouseEvent);
+	
+	
+		// Inherited from KeyListener
+	
+		virtual void keyPressed(KeyEvent& keyEvent);
+	
+		virtual void keyReleased(KeyEvent& keyEvent);
+
+	protected:
+		void wrapText();
+
+		FIFE::GuiFont* mGuiFont;
+		bool mTextWrapping;
+		std::string mCaption;
+		std::string mWrappedText;
+
+		bool mHasMouse;
+		bool mKeyPressed;
+		bool mMousePressed;
+	};
+}
+
+#endif
+/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/icon2.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,143 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+/*      _______   __   __   __   ______   __   __   _______   __   __                 
+ *     / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___  /\ /  |\/ /\                
+ *    / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /                 
+ *   / / /__   / / // / // / // / /    / ___  / // ___  / // /| ' / /                  
+ *  / /_// /\ / /_// / // / // /_/_   / / // / // /\_/ / // / |  / /                   
+ * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /                    
+ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/                      
+ *
+ * Copyright (c) 2004, 2005 darkbits                        Js_./
+ * Per Larsson a.k.a finalman                          _RqZ{a<^_aa
+ * Olof Naess�n a.k.a jansem/yakslem                _asww7!uY`>  )\a//
+ *                                                 _Qhm`] _f "'c  1!5m
+ * Visit: http://guichan.darkbits.org             )Qk<P ` _: :+' .'  "{[
+ *                                               .)j(] .d_/ '-(  P .   S
+ * License: (BSD)                                <Td/Z <fP"5(\"??"\a.  .L
+ * Redistribution and use in source and          _dV>ws?a-?'      ._/L  #'
+ * binary forms, with or without                 )4d[#7r, .   '     )d`)[
+ * modification, are permitted provided         _Q-5'5W..j/?'   -?!\)cam'
+ * that the following conditions are met:       j<<WP+k/);.        _W=j f
+ * 1. Redistributions of source code must       .$%w\/]Q  . ."'  .  mj$
+ *    retain the above copyright notice,        ]E.pYY(Q]>.   a     J@\
+ *    this list of conditions and the           j(]1u<sE"L,. .   ./^ ]{a
+ *    following disclaimer.                     4'_uomm\.  )L);-4     (3=
+ * 2. Redistributions in binary form must        )_]X{Z('a_"a7'<a"a,  ]"[
+ *    reproduce the above copyright notice,       #}<]m7`Za??4,P-"'7. ).m
+ *    this list of conditions and the            ]d2e)Q(<Q(  ?94   b-  LQ/
+ *    following disclaimer in the                <B!</]C)d_, '(<' .f. =C+m
+ *    documentation and/or other materials      .Z!=J ]e []('-4f _ ) -.)m]'
+ *    provided with the distribution.          .w[5]' _[ /.)_-"+?   _/ <W"
+ * 3. Neither the name of Guichan nor the      :$we` _! + _/ .        j?
+ *    names of its contributors may be used     =3)= _f  (_yQmWW$#(    "
+ *    to endorse or promote products derived     -   W,  sQQQQmZQ#Wwa]..
+ *    from this software without specific        (js, \[QQW$QWW#?!V"".
+ *    prior written permission.                    ]y:.<\..          .
+ *                                                 -]n w/ '         [.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT       )/ )/           !
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY         <  (; sac    ,    '
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,               ]^ .-  %
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF            c <   r
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR            aga<  <La
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE          5%  )P'-3L
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR        _bQf` y`..)a
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          ,J?4P'.P"_(\?d'.,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES               _Pa,)!f/<[]/  ?"
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT      _2-..:. .r+_,.. .
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     ?a.<%"'  " -'.a_ _,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION)                     ^
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * For comments regarding functions please see the header file. 
+ */
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/rectangle.hpp>
+#include <guichan/graphics.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "icon2.hpp"
+
+namespace gcn
+{
+
+    Icon2::Icon2(Image* image)
+    {
+        mImage = image;
+        if( mImage ) {
+            setHeight(image->getHeight());
+            setWidth(image->getWidth());
+        }
+    }
+
+    void Icon2::draw(Graphics* graphics)
+    {
+        if ( mImage )
+            graphics->drawImage(mImage, 0, 0);
+
+    }
+
+    void Icon2::drawFrame(Graphics* graphics)
+    {
+        Color faceColor = getBaseColor();
+        Color highlightColor, shadowColor;
+        int alpha = getBaseColor().a;
+        int width = getWidth() + getFrameSize() * 2 - 1;
+        int height = getHeight() + getFrameSize() * 2 - 1;
+        highlightColor = faceColor + 0x303030;
+        highlightColor.a = alpha;
+        shadowColor = faceColor - 0x303030;
+        shadowColor.a = alpha;
+        
+        unsigned int i;
+        for (i = 0; i < getFrameSize(); ++i)
+        {
+            graphics->setColor(shadowColor);
+            graphics->drawLine(i,i, width - i, i);
+            graphics->drawLine(i,i + 1, i, height - i - 1);
+            graphics->setColor(highlightColor);
+            graphics->drawLine(width - i,i + 1, width - i, height - i); 
+            graphics->drawLine(i,height - i, width - i - 1, height - i); 
+        }
+    }
+
+    void Icon2::setImage(Image* image) {
+        mImage = image;
+        if( mImage ) {
+            setHeight(image->getHeight());
+            setWidth(image->getWidth());
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/icon2.hpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,125 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+/*      _______   __   __   __   ______   __   __   _______   __   __                 
+ *     / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___  /\ /  |\/ /\                
+ *    / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /                 
+ *   / / /__   / / // / // / // / /    / ___  / // ___  / // /| ' / /                  
+ *  / /_// /\ / /_// / // / // /_/_   / / // / // /\_/ / // / |  / /                   
+ * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /                    
+ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/                      
+ *
+ * Copyright (c) 2004, 2005 darkbits                        Js_./
+ * Per Larsson a.k.a finalman                          _RqZ{a<^_aa
+ * Olof Naess�n a.k.a jansem/yakslem                _asww7!uY`>  )\a//
+ *                                                 _Qhm`] _f "'c  1!5m
+ * Visit: http://guichan.darkbits.org             )Qk<P ` _: :+' .'  "{[
+ *                                               .)j(] .d_/ '-(  P .   S
+ * License: (BSD)                                <Td/Z <fP"5(\"??"\a.  .L
+ * Redistribution and use in source and          _dV>ws?a-?'      ._/L  #'
+ * binary forms, with or without                 )4d[#7r, .   '     )d`)[
+ * modification, are permitted provided         _Q-5'5W..j/?'   -?!\)cam'
+ * that the following conditions are met:       j<<WP+k/);.        _W=j f
+ * 1. Redistributions of source code must       .$%w\/]Q  . ."'  .  mj$
+ *    retain the above copyright notice,        ]E.pYY(Q]>.   a     J@\
+ *    this list of conditions and the           j(]1u<sE"L,. .   ./^ ]{a
+ *    following disclaimer.                     4'_uomm\.  )L);-4     (3=
+ * 2. Redistributions in binary form must        )_]X{Z('a_"a7'<a"a,  ]"[
+ *    reproduce the above copyright notice,       #}<]m7`Za??4,P-"'7. ).m
+ *    this list of conditions and the            ]d2e)Q(<Q(  ?94   b-  LQ/
+ *    following disclaimer in the                <B!</]C)d_, '(<' .f. =C+m
+ *    documentation and/or other materials      .Z!=J ]e []('-4f _ ) -.)m]'
+ *    provided with the distribution.          .w[5]' _[ /.)_-"+?   _/ <W"
+ * 3. Neither the name of Guichan nor the      :$we` _! + _/ .        j?
+ *    names of its contributors may be used     =3)= _f  (_yQmWW$#(    "
+ *    to endorse or promote products derived     -   W,  sQQQQmZQ#Wwa]..
+ *    from this software without specific        (js, \[QQW$QWW#?!V"".
+ *    prior written permission.                    ]y:.<\..          .
+ *                                                 -]n w/ '         [.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT       )/ )/           !
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY         <  (; sac    ,    '
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,               ]^ .-  %
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF            c <   r
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR            aga<  <La
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE          5%  )P'-3L
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR        _bQf` y`..)a
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          ,J?4P'.P"_(\?d'.,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES               _Pa,)!f/<[]/  ?"
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT      _2-..:. .r+_,.. .
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     ?a.<%"'  " -'.a_ _,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION)                     ^
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GCN_ICON2_HPP
+#define GCN_ICON2_HPP
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/image.hpp>
+#include <guichan/platform.hpp>
+#include <guichan/widget.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+
+namespace gcn
+{
+	/**
+	* An Icon for displaying images.
+	*
+	* \note Modified for FIFE.
+	*/    
+	class Icon2 : public Widget
+	{
+	public:
+		/**
+		* Constructor.
+		*
+		* @param image an Image to display.
+		*/
+		Icon2(Image* image);
+		virtual ~Icon2() {}
+		
+		
+		// Inherited from Widget
+		
+		virtual void draw(Graphics* graphics);
+
+		virtual void drawFrame(Graphics* graphics);
+		
+		// added for FIFE
+		void setImage(Image* image);
+
+		// changed from private to allow derived instance access
+	protected:
+		Image* mImage;
+	};
+}
+
+#endif // end GCN_ICON2_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/percentagebar.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,108 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2010 by the FIFE team                              *
+ *   http://www.fifengine.net                                              *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+/*
+ * For comments regarding functions please see the header file.
+ */
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/rectangle.hpp>
+#include <guichan/graphics.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "percentagebar.hpp"
+
+namespace gcn
+{
+
+    PercentageBar::PercentageBar()
+    {
+		mImage = 0;
+
+		setOrientation(HORIZONTAL);
+        setValue(0);
+    }
+
+    void PercentageBar::draw(Graphics* graphics)
+    {
+		graphics->setColor(getForegroundColor());
+
+        if (getOrientation() == HORIZONTAL)
+        {
+			graphics->fillRectangle(gcn::Rectangle(0,0,getWidth() * mValue/100,getHeight()));
+		}
+		else
+		{
+			graphics->fillRectangle(gcn::Rectangle(0,getHeight()-getHeight() * mValue/100,getWidth(),getHeight() * mValue/100));
+		}
+
+
+        if ( mImage )
+            graphics->drawImage(mImage, 0, 0);
+
+    }
+
+    void PercentageBar::setForegroundImage(Image* image)
+    {
+        mImage = image;
+        if( mImage ) {
+            setHeight(image->getHeight());
+            setWidth(image->getWidth());
+        }
+    }
+
+    void PercentageBar::setValue(int value)
+    {
+        if (value > 100)
+        {
+            mValue = 100;
+            return;
+        }
+
+        if (value < 0)
+        {
+            mValue = 0;
+            return;
+        }
+
+        mValue = value;
+    }
+
+    int PercentageBar::getValue() const
+    {
+        return mValue;
+    }
+
+    void PercentageBar::setOrientation(PercentageBar::Orientation orientation)
+	{
+	    mOrientation = orientation;
+	}
+
+	PercentageBar::Orientation PercentageBar::getOrientation() const
+	{
+	    return mOrientation;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/percentagebar.hpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,120 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2010 by the FIFE team                              *
+ *   http://www.fifengine.net                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef GCN_PERCENTAGE_BAR_HPP
+#define GCN_PERCENTAGE_BAR_HPP
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/image.hpp>
+#include <guichan/platform.hpp>
+#include <guichan/widget.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+
+namespace gcn
+{
+	/**
+	* A simple percentage bar.
+	*
+	*
+	*/
+	class PercentageBar : public Widget
+	{
+	public:
+
+		enum Orientation
+		{
+			HORIZONTAL = 0,
+			VERTICAL
+        };
+
+		/**
+		* Constructor.
+		*
+		*/
+		PercentageBar();
+		virtual ~PercentageBar() {}
+
+
+		// Inherited from Widget
+
+		virtual void draw(Graphics* graphics);
+
+		/*
+		 * Sets the image that will be displayed above the widget
+		 *
+		 * @param image Image to be displayed
+		 */
+		void setForegroundImage(Image* image);
+
+        /**
+         * Sets the orientation of the percentage bar.
+         *
+         * @param orientation The orientation of the percentage bar.
+         * @see getOrientation
+         */
+        void setOrientation(Orientation orientation);
+
+        /**
+         * Gets the orientation of the percentage bar..
+         *
+         * @return The orientation of the percentage bar.
+         * @see setOrientation
+         */
+        Orientation getOrientation() const;
+
+        /**
+         * Gets the value of the percentage bar
+         *
+         * @return The value of the percentage bar.
+         */
+        int getValue() const;
+
+        /**
+         * Sets the value of the percentage bar
+         *
+         * @param value In the range of 0-100.
+         */
+        void setValue(int value);
+
+		// changed from private to allow derived instance access
+	protected:
+		Image* mImage;
+
+        /**
+         * Holds the current value of the percentage bar.
+         */
+        double mValue;
+
+        /**
+         * Holds the orientation of the percentage bar. A percentage bar can be drawn
+         * vertically or horizontally.
+         */
+        Orientation mOrientation;
+	};
+}
+
+#endif // end GCN_PERCENTAGE_BAR_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/togglebutton.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,265 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+/***************************************************************************
+ * Note! Group and groupmap borrows heavily from ideas of Guichan library  *
+ * version 0.8.1                                                           *
+ ***************************************************************************/
+
+
+
+// Standard C++ library includes
+#include <cassert>
+
+// 3rd party library includes
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include <iostream>
+
+#include <guichan/mouseevent.hpp>
+
+#include "togglebutton.h"
+
+
+namespace gcn {
+	ToggleButton::GroupMap ToggleButton::m_groupMap;
+
+	ToggleButton::ToggleButton(Image *up_file , Image *down_file, Image *hover_file, const std::string& caption, const std::string& group): 
+		Button(),
+		m_upImage(up_file),
+		m_downImage(down_file),
+		m_hoverImage(hover_file),
+		x_downoffset(0),
+		y_downoffset(0),
+		m_group(group) {
+
+		m_hoverImage = hover_file;
+		setFrameSize(0);
+		setGroup(m_group);
+		adjustSize();
+		mCaption = caption;
+		m_toggled = false;
+
+		addActionListener(this);
+	}
+	
+	ToggleButton::~ToggleButton() {
+		setGroup(""); // Remove button from group
+	}
+	
+	void ToggleButton::setDownOffset(int x, int y) {
+		x_downoffset = x;
+		y_downoffset = y;
+	}
+	
+	void ToggleButton::draw(Graphics *graphics) {
+		Color faceColor = getBaseColor();
+        Color highlightColor;
+		Color shadowColor;
+        int alpha = getBaseColor().a;
+
+		Image* img = NULL;
+		int xoffset = 0;
+		int yoffset = 0;
+		
+		if (isPressed() || m_toggled) {
+			faceColor = faceColor - 0x303030;
+            faceColor.a = alpha;
+            highlightColor = faceColor - 0x303030;
+            highlightColor.a = alpha;
+            shadowColor = faceColor + 0x303030;
+            shadowColor.a = alpha;
+
+			if( m_downImage ) {
+				img = m_downImage;
+				xoffset = x_downoffset;
+				yoffset = y_downoffset;
+			}
+		} else if(mHasMouse) {
+			faceColor = faceColor + 0x303030;
+            faceColor.a = alpha;
+			highlightColor = faceColor + 0x303030;
+            highlightColor.a = alpha;
+            shadowColor = faceColor - 0x303030;
+            shadowColor.a = alpha;
+
+			if ( m_hoverImage ) {
+				img = m_hoverImage;
+			}
+		} else{
+			highlightColor = faceColor + 0x303030;
+            highlightColor.a = alpha;
+            shadowColor = faceColor - 0x303030;
+            shadowColor.a = alpha;
+
+			if (m_upImage) {
+				img = m_upImage;
+			}
+		}
+		
+
+		graphics->setColor(faceColor);
+        graphics->fillRectangle(Rectangle(1, 1, getDimension().width-1, getHeight() - 1));
+
+        graphics->setColor(highlightColor);
+        graphics->drawLine(0, 0, getWidth() - 1, 0);
+        graphics->drawLine(0, 1, 0, getHeight() - 1);
+
+        graphics->setColor(shadowColor);
+        graphics->drawLine(getWidth() - 1, 1, getWidth() - 1, getHeight() - 1);
+        graphics->drawLine(1, getHeight() - 1, getWidth() - 1, getHeight() - 1);
+
+        graphics->setColor(getForegroundColor());
+
+		if (img) {
+			graphics->drawImage(img, xoffset, yoffset);
+		}
+
+		int textX;
+		int textY = getHeight() / 2 - getFont()->getHeight() / 2;
+		switch (getAlignment())
+		{
+			case Graphics::LEFT:
+				textX = 4;
+				break;
+			case Graphics::CENTER:
+				textX = getWidth() / 2;
+				break;
+			case Graphics::RIGHT:
+				textX = getWidth() - 4;
+				break;
+			default:
+				throw GCN_EXCEPTION("Unknown alignment.");
+		}
+
+		graphics->setFont(getFont());
+		if (mCaption.size() > 0) {
+			if (isPressed())
+				graphics->drawText(getCaption(), textX + 1, 
+						textY + 1, getAlignment());
+			else
+				graphics->drawText(getCaption(), textX, textY, getAlignment());
+		}
+	}
+
+	void ToggleButton::action(const ActionEvent& actionEvent) {
+		setToggled(!m_toggled);
+	}
+
+	void ToggleButton::adjustSize() {
+		int w = 0;
+		int h = w;
+		if( m_upImage ) {
+			w = m_upImage->getWidth();
+			h = m_upImage->getHeight();
+		}
+		if( m_downImage ) {
+			w = std::max(m_downImage->getWidth(), w);
+			h = std::max(m_downImage->getHeight(), h);
+		}
+		if( m_hoverImage ) {
+			w = std::max(m_hoverImage->getWidth(), w);
+			h = std::max(m_hoverImage->getHeight(), h);
+		}
+
+		if( mCaption.length() > 0 ) {
+			w = std::max(static_cast<int>(getFont()->getWidth(mCaption)+2*mSpacing), w);
+			h = std::max(static_cast<int>(getFont()->getHeight()+2*mSpacing), h);
+		}
+
+		setWidth(w);
+		setHeight(h);
+	}
+
+	void ToggleButton::setUpImage(Image* image) {
+		m_upImage = image;
+		adjustSize();
+	}
+
+	void ToggleButton::setDownImage(Image* image) {
+		m_downImage = image;
+		adjustSize();
+	}
+
+	void ToggleButton::setHoverImage(Image* image) {
+		m_hoverImage = image;
+		adjustSize();
+	}
+
+	bool ToggleButton::isToggled() const {
+		return m_toggled;
+	}
+
+	void ToggleButton::setToggled(bool toggled) {
+		if (toggled && m_group != "") {
+			// untoggle all buttons in group
+			GroupIterator iter, iterEnd;
+			iterEnd = m_groupMap.upper_bound(m_group);
+
+			for (iter = m_groupMap.lower_bound(m_group); iter != iterEnd; iter++) {
+				if (iter->second->isToggled()) {
+					iter->second->setToggled(false);
+				}
+			}
+		}
+
+		m_toggled = toggled;
+	}
+
+	void ToggleButton::setGroup(const std::string &group) {
+		// Remove button from previous group
+        if (m_group != "") {
+            GroupIterator iter, iterEnd;
+            iterEnd = m_groupMap.upper_bound(m_group);
+
+            for (iter = m_groupMap.lower_bound(m_group); iter != iterEnd; iter++) {
+                if (iter->second == this) {
+                    m_groupMap.erase(iter);
+                    break;
+                }
+            }
+        }
+
+		// Add button to new group
+        if (group != "") {
+            m_groupMap.insert( std::pair<std::string, ToggleButton *>(group, this));
+        }
+
+        m_group = group;
+    }
+
+    const std::string &ToggleButton::getGroup() const {
+        return m_group;
+    }
+
+	int ToggleButton::getDownXOffset() const { 
+		return x_downoffset; 
+	}
+	
+	int ToggleButton::getDownYOffset() const { 
+		return y_downoffset; 
+	}
+
+}
+/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/togglebutton.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,215 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef FIFE_GUICHAN_ADDON_TOGGLEBUTTON_H
+#define FIFE_GUICHAN_ADDON_TOGGLEBUTTON_H
+
+// Standard C++ library includes
+#include <string>
+#include <map>
+
+// 3rd party library includes
+#include <guichan.hpp>
+#include <guichan/actionlistener.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+
+namespace gcn {
+	/**
+     * An implementation of a toggleable button.
+	 *
+	 * If the button is in a group, all other buttons in that group will be untoggled
+	 * when a button gets toggled. If the button is already toggled, you can untoggle 
+	 * it by clicking on it.
+	 *
+     */
+	class ToggleButton : public Button, public ActionListener {
+		public:
+			/**
+			 * Constructor
+			 *
+			 * @param up_image Image displayed when the button isn't toggled
+			 * @param down_image Image displayed when the button is toggled
+			 * @param hover_file Image displayed when the mouse cursor is over button
+			 * @param caption Text to be displayed on button
+			 * @param group The group the button belongs to
+			 */
+			ToggleButton(Image *up_image = 0, Image *down_image = 0, Image *hover_image = 0, const std::string& caption = "", const std::string& group = "");
+
+			/**
+			 * Destructor
+			 */
+			~ToggleButton();
+
+			/**
+			 * Draws the button
+			 */
+			void draw(Graphics *graphics);
+
+			/**
+			 * Adjust size to fit image and caption
+			 */
+			void adjustSize();
+
+			/**
+			 * Sets the image that will be displayed when the button isn't toggled
+			 *
+			 * @param image Image to be displayed
+			 */
+			void setUpImage(Image* image);
+
+			/**
+			 * Sets the image that will be displayed when the button is toggled or pressed
+			 *
+			 * @param image Image to be displayed
+			 */
+			void setDownImage(Image* image);
+
+			/**
+			 * Sets the image which will be displayed when the mouse cursor is over the button
+			 *
+			 * @param image Image to be displayed
+			 */
+			void setHoverImage(Image* image);
+			
+			/**
+			 * Sets the number of pixels the image or text will be offset from
+			 * the top left corner of button when the button is pressed or toggled.
+			 *
+			 * @param x Offset from left
+			 * @param y Offset from top
+			 * @see getDownXOffset
+			 * @see getDownYOffset
+			 */
+			void setDownOffset(int x, int y);
+
+			/**
+			 * Gets the number of pixels the image or text will be offset
+			 * from the left of button when the button is pressed or toggled.
+			 *
+			 * @return Offset from left when button is pressed
+			 * @see setDownOffset
+			 */
+			int getDownXOffset() const;
+
+			/**
+			 * Gets the number of pixels the image or text will be offset
+			 * from the top of button when the button is pressed or toggled.
+			 *
+			 * @return Offset from top when button is pressed
+			 * @see setDownOffset
+			 */
+			int getDownYOffset() const;
+
+			/**
+			 * Checks if the radio button is selected.
+			 *
+			 * @return True if the radio button is selecte, false otherwise.
+			 * @see setSelected
+			 */
+			bool isToggled() const;
+
+			/**
+			 * Sets the radio button to selected or not.
+			 *
+			 * @param selected True if the radio button should be selected,
+			 *                 false otherwise.
+			 * @see isSelected
+			 */
+			void setToggled(bool toggled);
+
+			// From Guichan 0.8.1
+			/**
+			 * Sets the group the toggle button should belong to. Note that
+			 * a toggle button group is unique per application, not per Gui object
+			 * as the group is stored in a static map.
+			 *
+			 * @param group The name of the group.
+			 * @see getGroup
+			 */
+			void setGroup(const std::string &group);
+
+			/**
+			 * Gets the group the toggle button belongs to.
+			 *
+			 * @return The group the toggle button belongs to.
+			 * @see setGroup
+			 */
+			const std::string &getGroup() const;
+
+		protected:
+			// Inherited from gcn::Widget
+			/**
+			 * Toggle button when it is activated
+			 *
+			 * @param actionEvent ActionEvent object
+			 */
+			void action(const ActionEvent& actionEvent);
+
+		private:
+			// Image to be used when the button is not toggle
+			Image *m_upImage;
+
+			// Image to be used when the button is toggled or pressed
+			Image *m_downImage;
+
+			// Image to be used when the mouse cursor is over the image
+			Image *m_hoverImage;
+
+			// Number of pixels the image/text will be offset from the top left
+			// corner, when the button is pressed or toggled
+			int x_downoffset;
+			int y_downoffset;
+
+			/**
+			 * Whether the button is toggled or not.
+			 */
+			bool m_toggled;			
+
+			//-- From Guichan 0.8.1 --
+			/**
+			 * Holds the group of the toggle button.
+			 */
+			std::string m_group;
+
+			/**
+			 * Typedef.
+			 */
+			typedef std::multimap<std::string, ToggleButton *> GroupMap;
+
+			/**
+			 * Typedef.
+			 */
+			typedef GroupMap::iterator GroupIterator;
+
+			/**
+			 * Holds all available toggle button groups.
+			 */
+			static GroupMap m_groupMap;
+	};
+
+}
+
+#endif
+/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/twobutton.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,137 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+#include <cassert>
+
+// 3rd party library includes
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+
+#include "twobutton.h"
+
+namespace gcn {
+	TwoButton::TwoButton(Image *up_file , Image *down_file, Image *hover_file, const std::string& caption): 
+		Button(),
+		m_upImage(up_file),
+		m_downImage(down_file),
+		m_hoverImage(hover_file),
+		x_downoffset(0),
+		y_downoffset(0) {
+		m_hoverImage = hover_file;
+		setFrameSize(0);
+		adjustSize();
+		mCaption = caption;
+	}
+	
+	TwoButton::~TwoButton() {
+	}
+	
+	void TwoButton::setDownOffset(int x, int y) {
+		x_downoffset = x;
+		y_downoffset = y;
+	}
+	
+	void TwoButton::draw(Graphics *graphics) {
+		Image* img = m_upImage;
+		int xoffset = 0;
+		int yoffset = 0;
+		
+		if (isPressed()) {
+			if( m_downImage ) {
+				img = m_downImage;
+				xoffset = x_downoffset;
+				yoffset = y_downoffset;
+			}
+		} else if(mHasMouse) {
+			if( m_hoverImage ) {
+				img = m_hoverImage;
+			}
+		}
+		
+		if (img) {
+			graphics->drawImage(img, xoffset, yoffset);
+		}
+
+		graphics->setColor(getForegroundColor());
+		int textX;
+		int textY = getHeight() / 2 - getFont()->getHeight() / 2;
+		switch (getAlignment())
+		{
+			case Graphics::LEFT:
+				textX = 4;
+				break;
+			case Graphics::CENTER:
+				textX = getWidth() / 2;
+				break;
+			case Graphics::RIGHT:
+				textX = getWidth() - 4;
+				break;
+			default:
+				throw GCN_EXCEPTION("Unknown alignment.");
+		}
+
+		graphics->setFont(getFont());
+		if (mCaption.size() > 0) {
+			if (isPressed())
+				graphics->drawText(getCaption(), textX + 1, 
+						textY + 1, getAlignment());
+			else
+				graphics->drawText(getCaption(), textX, textY, getAlignment());
+		}
+	}
+	void TwoButton::adjustSize() {
+		int w = 0;
+		int h = w;
+		if( m_upImage ) {
+			w = m_upImage->getWidth();
+			h = m_upImage->getHeight();
+		}
+		if( m_downImage ) {
+			w = std::max(m_downImage->getWidth(), w);
+			h = std::max(m_downImage->getHeight(), h);
+		}
+		if( m_hoverImage ) {
+			w = std::max(m_hoverImage->getWidth(), w);
+			h = std::max(m_hoverImage->getHeight(), h);
+		}
+		setWidth(w);
+		setHeight(h);
+	}
+	void TwoButton::setUpImage(Image* image) {
+		m_upImage = image;
+		adjustSize();
+	}
+	void TwoButton::setDownImage(Image* image) {
+		m_downImage = image;
+		adjustSize();
+	}
+	void TwoButton::setHoverImage(Image* image) {
+		m_hoverImage = image;
+		adjustSize();
+	}
+		
+}
+/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/twobutton.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,66 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef FIFE_GUICHAN_ADDON_TWOBUTTON_H
+#define FIFE_GUICHAN_ADDON_TWOBUTTON_H
+
+// Standard C++ library includes
+#include <string>
+
+// 3rd party library includes
+#include <guichan.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+
+namespace gcn {
+
+	class TwoButton;
+
+	class TwoButton : public Button {
+		public:
+			TwoButton(Image *up_image = 0, Image *down_image = 0, Image *hover_file = 0, const std::string& caption = "");
+			~TwoButton();
+			void draw(Graphics *graphics);
+			void adjustSize();
+
+			void setUpImage(Image* image);
+			void setDownImage(Image* image);
+			void setHoverImage(Image* image);
+			
+			void setDownOffset(int x, int y);
+			int getDownXOffset() { return x_downoffset; }
+			int getDownYOffset() { return y_downoffset; }
+			
+		private:
+			Image *m_upImage;
+			Image *m_downImage;
+			Image *m_hoverImage;
+			int x_downoffset;
+			int y_downoffset;
+	};
+
+}
+
+#endif
+/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/utf8textbox.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,224 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by the FIFE team                                   *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+#include <cassert>
+
+// 3rd party library includes
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "util/utf8/utf8.h"
+
+#include "utf8textbox.h"
+
+namespace gcn {
+
+	UTF8TextBox::UTF8TextBox(const std::string & text)
+		:TextBox(text), mStringEditor(new UTF8StringEditor())
+	{
+	}
+
+	UTF8TextBox::~ UTF8TextBox()
+	{
+		delete mStringEditor;
+	}
+
+	void UTF8TextBox::keyPressed(KeyEvent& keyEvent)
+	{
+		Key key = keyEvent.getKey();
+
+		if (key.getValue() == Key::LEFT)
+		{
+			if (mCaretColumn == 0)
+			{
+				if (mCaretRow > 0)
+				{
+					mCaretRow--;
+					mCaretColumn = mTextRows[mCaretRow].size();
+				}
+			}
+			else
+			{
+				mCaretColumn = mStringEditor->prevChar(mTextRows[mCaretRow], mCaretColumn);
+			}
+		}
+		else if (key.getValue() == Key::RIGHT)
+		{
+			if (mCaretColumn < mTextRows[mCaretRow].size())
+			{
+				mCaretColumn = mStringEditor->nextChar(mTextRows[mCaretRow], mCaretColumn);
+			}
+			else
+			{
+				if (mCaretRow < mTextRows.size() - 1)
+				{
+					mCaretRow++;
+					mCaretColumn = 0;
+				}
+			}
+		}
+		else if (key.getValue() == Key::DOWN)
+		{
+			setCaretRowUTF8(mCaretRow + 1);
+		}
+
+		else if (key.getValue() == Key::UP)
+		{
+			setCaretRowUTF8(mCaretRow - 1);
+		}
+
+		else if (key.getValue() == Key::HOME)
+		{
+			mCaretColumn = 0;
+		}
+
+		else if (key.getValue() == Key::END)
+		{
+			mCaretColumn = mTextRows[mCaretRow].size();
+		}
+
+		else if (key.getValue() == Key::ENTER && mEditable)
+		{
+			mTextRows.insert(mTextRows.begin() + mCaretRow + 1,
+								mTextRows[mCaretRow].substr(mCaretColumn, mTextRows[mCaretRow].size() - mCaretColumn));
+			mTextRows[mCaretRow].resize(mCaretColumn);
+			++mCaretRow;
+			mCaretColumn = 0;
+		}
+
+		else if (key.getValue() == Key::BACKSPACE
+					&& mCaretColumn != 0
+					&& mEditable)
+		{
+			mCaretColumn = mStringEditor->prevChar(mTextRows[mCaretRow], mCaretColumn);
+			mCaretColumn = mStringEditor->eraseChar(mTextRows[mCaretRow], mCaretColumn);
+		}
+
+		else if (key.getValue() == Key::BACKSPACE
+					&& mCaretColumn == 0
+					&& mCaretRow != 0
+					&& mEditable)
+		{
+			mCaretColumn = mTextRows[mCaretRow - 1].size();
+			mTextRows[mCaretRow - 1] += mTextRows[mCaretRow];
+			mTextRows.erase(mTextRows.begin() + mCaretRow);
+			mCaretRow--;
+		}
+
+		else if (key.getValue() == Key::DELETE
+					&& mCaretColumn < (int)mTextRows[mCaretRow].size()
+					&& mEditable)
+		{
+			mCaretColumn = mStringEditor->eraseChar(mTextRows[mCaretRow], mCaretColumn);
+		}
+
+		else if (key.getValue() == Key::DELETE
+					&& mCaretColumn == (int)mTextRows[mCaretRow].size()
+					&& mCaretRow < ((int)mTextRows.size() - 1)
+					&& mEditable)
+		{
+			mTextRows[mCaretRow] += mTextRows[mCaretRow + 1];
+			mTextRows.erase(mTextRows.begin() + mCaretRow + 1);
+		}
+
+		else if(key.getValue() == Key::PAGE_UP)
+		{
+			Widget* par = getParent();
+
+			if (par != NULL)
+			{
+				int rowsPerPage = par->getChildrenArea().height / getFont()->getHeight();
+				int chars = mStringEditor->countChars(mTextRows[mCaretRow], mCaretColumn);
+				mCaretRow -= rowsPerPage;
+
+				if (mCaretRow < 0)
+				{
+					mCaretRow = 0;
+				}
+				mCaretColumn = mStringEditor->getOffset(mTextRows[mCaretRow], chars);
+			}
+		}
+
+		else if(key.getValue() == Key::PAGE_DOWN)
+		{
+			Widget* par = getParent();
+
+			if (par != NULL)
+			{
+				int rowsPerPage = par->getChildrenArea().height / getFont()->getHeight();
+				int chars = mStringEditor->countChars(mTextRows[mCaretRow], mCaretColumn);
+				mCaretRow += rowsPerPage;
+
+				if (mCaretRow >= (int)mTextRows.size())
+				{
+					mCaretRow = mTextRows.size() - 1;
+				}
+
+				mCaretColumn = mStringEditor->getOffset(mTextRows[mCaretRow], chars);
+			}
+		}
+
+		else if(key.getValue() == Key::TAB
+				&& mEditable)
+		{
+			// FIXME: jump X spaces, so mCaretColumn % TAB_SIZE = 0 and X <= TAB_SIZE
+			mTextRows[mCaretRow].insert(mCaretColumn,std::string("    "));
+			mCaretColumn += 4;
+		}
+
+		else if ((key.isCharacter() || key.getValue() > 255)
+					&& mEditable)
+		{
+			mCaretColumn = mStringEditor->insertChar(mTextRows[mCaretRow], mCaretColumn, key.getValue());
+		}
+
+		adjustSize();
+		scrollToCaret();
+		assert( utf8::is_valid(mTextRows[mCaretRow].begin(),mTextRows[mCaretRow].end()) );
+		assert( utf8::is_valid(mTextRows[mCaretRow].begin(),mTextRows[mCaretRow].begin() + mCaretColumn) );
+		keyEvent.consume();
+	}
+
+
+	void UTF8TextBox::setCaretColumnUTF8(int column)
+	{
+		// no need to clip the column, mStringEditor handles it automaticly
+		mCaretColumn = mStringEditor->getOffset(mTextRows[mCaretRow], column);
+	}
+
+	void UTF8TextBox::setCaretRowUTF8(int row)
+	{
+		int chars = mStringEditor->countChars(mTextRows[mCaretRow], mCaretColumn);
+		if (row < 0) {
+			row = 0;
+		} else if (row >= mTextRows.size()) {
+			row = mTextRows.size() - 1;
+		}
+		mCaretRow = row;
+		mCaretColumn = mStringEditor->getOffset(mTextRows[mCaretRow], chars);
+	}
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/utf8textbox.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,120 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by the FIFE team                                   *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef RAVERON_UTF8TEXTBOX_HPP
+#define RAVERON_UTF8TEXTBOX_HPP
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/widgets/textbox.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "util/utf8/utf8stringeditor.h"
+
+namespace gcn {
+
+	/**
+	 * UTF-8 aware version of the TextBox class.
+	 *
+	 * Using UTF8StringEditor, it is able to correctly edit UTF-8 multiline texts.
+	 *
+	 * You will also need an UTF-8 aware font to be able to correctly
+	 * display such text (so gcn::ImageFont can not be used).
+	 *
+	 * TextBox::setCaretColumn(), TextBox::setCaretRow(),
+	 * TextBox::setCaretRowColumn(), TextBox::getCaretColumn()
+	 * and TextBox::getCaretRow() addresses byte offsets of the text.
+	 * Use character versions of those methods with UTF8 suffix, they
+	 * will correctly access real character positions in UTF-8 texts.
+	 * 
+	 * @author Przemyslaw Grzywacz
+	 */
+	class UTF8TextBox: public TextBox {
+	public:
+		/**
+		 * Constructor.
+		 * @param text Initial text.
+		 */
+		UTF8TextBox(const std::string& text = "");
+
+		/**
+		 * Destructor.
+		 */
+		virtual ~UTF8TextBox();
+
+		/**
+		 * Key pressed handler.
+		 *
+		 * Overides gcn::TextField to handle UTF-8 character codes.
+		 *
+		 * @param keyEvent Keyboard event.
+		 */
+		virtual void keyPressed(KeyEvent& keyEvent);
+
+		/**
+		 * Sets caret column (UTF-8 aware).
+		 * @param column Caret column.
+		 */
+		void setCaretColumnUTF8(int column);
+
+		/**
+		 * Sets caret row  (UTF-8 aware).
+		 * @param row Caret row
+		 */
+		void setCaretRowUTF8(int row);
+
+		/**
+		 * Sets caret row and column  (UTF-8 aware).
+		 * @param row Caret row.
+		 * @param column Caret column.
+		 */
+		void setCaretRowColumnUTF8(int row, int column);
+
+		/**
+		 * Gets caret column (UTF-8 aware).
+		 * @return Caret column.
+		 */
+		int getCaretColumnUTF8();
+
+		/**
+		 * Gets caret column (UTF-8 aware).
+		 * @return Caret row.
+		 */
+		int getCaretRowUTF8();
+
+	protected:
+
+		/**
+		 * UTF-8 string editor suppor.
+		 *
+		 * It allows the UTF8TextBox to easly traverse UTF-8 strings
+		 * as well as inserting and deleting characters.
+		 */
+		UTF8StringEditor* mStringEditor;
+	};
+
+};
+
+#endif // !RAVERON_UTF8TEXTBOX_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/utf8textfield.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,102 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by the FIFE team                                   *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+// Standard C++ library includes
+#include <cassert>
+
+// 3rd party library includes
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "utf8textfield.h"
+
+namespace gcn {
+
+	UTF8TextField::UTF8TextField(const std::string & text)
+		: TextField(text)
+	{
+		mStringEditor = new UTF8StringEditor();
+	}
+
+	UTF8TextField::~UTF8TextField()
+	{
+		delete mStringEditor;
+	}
+
+	void UTF8TextField::keyPressed(KeyEvent & keyEvent)
+	{
+		Key key = keyEvent.getKey();
+
+		if (key.getValue() == Key::LEFT && mCaretPosition > 0)
+		{
+			mCaretPosition = mStringEditor->prevChar(mText, mCaretPosition);
+		}
+		else if (key.getValue() == Key::RIGHT && mCaretPosition < mText.size())
+		{
+			mCaretPosition = mStringEditor->nextChar(mText, mCaretPosition);
+		}
+		else if (key.getValue() == Key::DELETE && mCaretPosition < mText.size())
+		{
+			mCaretPosition = mStringEditor->eraseChar(mText, mCaretPosition);
+		}
+		else if (key.getValue() == Key::BACKSPACE && mCaretPosition > 0)
+		{
+			mCaretPosition = mStringEditor->prevChar(mText, mCaretPosition);
+			mCaretPosition = mStringEditor->eraseChar(mText, mCaretPosition);
+		}
+		else if (key.getValue() == Key::ENTER)
+		{
+			distributeActionEvent();
+		}
+		else if (key.getValue() == Key::HOME)
+		{
+			mCaretPosition = 0;
+		}
+
+		else if (key.getValue() == Key::END)
+		{
+			mCaretPosition = mText.size();
+		}
+
+		// Add character to text, if key is realy a ASCII character
+		// or is greater than 8bits long and the character is not
+		// the tab key.
+		else if ((key.isCharacter() || key.getValue() > 255)
+			&& key.getValue() != Key::TAB)
+		{
+			mCaretPosition = mStringEditor->insertChar(mText, mCaretPosition, key.getValue());
+		}
+
+		if (key.getValue() != Key::TAB)
+		{
+			// consume all characters except TAB which is needed
+			// for traversing through widgets in a container.
+			keyEvent.consume();
+		}
+
+		fixScroll();
+	}
+
+};
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/utf8textfield.h	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,84 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by the FIFE team                                   *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+#ifndef GCN_UTF8TEXTFIELD_HPP
+#define GCN_UTF8TEXTFIELD_HPP
+
+// Standard C++ library includes
+
+// 3rd party library includes
+#include <guichan/widgets/textfield.hpp>
+
+// FIFE includes
+// These includes are split up in two parts, separated by one empty line
+// First block: files included from the FIFE root src directory
+// Second block: files included from the same folder
+#include "util/utf8/utf8stringeditor.h"
+
+namespace gcn {
+
+	/**
+	 * UTF-8 aware version of the TextField class.
+	 *
+	 * Using UTF8StringEditor, it is able to correctly edit UTF-8 text line.
+	 *
+	 * You will also need an UTF-8 aware font to be able to correctly
+	 * display such text (so gcn::ImageFont can not be used).
+	 * 
+	 * @author Przemyslaw Grzywacz
+	 */
+	class UTF8TextField: public TextField
+	{
+	public:
+		/**
+		 * UTF8TextField constructor.
+		 * @param text Initial text.
+		 */
+		UTF8TextField(const std::string& text = "");
+
+		/**
+		 * Destructor.
+		 */
+		virtual ~UTF8TextField();
+
+		/**
+		 * Key pressed handler.
+		 *
+		 * Overides gcn::TextField to handle UTF-8 character codes.
+		 *
+		 * @param keyEvent Keyboard event.
+		 */
+		virtual void keyPressed(KeyEvent& keyEvent);
+
+	protected:
+		/**
+		 * UTF-8 string editor suppor.
+		 *
+		 * It allows the UTF8TextField to easly traverse UTF-8 strings
+		 * as well as inserting and deleting characters.
+		 */
+		UTF8StringEditor* mStringEditor;
+	};
+
+
+}
+
+#endif // !GCN_UTF8TEXTFIELD_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/gui/guichan/widgets/widgets.i	Sat Jun 18 00:28:40 2011 -1000
@@ -0,0 +1,447 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by the FIFE team                              *
+ *   http://www.fifengine.de                                               *
+ *   This file is part of FIFE.                                            *
+ *                                                                         *
+ *   FIFE is free software; you can redistribute it and/or                 *
+ *   modify it under the terms of the GNU Lesser General Public            *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2.1 of the License, or (at your option) any later version.    *
+ *                                                                         *
+ *   This library 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     *
+ *   Lesser General Public License for more details.                       *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this library; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+%module fife
+%{
+#include <guichan.hpp>
+#include <guichan/mouseevent.hpp>
+#include "gui/guichan/widgets/utf8textfield.h"
+#include "gui/guichan/widgets/utf8textbox.h"
+#include "gui/guichan/widgets/twobutton.h"
+#include "gui/guichan/widgets/togglebutton.h"
+#include "gui/guichan/widgets/clicklabel.h"
+#include "gui/guichan/widgets/icon2.hpp"
+#include "gui/guichan/widgets/percentagebar.hpp"
+%}
+
+namespace gcn {
+	class Font;
+	class Image;
+	class ActionListener;
+	class MouseListener;
+	class KeyListener;
+
+	%nodefaultctor;
+	class Graphics {
+	public:
+		enum Alignment {
+			LEFT = 0,
+			CENTER,
+			RIGHT
+		};
+	};
+	%clearnodefaultctor;
+
+	
+	class Color {
+	public:
+		Color();
+		Color(int color);
+		Color(int r, int g, int b, int a = 255);
+		Color operator+(const Color& color) const;
+		Color operator-(const Color& color) const;
+		Color operator*(float value) const;
+		bool operator==(const Color& color) const;
+		bool operator!=(const Color& color) const;
+		int r;
+		int g;
+		int b;
+		int a;
+	};
+
+	class Widget {
+	public:
+/* 		Widget(); */
+/* 		virtual ~Widget(); */
+		virtual void setWidth(int width);
+		virtual int getWidth() const;
+		virtual void setHeight(int height);
+		virtual int getHeight() const;
+		virtual void setSize(int width, int height);
+		virtual void setX(int x);
+		virtual int getX() const;
+		virtual void setY(int y);
+		virtual int getY() const;
+		virtual void setPosition(int x, int y);
+		virtual void setFrameSize(unsigned int frameSize);
+		virtual unsigned int getFrameSize() const;
+		virtual void setFocusable(bool focusable);
+		virtual bool isFocusable() const;
+		virtual bool isFocused() const;
+		virtual void setEnabled(bool enabled);
+		virtual bool isEnabled() const;
+		virtual void setVisible(bool visible);
+		virtual bool isVisible() const;
+		virtual void setBaseColor(const Color& color);
+		virtual const Color& getBaseColor() const;
+		virtual void setForegroundColor(const Color& color);
+		virtual const Color& getForegroundColor() const;
+		virtual void setBackgroundColor(const Color& color);
+		virtual const Color& getBackgroundColor() const;
+		virtual void setSelectionColor(const Color& color);
+		virtual const Color& getSelectionColor() const;
+		virtual void requestFocus();
+		virtual void requestMoveToTop();
+		virtual void requestMoveToBottom();
+		virtual void setActionEventId(const std::string& actionEventId);
+		virtual const std::string& getActionEventId() const;
+		virtual void getAbsolutePosition(int& x, int& y) const;
+		Font *getFont() const;
+		static void setGlobalFont(Font* font);
+		virtual void setFont(Font* font);
+		virtual bool isTabInEnabled() const;
+		virtual void setTabInEnabled(bool enabled);
+		virtual bool isTabOutEnabled() const;
+		virtual void setTabOutEnabled(bool enabled);
+		virtual void requestModalFocus();
+		virtual void requestModalMouseInputFocus();
+		virtual void releaseModalFocus();
+		virtual void releaseModalMouseInputFocus();
+		virtual bool isModalFocused() const;
+		virtual bool isModalMouseInputFocused() const;
+		virtual Widget *getWidgetAt(int x, int y);
+		virtual void moveToTop(Widget* widget) { };
+		virtual void moveToBottom(Widget* widget) { };
+		virtual void focusNext() { };
+		virtual void focusPrevious() { };
+		virtual void addActionListener(ActionListener* actionListener);
+		virtual void removeActionListener(ActionListener* actionListener);
+		virtual void addMouseListener(MouseListener* actionListener);
+		virtual void removeMouseListener(MouseListener* actionListener);
+		virtual void addKeyListener(KeyListener* actionListener);
+		virtual void removeKeyListener(KeyListener* actionListener);
+/* 	protected: */
+		virtual void draw(Graphics* graphics) = 0;
+	};
+	
+	%feature("notabstract") Container;
+	class Container: public Widget {
+	public:
+		Container();
+		virtual ~Container();
+		virtual void setOpaque(bool opaque);
+		virtual bool isOpaque() const;
+		virtual void add(Widget* widget);
+		virtual void add(Widget* widget, int x, int y);
+		virtual void remove(Widget* widget);
+		virtual void clear();
+	};
+	
+	%feature("notabstract") CheckBox;
+	class CheckBox: public Widget {
+	public:
+		CheckBox();
+		virtual ~CheckBox();
+		virtual bool isSelected() const;
+		virtual void setSelected(bool marked);
+		virtual const std::string &getCaption() const;
+		virtual void setCaption(const std::string& caption);
+		virtual void adjustSize();
+	};
+
+	%feature("notabstract") UTF8TextField;
+	%rename(TextField) UTF8TextField;
+	class UTF8TextField: public Widget {
+	public:
+		UTF8TextField();
+		UTF8TextField(const std::string& text);
+		virtual void setText(const std::string& text);
+		virtual const std::string& getText() const;
+		virtual void adjustSize();
+		virtual void adjustHeight();
+		virtual void setCaretPosition(unsigned int position);
+		virtual unsigned int getCaretPosition() const;
+	};
+
+	%feature("notabstract") Button;
+	class Button: public Widget {
+	public:
+		Button();
+		Button(const std::string& caption);
+		virtual void setCaption(const std::string& caption);
+		virtual const std::string& getCaption() const;
+		virtual void setAlignment(Graphics::Alignment alignment);
+		virtual Graphics::Alignment getAlignment() const;
+		virtual void adjustSize();
+		/*virtual bool isPressed() const;*/
+	};
+		
+	%feature("notabstract") TwoButton;
+	class TwoButton: public Widget {
+	public:
+		TwoButton(Image *up_image = 0, Image *down_image = 0, Image *hover_image = 0, const char * caption = "");
+		~TwoButton();
+		virtual void setCaption(const std::string& caption);
+		virtual const std::string& getCaption() const;
+		virtual void setAlignment(Graphics::Alignment alignment);
+		virtual Graphics::Alignment getAlignment() const;
+		void setUpImage(Image* image);
+		void setDownImage(Image* image);
+		void setHoverImage(Image* image);
+		void setDownOffset(int x, int y);
+		int getDownXOffset();
+		int getDownYOffset();
+	};
+	
+	%feature("notabstract") ToggleButton;
+	class ToggleButton: public Widget {
+	public:
+		ToggleButton(Image *up_image = 0, Image *down_image = 0, Image *hover_image = 0, const char * caption = "", const char * group = "");
+		~ToggleButton();
+		virtual void setCaption(const std::string& caption);
+		virtual const std::string& getCaption() const;
+		virtual void setAlignment(Graphics::Alignment alignment);
+		virtual Graphics::Alignment getAlignment() const;
+		void setSpacing(unsigned int spacing);
+		unsigned int getSpacing() const;
+		void setUpImage(Image* image);
+		void setDownImage(Image* image);
+		void setHoverImage(Image* image);
+		void setDownOffset(int x, int y);
+		int getDownXOffset() const;
+		int getDownYOffset() const;
+		bool isToggled() const;
+		void setToggled(bool toggled);
+		void setGroup(const std::string &group);
+		const std::string &getGroup() const;
+	};
+
+	%feature("notabstract") ScrollArea;
+	class ScrollArea: public Widget {
+	public:
+		ScrollArea();
+		ScrollArea(Widget *content);
+		ScrollArea(Widget *content,ScrollArea::ScrollPolicy hPolicy,ScrollArea::ScrollPolicy vPolicy);
+		virtual ~ScrollArea();
+		virtual void setContent(Widget* widget);
+		virtual Widget* getContent();
+		virtual void setHorizontalScrollPolicy(ScrollArea::ScrollPolicy hPolicy);
+		virtual ScrollArea::ScrollPolicy getHorizontalScrollPolicy();
+		virtual void setVerticalScrollPolicy(ScrollArea::ScrollPolicy vPolicy);
+		virtual ScrollArea::ScrollPolicy getVerticalScrollPolicy();
+		virtual void setScrollPolicy(ScrollArea::ScrollPolicy hPolicy, ScrollArea::ScrollPolicy vPolicy);
+		virtual void setVerticalScrollAmount(int vScroll);
+		virtual int getVerticalScrollAmount();
+		virtual void setHorizontalScrollAmount(int hScroll);
+		virtual int getHorizontalScrollAmount();
+		virtual void setScrollAmount(int hScroll, int vScroll);
+		virtual int getHorizontalMaxScroll();
+		virtual int getVerticalMaxScroll();
+		virtual void setScrollbarWidth(int width);
+		virtual int getScrollbarWidth();
+		virtual void setLeftButtonScrollAmount(int amount);
+		virtual void setRightButtonScrollAmount(int amount);
+		virtual void setUpButtonScrollAmount(int amount);
+		virtual void setDownButtonScrollAmount(int amount);
+		virtual int getLeftButtonScrollAmount();
+		virtual int getRightButtonScrollAmount();
+		virtual int getUpButtonScrollAmount();
+		virtual int getDownButtonScrollAmount();
+		enum ScrollPolicy
+		{
+			SHOW_ALWAYS,
+			SHOW_NEVER,
+			SHOW_AUTO
+		};
+	};
+	
+	
+	%feature("notabstract") UTF8TextBox;
+	%rename(TextBox) UTF8TextBox;
+	class UTF8TextBox: public Widget {
+	public:
+		UTF8TextBox();
+		UTF8TextBox(const std::string& text);
+		virtual void setText(const std::string& text);
+		virtual std::string getText() const;
+		virtual const std::string& getTextRow(int row) const;
+		virtual void setTextRow(int row, const std::string& text);
+		virtual unsigned int getNumberOfRows() const;
+		virtual unsigned int getCaretPosition() const;
+		virtual void setCaretPosition(unsigned int position);
+		virtual unsigned int getCaretRow() const;
+		virtual void setCaretRow(int row);
+		virtual unsigned int getCaretColumn() const;
+		virtual void setCaretColumn(int column);
+		virtual void setCaretRowColumn(int row, int column);
+		virtual void scrollToCaret();
+		virtual bool isEditable() const;
+		virtual void setEditable(bool editable);
+		virtual void addRow(const std::string row);
+		virtual bool isOpaque();
+		virtual void setOpaque(bool opaque);
+	};
+
+	%feature("director") ListModel;
+	class ListModel
+	{
+	public:
+		virtual ~ListModel() { }
+		virtual int getNumberOfElements() = 0;
+		virtual std::string getElementAt(int i) = 0;
+	};
+
+	%feature("notabstract") ListBox;
+	class ListBox: public Widget {
+	public:
+		ListBox();
+		ListBox(ListModel *listModel);
+		virtual ~ListBox() { }
+		virtual int getSelected();
+		virtual void setSelected(int selected);
+		virtual void setListModel(ListModel *listModel);
+		virtual ListModel *getListModel();
+		virtual void adjustSize();
+		virtual bool isWrappingEnabled();
+		virtual void setWrappingEnabled(bool wrapping);
+	};
+
+	%feature("notabstract") DropDown;
+	class DropDown: public Widget {
+	public:
+		DropDown(ListModel *listModel = NULL,
+		         ScrollArea *scrollArea = NULL,
+		         ListBox *listBox = NULL);
+		virtual ~DropDown();
+		virtual int getSelected();
+		virtual void setSelected(int selected);
+		virtual void setListModel(ListModel *listModel);
+		virtual ListModel *getListModel();
+		virtual void adjustHeight();
+		virtual void setBaseColor(const Color& color);
+		virtual const Color& getBaseColor() const;
+		virtual void setForegroundColor(const Color& color);
+		virtual const Color& getForegroundColor() const;
+		virtual void setBackgroundColor(const Color& color);
+		virtual const Color& getBackgroundColor() const;
+		virtual void setSelectionColor(const Color& color);
+		virtual const Color& getSelectionColor() const;
+	};
+
+	%feature("notabstract") RadioButton;
+	class RadioButton: public Widget {
+	public:
+		RadioButton();
+		RadioButton(const std::string &caption,
+					const std::string &group,
+					bool marked=false);
+		virtual ~RadioButton();
+		virtual bool isSelected() const;
+		virtual void setSelected(bool marked);
+		virtual const std::string &getCaption() const;
+		virtual void setCaption(const std::string caption);
+		virtual void setGroup(const std::string &group);
+		virtual const std::string &getGroup() const;
+		virtual void adjustSize();
+	};
+
+	%feature("notabstract") Slider;
+	class Slider: public Widget {
+	public:
+		Slider(double scaleEnd = 1.0);
+		Slider(double scaleStart, double scaleEnd);
+		virtual ~Slider() { }
+		virtual void setScale(double scaleStart, double scaleEnd);
+		virtual double getScaleStart() const;
+		virtual void setScaleStart(double scaleStart);
+		virtual double getScaleEnd() const;
+		virtual void setScaleEnd(double scaleEnd);
+		virtual double getValue() const;
+		virtual void setValue(double value);
+		virtual void setMarkerLength(int length);
+		virtual int getMarkerLength() const;
+		virtual void setOrientation(Slider::Orientation orientation);
+		virtual Slider::Orientation getOrientation() const;
+		virtual void setStepLength(double length);
+		virtual double getStepLength() const;
+		enum Orientation
+		{
+			HORIZONTAL = 0,
+			VERTICAL
+		};
+	};
+
+	%feature("notabstract") Window;
+	class Window: public Container {
+	public:
+		Window();
+		Window(const std::string& caption);
+		virtual ~Window();
+		virtual void setCaption(const std::string& caption);
+		virtual const std::string& getCaption() const;
+		virtual void setAlignment(Graphics::Alignment alignment);
+		virtual Graphics::Alignment getAlignment() const;
+		virtual void setPadding(unsigned int padding);
+		virtual unsigned int getPadding() const;
+		virtual void setTitleBarHeight(unsigned int height);
+		virtual unsigned int getTitleBarHeight();
+		virtual void setMovable(bool movable);
+		virtual bool isMovable() const;
+		virtual void setOpaque(bool opaque);
+		virtual bool isOpaque();
+		virtual void resizeToContent();
+	};
+
+	%feature("notabstract") ClickLabel;
+	%rename(Label) ClickLabel;
+	class ClickLabel: public Widget {
+	public:
+		ClickLabel();
+		ClickLabel(const std::string& caption);
+		virtual ~ClickLabel();
+		virtual void setCaption(const std::string& caption);
+		virtual const std::string& getCaption() const;
+		bool isTextWrapping() const;
+		void setTextWrapping(bool);
+		virtual void setWidth(int width);
+		virtual void adjustSize();
+	};
+
+	%feature("notabstract") Icon2;
+	%rename(Icon) Icon2;
+	class Icon2: public Widget {
+	public:
+		Icon2(Image* image);
+		virtual ~Icon2();
+		void setImage(Image* image);
+	};
+	
+	%feature("notabstract") PercentageBar;
+	class PercentageBar: public Widget {
+	public:
+		PercentageBar();
+		virtual ~PercentageBar();
+		virtual void setForegroundImage(Image* image);
+        virtual void setOrientation(PercentageBar::Orientation orientation);
+        virtual PercentageBar::Orientation getOrientation() const;
+        virtual int getValue() const;
+        virtual void setValue(int value);
+		
+		enum Orientation
+		{
+			HORIZONTAL = 0,
+			VERTICAL
+		};
+	};
+}
+
+
+
--- a/engine/core/gui/guilistener.i	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-%module fife
-%{
-#include <guichan.hpp>
-#include <guichan/actionevent.hpp>
-#include <guichan/keyevent.hpp>
-%}
-
-namespace gcn {
-
-	%feature("director") MouseListener;
-	class MouseListener {
-	public:
-		virtual ~MouseListener();
-
-		virtual void mouseEntered(gcn::MouseEvent& mouseEvent);
-		virtual void mouseExited(gcn::MouseEvent& mouseEvent);
-		virtual void mousePressed(gcn::MouseEvent& mouseEvent);
-		virtual void mouseReleased(gcn::MouseEvent& mouseEvent);
-		virtual void mouseClicked(gcn::MouseEvent& mouseEvent);
-		virtual void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent);
-		virtual void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent);
-		virtual void mouseMoved(gcn::MouseEvent& mouseEvent);
-		virtual void mouseDragged(gcn::MouseEvent& mouseEvent);
-	protected:
-		MouseListener() { }
-	};
-
-	%feature("director") KeyListener;
-	class KeyListener {
-	public:
-		virtual ~KeyListener();
-
-		virtual void keyPressed(gcn::KeyEvent& keyEvent);
-		virtual void keyReleased(gcn::KeyEvent& keyEvent);
-
-	protected:
-		KeyListener() { }
-	};
-
-	%feature("director") ActionListener;
-	class ActionListener {
-	public:
-		virtual ~ActionListener() { }
-		virtual void action(const gcn::ActionEvent& actionEvent) = 0;
-	};
-}
-
-
--- a/engine/core/gui/guimanager.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ b/engine/core/gui/guimanager.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -24,10 +24,6 @@
 
 // 3rd party library includes
 #include <boost/filesystem/convenience.hpp>
-#include <guichan/sdl/sdlinput.hpp>
-#include <guichan/key.hpp>
-#include <guichan/focushandler.hpp>
-#include <guichan.hpp>
 
 // FIFE includes
 // These includes are split up in two parts, separated by one empty line
@@ -36,441 +32,101 @@
 #include "util/base/exception.h"
 #include "util/log/logger.h"
 #include "video/renderbackend.h"
-#include "gui/base/gui_imageloader.h"
-#include "gui/base/gui_font.h"
-#include "gui/console/console.h"
-#include "video/fonts/fontbase.h"
+#include "video/fonts/subimagefont.h"
 #include "video/fonts/truetypefont.h"
-#include "video/fonts/subimagefont.h"
-#include "eventchannel/key/ec_key.h"
-#include "eventchannel/key/ec_keyevent.h"
-#include "eventchannel/mouse/ec_mouseevent.h"
 
+#include "console.h"
+// FIXME M. George Hansen 2011-06-17: There should be NO references to GuiChan
+// 	here!
+#include "guichan/gui_font.h"
+#include "guichan/gui_imageloader.h"
 #include "guimanager.h"
 
-
 namespace FIFE {
-	static Logger _log(LM_GUI);
-
-	GUIManager::GUIManager(ImagePool& pool) :
-		m_gcn_gui(new gcn::Gui()),
-		m_focushandler(0),
-		m_gcn_topcontainer(new gcn::Container()),
-		m_imgloader(new GuiImageLoader(pool)) ,
-		m_input(new gcn::SDLInput()),
+	GuiManager::GuiManager(ImagePool& pool) :
+		m_console_visible(false),
+		m_image_pool(pool),
 		m_console(0),
 		m_fonts(),
-		m_pool(pool),
-		m_logic_executed(false) {
-
-		m_gcn_gui->setInput(m_input);
-		gcn::Image::setImageLoader(m_imgloader);
-
-		m_gcn_gui->setTop(m_gcn_topcontainer);
-		m_focushandler = m_gcn_topcontainer->_getFocusHandler();
-
-		m_gcn_topcontainer->setOpaque(false);
-		m_gcn_topcontainer->setFocusable(false);
-		m_had_mouse = false;
-	}
-
-	GUIManager::~GUIManager() {
-		delete m_console;
-		delete m_gcn_topcontainer;
-		delete m_imgloader;
-		delete m_input;
-		delete m_gcn_gui;
-		std::vector<GuiFont*>::iterator i = m_fonts.begin();
-		while (i != m_fonts.end()) {
-			delete *i;
-			++i;
-		}
+		m_fontpath(),
+		m_fontglyphs(),
+		m_fontsize() {
 	}
 
-	bool GUIManager::onSdlEvent(SDL_Event& evt) {
-		if (!m_input) {
-			FL_WARN(_log, "GUIManager, GuichanGUI->getInput == 0 ... discarding events!");
-			return false;
-		}
-
-		switch(evt.type) {
-			case SDL_MOUSEBUTTONDOWN:
-			case SDL_MOUSEBUTTONUP:
-				if( m_gcn_topcontainer->getWidgetAt(evt.button.x,evt.button.y) ) {
-					m_input->pushInput(evt);
-					return true;
-				}
-				m_focushandler->focusNone();
-				return false;
-
-			case SDL_MOUSEMOTION:
-				if( m_gcn_topcontainer->getWidgetAt(evt.button.x,evt.button.y) ) {
-					m_had_mouse = true;
-					m_input->pushInput(evt);
-					return true;
-				}
-				if( m_had_mouse ) {
-					// We only keep the mouse if a widget/window has requested
-					// dragging.
-					m_had_mouse = bool(m_focushandler->getDraggedWidget());
-					m_input->pushInput(evt);
-					return true;
-				}
-				return false;
-
-			case SDL_KEYDOWN:
-			case SDL_KEYUP:
-				if(m_focushandler->getFocused()) {
-					m_input->pushInput(evt);
-					return true;
-				}
-				return false;
-
-			case SDL_ACTIVEEVENT:
-				// Actually Guichan doesn't care (it should!)
-				// so at least don't swallow mouse_focus events up.
-				return false;
-
-			default:
-				return false;
-		}
+	GuiManager::~GuiManager() {
+		delete m_console;
 	}
 
-	void GUIManager::resizeTopContainer(unsigned int x, unsigned int y, unsigned int width, unsigned int height) {
-		m_gcn_topcontainer->setDimension(gcn::Rectangle(x, y, width, height));
-	}
-
-	gcn::Gui* GUIManager::getGuichanGUI() const {
-		return m_gcn_gui;
-	}
-
-	void GUIManager::add(gcn::Widget* widget) {
-		if( !m_widgets.count(widget) ) {
-			m_gcn_topcontainer->add(widget);
-			m_widgets.insert(widget);
-		}
-	}
-
-	void GUIManager::remove(gcn::Widget* widget) {
-		if( m_widgets.count(widget) ) {
-			m_widgets.erase(widget);
-			m_gcn_topcontainer->remove(widget);
-		}
-	}
-
-	void GUIManager::init(gcn::Graphics* graphics, int screenWidth, int screenHeight) {
-		m_gcn_gui->setGraphics(graphics);
-		resizeTopContainer(0, 0, screenWidth, screenHeight);
+	void GuiManager::init(RenderBackend* render_backend, int screenWidth,
+			int screenHeight) {
 		m_console = new Console();
 	}
 
-	GuiFont* GUIManager::createFont(const std::string& path, unsigned int size, const std::string& glyphs) {
-		std::string fontpath = path;
-		std::string fontglyphs = glyphs;
-		int fontsize = size;
-
-		// Set default settings if necessary
-		if(fontpath == "") {
-			fontpath = m_fontpath;
-		}
-		if(fontsize == 0) {
-			fontsize = m_fontsize;
-		}
-		if(fontglyphs == "") {
-			fontglyphs = m_fontglyphs;
-		}
-
-		AbstractFont* font = NULL;
-		GuiFont* guifont = NULL;
-		if( boost::filesystem::extension(fontpath) == ".ttf" ) {
-			font = new TrueTypeFont(fontpath, fontsize);
+	void GuiManager::toggleConsole() {
+		if (m_console_visible) {
+			hideConsole();
 		} else {
-			font = new SubImageFont(fontpath, fontglyphs, m_pool);
-		}
-		guifont = new GuiFont(font);
-
-		m_fonts.push_back(guifont);
-		return guifont;
-	}
-
-	void GUIManager::releaseFont(GuiFont* font) {
-		std::vector<GuiFont*>::iterator i = m_fonts.begin();
-		while (i != m_fonts.end()) {
-			if ((*i) == font) {
-				m_fonts.erase(i);
-				delete font;
-				return;
-			}
-			++i;
-		}
-	}
-
-	void GUIManager::invalidateFonts() {
-		std::vector<GuiFont*>::iterator it = m_fonts.begin();
-		while (it != m_fonts.end()) {
-			(*it)->invalidate();
-			++it;
+			showConsole();
 		}
 	}
 
-	GuiFont* GUIManager::setDefaultFont(const std::string& path, unsigned int size, const std::string& glyphs) {
-		m_fontpath = path;
-		m_fontsize = size;
-		m_fontglyphs = glyphs;
-
-		GuiFont* defaultfont = createFont();
-		gcn::Widget::setGlobalFont(defaultfont);
-		if (m_console) {
-			m_console->reLayout();
-		}
-
-		return defaultfont;
-	}
-
-	void GUIManager::turn() {
-		if (!m_logic_executed)
-			m_gcn_gui->logic();
-		m_logic_executed = false;
-		m_gcn_gui->draw();
-	}
-
-	KeyEvent GUIManager::translateKeyEvent(const gcn::KeyEvent& gcnevt) {
-		KeyEvent keyevt;
-		if(gcnevt.getType() == gcn::KeyEvent::PRESSED)
-			keyevt.setType(KeyEvent::PRESSED);
-		else if(gcnevt.getType() == gcn::KeyEvent::RELEASED)
-			keyevt.setType(KeyEvent::RELEASED);
-		else
-			throw EventException("Invalid event type in fillKeyEvent");
-		keyevt.setShiftPressed(gcnevt.isShiftPressed());
-		keyevt.setControlPressed(gcnevt.isControlPressed());
-		keyevt.setAltPressed(gcnevt.isAltPressed());
-		keyevt.setMetaPressed(gcnevt.isMetaPressed());
-		keyevt.setNumericPad(gcnevt.isNumericPad());
-
-		// Convert from guichan keyval to FIFE keyval
-		int keyval = gcnevt.getKey().getValue();
-		keyval = convertGuichanKeyToFifeKey(keyval);
-
-		keyevt.setKey(Key(static_cast<Key::KeyType>(keyval), keyval));
+	GuiFont* GuiManager::createFont(const std::string& path, unsigned int size,
+				const std::string& glyphs) {
+			std::string fontpath = path;
+			std::string fontglyphs = glyphs;
+			int fontsize = size;
 
-		return keyevt;
-	}
-
-	MouseEvent GUIManager::translateMouseEvent(const gcn::MouseEvent& gcnevt) {
-		MouseEvent mouseevt;
-		mouseevt.setShiftPressed(gcnevt.isShiftPressed());
-		mouseevt.setControlPressed(gcnevt.isControlPressed());
-		mouseevt.setAltPressed(gcnevt.isAltPressed());
-		mouseevt.setMetaPressed(gcnevt.isMetaPressed());
-		mouseevt.setX(gcnevt.getX());
-		mouseevt.setY(gcnevt.getY());
+			// Set default settings if necessary
+			if (fontpath == "") {
+				fontpath = m_fontpath;
+			}
+			if (fontsize == 0) {
+				fontsize = m_fontsize;
+			}
+			if (fontglyphs == "") {
+				fontglyphs = m_fontglyphs;
+			}
 
-		switch(gcnevt.getType()) {
-			case gcn::MouseEvent::PRESSED:
-				mouseevt.setType(MouseEvent::PRESSED);
-				break;
-			case gcn::MouseEvent::RELEASED:
-				mouseevt.setType(MouseEvent::RELEASED);
-				break;
-			case gcn::MouseEvent::MOVED:
-				mouseevt.setType(MouseEvent::MOVED);
-				break;
-			case gcn::MouseEvent::CLICKED:
-				mouseevt.setType(MouseEvent::CLICKED);
-				break;
-			case gcn::MouseEvent::ENTERED:
-				mouseevt.setType(MouseEvent::ENTERED);
-				break;
-			case gcn::MouseEvent::EXITED:
-				mouseevt.setType(MouseEvent::EXITED);
-				break;
-			case gcn::MouseEvent::DRAGGED:
-				mouseevt.setType(MouseEvent::DRAGGED);
-				break;
-			case gcn::MouseEvent::WHEEL_MOVED_DOWN:
-				mouseevt.setType(MouseEvent::WHEEL_MOVED_DOWN);
-				break;
-			case gcn::MouseEvent::WHEEL_MOVED_UP:
-				mouseevt.setType(MouseEvent::WHEEL_MOVED_UP);
-				break;
-			default:
-				mouseevt.setType(MouseEvent::UNKNOWN_EVENT);
+			AbstractFont* font = NULL;
+			GuiFont* guifont = NULL;
+			if (boost::filesystem::extension(fontpath) == ".ttf") {
+				font = new TrueTypeFont(fontpath, fontsize);
+			} else {
+				font = new SubImageFont(fontpath, fontglyphs, m_image_pool);
+			}
+			guifont = new GuiFont(font);
+
+			m_fonts.push_back(guifont);
+			return guifont;
 		}
 
-		switch(gcnevt.getButton()) {
-			case gcn::MouseInput::LEFT:
-				mouseevt.setButton(MouseEvent::LEFT);
-				break;
-			case gcn::MouseInput::RIGHT:
-				mouseevt.setButton(MouseEvent::RIGHT);
-				break;
-			case gcn::MouseInput::MIDDLE:
-				mouseevt.setButton(MouseEvent::MIDDLE);
-				break;
-			default:
-				mouseevt.setButton(MouseEvent::UNKNOWN_BUTTON);
-				break;
-		}
-		return mouseevt;
-	}
-
-
-	int GUIManager::convertGuichanKeyToFifeKey(int value) {
-
-		switch (value) {
-			case gcn::Key::TAB:
-				value = Key::TAB;
-				break;
-			case gcn::Key::LEFT_ALT:
-				value = Key::LEFT_ALT;
-				break;
-			case gcn::Key::RIGHT_ALT:
-				value = Key::RIGHT_ALT;
-				break;
-			case gcn::Key::LEFT_SHIFT:
-				value = Key::LEFT_SHIFT;
-				break;
-			case gcn::Key::RIGHT_SHIFT:
-				value = Key::RIGHT_SHIFT;
-				break;
-			case gcn::Key::LEFT_CONTROL:
-				value = Key::LEFT_CONTROL;
-				break;
-			case gcn::Key::RIGHT_CONTROL:
-				value = Key::RIGHT_CONTROL;
-				break;
-			case gcn::Key::BACKSPACE:
-				value = Key::BACKSPACE;
-				break;
-			case gcn::Key::PAUSE:
-				value = Key::PAUSE;
-				break;
-			case gcn::Key::SPACE:
-				value = Key::SPACE;
-				break;
-			case gcn::Key::ESCAPE:
-				value = Key::ESCAPE;
-				break;
-			case gcn::Key::DELETE:
-				value = Key::DELETE;
-				break;
-			case gcn::Key::INSERT:
-				value = Key::INSERT;
-				break;
-			case gcn::Key::HOME:
-				value = Key::HOME;
-				break;
-			case gcn::Key::END:
-				value = Key::END;
-				break;
-			case gcn::Key::PAGE_UP:
-				value = Key::PAGE_UP;
-				break;
-			case gcn::Key::PRINT_SCREEN:
-				value = Key::PRINT_SCREEN;
-				break;
-			case gcn::Key::PAGE_DOWN:
-				value = Key::PAGE_DOWN;
-				break;
-			case gcn::Key::F1:
-				value = Key::F1;
-				break;
-			case gcn::Key::F2:
-				value = Key::F2;
-				break;
-			case gcn::Key::F3:
-				value = Key::F3;
-				break;
-			case gcn::Key::F4:
-				value = Key::F4;
-				break;
-			case gcn::Key::F5:
-				value = Key::F5;
-				break;
-			case gcn::Key::F6:
-				value = Key::F6;
-				break;
-			case gcn::Key::F7:
-				value = Key::F7;
-				break;
-			case gcn::Key::F8:
-				value = Key::F8;
-				break;
-			case gcn::Key::F9:
-				value = Key::F9;
-				break;
-			case gcn::Key::F10:
-				value = Key::F10;
-				break;
-			case gcn::Key::F11:
-				value = Key::F11;
-				break;
-			case gcn::Key::F12:
-				value = Key::F12;
-				break;
-			case gcn::Key::F13:
-				value = Key::F13;
-				break;
-			case gcn::Key::F14:
-				value = Key::F14;
-				break;
-			case gcn::Key::F15:
-				value = Key::F15;
-				break;
-			case gcn::Key::NUM_LOCK:
-				value = Key::NUM_LOCK;
-				break;
-			case gcn::Key::CAPS_LOCK:
-				value = Key::CAPS_LOCK;
-				break;
-			case gcn::Key::SCROLL_LOCK:
-				value = Key::SCROLL_LOCK;
-				break;
-			case gcn::Key::RIGHT_META:
-				value = Key::RIGHT_META;
-				break;
-			case gcn::Key::LEFT_META:
-				value = Key::LEFT_META;
-				break;
-			case gcn::Key::LEFT_SUPER:
-				value = Key::LEFT_SUPER;
-				break;
-			case gcn::Key::RIGHT_SUPER:
-				value = Key::RIGHT_SUPER;
-				break;
-			case gcn::Key::ALT_GR:
-				value = Key::ALT_GR;
-				break;
-			case gcn::Key::UP:
-				value = Key::UP;
-				break;
-			case gcn::Key::DOWN:
-				value = Key::DOWN;
-				break;
-			case gcn::Key::LEFT:
-				value = Key::LEFT;
-				break;
-			case gcn::Key::RIGHT:
-				value = Key::RIGHT;
-				break;
-			case gcn::Key::ENTER:
-				value = Key::ENTER;
-				break;
-
-			default:
-				// Convert from unicode to lowercase letters
-				if (value >= 1 && value <= 26) {
-					// Control characters
-					value = value - 1 + 'a';
-				} else if (value >= 'A' && value <= 'Z') {
-					value = value - 'A' + 'a';
+		void GuiManager::releaseFont(GuiFont* font) {
+			std::vector<GuiFont*>::iterator i = m_fonts.begin();
+			while (i != m_fonts.end()) {
+				if ((*i) == font) {
+					m_fonts.erase(i);
+					delete font;
+					return;
 				}
-
-				// FIXME: Accented characters (á) will not get converted properly.
-				break;
+				++i;
+			}
 		}
 
-		return value;
-	}
+		void GuiManager::invalidateFonts() {
+			std::vector<GuiFont*>::iterator it = m_fonts.begin();
+			while (it != m_fonts.end()) {
+				(*it)->invalidate();
+				++it;
+			}
+		}
+
+		GuiFont* GuiManager::setDefaultFont(const std::string& path,
+				unsigned int size, const std::string& glyphs) {
+			m_fontpath = path;
+			m_fontsize = size;
+			m_fontglyphs = glyphs;
+
+			GuiFont* defaultfont = createFont();
+			return defaultfont;
+		}
 }
--- a/engine/core/gui/guimanager.h	Fri Jun 10 23:37:46 2011 -1000
+++ b/engine/core/gui/guimanager.h	Sat Jun 18 00:28:40 2011 -1000
@@ -19,14 +19,12 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
  ***************************************************************************/
 
-#ifndef FIFE_VIDEO_GUI_GUIMANAGER_H
-#define FIFE_VIDEO_GUI_GUIMANAGER_H
+#ifndef FIFE_GUI_GUIMANAGER_H
+#define FIFE_GUI_GUIMANAGER_H
 
 // Standard C++ library includes
-#include <set>
 
 // 3rd party library includes
-#include <guichan.hpp>
 
 // FIFE includes
 // These includes are split up in two parts, separated by one empty line
@@ -34,151 +32,111 @@
 // Second block: files included from the same folder
 #include "util/base/singleton.h"
 #include "eventchannel/sdl/ec_isdleventlistener.h"
-// #include "eventchannel/mouse/ec_imouselistener.h"
-// #include "eventchannel/key/ec_ikeylistener.h"
-
-namespace gcn {
-
-	class Gui;
-	class Container;
-	class Widget;
-	class SDLInput;
-	class FocusHandler;
-
-}
-
 
 namespace FIFE {
-
 	class ImagePool;
+	class RenderBackend;
 	class GuiImageLoader;
 	class Console;
-	class KeyEvent;
-	class MouseEvent;
-	class AbstractFont;
 	class GuiFont;
 
-	/* GUI Manager.
-	 *
-	 * This class controls the GUI system in FIFE.
-	 */
-	class GUIManager :
-		public DynamicSingleton<GUIManager>,
-		public ISdlEventListener
-		 {
-		public:
-			/** Constructor.
-			 */
-			GUIManager(ImagePool& pool);
-			/** Destructor.
-			 */
-			virtual ~GUIManager();
+	class GuiManager:
+			public ISdlEventListener {
+	public:
+		/** Constructor.
+		 */
+		GuiManager(ImagePool& pool);
 
-			/** Gets the member pointer to the Guichan GUI.
-			 *
-			 * @return The member pointer to the Guichan GUI.
-			 */
-			gcn::Gui* getGuichanGUI() const;
+		/** Destructor.
+		 */
+		virtual ~GuiManager();
 
-			/** Performs the GUI logic and draws the GUI accordingly.
-			 *
-			 * This will be called each frame.
-			 */
-			void turn();
+		/** Performs the GUI logic and draws the GUI accordingly.
+		 *
+		 * This will be called each frame.
+		 */
+		virtual void turn() = 0;
 
-			/** Inits the GUI Manager.
-			 * @param graphics backend specific grapchics object to use
-			 * @param screenWidth width for the gui top container
-			 * @param screenHeight height for the gui top container
-			 */
-			void init(gcn::Graphics* graphics, int screenWidth, int screenHeight);
-
-			/** Resizes the top container.
-			 *
-			 * @param x The new starting X coordinate.
-			 * @param y The new starting Y coordinate.
-			 * @param width The new width.
-			 * @param height The new height.
-			 */
-			void resizeTopContainer(unsigned int x, unsigned int y, unsigned int width, unsigned int height);
+		/** Inits the GUI Manager.
+		 * @param graphics backend specific graphics object to use
+		 * @param screenWidth width for the gui top container
+		 * @param screenHeight height for the gui top container
+		 */
+		virtual void init(RenderBackend* render_backend, int screenWidth,
+				int screenHeight);
 
-			/** Adds a new widget.
-			 *
-			 * @param A pointer to the widget to add.
-			 */
-			void add(gcn::Widget* widget);
-			/** Removes a widget.
-			 *
-			 * @param A pointer to the widget to remove.
-			 */
-			void remove(gcn::Widget* widget);
-			/** Gets the top container.
-			 *
-			 * @return The top container.
-			 */
-			gcn::Container* getTopContainer() const { return m_gcn_topcontainer; }
+		/** Resizes the top container.
+		 *
+		 * @param x The new starting X coordinate.
+		 * @param y The new starting Y coordinate.
+		 * @param width The new width.
+		 * @param height The new height.
+		 */
+		virtual void resize(unsigned int x, unsigned int y, unsigned int width,
+				unsigned int height) = 0;
+
+		/** Gets the console.
+		 *
+		 * @return The console.
+		 */
+		Console* getConsole() const {
+			return m_console;
+		}
+
+		/** Display the in-game FIFE console. */
+		virtual void showConsole() = 0;
+
+		/** Hide the in-game FIFE console. */
+		virtual void hideConsole() = 0;
 
-			/** Gets the console.
-			 *
-			 * @return The console.
-			 */
-			Console* getConsole() const { return m_console; };
+		/** Toggle the visibility of the in-game FIFE console. */
+		virtual void toggleConsole();
 
-			/** Set the global font properties.
-			 */
-			GuiFont* setDefaultFont(const std::string& path, unsigned int size, const std::string& glyphs);
-
-			/** Gets font with given properties. Note that font will be owned by guimanager
-			 */
-			GuiFont* createFont(const std::string& path = "", unsigned int size = 0, const std::string& glyphs = "");
+		/** Gets the shared ImagePool instance.
+		 *
+		 * @return The ImagePool instance.
+		 */
+		ImagePool& getImagePool() const {
+			return m_image_pool;
+		}
 
-			/** Releases given font.
-			 */
-			void releaseFont(GuiFont* font);
-
-			void invalidateFonts();
+		virtual bool onSdlEvent(SDL_Event& evt) = 0;
 
-			bool onSdlEvent(SDL_Event& evt);
+		/** Set the global font properties.
+		 */
+		virtual GuiFont* setDefaultFont(const std::string& path,
+				unsigned int size, const std::string& glyphs);
 
-			KeyEvent translateKeyEvent(const gcn::KeyEvent& evt);
-			MouseEvent translateMouseEvent(const gcn::MouseEvent& evt);
-
-		protected:
-			static int convertGuichanKeyToFifeKey(int value);
+		/** Gets font with given properties. Note that font will be owned by
+		 *  guimanager
+		 */
+		virtual GuiFont* createFont(const std::string& path = "",
+				unsigned int size = 0, const std::string& glyphs = "");
 
-		private:
-			// The Guichan GUI.
-			gcn::Gui* m_gcn_gui;
-			// Focus handler for input management
-			gcn::FocusHandler* m_focushandler;
-			// The top container of the GUI.
-			gcn::Container* m_gcn_topcontainer;
-			// The imageloader.
-			GuiImageLoader* m_imgloader;
-			// The input controller.
-			gcn::SDLInput *m_input;
-			// The console.
-			Console       *m_console;
-			// The fonts used
-			std::vector<GuiFont*> m_fonts;
-			// Added widgets
-			std::set<gcn::Widget*> m_widgets;
+		/** Releases given font.
+		 */
+		virtual void releaseFont(GuiFont* font);
+
+		virtual void invalidateFonts();
+
+	protected:
+		// Whether the console is visible.
+		bool m_console_visible;
 
-			// Used to accept mouse motion events that leave widget space
-			bool m_had_mouse;
+	private:
+		// pool used for images
+		ImagePool& m_image_pool;
 
-			// pool used for images
-			ImagePool& m_pool;
+		// The console.
+		Console* m_console;
 
-			// default font settings
-			std::string m_fontpath;
-			std::string m_fontglyphs;
-			int m_fontsize;
-
-			// true, if guichan logic has already been executed for this round
-			bool m_logic_executed;
+		// The fonts used
+		std::vector<GuiFont*> m_fonts;
+		// default font settings
+		std::string m_fontpath;
+		std::string m_fontglyphs;
+		int m_fontsize;
 	};
-
 }
 
 #endif
--- a/engine/core/gui/guimanager.i	Fri Jun 10 23:37:46 2011 -1000
+++ b/engine/core/gui/guimanager.i	Sat Jun 18 00:28:40 2011 -1000
@@ -25,25 +25,81 @@
 #include "gui/guimanager.h"
 %}
 
-namespace gcn {
-	class Widget;
-}
 namespace FIFE {
+	class ImagePool;
 	class Console;
 	
-	%feature("notabstract") GUIManager;
-	class GUIManager {
+	class GuiManager {
 	public:
-		Console* getConsole() const;
-		void add(gcn::Widget* widget);
-		void remove(gcn::Widget* widget);
-		GuiFont* createFont(const std::string& path, unsigned int size, const std::string& glyphs);
-		void releaseFont(GuiFont* font);
+		/** Constructor.
+		 */
+		GuiManager(ImagePool& pool);
+
+		/** Destructor.
+		 */
+		virtual ~GuiManager();
+
+		/** Performs the GUI logic and draws the GUI accordingly.
+		 *
+		 * This will be called each frame.
+		 */
+		virtual void turn() = 0;
+
+		/** Inits the GUI Manager.
+		 * @param graphics backend specific graphics object to use
+		 * @param screenWidth width for the gui top container
+		 * @param screenHeight height for the gui top container
+		 */
+		virtual void init(RenderBackend* render_backend, int screenWidth,
+				int screenHeight);
+
+		/** Resizes the top container.
+		 *
+		 * @param x The new starting X coordinate.
+		 * @param y The new starting Y coordinate.
+		 * @param width The new width.
+		 * @param height The new height.
+		 */
+		virtual void resize(unsigned int x, unsigned int y, unsigned int width,
+				unsigned int height) = 0;
 
-		KeyEvent translateKeyEvent(const gcn::KeyEvent& evt);
-		MouseEvent translateMouseEvent(const gcn::MouseEvent& evt);
+		/** Gets the console.
+		 *
+		 * @return The console.
+		 */
+		Console* getConsole() const {
+			return m_console;
+		}
+
+		/** Display the in-game FIFE console. */
+		virtual void showConsole() = 0;
+
+		/** Hide the in-game FIFE console. */
+		virtual void hideConsole() = 0;
+
+		/** Toggle the visibility of the in-game FIFE console. */
+		virtual void toggleConsole();
+
+		/** Gets the shared ImagePool instance.
+		 *
+		 * @return The ImagePool instance.
+		 */
+		ImagePool& getImagePool() const {
+			return m_image_pool;
+		}
+
+		virtual bool onSdlEvent(SDL_Event& evt) = 0;
+
+		GuiFont* setDefaultFont(const std::string& path, unsigned int size,
+				const std::string& glyphs);
+		GuiFont* createFont(const std::string& path = "",
+				unsigned int size = 0, const std::string& glyphs = "");
+		void releaseFont(GuiFont* font);
+		void invalidateFonts();
+
+	protected:
+		// Whether the console is visible.
+		bool m_console_visible;
 		
-	private:
-		GUIManager();
 	};
 }
--- a/engine/core/gui/widgets/clicklabel.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-// Standard C++ library includes
-#include <cassert>
-
-// 3rd party library includes
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "gui/base/gui_font.h" 
-#include "util/base/exception.h"
-#include "video/image.h" 
-
-#include "clicklabel.h"
-
-namespace gcn {
-	ClickLabel::ClickLabel()  {
-		mGuiFont = static_cast<FIFE::GuiFont*> (getFont());
-// 		setAlignment(Graphics::LEFT);
-		setTextWrapping(false);
-		setFrameSize(0);
-		addMouseListener(this);
-		addKeyListener(this);
-		addFocusListener(this);
-
-	}
-	
-	ClickLabel::ClickLabel(const std::string& caption) {
-		mGuiFont = static_cast<FIFE::GuiFont*> (getFont());
-// 		setAlignment(Graphics::LEFT);
-		setTextWrapping(false);
-		setCaption(caption);
-		setFrameSize(0);
-		addMouseListener(this);
-		addKeyListener(this);
-		addFocusListener(this);
-
-		wrapText();
-	}
-	
-	ClickLabel::~ClickLabel() {
-	}
-	
-	void ClickLabel::setCaption(const std::string& caption) {
-		mCaption = caption;
-		mGuiFont = static_cast<FIFE::GuiFont*> (getFont());
-		wrapText();
-	}
-
-	const std::string& ClickLabel::getCaption() const {
-		return mCaption;
-	}
-
-	void ClickLabel::setWidth(int width) {
-		Widget::setWidth(width);
-		wrapText();
-	}
-	
-	void ClickLabel::draw(Graphics* graphics) {
-
-		if (mGuiFont != static_cast<FIFE::GuiFont*> (getFont())) {
-			mGuiFont = static_cast<FIFE::GuiFont*> (getFont());
-			wrapText();
-			adjustSize();
-		}
-
-		int textX = 0;
-		int textY = 0;
-
-		graphics->setColor(getBackgroundColor());
-		graphics->fillRectangle(Rectangle(1, 1, getDimension().width-1, getHeight() - 1));
-		if (mGuiFont) {
-			if( isTextWrapping() ) {
-				mGuiFont->drawMultiLineString(graphics, mWrappedText, textX, textY);
-			} else {
-				mGuiFont->drawMultiLineString(graphics, mCaption, textX, textY);
-			}
-		}
-	}
-
-	void ClickLabel::setTextWrapping(bool textWrapping) {
-		bool wrappingEnabled = !mTextWrapping && textWrapping;
-		mTextWrapping = textWrapping;
-		if (wrappingEnabled) {
-			wrapText();
-		}
-	}
-
-	bool ClickLabel::isTextWrapping() const {
-		return mTextWrapping;
-	}
-
-	void  ClickLabel::adjustSize() {
-		if (mGuiFont) {
-			FIFE::Image* image;
-			if( isTextWrapping() ) {
-				image = mGuiFont->getAsImageMultiline(mWrappedText);
-			} else {
-				image = mGuiFont->getAsImageMultiline(mCaption);
-			}
-			setWidth( image->getWidth() );
-			setHeight( image->getHeight() );
-		}
-	}
-
-	void ClickLabel::wrapText() {
-		if( isTextWrapping() && mGuiFont ) {
-			mWrappedText = mGuiFont->splitTextToWidth(mCaption,getWidth());
-		}
-	}
-
-
-	void ClickLabel::mousePressed(MouseEvent& mouseEvent)
-	{
-		if (mouseEvent.getButton() == MouseEvent::LEFT) {
-			mMousePressed = true;
-			mouseEvent.consume();
-		}
-	}
-	
-	void ClickLabel::mouseExited(MouseEvent& mouseEvent)
-	{
-		mHasMouse = false;
-	}
-	
-	void ClickLabel::mouseEntered(MouseEvent& mouseEvent)
-	{
-		mHasMouse = true;
-	}
-	
-	void ClickLabel::mouseReleased(MouseEvent& mouseEvent)
-	{
-		if (mouseEvent.getButton() == MouseEvent::LEFT && mMousePressed && mHasMouse) {
-			mMousePressed = false;
-			distributeActionEvent();
-			mouseEvent.consume();
-		} else if (mouseEvent.getButton() == MouseEvent::LEFT) {
-			mMousePressed = false;
-			mouseEvent.consume();
-		}
-	}
-	
-	void ClickLabel::mouseDragged(MouseEvent& mouseEvent)
-	{
-		mouseEvent.consume();
-	}
-	
-	void ClickLabel::keyPressed(KeyEvent& keyEvent)
-	{
-		Key key = keyEvent.getKey();
-	
-		if (key.getValue() == Key::ENTER || key.getValue() == Key::SPACE) {
-			mKeyPressed = true;
-			keyEvent.consume();
-		}
-	}
-	
-	void ClickLabel::keyReleased(KeyEvent& keyEvent)
-	{
-		Key key = keyEvent.getKey();
-	
-		if ((key.getValue() == Key::ENTER || key.getValue() == Key::SPACE) && mKeyPressed) {
-			mKeyPressed = false;
-			distributeActionEvent();
-			keyEvent.consume();
-		}
-	}
-	
-	void ClickLabel::focusLost(const Event& event)
-	{
-		mMousePressed = false;
-		mKeyPressed = false;
-	}
-}
--- a/engine/core/gui/widgets/clicklabel.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef FIFE_GUI_WIDGETS_CLICKLABEL_H
-#define FIFE_GUI_WIDGETS_CLICKLABEL_H
-
-// Standard C++ library includes
-#include <string>
-
-// 3rd party library includes
-#include <guichan.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-
-namespace FIFE {
-	class GuiFont;
-}
-
-namespace gcn {
-	
-	class ClickLabel : public Widget, public MouseListener, public KeyListener, public FocusListener {
-	public:
-		ClickLabel();
-		ClickLabel(const std::string& caption);
-		virtual ~ClickLabel();
-
-		virtual void setWidth(int width);
-		virtual void setCaption(const std::string& caption);
-		virtual const std::string& getCaption() const;
-
-		virtual void draw(Graphics* graphics);
-
-		virtual void adjustSize();
-
-		void setTextWrapping(bool);
-		bool isTextWrapping() const;
-
-		// Inherited from FocusListener
-	
-		virtual void focusLost(const Event& event);
-	
-	
-		// Inherited from MouseListener
-	
-		virtual void mousePressed(MouseEvent& mouseEvent);
-	
-		virtual void mouseReleased(MouseEvent& mouseEvent);
-	
-		virtual void mouseEntered(MouseEvent& mouseEvent);
-	
-		virtual void mouseExited(MouseEvent& mouseEvent);
-	
-		virtual void mouseDragged(MouseEvent& mouseEvent);
-	
-	
-		// Inherited from KeyListener
-	
-		virtual void keyPressed(KeyEvent& keyEvent);
-	
-		virtual void keyReleased(KeyEvent& keyEvent);
-
-	protected:
-		void wrapText();
-
-		FIFE::GuiFont* mGuiFont;
-		bool mTextWrapping;
-		std::string mCaption;
-		std::string mWrappedText;
-
-		bool mHasMouse;
-		bool mKeyPressed;
-		bool mMousePressed;
-	};
-}
-
-#endif
-/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- a/engine/core/gui/widgets/icon2.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-/*      _______   __   __   __   ______   __   __   _______   __   __                 
- *     / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___  /\ /  |\/ /\                
- *    / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /                 
- *   / / /__   / / // / // / // / /    / ___  / // ___  / // /| ' / /                  
- *  / /_// /\ / /_// / // / // /_/_   / / // / // /\_/ / // / |  / /                   
- * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /                    
- * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/                      
- *
- * Copyright (c) 2004, 2005 darkbits                        Js_./
- * Per Larsson a.k.a finalman                          _RqZ{a<^_aa
- * Olof Naess�n a.k.a jansem/yakslem                _asww7!uY`>  )\a//
- *                                                 _Qhm`] _f "'c  1!5m
- * Visit: http://guichan.darkbits.org             )Qk<P ` _: :+' .'  "{[
- *                                               .)j(] .d_/ '-(  P .   S
- * License: (BSD)                                <Td/Z <fP"5(\"??"\a.  .L
- * Redistribution and use in source and          _dV>ws?a-?'      ._/L  #'
- * binary forms, with or without                 )4d[#7r, .   '     )d`)[
- * modification, are permitted provided         _Q-5'5W..j/?'   -?!\)cam'
- * that the following conditions are met:       j<<WP+k/);.        _W=j f
- * 1. Redistributions of source code must       .$%w\/]Q  . ."'  .  mj$
- *    retain the above copyright notice,        ]E.pYY(Q]>.   a     J@\
- *    this list of conditions and the           j(]1u<sE"L,. .   ./^ ]{a
- *    following disclaimer.                     4'_uomm\.  )L);-4     (3=
- * 2. Redistributions in binary form must        )_]X{Z('a_"a7'<a"a,  ]"[
- *    reproduce the above copyright notice,       #}<]m7`Za??4,P-"'7. ).m
- *    this list of conditions and the            ]d2e)Q(<Q(  ?94   b-  LQ/
- *    following disclaimer in the                <B!</]C)d_, '(<' .f. =C+m
- *    documentation and/or other materials      .Z!=J ]e []('-4f _ ) -.)m]'
- *    provided with the distribution.          .w[5]' _[ /.)_-"+?   _/ <W"
- * 3. Neither the name of Guichan nor the      :$we` _! + _/ .        j?
- *    names of its contributors may be used     =3)= _f  (_yQmWW$#(    "
- *    to endorse or promote products derived     -   W,  sQQQQmZQ#Wwa]..
- *    from this software without specific        (js, \[QQW$QWW#?!V"".
- *    prior written permission.                    ]y:.<\..          .
- *                                                 -]n w/ '         [.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT       )/ )/           !
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY         <  (; sac    ,    '
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,               ]^ .-  %
- * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF            c <   r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR            aga<  <La
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE          5%  )P'-3L
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR        _bQf` y`..)a
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          ,J?4P'.P"_(\?d'.,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES               _Pa,)!f/<[]/  ?"
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT      _2-..:. .r+_,.. .
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     ?a.<%"'  " -'.a_ _,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION)                     ^
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * For comments regarding functions please see the header file. 
- */
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/rectangle.hpp>
-#include <guichan/graphics.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "icon2.hpp"
-
-namespace gcn
-{
-
-    Icon2::Icon2(Image* image)
-    {
-        mImage = image;
-        if( mImage ) {
-            setHeight(image->getHeight());
-            setWidth(image->getWidth());
-        }
-    }
-
-    void Icon2::draw(Graphics* graphics)
-    {
-        if ( mImage )
-            graphics->drawImage(mImage, 0, 0);
-
-    }
-
-    void Icon2::drawFrame(Graphics* graphics)
-    {
-        Color faceColor = getBaseColor();
-        Color highlightColor, shadowColor;
-        int alpha = getBaseColor().a;
-        int width = getWidth() + getFrameSize() * 2 - 1;
-        int height = getHeight() + getFrameSize() * 2 - 1;
-        highlightColor = faceColor + 0x303030;
-        highlightColor.a = alpha;
-        shadowColor = faceColor - 0x303030;
-        shadowColor.a = alpha;
-        
-        unsigned int i;
-        for (i = 0; i < getFrameSize(); ++i)
-        {
-            graphics->setColor(shadowColor);
-            graphics->drawLine(i,i, width - i, i);
-            graphics->drawLine(i,i + 1, i, height - i - 1);
-            graphics->setColor(highlightColor);
-            graphics->drawLine(width - i,i + 1, width - i, height - i); 
-            graphics->drawLine(i,height - i, width - i - 1, height - i); 
-        }
-    }
-
-    void Icon2::setImage(Image* image) {
-        mImage = image;
-        if( mImage ) {
-            setHeight(image->getHeight());
-            setWidth(image->getWidth());
-        }
-    }
-
-}
--- a/engine/core/gui/widgets/icon2.hpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-/*      _______   __   __   __   ______   __   __   _______   __   __                 
- *     / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___  /\ /  |\/ /\                
- *    / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /                 
- *   / / /__   / / // / // / // / /    / ___  / // ___  / // /| ' / /                  
- *  / /_// /\ / /_// / // / // /_/_   / / // / // /\_/ / // / |  / /                   
- * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /                    
- * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/                      
- *
- * Copyright (c) 2004, 2005 darkbits                        Js_./
- * Per Larsson a.k.a finalman                          _RqZ{a<^_aa
- * Olof Naess�n a.k.a jansem/yakslem                _asww7!uY`>  )\a//
- *                                                 _Qhm`] _f "'c  1!5m
- * Visit: http://guichan.darkbits.org             )Qk<P ` _: :+' .'  "{[
- *                                               .)j(] .d_/ '-(  P .   S
- * License: (BSD)                                <Td/Z <fP"5(\"??"\a.  .L
- * Redistribution and use in source and          _dV>ws?a-?'      ._/L  #'
- * binary forms, with or without                 )4d[#7r, .   '     )d`)[
- * modification, are permitted provided         _Q-5'5W..j/?'   -?!\)cam'
- * that the following conditions are met:       j<<WP+k/);.        _W=j f
- * 1. Redistributions of source code must       .$%w\/]Q  . ."'  .  mj$
- *    retain the above copyright notice,        ]E.pYY(Q]>.   a     J@\
- *    this list of conditions and the           j(]1u<sE"L,. .   ./^ ]{a
- *    following disclaimer.                     4'_uomm\.  )L);-4     (3=
- * 2. Redistributions in binary form must        )_]X{Z('a_"a7'<a"a,  ]"[
- *    reproduce the above copyright notice,       #}<]m7`Za??4,P-"'7. ).m
- *    this list of conditions and the            ]d2e)Q(<Q(  ?94   b-  LQ/
- *    following disclaimer in the                <B!</]C)d_, '(<' .f. =C+m
- *    documentation and/or other materials      .Z!=J ]e []('-4f _ ) -.)m]'
- *    provided with the distribution.          .w[5]' _[ /.)_-"+?   _/ <W"
- * 3. Neither the name of Guichan nor the      :$we` _! + _/ .        j?
- *    names of its contributors may be used     =3)= _f  (_yQmWW$#(    "
- *    to endorse or promote products derived     -   W,  sQQQQmZQ#Wwa]..
- *    from this software without specific        (js, \[QQW$QWW#?!V"".
- *    prior written permission.                    ]y:.<\..          .
- *                                                 -]n w/ '         [.
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT       )/ )/           !
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY         <  (; sac    ,    '
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,               ]^ .-  %
- * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF            c <   r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR            aga<  <La
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE          5%  )P'-3L
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR        _bQf` y`..)a
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          ,J?4P'.P"_(\?d'.,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES               _Pa,)!f/<[]/  ?"
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT      _2-..:. .r+_,.. .
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     ?a.<%"'  " -'.a_ _,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION)                     ^
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef GCN_ICON2_HPP
-#define GCN_ICON2_HPP
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/image.hpp>
-#include <guichan/platform.hpp>
-#include <guichan/widget.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-
-namespace gcn
-{
-	/**
-	* An Icon for displaying images.
-	*
-	* \note Modified for FIFE.
-	*/    
-	class Icon2 : public Widget
-	{
-	public:
-		/**
-		* Constructor.
-		*
-		* @param image an Image to display.
-		*/
-		Icon2(Image* image);
-		virtual ~Icon2() {}
-		
-		
-		// Inherited from Widget
-		
-		virtual void draw(Graphics* graphics);
-
-		virtual void drawFrame(Graphics* graphics);
-		
-		// added for FIFE
-		void setImage(Image* image);
-
-		// changed from private to allow derived instance access
-	protected:
-		Image* mImage;
-	};
-}
-
-#endif // end GCN_ICON2_HPP
--- a/engine/core/gui/widgets/percentagebar.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2010 by the FIFE team                              *
- *   http://www.fifengine.net                                              *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-/*
- * For comments regarding functions please see the header file.
- */
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/rectangle.hpp>
-#include <guichan/graphics.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "percentagebar.hpp"
-
-namespace gcn
-{
-
-    PercentageBar::PercentageBar()
-    {
-		mImage = 0;
-
-		setOrientation(HORIZONTAL);
-        setValue(0);
-    }
-
-    void PercentageBar::draw(Graphics* graphics)
-    {
-		graphics->setColor(getForegroundColor());
-
-        if (getOrientation() == HORIZONTAL)
-        {
-			graphics->fillRectangle(gcn::Rectangle(0,0,getWidth() * mValue/100,getHeight()));
-		}
-		else
-		{
-			graphics->fillRectangle(gcn::Rectangle(0,getHeight()-getHeight() * mValue/100,getWidth(),getHeight() * mValue/100));
-		}
-
-
-        if ( mImage )
-            graphics->drawImage(mImage, 0, 0);
-
-    }
-
-    void PercentageBar::setForegroundImage(Image* image)
-    {
-        mImage = image;
-        if( mImage ) {
-            setHeight(image->getHeight());
-            setWidth(image->getWidth());
-        }
-    }
-
-    void PercentageBar::setValue(int value)
-    {
-        if (value > 100)
-        {
-            mValue = 100;
-            return;
-        }
-
-        if (value < 0)
-        {
-            mValue = 0;
-            return;
-        }
-
-        mValue = value;
-    }
-
-    int PercentageBar::getValue() const
-    {
-        return mValue;
-    }
-
-    void PercentageBar::setOrientation(PercentageBar::Orientation orientation)
-	{
-	    mOrientation = orientation;
-	}
-
-	PercentageBar::Orientation PercentageBar::getOrientation() const
-	{
-	    return mOrientation;
-    }
-}
--- a/engine/core/gui/widgets/percentagebar.hpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2010 by the FIFE team                              *
- *   http://www.fifengine.net                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef GCN_PERCENTAGE_BAR_HPP
-#define GCN_PERCENTAGE_BAR_HPP
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/image.hpp>
-#include <guichan/platform.hpp>
-#include <guichan/widget.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-
-namespace gcn
-{
-	/**
-	* A simple percentage bar.
-	*
-	*
-	*/
-	class PercentageBar : public Widget
-	{
-	public:
-
-		enum Orientation
-		{
-			HORIZONTAL = 0,
-			VERTICAL
-        };
-
-		/**
-		* Constructor.
-		*
-		*/
-		PercentageBar();
-		virtual ~PercentageBar() {}
-
-
-		// Inherited from Widget
-
-		virtual void draw(Graphics* graphics);
-
-		/*
-		 * Sets the image that will be displayed above the widget
-		 *
-		 * @param image Image to be displayed
-		 */
-		void setForegroundImage(Image* image);
-
-        /**
-         * Sets the orientation of the percentage bar.
-         *
-         * @param orientation The orientation of the percentage bar.
-         * @see getOrientation
-         */
-        void setOrientation(Orientation orientation);
-
-        /**
-         * Gets the orientation of the percentage bar..
-         *
-         * @return The orientation of the percentage bar.
-         * @see setOrientation
-         */
-        Orientation getOrientation() const;
-
-        /**
-         * Gets the value of the percentage bar
-         *
-         * @return The value of the percentage bar.
-         */
-        int getValue() const;
-
-        /**
-         * Sets the value of the percentage bar
-         *
-         * @param value In the range of 0-100.
-         */
-        void setValue(int value);
-
-		// changed from private to allow derived instance access
-	protected:
-		Image* mImage;
-
-        /**
-         * Holds the current value of the percentage bar.
-         */
-        double mValue;
-
-        /**
-         * Holds the orientation of the percentage bar. A percentage bar can be drawn
-         * vertically or horizontally.
-         */
-        Orientation mOrientation;
-	};
-}
-
-#endif // end GCN_PERCENTAGE_BAR_HPP
--- a/engine/core/gui/widgets/togglebutton.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-/***************************************************************************
- * Note! Group and groupmap borrows heavily from ideas of Guichan library  *
- * version 0.8.1                                                           *
- ***************************************************************************/
-
-
-
-// Standard C++ library includes
-#include <cassert>
-
-// 3rd party library includes
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include <iostream>
-
-#include <guichan/mouseevent.hpp>
-
-#include "togglebutton.h"
-
-
-namespace gcn {
-	ToggleButton::GroupMap ToggleButton::m_groupMap;
-
-	ToggleButton::ToggleButton(Image *up_file , Image *down_file, Image *hover_file, const std::string& caption, const std::string& group): 
-		Button(),
-		m_upImage(up_file),
-		m_downImage(down_file),
-		m_hoverImage(hover_file),
-		x_downoffset(0),
-		y_downoffset(0),
-		m_group(group) {
-
-		m_hoverImage = hover_file;
-		setFrameSize(0);
-		setGroup(m_group);
-		adjustSize();
-		mCaption = caption;
-		m_toggled = false;
-
-		addActionListener(this);
-	}
-	
-	ToggleButton::~ToggleButton() {
-		setGroup(""); // Remove button from group
-	}
-	
-	void ToggleButton::setDownOffset(int x, int y) {
-		x_downoffset = x;
-		y_downoffset = y;
-	}
-	
-	void ToggleButton::draw(Graphics *graphics) {
-		Color faceColor = getBaseColor();
-        Color highlightColor;
-		Color shadowColor;
-        int alpha = getBaseColor().a;
-
-		Image* img = NULL;
-		int xoffset = 0;
-		int yoffset = 0;
-		
-		if (isPressed() || m_toggled) {
-			faceColor = faceColor - 0x303030;
-            faceColor.a = alpha;
-            highlightColor = faceColor - 0x303030;
-            highlightColor.a = alpha;
-            shadowColor = faceColor + 0x303030;
-            shadowColor.a = alpha;
-
-			if( m_downImage ) {
-				img = m_downImage;
-				xoffset = x_downoffset;
-				yoffset = y_downoffset;
-			}
-		} else if(mHasMouse) {
-			faceColor = faceColor + 0x303030;
-            faceColor.a = alpha;
-			highlightColor = faceColor + 0x303030;
-            highlightColor.a = alpha;
-            shadowColor = faceColor - 0x303030;
-            shadowColor.a = alpha;
-
-			if ( m_hoverImage ) {
-				img = m_hoverImage;
-			}
-		} else{
-			highlightColor = faceColor + 0x303030;
-            highlightColor.a = alpha;
-            shadowColor = faceColor - 0x303030;
-            shadowColor.a = alpha;
-
-			if (m_upImage) {
-				img = m_upImage;
-			}
-		}
-		
-
-		graphics->setColor(faceColor);
-        graphics->fillRectangle(Rectangle(1, 1, getDimension().width-1, getHeight() - 1));
-
-        graphics->setColor(highlightColor);
-        graphics->drawLine(0, 0, getWidth() - 1, 0);
-        graphics->drawLine(0, 1, 0, getHeight() - 1);
-
-        graphics->setColor(shadowColor);
-        graphics->drawLine(getWidth() - 1, 1, getWidth() - 1, getHeight() - 1);
-        graphics->drawLine(1, getHeight() - 1, getWidth() - 1, getHeight() - 1);
-
-        graphics->setColor(getForegroundColor());
-
-		if (img) {
-			graphics->drawImage(img, xoffset, yoffset);
-		}
-
-		int textX;
-		int textY = getHeight() / 2 - getFont()->getHeight() / 2;
-		switch (getAlignment())
-		{
-			case Graphics::LEFT:
-				textX = 4;
-				break;
-			case Graphics::CENTER:
-				textX = getWidth() / 2;
-				break;
-			case Graphics::RIGHT:
-				textX = getWidth() - 4;
-				break;
-			default:
-				throw GCN_EXCEPTION("Unknown alignment.");
-		}
-
-		graphics->setFont(getFont());
-		if (mCaption.size() > 0) {
-			if (isPressed())
-				graphics->drawText(getCaption(), textX + 1, 
-						textY + 1, getAlignment());
-			else
-				graphics->drawText(getCaption(), textX, textY, getAlignment());
-		}
-	}
-
-	void ToggleButton::action(const ActionEvent& actionEvent) {
-		setToggled(!m_toggled);
-	}
-
-	void ToggleButton::adjustSize() {
-		int w = 0;
-		int h = w;
-		if( m_upImage ) {
-			w = m_upImage->getWidth();
-			h = m_upImage->getHeight();
-		}
-		if( m_downImage ) {
-			w = std::max(m_downImage->getWidth(), w);
-			h = std::max(m_downImage->getHeight(), h);
-		}
-		if( m_hoverImage ) {
-			w = std::max(m_hoverImage->getWidth(), w);
-			h = std::max(m_hoverImage->getHeight(), h);
-		}
-
-		if( mCaption.length() > 0 ) {
-			w = std::max(static_cast<int>(getFont()->getWidth(mCaption)+2*mSpacing), w);
-			h = std::max(static_cast<int>(getFont()->getHeight()+2*mSpacing), h);
-		}
-
-		setWidth(w);
-		setHeight(h);
-	}
-
-	void ToggleButton::setUpImage(Image* image) {
-		m_upImage = image;
-		adjustSize();
-	}
-
-	void ToggleButton::setDownImage(Image* image) {
-		m_downImage = image;
-		adjustSize();
-	}
-
-	void ToggleButton::setHoverImage(Image* image) {
-		m_hoverImage = image;
-		adjustSize();
-	}
-
-	bool ToggleButton::isToggled() const {
-		return m_toggled;
-	}
-
-	void ToggleButton::setToggled(bool toggled) {
-		if (toggled && m_group != "") {
-			// untoggle all buttons in group
-			GroupIterator iter, iterEnd;
-			iterEnd = m_groupMap.upper_bound(m_group);
-
-			for (iter = m_groupMap.lower_bound(m_group); iter != iterEnd; iter++) {
-				if (iter->second->isToggled()) {
-					iter->second->setToggled(false);
-				}
-			}
-		}
-
-		m_toggled = toggled;
-	}
-
-	void ToggleButton::setGroup(const std::string &group) {
-		// Remove button from previous group
-        if (m_group != "") {
-            GroupIterator iter, iterEnd;
-            iterEnd = m_groupMap.upper_bound(m_group);
-
-            for (iter = m_groupMap.lower_bound(m_group); iter != iterEnd; iter++) {
-                if (iter->second == this) {
-                    m_groupMap.erase(iter);
-                    break;
-                }
-            }
-        }
-
-		// Add button to new group
-        if (group != "") {
-            m_groupMap.insert( std::pair<std::string, ToggleButton *>(group, this));
-        }
-
-        m_group = group;
-    }
-
-    const std::string &ToggleButton::getGroup() const {
-        return m_group;
-    }
-
-	int ToggleButton::getDownXOffset() const { 
-		return x_downoffset; 
-	}
-	
-	int ToggleButton::getDownYOffset() const { 
-		return y_downoffset; 
-	}
-
-}
-/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
-
--- a/engine/core/gui/widgets/togglebutton.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef FIFE_GUICHAN_ADDON_TOGGLEBUTTON_H
-#define FIFE_GUICHAN_ADDON_TOGGLEBUTTON_H
-
-// Standard C++ library includes
-#include <string>
-#include <map>
-
-// 3rd party library includes
-#include <guichan.hpp>
-#include <guichan/actionlistener.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-
-namespace gcn {
-	/**
-     * An implementation of a toggleable button.
-	 *
-	 * If the button is in a group, all other buttons in that group will be untoggled
-	 * when a button gets toggled. If the button is already toggled, you can untoggle 
-	 * it by clicking on it.
-	 *
-     */
-	class ToggleButton : public Button, public ActionListener {
-		public:
-			/**
-			 * Constructor
-			 *
-			 * @param up_image Image displayed when the button isn't toggled
-			 * @param down_image Image displayed when the button is toggled
-			 * @param hover_file Image displayed when the mouse cursor is over button
-			 * @param caption Text to be displayed on button
-			 * @param group The group the button belongs to
-			 */
-			ToggleButton(Image *up_image = 0, Image *down_image = 0, Image *hover_image = 0, const std::string& caption = "", const std::string& group = "");
-
-			/**
-			 * Destructor
-			 */
-			~ToggleButton();
-
-			/**
-			 * Draws the button
-			 */
-			void draw(Graphics *graphics);
-
-			/**
-			 * Adjust size to fit image and caption
-			 */
-			void adjustSize();
-
-			/**
-			 * Sets the image that will be displayed when the button isn't toggled
-			 *
-			 * @param image Image to be displayed
-			 */
-			void setUpImage(Image* image);
-
-			/**
-			 * Sets the image that will be displayed when the button is toggled or pressed
-			 *
-			 * @param image Image to be displayed
-			 */
-			void setDownImage(Image* image);
-
-			/**
-			 * Sets the image which will be displayed when the mouse cursor is over the button
-			 *
-			 * @param image Image to be displayed
-			 */
-			void setHoverImage(Image* image);
-			
-			/**
-			 * Sets the number of pixels the image or text will be offset from
-			 * the top left corner of button when the button is pressed or toggled.
-			 *
-			 * @param x Offset from left
-			 * @param y Offset from top
-			 * @see getDownXOffset
-			 * @see getDownYOffset
-			 */
-			void setDownOffset(int x, int y);
-
-			/**
-			 * Gets the number of pixels the image or text will be offset
-			 * from the left of button when the button is pressed or toggled.
-			 *
-			 * @return Offset from left when button is pressed
-			 * @see setDownOffset
-			 */
-			int getDownXOffset() const;
-
-			/**
-			 * Gets the number of pixels the image or text will be offset
-			 * from the top of button when the button is pressed or toggled.
-			 *
-			 * @return Offset from top when button is pressed
-			 * @see setDownOffset
-			 */
-			int getDownYOffset() const;
-
-			/**
-			 * Checks if the radio button is selected.
-			 *
-			 * @return True if the radio button is selecte, false otherwise.
-			 * @see setSelected
-			 */
-			bool isToggled() const;
-
-			/**
-			 * Sets the radio button to selected or not.
-			 *
-			 * @param selected True if the radio button should be selected,
-			 *                 false otherwise.
-			 * @see isSelected
-			 */
-			void setToggled(bool toggled);
-
-			// From Guichan 0.8.1
-			/**
-			 * Sets the group the toggle button should belong to. Note that
-			 * a toggle button group is unique per application, not per Gui object
-			 * as the group is stored in a static map.
-			 *
-			 * @param group The name of the group.
-			 * @see getGroup
-			 */
-			void setGroup(const std::string &group);
-
-			/**
-			 * Gets the group the toggle button belongs to.
-			 *
-			 * @return The group the toggle button belongs to.
-			 * @see setGroup
-			 */
-			const std::string &getGroup() const;
-
-		protected:
-			// Inherited from gcn::Widget
-			/**
-			 * Toggle button when it is activated
-			 *
-			 * @param actionEvent ActionEvent object
-			 */
-			void action(const ActionEvent& actionEvent);
-
-		private:
-			// Image to be used when the button is not toggle
-			Image *m_upImage;
-
-			// Image to be used when the button is toggled or pressed
-			Image *m_downImage;
-
-			// Image to be used when the mouse cursor is over the image
-			Image *m_hoverImage;
-
-			// Number of pixels the image/text will be offset from the top left
-			// corner, when the button is pressed or toggled
-			int x_downoffset;
-			int y_downoffset;
-
-			/**
-			 * Whether the button is toggled or not.
-			 */
-			bool m_toggled;			
-
-			//-- From Guichan 0.8.1 --
-			/**
-			 * Holds the group of the toggle button.
-			 */
-			std::string m_group;
-
-			/**
-			 * Typedef.
-			 */
-			typedef std::multimap<std::string, ToggleButton *> GroupMap;
-
-			/**
-			 * Typedef.
-			 */
-			typedef GroupMap::iterator GroupIterator;
-
-			/**
-			 * Holds all available toggle button groups.
-			 */
-			static GroupMap m_groupMap;
-	};
-
-}
-
-#endif
-/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- a/engine/core/gui/widgets/twobutton.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-// Standard C++ library includes
-#include <cassert>
-
-// 3rd party library includes
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-
-#include "twobutton.h"
-
-namespace gcn {
-	TwoButton::TwoButton(Image *up_file , Image *down_file, Image *hover_file, const std::string& caption): 
-		Button(),
-		m_upImage(up_file),
-		m_downImage(down_file),
-		m_hoverImage(hover_file),
-		x_downoffset(0),
-		y_downoffset(0) {
-		m_hoverImage = hover_file;
-		setFrameSize(0);
-		adjustSize();
-		mCaption = caption;
-	}
-	
-	TwoButton::~TwoButton() {
-	}
-	
-	void TwoButton::setDownOffset(int x, int y) {
-		x_downoffset = x;
-		y_downoffset = y;
-	}
-	
-	void TwoButton::draw(Graphics *graphics) {
-		Image* img = m_upImage;
-		int xoffset = 0;
-		int yoffset = 0;
-		
-		if (isPressed()) {
-			if( m_downImage ) {
-				img = m_downImage;
-				xoffset = x_downoffset;
-				yoffset = y_downoffset;
-			}
-		} else if(mHasMouse) {
-			if( m_hoverImage ) {
-				img = m_hoverImage;
-			}
-		}
-		
-		if (img) {
-			graphics->drawImage(img, xoffset, yoffset);
-		}
-
-		graphics->setColor(getForegroundColor());
-		int textX;
-		int textY = getHeight() / 2 - getFont()->getHeight() / 2;
-		switch (getAlignment())
-		{
-			case Graphics::LEFT:
-				textX = 4;
-				break;
-			case Graphics::CENTER:
-				textX = getWidth() / 2;
-				break;
-			case Graphics::RIGHT:
-				textX = getWidth() - 4;
-				break;
-			default:
-				throw GCN_EXCEPTION("Unknown alignment.");
-		}
-
-		graphics->setFont(getFont());
-		if (mCaption.size() > 0) {
-			if (isPressed())
-				graphics->drawText(getCaption(), textX + 1, 
-						textY + 1, getAlignment());
-			else
-				graphics->drawText(getCaption(), textX, textY, getAlignment());
-		}
-	}
-	void TwoButton::adjustSize() {
-		int w = 0;
-		int h = w;
-		if( m_upImage ) {
-			w = m_upImage->getWidth();
-			h = m_upImage->getHeight();
-		}
-		if( m_downImage ) {
-			w = std::max(m_downImage->getWidth(), w);
-			h = std::max(m_downImage->getHeight(), h);
-		}
-		if( m_hoverImage ) {
-			w = std::max(m_hoverImage->getWidth(), w);
-			h = std::max(m_hoverImage->getHeight(), h);
-		}
-		setWidth(w);
-		setHeight(h);
-	}
-	void TwoButton::setUpImage(Image* image) {
-		m_upImage = image;
-		adjustSize();
-	}
-	void TwoButton::setDownImage(Image* image) {
-		m_downImage = image;
-		adjustSize();
-	}
-	void TwoButton::setHoverImage(Image* image) {
-		m_hoverImage = image;
-		adjustSize();
-	}
-		
-}
-/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
-
--- a/engine/core/gui/widgets/twobutton.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef FIFE_GUICHAN_ADDON_TWOBUTTON_H
-#define FIFE_GUICHAN_ADDON_TWOBUTTON_H
-
-// Standard C++ library includes
-#include <string>
-
-// 3rd party library includes
-#include <guichan.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-
-namespace gcn {
-
-	class TwoButton;
-
-	class TwoButton : public Button {
-		public:
-			TwoButton(Image *up_image = 0, Image *down_image = 0, Image *hover_file = 0, const std::string& caption = "");
-			~TwoButton();
-			void draw(Graphics *graphics);
-			void adjustSize();
-
-			void setUpImage(Image* image);
-			void setDownImage(Image* image);
-			void setHoverImage(Image* image);
-			
-			void setDownOffset(int x, int y);
-			int getDownXOffset() { return x_downoffset; }
-			int getDownYOffset() { return y_downoffset; }
-			
-		private:
-			Image *m_upImage;
-			Image *m_downImage;
-			Image *m_hoverImage;
-			int x_downoffset;
-			int y_downoffset;
-	};
-
-}
-
-#endif
-/* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- a/engine/core/gui/widgets/utf8textbox.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,224 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2009 by the FIFE team                                   *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-// Standard C++ library includes
-#include <cassert>
-
-// 3rd party library includes
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "util/utf8/utf8.h"
-
-#include "utf8textbox.h"
-
-namespace gcn {
-
-	UTF8TextBox::UTF8TextBox(const std::string & text)
-		:TextBox(text), mStringEditor(new UTF8StringEditor())
-	{
-	}
-
-	UTF8TextBox::~ UTF8TextBox()
-	{
-		delete mStringEditor;
-	}
-
-	void UTF8TextBox::keyPressed(KeyEvent& keyEvent)
-	{
-		Key key = keyEvent.getKey();
-
-		if (key.getValue() == Key::LEFT)
-		{
-			if (mCaretColumn == 0)
-			{
-				if (mCaretRow > 0)
-				{
-					mCaretRow--;
-					mCaretColumn = mTextRows[mCaretRow].size();
-				}
-			}
-			else
-			{
-				mCaretColumn = mStringEditor->prevChar(mTextRows[mCaretRow], mCaretColumn);
-			}
-		}
-		else if (key.getValue() == Key::RIGHT)
-		{
-			if (mCaretColumn < mTextRows[mCaretRow].size())
-			{
-				mCaretColumn = mStringEditor->nextChar(mTextRows[mCaretRow], mCaretColumn);
-			}
-			else
-			{
-				if (mCaretRow < mTextRows.size() - 1)
-				{
-					mCaretRow++;
-					mCaretColumn = 0;
-				}
-			}
-		}
-		else if (key.getValue() == Key::DOWN)
-		{
-			setCaretRowUTF8(mCaretRow + 1);
-		}
-
-		else if (key.getValue() == Key::UP)
-		{
-			setCaretRowUTF8(mCaretRow - 1);
-		}
-
-		else if (key.getValue() == Key::HOME)
-		{
-			mCaretColumn = 0;
-		}
-
-		else if (key.getValue() == Key::END)
-		{
-			mCaretColumn = mTextRows[mCaretRow].size();
-		}
-
-		else if (key.getValue() == Key::ENTER && mEditable)
-		{
-			mTextRows.insert(mTextRows.begin() + mCaretRow + 1,
-								mTextRows[mCaretRow].substr(mCaretColumn, mTextRows[mCaretRow].size() - mCaretColumn));
-			mTextRows[mCaretRow].resize(mCaretColumn);
-			++mCaretRow;
-			mCaretColumn = 0;
-		}
-
-		else if (key.getValue() == Key::BACKSPACE
-					&& mCaretColumn != 0
-					&& mEditable)
-		{
-			mCaretColumn = mStringEditor->prevChar(mTextRows[mCaretRow], mCaretColumn);
-			mCaretColumn = mStringEditor->eraseChar(mTextRows[mCaretRow], mCaretColumn);
-		}
-
-		else if (key.getValue() == Key::BACKSPACE
-					&& mCaretColumn == 0
-					&& mCaretRow != 0
-					&& mEditable)
-		{
-			mCaretColumn = mTextRows[mCaretRow - 1].size();
-			mTextRows[mCaretRow - 1] += mTextRows[mCaretRow];
-			mTextRows.erase(mTextRows.begin() + mCaretRow);
-			mCaretRow--;
-		}
-
-		else if (key.getValue() == Key::DELETE
-					&& mCaretColumn < (int)mTextRows[mCaretRow].size()
-					&& mEditable)
-		{
-			mCaretColumn = mStringEditor->eraseChar(mTextRows[mCaretRow], mCaretColumn);
-		}
-
-		else if (key.getValue() == Key::DELETE
-					&& mCaretColumn == (int)mTextRows[mCaretRow].size()
-					&& mCaretRow < ((int)mTextRows.size() - 1)
-					&& mEditable)
-		{
-			mTextRows[mCaretRow] += mTextRows[mCaretRow + 1];
-			mTextRows.erase(mTextRows.begin() + mCaretRow + 1);
-		}
-
-		else if(key.getValue() == Key::PAGE_UP)
-		{
-			Widget* par = getParent();
-
-			if (par != NULL)
-			{
-				int rowsPerPage = par->getChildrenArea().height / getFont()->getHeight();
-				int chars = mStringEditor->countChars(mTextRows[mCaretRow], mCaretColumn);
-				mCaretRow -= rowsPerPage;
-
-				if (mCaretRow < 0)
-				{
-					mCaretRow = 0;
-				}
-				mCaretColumn = mStringEditor->getOffset(mTextRows[mCaretRow], chars);
-			}
-		}
-
-		else if(key.getValue() == Key::PAGE_DOWN)
-		{
-			Widget* par = getParent();
-
-			if (par != NULL)
-			{
-				int rowsPerPage = par->getChildrenArea().height / getFont()->getHeight();
-				int chars = mStringEditor->countChars(mTextRows[mCaretRow], mCaretColumn);
-				mCaretRow += rowsPerPage;
-
-				if (mCaretRow >= (int)mTextRows.size())
-				{
-					mCaretRow = mTextRows.size() - 1;
-				}
-
-				mCaretColumn = mStringEditor->getOffset(mTextRows[mCaretRow], chars);
-			}
-		}
-
-		else if(key.getValue() == Key::TAB
-				&& mEditable)
-		{
-			// FIXME: jump X spaces, so mCaretColumn % TAB_SIZE = 0 and X <= TAB_SIZE
-			mTextRows[mCaretRow].insert(mCaretColumn,std::string("    "));
-			mCaretColumn += 4;
-		}
-
-		else if ((key.isCharacter() || key.getValue() > 255)
-					&& mEditable)
-		{
-			mCaretColumn = mStringEditor->insertChar(mTextRows[mCaretRow], mCaretColumn, key.getValue());
-		}
-
-		adjustSize();
-		scrollToCaret();
-		assert( utf8::is_valid(mTextRows[mCaretRow].begin(),mTextRows[mCaretRow].end()) );
-		assert( utf8::is_valid(mTextRows[mCaretRow].begin(),mTextRows[mCaretRow].begin() + mCaretColumn) );
-		keyEvent.consume();
-	}
-
-
-	void UTF8TextBox::setCaretColumnUTF8(int column)
-	{
-		// no need to clip the column, mStringEditor handles it automaticly
-		mCaretColumn = mStringEditor->getOffset(mTextRows[mCaretRow], column);
-	}
-
-	void UTF8TextBox::setCaretRowUTF8(int row)
-	{
-		int chars = mStringEditor->countChars(mTextRows[mCaretRow], mCaretColumn);
-		if (row < 0) {
-			row = 0;
-		} else if (row >= mTextRows.size()) {
-			row = mTextRows.size() - 1;
-		}
-		mCaretRow = row;
-		mCaretColumn = mStringEditor->getOffset(mTextRows[mCaretRow], chars);
-	}
-
-}
-
-
--- a/engine/core/gui/widgets/utf8textbox.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2009 by the FIFE team                                   *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef RAVERON_UTF8TEXTBOX_HPP
-#define RAVERON_UTF8TEXTBOX_HPP
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/widgets/textbox.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "util/utf8/utf8stringeditor.h"
-
-namespace gcn {
-
-	/**
-	 * UTF-8 aware version of the TextBox class.
-	 *
-	 * Using UTF8StringEditor, it is able to correctly edit UTF-8 multiline texts.
-	 *
-	 * You will also need an UTF-8 aware font to be able to correctly
-	 * display such text (so gcn::ImageFont can not be used).
-	 *
-	 * TextBox::setCaretColumn(), TextBox::setCaretRow(),
-	 * TextBox::setCaretRowColumn(), TextBox::getCaretColumn()
-	 * and TextBox::getCaretRow() addresses byte offsets of the text.
-	 * Use character versions of those methods with UTF8 suffix, they
-	 * will correctly access real character positions in UTF-8 texts.
-	 * 
-	 * @author Przemyslaw Grzywacz
-	 */
-	class UTF8TextBox: public TextBox {
-	public:
-		/**
-		 * Constructor.
-		 * @param text Initial text.
-		 */
-		UTF8TextBox(const std::string& text = "");
-
-		/**
-		 * Destructor.
-		 */
-		virtual ~UTF8TextBox();
-
-		/**
-		 * Key pressed handler.
-		 *
-		 * Overides gcn::TextField to handle UTF-8 character codes.
-		 *
-		 * @param keyEvent Keyboard event.
-		 */
-		virtual void keyPressed(KeyEvent& keyEvent);
-
-		/**
-		 * Sets caret column (UTF-8 aware).
-		 * @param column Caret column.
-		 */
-		void setCaretColumnUTF8(int column);
-
-		/**
-		 * Sets caret row  (UTF-8 aware).
-		 * @param row Caret row
-		 */
-		void setCaretRowUTF8(int row);
-
-		/**
-		 * Sets caret row and column  (UTF-8 aware).
-		 * @param row Caret row.
-		 * @param column Caret column.
-		 */
-		void setCaretRowColumnUTF8(int row, int column);
-
-		/**
-		 * Gets caret column (UTF-8 aware).
-		 * @return Caret column.
-		 */
-		int getCaretColumnUTF8();
-
-		/**
-		 * Gets caret column (UTF-8 aware).
-		 * @return Caret row.
-		 */
-		int getCaretRowUTF8();
-
-	protected:
-
-		/**
-		 * UTF-8 string editor suppor.
-		 *
-		 * It allows the UTF8TextBox to easly traverse UTF-8 strings
-		 * as well as inserting and deleting characters.
-		 */
-		UTF8StringEditor* mStringEditor;
-	};
-
-};
-
-#endif // !RAVERON_UTF8TEXTBOX_HPP
--- a/engine/core/gui/widgets/utf8textfield.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2009 by the FIFE team                                   *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-// Standard C++ library includes
-#include <cassert>
-
-// 3rd party library includes
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "utf8textfield.h"
-
-namespace gcn {
-
-	UTF8TextField::UTF8TextField(const std::string & text)
-		: TextField(text)
-	{
-		mStringEditor = new UTF8StringEditor();
-	}
-
-	UTF8TextField::~UTF8TextField()
-	{
-		delete mStringEditor;
-	}
-
-	void UTF8TextField::keyPressed(KeyEvent & keyEvent)
-	{
-		Key key = keyEvent.getKey();
-
-		if (key.getValue() == Key::LEFT && mCaretPosition > 0)
-		{
-			mCaretPosition = mStringEditor->prevChar(mText, mCaretPosition);
-		}
-		else if (key.getValue() == Key::RIGHT && mCaretPosition < mText.size())
-		{
-			mCaretPosition = mStringEditor->nextChar(mText, mCaretPosition);
-		}
-		else if (key.getValue() == Key::DELETE && mCaretPosition < mText.size())
-		{
-			mCaretPosition = mStringEditor->eraseChar(mText, mCaretPosition);
-		}
-		else if (key.getValue() == Key::BACKSPACE && mCaretPosition > 0)
-		{
-			mCaretPosition = mStringEditor->prevChar(mText, mCaretPosition);
-			mCaretPosition = mStringEditor->eraseChar(mText, mCaretPosition);
-		}
-		else if (key.getValue() == Key::ENTER)
-		{
-			distributeActionEvent();
-		}
-		else if (key.getValue() == Key::HOME)
-		{
-			mCaretPosition = 0;
-		}
-
-		else if (key.getValue() == Key::END)
-		{
-			mCaretPosition = mText.size();
-		}
-
-		// Add character to text, if key is realy a ASCII character
-		// or is greater than 8bits long and the character is not
-		// the tab key.
-		else if ((key.isCharacter() || key.getValue() > 255)
-			&& key.getValue() != Key::TAB)
-		{
-			mCaretPosition = mStringEditor->insertChar(mText, mCaretPosition, key.getValue());
-		}
-
-		if (key.getValue() != Key::TAB)
-		{
-			// consume all characters except TAB which is needed
-			// for traversing through widgets in a container.
-			keyEvent.consume();
-		}
-
-		fixScroll();
-	}
-
-};
-
-
--- a/engine/core/gui/widgets/utf8textfield.h	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2009 by the FIFE team                                   *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-#ifndef GCN_UTF8TEXTFIELD_HPP
-#define GCN_UTF8TEXTFIELD_HPP
-
-// Standard C++ library includes
-
-// 3rd party library includes
-#include <guichan/widgets/textfield.hpp>
-
-// FIFE includes
-// These includes are split up in two parts, separated by one empty line
-// First block: files included from the FIFE root src directory
-// Second block: files included from the same folder
-#include "util/utf8/utf8stringeditor.h"
-
-namespace gcn {
-
-	/**
-	 * UTF-8 aware version of the TextField class.
-	 *
-	 * Using UTF8StringEditor, it is able to correctly edit UTF-8 text line.
-	 *
-	 * You will also need an UTF-8 aware font to be able to correctly
-	 * display such text (so gcn::ImageFont can not be used).
-	 * 
-	 * @author Przemyslaw Grzywacz
-	 */
-	class UTF8TextField: public TextField
-	{
-	public:
-		/**
-		 * UTF8TextField constructor.
-		 * @param text Initial text.
-		 */
-		UTF8TextField(const std::string& text = "");
-
-		/**
-		 * Destructor.
-		 */
-		virtual ~UTF8TextField();
-
-		/**
-		 * Key pressed handler.
-		 *
-		 * Overides gcn::TextField to handle UTF-8 character codes.
-		 *
-		 * @param keyEvent Keyboard event.
-		 */
-		virtual void keyPressed(KeyEvent& keyEvent);
-
-	protected:
-		/**
-		 * UTF-8 string editor suppor.
-		 *
-		 * It allows the UTF8TextField to easly traverse UTF-8 strings
-		 * as well as inserting and deleting characters.
-		 */
-		UTF8StringEditor* mStringEditor;
-	};
-
-
-}
-
-#endif // !GCN_UTF8TEXTFIELD_HPP
--- a/engine/core/gui/widgets/widgets.i	Fri Jun 10 23:37:46 2011 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,447 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2008 by the FIFE team                              *
- *   http://www.fifengine.de                                               *
- *   This file is part of FIFE.                                            *
- *                                                                         *
- *   FIFE is free software; you can redistribute it and/or                 *
- *   modify it under the terms of the GNU Lesser General Public            *
- *   License as published by the Free Software Foundation; either          *
- *   version 2.1 of the License, or (at your option) any later version.    *
- *                                                                         *
- *   This library 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     *
- *   Lesser General Public License for more details.                       *
- *                                                                         *
- *   You should have received a copy of the GNU Lesser General Public      *
- *   License along with this library; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
-
-%module fife
-%{
-#include <guichan.hpp>
-#include <guichan/mouseevent.hpp>
-#include "gui/widgets/utf8textfield.h"
-#include "gui/widgets/utf8textbox.h"
-#include "gui/widgets/twobutton.h"
-#include "gui/widgets/togglebutton.h"
-#include "gui/widgets/clicklabel.h"
-#include "gui/widgets/icon2.hpp"
-#include "gui/widgets/percentagebar.hpp"
-%}
-
-namespace gcn {
-	class Font;
-	class Image;
-	class ActionListener;
-	class MouseListener;
-	class KeyListener;
-
-	%nodefaultctor;
-	class Graphics {
-	public:
-		enum Alignment {
-			LEFT = 0,
-			CENTER,
-			RIGHT
-		};
-	};
-	%clearnodefaultctor;
-
-	
-	class Color {
-	public:
-		Color();
-		Color(int color);
-		Color(int r, int g, int b, int a = 255);
-		Color operator+(const Color& color) const;
-		Color operator-(const Color& color) const;
-		Color operator*(float value) const;
-		bool operator==(const Color& color) const;
-		bool operator!=(const Color& color) const;
-		int r;
-		int g;
-		int b;
-		int a;
-	};
-
-	class Widget {
-	public:
-/* 		Widget(); */
-/* 		virtual ~Widget(); */
-		virtual void setWidth(int width);
-		virtual int getWidth() const;
-		virtual void setHeight(int height);
-		virtual int getHeight() const;
-		virtual void setSize(int width, int height);
-		virtual void setX(int x);
-		virtual int getX() const;
-		virtual void setY(int y);
-		virtual int getY() const;
-		virtual void setPosition(int x, int y);
-		virtual void setFrameSize(unsigned int frameSize);
-		virtual unsigned int getFrameSize() const;
-		virtual void setFocusable(bool focusable);
-		virtual bool isFocusable() const;
-		virtual bool isFocused() const;
-		virtual void setEnabled(bool enabled);
-		virtual bool isEnabled() const;
-		virtual void setVisible(bool visible);
-		virtual bool isVisible() const;
-		virtual void setBaseColor(const Color& color);
-		virtual const Color& getBaseColor() const;
-		virtual void setForegroundColor(const Color& color);
-		virtual const Color& getForegroundColor() const;
-		virtual void setBackgroundColor(const Color& color);
-		virtual const Color& getBackgroundColor() const;
-		virtual void setSelectionColor(const Color& color);
-		virtual const Color& getSelectionColor() const;
-		virtual void requestFocus();
-		virtual void requestMoveToTop();
-		virtual void requestMoveToBottom();
-		virtual void setActionEventId(const std::string& actionEventId);
-		virtual const std::string& getActionEventId() const;
-		virtual void getAbsolutePosition(int& x, int& y) const;
-		Font *getFont() const;
-		static void setGlobalFont(Font* font);
-		virtual void setFont(Font* font);
-		virtual bool isTabInEnabled() const;
-		virtual void setTabInEnabled(bool enabled);
-		virtual bool isTabOutEnabled() const;
-		virtual void setTabOutEnabled(bool enabled);
-		virtual void requestModalFocus();
-		virtual void requestModalMouseInputFocus();
-		virtual void releaseModalFocus();
-		virtual void releaseModalMouseInputFocus();
-		virtual bool isModalFocused() const;
-		virtual bool isModalMouseInputFocused() const;
-		virtual Widget *getWidgetAt(int x, int y);
-		virtual void moveToTop(Widget* widget) { };
-		virtual void moveToBottom(Widget* widget) { };
-		virtual void focusNext() { };
-		virtual void focusPrevious() { };
-		virtual void addActionListener(ActionListener* actionListener);
-		virtual void removeActionListener(ActionListener* actionListener);
-		virtual void addMouseListener(MouseListener* actionListener);
-		virtual void removeMouseListener(MouseListener* actionListener);
-		virtual void addKeyListener(KeyListener* actionListener);
-		virtual void removeKeyListener(KeyListener* actionListener);
-/* 	protected: */
-		virtual void draw(Graphics* graphics) = 0;
-	};
-	
-	%feature("notabstract") Container;
-	class Container: public Widget {
-	public:
-		Container();
-		virtual ~Container();
-		virtual void setOpaque(bool opaque);
-		virtual bool isOpaque() const;
-		virtual void add(Widget* widget);
-		virtual void add(Widget* widget, int x, int y);
-		virtual void remove(Widget* widget);
-		virtual void clear();
-	};
-	
-	%feature("notabstract") CheckBox;
-	class CheckBox: public Widget {
-	public:
-		CheckBox();
-		virtual ~CheckBox();
-		virtual bool isSelected() const;
-		virtual void setSelected(bool marked);
-		virtual const std::string &getCaption() const;
-		virtual void setCaption(const std::string& caption);
-		virtual void adjustSize();
-	};
-
-	%feature("notabstract") UTF8TextField;
-	%rename(TextField) UTF8TextField;
-	class UTF8TextField: public Widget {
-	public:
-		UTF8TextField();
-		UTF8TextField(const std::string& text);
-		virtual void setText(const std::string& text);
-		virtual const std::string& getText() const;
-		virtual void adjustSize();
-		virtual void adjustHeight();
-		virtual void setCaretPosition(unsigned int position);
-		virtual unsigned int getCaretPosition() const;
-	};
-
-	%feature("notabstract") Button;
-	class Button: public Widget {
-	public:
-		Button();
-		Button(const std::string& caption);
-		virtual void setCaption(const std::string& caption);
-		virtual const std::string& getCaption() const;
-		virtual void setAlignment(Graphics::Alignment alignment);
-		virtual Graphics::Alignment getAlignment() const;
-		virtual void adjustSize();
-		/*virtual bool isPressed() const;*/
-	};
-		
-	%feature("notabstract") TwoButton;
-	class TwoButton: public Widget {
-	public:
-		TwoButton(Image *up_image = 0, Image *down_image = 0, Image *hover_image = 0, const char * caption = "");
-		~TwoButton();
-		virtual void setCaption(const std::string& caption);
-		virtual const std::string& getCaption() const;
-		virtual void setAlignment(Graphics::Alignment alignment);
-		virtual Graphics::Alignment getAlignment() const;
-		void setUpImage(Image* image);
-		void setDownImage(Image* image);
-		void setHoverImage(Image* image);
-		void setDownOffset(int x, int y);
-		int getDownXOffset();
-		int getDownYOffset();
-	};
-	
-	%feature("notabstract") ToggleButton;
-	class ToggleButton: public Widget {
-	public:
-		ToggleButton(Image *up_image = 0, Image *down_image = 0, Image *hover_image = 0, const char * caption = "", const char * group = "");
-		~ToggleButton();
-		virtual void setCaption(const std::string& caption);
-		virtual const std::string& getCaption() const;
-		virtual void setAlignment(Graphics::Alignment alignment);
-		virtual Graphics::Alignment getAlignment() const;
-		void setSpacing(unsigned int spacing);
-		unsigned int getSpacing() const;
-		void setUpImage(Image* image);
-		void setDownImage(Image* image);
-		void setHoverImage(Image* image);
-		void setDownOffset(int x, int y);
-		int getDownXOffset() const;
-		int getDownYOffset() const;
-		bool isToggled() const;
-		void setToggled(bool toggled);
-		void setGroup(const std::string &group);
-		const std::string &getGroup() const;
-	};
-
-	%feature("notabstract") ScrollArea;
-	class ScrollArea: public Widget {
-	public:
-		ScrollArea();
-		ScrollArea(Widget *content);
-		ScrollArea(Widget *content,ScrollArea::ScrollPolicy hPolicy,ScrollArea::ScrollPolicy vPolicy);
-		virtual ~ScrollArea();
-		virtual void setContent(Widget* widget);
-		virtual Widget* getContent();
-		virtual void setHorizontalScrollPolicy(ScrollArea::ScrollPolicy hPolicy);
-		virtual ScrollArea::ScrollPolicy getHorizontalScrollPolicy();
-		virtual void setVerticalScrollPolicy(ScrollArea::ScrollPolicy vPolicy);
-		virtual ScrollArea::ScrollPolicy getVerticalScrollPolicy();
-		virtual void setScrollPolicy(ScrollArea::ScrollPolicy hPolicy, ScrollArea::ScrollPolicy vPolicy);
-		virtual void setVerticalScrollAmount(int vScroll);
-		virtual int getVerticalScrollAmount();
-		virtual void setHorizontalScrollAmount(int hScroll);
-		virtual int getHorizontalScrollAmount();
-		virtual void setScrollAmount(int hScroll, int vScroll);
-		virtual int getHorizontalMaxScroll();
-		virtual int getVerticalMaxScroll();
-		virtual void setScrollbarWidth(int width);
-		virtual int getScrollbarWidth();
-		virtual void setLeftButtonScrollAmount(int amount);
-		virtual void setRightButtonScrollAmount(int amount);
-		virtual void setUpButtonScrollAmount(int amount);
-		virtual void setDownButtonScrollAmount(int amount);
-		virtual int getLeftButtonScrollAmount();
-		virtual int getRightButtonScrollAmount();
-		virtual int getUpButtonScrollAmount();
-		virtual int getDownButtonScrollAmount();
-		enum ScrollPolicy
-		{
-			SHOW_ALWAYS,
-			SHOW_NEVER,
-			SHOW_AUTO
-		};
-	};
-	
-	
-	%feature("notabstract") UTF8TextBox;
-	%rename(TextBox) UTF8TextBox;
-	class UTF8TextBox: public Widget {
-	public:
-		UTF8TextBox();
-		UTF8TextBox(const std::string& text);
-		virtual void setText(const std::string& text);
-		virtual std::string getText() const;
-		virtual const std::string& getTextRow(int row) const;
-		virtual void setTextRow(int row, const std::string& text);
-		virtual unsigned int getNumberOfRows() const;
-		virtual unsigned int getCaretPosition() const;
-		virtual void setCaretPosition(unsigned int position);
-		virtual unsigned int getCaretRow() const;
-		virtual void setCaretRow(int row);
-		virtual unsigned int getCaretColumn() const;
-		virtual void setCaretColumn(int column);
-		virtual void setCaretRowColumn(int row, int column);
-		virtual void scrollToCaret();
-		virtual bool isEditable() const;
-		virtual void setEditable(bool editable);
-		virtual void addRow(const std::string row);
-		virtual bool isOpaque();
-		virtual void setOpaque(bool opaque);
-	};
-
-	%feature("director") ListModel;
-	class ListModel
-	{
-	public:
-		virtual ~ListModel() { }
-		virtual int getNumberOfElements() = 0;
-		virtual std::string getElementAt(int i) = 0;
-	};
-
-	%feature("notabstract") ListBox;
-	class ListBox: public Widget {
-	public:
-		ListBox();
-		ListBox(ListModel *listModel);
-		virtual ~ListBox() { }
-		virtual int getSelected();
-		virtual void setSelected(int selected);
-		virtual void setListModel(ListModel *listModel);
-		virtual ListModel *getListModel();
-		virtual void adjustSize();
-		virtual bool isWrappingEnabled();
-		virtual void setWrappingEnabled(bool wrapping);
-	};
-
-	%feature("notabstract") DropDown;
-	class DropDown: public Widget {
-	public:
-		DropDown(ListModel *listModel = NULL,
-		         ScrollArea *scrollArea = NULL,
-		         ListBox *listBox = NULL);
-		virtual ~DropDown();
-		virtual int getSelected();
-		virtual void setSelected(int selected);
-		virtual void setListModel(ListModel *listModel);
-		virtual ListModel *getListModel();
-		virtual void adjustHeight();
-		virtual void setBaseColor(const Color& color);
-		virtual const Color& getBaseColor() const;
-		virtual void setForegroundColor(const Color& color);
-		virtual const Color& getForegroundColor() const;
-		virtual void setBackgroundColor(const Color& color);
-		virtual const Color& getBackgroundColor() const;
-		virtual void setSelectionColor(const Color& color);
-		virtual const Color& getSelectionColor() const;
-	};
-
-	%feature("notabstract") RadioButton;
-	class RadioButton: public Widget {
-	public:
-		RadioButton();
-		RadioButton(const std::string &caption,
-					const std::string &group,
-					bool marked=false);
-		virtual ~RadioButton();
-		virtual bool isSelected() const;
-		virtual void setSelected(bool marked);
-		virtual const std::string &getCaption() const;
-		virtual void setCaption(const std::string caption);
-		virtual void setGroup(const std::string &group);
-		virtual const std::string &getGroup() const;
-		virtual void adjustSize();
-	};
-
-	%feature("notabstract") Slider;
-	class Slider: public Widget {
-	public:
-		Slider(double scaleEnd = 1.0);
-		Slider(double scaleStart, double scaleEnd);
-		virtual ~Slider() { }
-		virtual void setScale(double scaleStart, double scaleEnd);
-		virtual double getScaleStart() const;
-		virtual void setScaleStart(double scaleStart);
-		virtual double getScaleEnd() const;
-		virtual void setScaleEnd(double scaleEnd);
-		virtual double getValue() const;
-		virtual void setValue(double value);
-		virtual void setMarkerLength(int length);
-		virtual int getMarkerLength() const;
-		virtual void setOrientation(Slider::Orientation orientation);
-		virtual Slider::Orientation getOrientation() const;
-		virtual void setStepLength(double length);
-		virtual double getStepLength() const;
-		enum Orientation
-		{
-			HORIZONTAL = 0,
-			VERTICAL
-		};
-	};
-
-	%feature("notabstract") Window;
-	class Window: public Container {
-	public:
-		Window();
-		Window(const std::string& caption);
-		virtual ~Window();
-		virtual void setCaption(const std::string& caption);
-		virtual const std::string& getCaption() const;
-		virtual void setAlignment(Graphics::Alignment alignment);
-		virtual Graphics::Alignment getAlignment() const;
-		virtual void setPadding(unsigned int padding);
-		virtual unsigned int getPadding() const;
-		virtual void setTitleBarHeight(unsigned int height);
-		virtual unsigned int getTitleBarHeight();
-		virtual void setMovable(bool movable);
-		virtual bool isMovable() const;
-		virtual void setOpaque(bool opaque);
-		virtual bool isOpaque();
-		virtual void resizeToContent();
-	};
-
-	%feature("notabstract") ClickLabel;
-	%rename(Label) ClickLabel;
-	class ClickLabel: public Widget {
-	public:
-		ClickLabel();
-		ClickLabel(const std::string& caption);
-		virtual ~ClickLabel();
-		virtual void setCaption(const std::string& caption);
-		virtual const std::string& getCaption() const;
-		bool isTextWrapping() const;
-		void setTextWrapping(bool);
-		virtual void setWidth(int width);
-		virtual void adjustSize();
-	};
-
-	%feature("notabstract") Icon2;
-	%rename(Icon) Icon2;
-	class Icon2: public Widget {
-	public:
-		Icon2(Image* image);
-		virtual ~Icon2();
-		void setImage(Image* image);
-	};
-	
-	%feature("notabstract") PercentageBar;
-	class PercentageBar: public Widget {
-	public:
-		PercentageBar();
-		virtual ~PercentageBar();
-		virtual void setForegroundImage(Image* image);
-        virtual void setOrientation(PercentageBar::Orientation orientation);
-        virtual PercentageBar::Orientation getOrientation() const;
-        virtual int getValue() const;
-        virtual void setValue(int value);
-		
-		enum Orientation
-		{
-			HORIZONTAL = 0,
-			VERTICAL
-		};
-	};
-}
-
-
-
--- a/engine/python/fife/extensions/pychan/compat.py	Fri Jun 10 23:37:46 2011 -1000
+++ b/engine/python/fife/extensions/pychan/compat.py	Sat Jun 18 00:28:40 2011 -1000
@@ -56,7 +56,13 @@
 	if not isinstance(engine,fife.Engine):
 		return engine
 
-	guimanager = engine.getGuiManager()
+	# FIXME M. George Hansen 2011-06-17: This is a hack to cast the GuiManager.
+	# 	Ideally the GuiManager interface would be standardized enough not to
+	# 	have to do this.
+	guimanager = fife.GuiChanGuiManager.castTo(engine.getGuiManager())
+	if not guimanager:
+		raise RuntimeError('FIFE engine does not use GuiChanGuiManager, '
+			'please enable GuiChan')
 
 	def _fife_load_image(filename):
 		index = engine.getImagePool().addResourceFromFile(filename)
--- a/tests/core_tests/test_gui.cpp	Fri Jun 10 23:37:46 2011 -1000
+++ b/tests/core_tests/test_gui.cpp	Sat Jun 18 00:28:40 2011 -1000
@@ -44,10 +44,10 @@
 #include "loaders/native/video_loaders/image_loader.h"
 #include "loaders/native/video_loaders/subimage_loader.h"
 #include "util/base/exception.h"
-#include "gui/base/opengl/opengl_gui_graphics.h"
-#include "gui/base/sdl/sdl_gui_graphics.h"
-#include "gui/base/gui_image.h"
-#include "gui/base/gui_imageloader.h"
+#include "gui/guichan/opengl/opengl_gui_graphics.h"
+#include "gui/guichan/sdl/sdl_gui_graphics.h"
+#include "gui/guichan/gui_image.h"
+#include "gui/guichan/gui_imageloader.h"
 
 using namespace FIFE;