Index: /code/branches/libraries2/src/external/ceguilua/AUTHORS_CEGUI
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/AUTHORS_CEGUI	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/AUTHORS_CEGUI	(revision 5707)
@@ -0,0 +1,112 @@
+Crazy Eddie's GUI System Mk-2
+http://www.cegui.org.uk
+
+Copyright ©2004 - 2008 CEGUI Team & Contributing Authors
+
+
+The following is a list of primary authors and contributors for Crazy Eddie's
+GUI System Mk-2.
+
+
+CEGUI Team
+---------
+James O'Sullivan (_mental_)
+Tomas Lindquist Olsen (lindquist)
+Paul D Turner (crayzed / CrazyEddie)
+Patrick Kooman (scriptkid)
+Paul Schifferer (Exsortis)
+Olivier Delannoy (Dalfy)
+
+CEGUI Tools Team
+----------------
+
+Frederico Jeronimo (fjeronimo). See:
+- http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2766
+- http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2785
+- http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2799
+- http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2816
+
+Main Contributors
+-----------------
+The following have made large, important, or on-going contributions to the
+system (these people may have made additional contributions than those
+specifically mentioned)...
+
+Lars Rinde:
+- Original TaharezLook graphics design.
+
+'Blakharaz':
+- Initial XmlHandlerHelper class and general cleanup of original XML parsing
+code.
+
+Jeff Leigh:
+- Original CEGUI::ColourManipulator class (now re-factored into CEGUI::colour
+class) and related fixes.
+
+Jose A Milan:
+- Refactoring of XML handling classes to remove public dependency on Xerces-C++.
+- Initial updates to Ogre renderer to support Ogre 1.0.
+
+Magnus Osterlind:
+- Direct3D 9 GUI renderer module.
+
+Steve Streeting:
+- TabControl widget base classes & related 'TaharezLook' classes.
+
+Mark Strom:
+- OpenGL GUI renderer module.
+
+Thomas Suter:
+- Irrlicht GUI renderer module.
+
+Andrew Zabolotny:
+- Font class rewrite.
+
+
+Other Contributors
+------------------
+The following have contributed patches, bug reports, and other such valuable
+things...
+
+Tupone Alfredo
+Geoff Carlton
+Clay Culver
+Paul Downey
+Jeff Doyle
+Jan Eickmann
+Andrzej Krzysztof Haczewski
+Markus Henschel
+Erik Hjortsberg
+Rafal Jastrzebski
+Chris Kang
+Peter Newman
+Chris Osborn
+Shane Parker
+Andrea Santambrogio
+James Turner
+Chris Weaver
+Christopher Wedman
+armaduck
+genva
+Te'ja
+Xavier
+
+
+Special Thanks
+--------------
+Shawn Carroll	- For his tutorial series.
+Chris McGuirk	- For his C#.Net port.
+Shane Parker	- For giving permission to use his "Vanilla GUI" imagery.
+
+Everyone on the GameDev.Net forums who looked at earlier versions of the system
+and gave constructive criticism.
+
+Everyone on the Ogre forums who encouraged the development of this Mk-2 version
+of the system.
+
+
+Have I Missed You?
+------------------
+If you feel that we have missed you from some section of this list, then please
+contact us (team@cegui.org.uk) and let us know who you are and what you did,
+and we'll correct the mistake as soon as possible.
Index: /code/branches/libraries2/src/external/ceguilua/CMakeLists.txt
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/CMakeLists.txt	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/CMakeLists.txt	(revision 5707)
@@ -0,0 +1,90 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+
+SET(CEGUILUA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua-${CEGUI_VERSION}/ceguilua)
+SET(CEGUILUA_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
+SET(CEGUILUA_FILES
+  ${CEGUILUA_DIR}/CEGUILua.cpp
+  ${CEGUILUA_DIR}/CEGUILuaFunctor.cpp
+  ${CEGUILUA_DIR}/required.cpp
+  ${CEGUILUA_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lua_CEGUI.cpp
+
+  ${CEGUILUA_DIR}/CEGUILua.h
+  ${CEGUILUA_DIR}/CEGUILuaFunctor.h
+  ${CEGUILUA_DIR}/required.h
+)
+
+INCLUDE(CompareVersionStrings)
+
+# Copy package files incrementally until the version is met
+SET(CEGUILUA_VERSIONS 0.5.0 0.6.0 0.6.1 0.6.2)
+# Only copy on version change
+IF(NOT "${_CEGUI_VERSION_REF}" STREQUAL "${CEGUI_VERSION}"
+   OR NOT EXISTS ${CEGUILUA_BINARY_DIR}/exceptions.lua)
+  SET(_CEGUI_VERSION_REF ${CEGUI_VERSION} CACHE INTERNAL "Do not edit")
+  FOREACH(_version ${CEGUILUA_VERSIONS})
+    COMPARE_VERSION_STRINGS(${_version} ${CEGUI_VERSION} _compare_result)
+    IF(_compare_result EQUAL 1)
+      BREAK() # _version > CEGUI_VERSION
+    ENDIF()
+  
+    ADD_SUBDIRECTORY(ceguilua-${_version}) # Sets parent scope variable _package_files
+    FOREACH(_file ${_package_files})
+      CONFIGURE_FILE(ceguilua-${_version}/package/${_file} ${CEGUILUA_BINARY_DIR}/${_file} COPYONLY)
+    ENDFOREACH(_file)
+  ENDFOREACH(_version)
+ENDIF()
+
+# Create the tolua bind file. We could use the orignal file though, but it is 1.6MB...
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${CEGUILUA_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lua_CEGUI.cpp
+  COMMAND tolua++app_orxonox -n CEGUI
+                             -w ${CEGUILUA_BINARY_DIR}
+                             -o ${CMAKE_CFG_INTDIR}/lua_CEGUI.cpp
+                             -L exceptions.lua
+                             -s ${TOLUA_PARSER_SOURCE}
+                                CEGUI.pkg
+  DEPENDS              ${TOLUA_PARSER_DEPENDENCIES}
+  WORKING_DIRECTORY    ${RUNTIME_LIBRARY_DIRECTORY}
+  COMMENT "Generating tolua bind files for package CEGUILua"
+)
+
+# No warnings needed from third party libraries
+REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
+ADD_COMPILER_FLAGS("-w")
+
+SOURCE_GROUP("Source" FILES ${CEGUILUA_FILES})
+
+SET(CEGUILUA_LIBRARY ceguilua_orxonox)
+SET(CEGUILUA_LIBRARY ${CEGUILUA_LIBRARY} PARENT_SCOPE)
+ORXONOX_ADD_LIBRARY(${CEGUILUA_LIBRARY}
+  ORXONOX_EXTERNAL
+  NO_SOURCE_GROUPS
+  DEFINE_SYMBOL
+    "CEGUILUA_EXPORTS"
+  VERSION
+    ${CEGUI_VERSION}
+  LINK_LIBRARIES
+    tolua++_orxonox
+    ${LUA_LIBRARIES}
+    ${CEGUI_LIBRARY}
+  SOURCE_FILES
+    ${CEGUILUA_FILES}
+)
Index: /code/branches/libraries2/src/external/ceguilua/COPYING
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/COPYING	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/COPYING	(revision 5707)
@@ -0,0 +1,20 @@
+The MIT License
+
+Copyright (c) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index: /code/branches/libraries2/src/external/ceguilua/ChangeLog
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ChangeLog	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ChangeLog	(revision 5707)
@@ -0,0 +1,130 @@
+Crazy Eddie's GUI System Mk-2
+http://www.cegui.org.uk
+
+Copyright 2004 - 2008 CEGUI Team & Contributing Authors
+
+
+The following is a high-level view of changes made to the system between releases.
+
+All changes not related to the lua script module have been deleted!
+
+Release 0.6.2
+=============
+Added: Support for TreeEventArgs in the lua scripting module (patch from kripken, http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3704)
+Added: Added ability to specify a function to be used as the error handler in calls to lua_pcall.  See: http://www.cegui.org.uk/mantis/view.php?id=239
+
+Modified: Forward CEGUI::ScriptException from within the CEGUI::System script execution functions as opposed to translating them into less useful CEGUI::GenericException.  See: http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3595
+
+Bug Fix: Event connection objects returned to lua subscribeEvent calls did not have the connected or disconnect members available for use (making the connection object useless).
+Bug Fix: Lua script module based 'executeScriptedEventHandler was still not returning correct value (missed when I did the LuaFunctor version of the same, see: http://www.cegui.org.uk/mantis/view.php?id=225 for original issue).
+Bug Fix: ScriptModule bindings were destroyed out of sequence meaning event handlers could still be fired that needed CEGUI bindings to exist.  See: http://www.cegui.org.uk/mantis/view.php?id=245.
+Bug Fix: The C++ side of the lua based event mechanism would always return true as if the event were handled, even if some other boolean value (i.e. false) were returned from the lua side.  See: http://www.cegui.org.uk/mantis/view.php?id=225
+
+
+Release 0.6.1
+=============
+Modified: On linux, use installed system versions of tolua++ and TinyXML libraries if available (can be disabled to force continued use of internal versions).  See: http://www.cegui.org.uk/mantis/view.php?id=198
+
+Bug Fix: Need to bring in CEGUIConfig.h when building CEGUILua.cpp in case we're on a Mac.
+Bug Fix: uncomment part of cegui.lua configuration script that allows use of option to have Ogre in samples.
+Bug Fix: tolua++cegui generator missing Lua_CFLAGS in autotools build.
+
+
+Release 0.6.0
+=============
+Added: Levia's GroupBox to the Lua module.
+Added: Warning log level to the Lua module.
+
+Modified: tolua++cegui changes in exception handlers.
+
+Bug Fix: Lua 5.1 removes table.setn - update code to use alternate method of ensuring table is indeed empty.
+Bug Fix: Lua was not correctly detected on (K)Ubuntu type systems (http://www.cegui.org.uk/mantis/view.php?id=138)
+Bug Fix: Support lua 5.1 in CEGUILua.cpp (not sure of generator status with 5.1) (http://www.cegui.org.uk/mantis/view.php?id=161)
+Bug Fix: warnings of unused local variables in lua_CEGUI.cpp fixed.
+Bug Fix: Fixed Memory Leak in Lua Scripting Module when it throws and helper object has already been created.
+
+
+Release 0.5.0 (Final)
+=====================
+Added: Missing functions in WindowFactoryManager Lua bindings. Incomplete FalagardWindowMapping binding as well.
+Added: Lua binding for OutStream: FileStream (minimal std::ofstream).
+Added: XML writing function in Lua bindings.
+
+Modified: Renamed tolua++bin/remake_pkg..bat to remove extra period
+
+
+Release 0.5.0-RC2
+=================
+Modified: Removed static Makefile for tolua++cegui generator tool and switched to autotools style build, with enable/disable configure option, for tolua++cegui generator tool
+Modified: Moved tolua++ into it's own dir, removed lua_and_tolua++
+Modified: Externalised our use of the Lua library
+Modified: LuaScriptModule public headers no longer need include lua.h included.
+
+Bug Fix: Corrected some mistakes in the Falagard Lua bindings
+Bug Fix: Lua bindings was missing ImagesetManager::createImagesetFromImageFile + some missing tolua_throws modifiers
+
+
+Release 0.5.0-RC1
+=================
+CEGUI MK2 has moved to the MIT license.
+
+Added: small script to recreate the binding generator for tolua++
+Added: customized tolua++ binary. For exception handling support in generated binding code.
+Added: Documentation for some of the new features in the bundled tolua++ generator.
+Added: When subscribing to events from "inside" Lua a self object can be registered as well to be passed along with the EventArgs.
+Added: Major update of the LuaScriptModule to support anonymous functions.
+Added: Default resource group support to ScriptingModule, and implemented it's use in the CEGUILua module.
+Added: Lots of missing members in the Lua bindings.
+Added: bat files to make it easier for Windows users to regenerate the Lua bindings and tolua++cegui.
+
+Modified: The "Lua and tolua++" module has been made a DLL on Windows machines.
+Modified: In the lua module, updated Window with casting helpers as member functions. eg. w:toFrameWindow()
+Modified: Updated to tolua++ 1.0.92
+Modified: Moved LuaFunctor into its own files
+Modified: Reimplemented the "late binding" effect from the v04 Lua module. In v04 the function is always looked up by name. In CVS HEAD the actual Lua function is referenced, but now this will only occur the first time the event is triggered. This means that it's no longer necessary to have a function defined to subscribe it to an event. As long as the function has been created before the event occurs everything will be good Smile
+Modified: Moved subscribeScriptedEvent into ScriptModule to allow more customized script subscription functionality.
+Modified: Removal of "tolua_outside" stuff that was no longer needed.
+Modified: The script module now throws ScriptException.
+Modified: The bundled tolua++cegui binding generator will now generate a lua_CEGUI.cpp that compiles out-of-the-box on Windows
+
+Bug Fix: Bug in LuaScriptModule where executeScriptFile did not unload the file data buffer correctly in case of an exception (thanks gcarlton).
+
+
+Release 0.4.1
+=============
+
+
+Release 0.4.0
+=============
+Added: Missing Lua bindings for some System based Tooltip stuff.
+Added: Missing Lua bindings for Menusystem widgets.
+Added: Lua module 'toKeyEventArgs' helper 
+Added: Support to the Lua module for FontFlags to allow direct loading of TTF fonts from script without using .font files.
+
+Modified: Lua scripting module renamed to CEGUILua (Win32 systems).
+
+Bug Fix: Fixed some uint/ColourRect/String CEGUILua issues.
+
+
+Release 0.3.0
+=============
+Added: Lua based ScriptModule (including optional embedded lua and toloua++) for Win32 and Linux users.
+Added: resourceGroup parameter to executeScriptFile methods.
+
+
+Release 0.2.1
+=============
+
+
+Release 0.2.0
+=============
+Added: CEGUI::System constructor overload to allow custom ResourceProvider to be specified when also using a ScriptModule.
+
+
+Release 0.1.1
+=============
+
+
+Release 0.1.0
+=============
+Initial release.
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/CMakeLists.txt
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/CMakeLists.txt	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/CMakeLists.txt	(revision 5707)
@@ -0,0 +1,34 @@
+SET(_package_files
+  exceptions.lua Basic.pkg FontManager.pkg InputEvent.pkg OutStream.pkg
+  System.pkg WindowManager.pkg CEGUI.pkg HelperFunctions.pkg Iterators.pkg
+  PropertyHelper.pkg Texture.pkg CoordConverter.pkg Image.pkg Key.pkg
+  Renderer.pkg UnifiedCoordSystem.pkg EventSet.pkg Imageset.pkg Logger.pkg
+  Scheme.pkg Window.pkg Font.pkg ImagesetManager.pkg MouseCursor.pkg
+  SchemeManager.pkg WindowFactoryManager.pkg
+
+  elements/ButtonBase.pkg elements/Checkbox.pkg elements/ComboDropList.pkg
+  elements/Combobox.pkg elements/DragContainer.pkg elements/Editbox.pkg
+  elements/FrameWindow.pkg elements/GUISheet.pkg elements/ItemEntry.pkg
+  elements/ItemListBase.pkg elements/ItemListbox.pkg elements/ListHeader.pkg
+  elements/ListHeaderSegment.pkg elements/Listbox.pkg elements/ListboxItem.pkg
+  elements/ListboxTextItem.pkg elements/MenuBase.pkg elements/MenuItem.pkg
+  elements/Menubar.pkg elements/MultiColumnList.pkg
+  elements/MultiLineEditbox.pkg elements/PopupMenu.pkg elements/ProgressBar.pkg
+  elements/PushButton.pkg elements/RadioButton.pkg elements/ScrollablePane.pkg
+  elements/Scrollbar.pkg elements/ScrolledContainer.pkg
+  elements/ScrolledItemListBase.pkg elements/Slider.pkg elements/Spinner.pkg
+  elements/TabButton.pkg elements/TabControl.pkg elements/Thumb.pkg
+  elements/Titlebar.pkg elements/Tooltip.pkg
+  
+  falagard/Dimension.pkg falagard/Enums.pkg falagard/FalagardComponentBase.pkg
+  falagard/FrameComponent.pkg falagard/ImageryComponent.pkg
+  falagard/ImagerySection.pkg falagard/LayerSpecification.pkg
+  falagard/NamedArea.pkg falagard/PropertyDefinition.pkg
+  falagard/PropertyDefinitionBase.pkg falagard/PropertyInitialiser.pkg
+  falagard/PropertyLinkDefinition.pkg falagard/SectionSpecification.pkg
+  falagard/StateImagery.pkg falagard/TextComponent.pkg
+  falagard/WidgetComponent.pkg falagard/WidgetLookFeel.pkg
+  falagard/WidgetLookManager.pkg
+
+  PARENT_SCOPE
+)
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.cpp	(revision 5707)
@@ -0,0 +1,312 @@
+/***********************************************************************
+	filename: CEGUILua.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Implementation for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUIPropertyHelper.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <vector>
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// prototype for bindings initialisation function
+int tolua_CEGUI_open(lua_State* tolua_S);
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Constructor (creates Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule()
+{
+    #if LUA_VERSION_NUM >= 501
+        static const luaL_Reg lualibs[] = {
+            {"", luaopen_base},
+            {LUA_LOADLIBNAME, luaopen_package},
+            {LUA_TABLIBNAME, luaopen_table},
+            {LUA_IOLIBNAME, luaopen_io},
+            {LUA_OSLIBNAME, luaopen_os},
+            {LUA_STRLIBNAME, luaopen_string},
+            {LUA_MATHLIBNAME, luaopen_math},
+        #if defined(DEBUG) || defined (_DEBUG)
+                {LUA_DBLIBNAME, luaopen_debug},
+        #endif
+            {0, 0}
+        };
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+	// create a lua state
+	d_ownsState = true;
+	d_state = lua_open();
+
+	// init all standard libraries
+    #if LUA_VERSION_NUM >= 501
+            const luaL_Reg *lib = lualibs;
+            for (; lib->func; lib++)
+            {
+                lua_pushcfunction(d_state, lib->func);
+                lua_pushstring(d_state, lib->name);
+                lua_call(d_state, 1, 0);
+            }
+    #else /* LUA_VERSION_NUM >= 501 */
+	    luaopen_base(d_state);
+	    luaopen_io(d_state);
+	    luaopen_string(d_state);
+	    luaopen_table(d_state);
+	    luaopen_math(d_state);
+        #if defined(DEBUG) || defined (_DEBUG)
+	        luaopen_debug(d_state);
+        #endif
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+	setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Constructor (uses given Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule(lua_State* state)
+{
+	// just use the given state
+	d_ownsState = false;
+	d_state = state;
+
+	setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Destructor
+*************************************************************************/
+LuaScriptModule::~LuaScriptModule()
+{
+	if ( d_ownsState && d_state )
+	{
+		lua_close( d_state );
+	}
+}
+
+
+/*************************************************************************
+	Execute script file
+*************************************************************************/
+void LuaScriptModule::executeScriptFile(const String& filename, const String& resourceGroup)
+{
+	// load file
+	RawDataContainer raw;
+	System::getSingleton().getResourceProvider()->loadRawDataContainer(filename,
+        raw, resourceGroup.empty() ? d_defaultResourceGroup : resourceGroup);
+
+	// load code into lua
+	int top = lua_gettop(d_state);
+	int loaderr = luaL_loadbuffer(d_state, (char*)raw.getDataPtr(), raw.getSize(), filename.c_str());
+	System::getSingleton().getResourceProvider()->unloadRawDataContainer( raw );
+	if (loaderr)
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+    
+    // call it
+	if (lua_pcall(d_state,0,0,0))
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+
+	lua_settop(d_state,top); // just in case :P
+}
+
+
+/*************************************************************************
+	Execute global script function
+*************************************************************************/
+int	LuaScriptModule::executeScriptGlobal(const String& function_name)
+{
+    int top = lua_gettop(d_state);
+
+    // get the function from lua
+    lua_getglobal(d_state, function_name.c_str());
+
+    // is it a function
+    if (!lua_isfunction(d_state,-1))
+    {
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to get Lua global: '"+function_name+"' as name not represent a global Lua function" );
+    }
+
+    // call it
+    int error = lua_pcall(d_state,0,1,0);		
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_pop(d_state,1);
+        throw ScriptException("Unable to evaluate Lua global: '"+function_name+"\n\n"+errMsg+"\n");
+    }
+
+    // get return value
+    if (!lua_isnumber(d_state,-1))
+    {
+        // log that return value is invalid. return -1 and move on.
+        lua_settop(d_state,top);
+        ScriptException("Unable to get Lua global : '"+function_name+"' return value as it's not a number" );
+        return -1;
+    }
+
+    int ret = (int)lua_tonumber(d_state,-1);
+    lua_pop(d_state,1);
+
+    // return it
+    return ret;
+}
+
+
+/*************************************************************************
+	Execute scripted event handler
+*************************************************************************/
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name, const EventArgs& e)
+{
+    LuaFunctor::pushNamedFunction(d_state, handler_name);
+
+    // push EventArgs as the first parameter
+    tolua_pushusertype(d_state,(void*)&e,"const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(d_state,1,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(d_state,-1));
+        lua_pop(d_state,1);
+        throw ScriptException("Unable to evaluate the Lua event handler: '"+handler_name+"'\n\n"+errStr+"\n");
+    }
+
+    return true;
+}
+
+
+/*************************************************************************
+	Execute script code string
+*************************************************************************/
+void LuaScriptModule::executeString(const String& str)
+{
+    int top = lua_gettop(d_state);
+
+    // load code into lua and call it
+    int error =	luaL_loadbuffer(d_state, str.c_str(), str.length(), str.c_str()) || lua_pcall(d_state,0,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script string: '"+str+"'\n\n"+errMsg+"\n");
+    }
+}
+	
+
+/*************************************************************************
+	Create Lua bindings
+*************************************************************************/
+void LuaScriptModule::createBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Creating Lua bindings ----" );
+	// init CEGUI module
+	tolua_CEGUI_open(d_state);
+}
+
+
+/*************************************************************************
+	Destroy Lua bindings
+*************************************************************************/
+void LuaScriptModule::destroyBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Destroying Lua bindings ----" );
+	// is this ok ?
+	lua_pushnil(d_state);
+	lua_setglobal(d_state,"CEGUI");
+}
+
+
+/*************************************************************************
+	Set the ID string for the module
+*************************************************************************/
+void LuaScriptModule::setModuleIdentifierString()
+{
+    // set ID string
+    d_identifierString = "CEGUI::LuaScriptModule - Official Lua based scripting module for CEGUI";
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, Event::Subscriber(functor));
+    // make sure we don't release the reference we just made when this call returns
+    functor.index = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, Event::Group group, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // return the event connection
+    return con;
+}
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.h	(revision 5707)
@@ -0,0 +1,253 @@
+/***********************************************************************
+	filename: CEGUILua.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Defines interface for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILua_h_
+#define _CEGUILua_h_
+
+
+/*************************************************************************
+	Import / Export control macros
+*************************************************************************/
+#if defined( __WIN32__ ) || defined( _WIN32 )
+#   ifdef CEGUILUA_EXPORTS
+#       define CEGUILUA_API __declspec(dllexport)
+#   else
+#       if defined( __MINGW32__ )
+#           define CEGUILUA_API
+#       else
+#           define CEGUILUA_API __declspec(dllimport)
+#       endif
+#   endif
+#else
+#   define CEGUILUA_API
+#endif
+
+
+#include "CEGUIScriptModule.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Interface for the LuaScriptModule class
+*/
+class CEGUILUA_API LuaScriptModule : public CEGUI::ScriptModule
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which create a lua_State
+	*/
+	LuaScriptModule();
+
+
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which takes a lua_State
+
+	\param state
+		Pointer to the lua_State that the script module should attach to.
+	*/
+	LuaScriptModule(lua_State* state);
+
+
+	/*!
+	\brief
+		Destructor for LuaScriptModule class.
+	*/
+	~LuaScriptModule();
+
+
+	/*************************************************************************
+		Script Execution Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Execute a script file.
+
+	\param filename
+		String object holding the filename of the script file that is to be executed
+		
+	\param resourceGroup
+		Resource group idendifier to be passed to the ResourceProvider when loading the script file.
+	*/
+	void executeScriptFile(const String& filename, const String& resourceGroup);
+
+
+	/*!
+	\brief
+		Execute a scripted global function.  The function should not take any parameters and should return an integer.
+
+	\param function_name
+		String object holding the name of the function, in the global script environment, that
+		is to be executed.
+
+	\return
+		The integer value returned from the script function.
+	*/
+	int executeScriptGlobal(const String& function_name);
+
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing a function field.
+        For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means, to the scripted function.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name, const EventArgs& e);
+
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str);
+
+    /*************************************************************************
+        Event subscription
+    *************************************************************************/
+    /*!
+    \brief
+            Subscribes the named Event to a scripted funtion
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, const String& subscriber_name);
+
+    /*!
+    \brief
+            Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param group
+            Group which is to be subscribed to.  Subscription groups are called in ascending order.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, Event::Group group, const String& subscriber_name);
+
+    /*************************************************************************
+        Bindings creation / destruction
+    *************************************************************************/
+    /*!
+    \brief
+        Method called during system initialisation, prior to running any scripts via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to complete initialisation or binding of the script language to the gui system objects.
+
+    \return
+        Nothing.
+    */
+    void createBindings(void);
+
+
+    /*!
+    \brief
+        Method called during system destruction, after all scripts have been run via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to cleanup bindings of the script language to the gui system objects, as set-up in the
+        earlier createBindings call.
+
+    \return
+        Nothing.
+    */
+    void destroyBindings(void);
+
+    /*************************************************************************
+        Accessor type functions
+    *************************************************************************/
+    /*!
+    \brief
+        Method used to get a pointer to the lua_State that the script module is attached to.
+
+    \return
+        A pointer to the lua_State that the script module is attached to.
+    */
+    lua_State* getLuaState(void) const {return d_state;}
+
+private:
+    /*************************************************************************
+        Implementation Functions
+    *************************************************************************/
+    void setModuleIdentifierString();
+
+    /*************************************************************************
+        Implementation Data
+    *************************************************************************/
+    bool d_ownsState;      //!< true when the attached lua_State was created by this script module
+    lua_State* d_state;    //!< The lua_State that this script module uses.
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILua_h_
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.cpp	(revision 5707)
@@ -0,0 +1,259 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.cpp
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Implementation for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUILuaFunctor.h"
+#include "CEGUILogger.h"
+#include "CEGUIExceptions.h"
+#include "CEGUIPropertyHelper.h"
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, int func, int selfIndex) :
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, int selfIndex) :
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(const LuaFunctor& cp) :
+    L(cp.L),
+    index(cp.index),
+    self(cp.self),
+    needs_lookup(cp.needs_lookup),
+    function_name(cp.function_name)
+{
+}
+
+/*************************************************************************
+    Destructor
+*************************************************************************/
+LuaFunctor::~LuaFunctor()
+{
+    if (self!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, self);
+    }
+    if (index!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, index);
+    }
+}
+
+/*************************************************************************
+    Call operator
+*************************************************************************/
+bool LuaFunctor::operator()(const EventArgs& args) const
+{
+    // is this a late binding?
+    if (needs_lookup)
+    {
+        pushNamedFunction(L, function_name);
+        // reference function
+        index = luaL_ref(L, LUA_REGISTRYINDEX);
+        needs_lookup = false;
+        CEGUI_LOGINSANE("Late binding of callback '"+function_name+"' performed");
+        function_name.clear();
+    }
+
+    // retrieve function
+    lua_rawgeti(L, LUA_REGISTRYINDEX, index);
+
+    // possibly self as well?
+    int nargs = 1;
+    if (self != LUA_NOREF)
+    {
+        lua_rawgeti(L, LUA_REGISTRYINDEX, self);
+        ++nargs;
+    }
+
+    // push EventArgs  parameter
+    tolua_pushusertype(L, (void*)&args, "const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(L, nargs, 0, 0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(L, -1));
+        lua_pop(L, 1);
+        throw ScriptException("Unable to call Lua event handler:\n\n"+errStr+"\n");
+    }
+
+    return true;
+}
+
+/*************************************************************************
+    do event subscription by reference instead of by name
+*************************************************************************/
+Event::Connection LuaFunctor::SubscribeEvent(EventSet* self, const String& event_name, int funcIndex, int selfIndex, lua_State* L)
+{
+    // should we pass a self to the callback?
+    int thisIndex = LUA_NOREF;
+    if (selfIndex != LUA_NOREF)
+    {
+        // reference self
+        thisIndex = luaL_ref(L, LUA_REGISTRYINDEX);
+    }
+
+    // do the real subscription
+    int type = lua_type(L,-1);
+    Event::Connection con;
+    if (type == LUA_TFUNCTION)
+    {
+        // reference function
+        int index = luaL_ref(L, LUA_REGISTRYINDEX);
+        LuaFunctor functor(L,index,thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference(s) we just made when this call returns
+        functor.index = LUA_NOREF;
+        functor.self = LUA_NOREF;
+    }
+    else if (type == LUA_TSTRING)
+    {
+        const char* str = lua_tostring(L, -1);
+        LuaFunctor functor(L,String(str),thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference we just (maybe) made when this call returns
+        functor.self = LUA_NOREF;
+    }
+    else
+    {
+        luaL_error(L,"bad function passed to subscribe function. must be a real function, or a string for late binding");
+    }
+
+    // return the event connection
+    return con;
+}
+
+/*************************************************************************
+    Pushes a named function on the stack
+*************************************************************************/
+void LuaFunctor::pushNamedFunction(lua_State* L, const String& handler_name)
+{
+    int top = lua_gettop(L);
+
+    // do we have any dots in the handler name? if so we grab the function as a table field
+    String::size_type i = handler_name.find_first_of((utf32)'.');
+    if (i!=String::npos)
+    {
+        // split the rest of the string up in parts seperated by '.'
+        // TODO: count the dots and size the vector accordingly from the beginning.
+        std::vector<String> parts;
+        String::size_type start = 0;
+        do
+        {
+            parts.push_back(handler_name.substr(start,i-start));
+            start = i+1;
+            i = handler_name.find_first_of((utf32)'.',start);
+        } while(i!=String::npos);
+
+        // add last part
+        parts.push_back(handler_name.substr(start));
+
+        // first part is the global
+        lua_getglobal(L, parts[0].c_str());
+        if (!lua_istable(L,-1))
+        {
+            lua_settop(L,top);
+            throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as first part is not a table");
+        }
+
+        // if there is more than two parts, we have more tables to go through
+        std::vector<String>::size_type visz = parts.size();
+        if (visz-- > 2) // avoid subtracting one later on
+        {
+            // go through all the remaining parts to (hopefully) have a valid Lua function in the end
+            std::vector<String>::size_type vi = 1;
+            while (vi<visz)
+            {
+                // push key, and get the next table
+                lua_pushstring(L,parts[vi].c_str());
+                lua_gettable(L,-2);
+                if (!lua_istable(L,-1))
+                {
+                    lua_settop(L,top);
+                    throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as part #"+PropertyHelper::uintToString(uint(vi+1))+" ("+parts[vi]+") is not a table");
+                }
+                // get rid of the last table and move on
+                lua_remove(L,-2);
+                vi++;
+            }
+        }
+
+        // now we are ready to get the function to call ... phew :)
+        lua_pushstring(L,parts[visz].c_str());
+        lua_gettable(L,-2);
+        lua_remove(L,-2); // get rid of the table
+    }
+    // just a regular global function
+    else
+    {
+        lua_getglobal(L, handler_name.c_str());
+    }
+
+    // is it a function
+    if (!lua_isfunction(L,-1))
+    {
+        lua_settop(L,top);
+        throw ScriptException("The Lua event handler: '"+handler_name+"' does not represent a Lua function");
+    }
+}
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.h	(revision 5707)
@@ -0,0 +1,85 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.h
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Defines interface for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILuaFunctor_h_
+#define _CEGUILuaFunctor_h_
+
+#include "CEGUIEventSet.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// forward declaration
+class LuaScriptModule;
+
+/*!
+\brief
+    Functor class used for subscribing Lua functions to CEGUI events
+*/
+class LuaFunctor
+{
+public:
+    LuaFunctor(lua_State* state, int func, int selfIndex);
+    LuaFunctor(lua_State* state, const String& func, int selfIndex);
+    LuaFunctor(const LuaFunctor& cp);
+    ~LuaFunctor();
+
+    bool operator()(const EventArgs& args) const;
+
+    /*!
+    \brief
+        function used to subscribe any Lua function as event handler.
+        References using the Lua registry.
+        To be called from Lua only.
+    */
+    static Event::Connection SubscribeEvent(EventSet* self, const String& eventName, int funcIndex, int selfIndex, lua_State* L);
+
+    /*!
+    \brief
+        Pushes the Lua function named \param name on top of the Lua stack.
+        The name may contain '.' (dots) character for (nested) table values.
+    */
+    static void pushNamedFunction(lua_State* L, const String& name);
+
+private:
+    lua_State* L;
+    mutable int index;
+    int self;
+    mutable bool needs_lookup;
+    mutable String function_name;
+
+    friend class LuaScriptModule;
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILuaFunctor_h_
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/changes_orxonox.diff
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/changes_orxonox.diff	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/changes_orxonox.diff	(revision 5707)
@@ -0,0 +1,103 @@
+--- CEGUILua.cpp	Thu Jan 29 20:08:43 2009
++++ CEGUILua.cpp	Thu Jan 29 10:23:36 2009
+@@ -40,7 +40,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // prototype for bindings initialisation function
+ int tolua_CEGUI_open(lua_State* tolua_S);
+@@ -55,19 +55,45 @@
+ *************************************************************************/
+ LuaScriptModule::LuaScriptModule()
+ {
++    #if LUA_VERSION_NUM >= 501
++        static const luaL_Reg lualibs[] = {
++            {"", luaopen_base},
++            {LUA_LOADLIBNAME, luaopen_package},
++            {LUA_TABLIBNAME, luaopen_table},
++            {LUA_IOLIBNAME, luaopen_io},
++            {LUA_OSLIBNAME, luaopen_os},
++            {LUA_STRLIBNAME, luaopen_string},
++            {LUA_MATHLIBNAME, luaopen_math},
++        #if defined(DEBUG) || defined (_DEBUG)
++                {LUA_DBLIBNAME, luaopen_debug},
++        #endif
++            {0, 0}
++        };
++    #endif /* LUA_VERSION_NUM >= 501 */
++
+ 	// create a lua state
+ 	d_ownsState = true;
+ 	d_state = lua_open();
+ 
+ 	// init all standard libraries
+-	luaopen_base(d_state);
+-	luaopen_io(d_state);
+-	luaopen_string(d_state);
+-	luaopen_table(d_state);
+-	luaopen_math(d_state);
+-#if defined(DEBUG) || defined (_DEBUG)
+-	luaopen_debug(d_state);
+-#endif
++    #if LUA_VERSION_NUM >= 501
++            const luaL_Reg *lib = lualibs;
++            for (; lib->func; lib++)
++            {
++                lua_pushcfunction(d_state, lib->func);
++                lua_pushstring(d_state, lib->name);
++                lua_call(d_state, 1, 0);
++            }
++    #else /* LUA_VERSION_NUM >= 501 */
++	    luaopen_base(d_state);
++	    luaopen_io(d_state);
++	    luaopen_string(d_state);
++	    luaopen_table(d_state);
++	    luaopen_math(d_state);
++        #if defined(DEBUG) || defined (_DEBUG)
++	        luaopen_debug(d_state);
++        #endif
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+ 	setModuleIdentifierString();
+ }
+--- CEGUILua.h	Thu Jan 29 20:08:23 2009
++++ CEGUILua.h	Thu Jan 29 10:18:39 2009
+@@ -38,7 +38,11 @@
+ #   ifdef CEGUILUA_EXPORTS
+ #       define CEGUILUA_API __declspec(dllexport)
+ #   else
+-#       define CEGUILUA_API __declspec(dllimport)
++#       if defined( __MINGW32__ )
++#           define CEGUILUA_API
++#       else
++#           define CEGUILUA_API __declspec(dllimport)
++#       endif
+ #   endif
+ #else
+ #   define CEGUILUA_API
+--- CEGUILuaFunctor.cpp	Thu Jan 29 20:08:38 2009
++++ CEGUILuaFunctor.cpp	Thu Jan 29 10:21:45 2009
+@@ -39,7 +39,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // Start of CEGUI namespace section
+ namespace CEGUI
+--- required.h	Thu Jan 29 20:08:32 2009
++++ required.h	Thu Jan 29 15:01:58 2009
+@@ -36,6 +36,9 @@
+ #define __operator_decrement    operator--
+ #define __operator_dereference  operator*
+ 
++//This is used to keep compilers happy
++#define CEGUIDeadException(e) &
++
+ #define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent
+ 
+ #if defined(_MSC_VER) && !defined(snprintf)
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/required.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/required.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/required.cpp	(revision 5707)
@@ -0,0 +1,88 @@
+/***********************************************************************
+	filename: required.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Implementation of helper functions
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "required.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+
+// returns horizontal range as two values for lua
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getHorzRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+// returns vertical range as two values for lua
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getVertRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+
+// allocates and returns a new ListboxTextItem
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete)
+{
+	return new ListboxTextItem(text,item_id,item_data,disabled,auto_delete);
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+void ceguiLua_FileStream_open(FileStream* os, const char* filename)
+{
+    os->open(filename, std::ios::binary);
+}
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k)
+{
+    return (k & sys->getSystemKeys()) != 0;
+}
+
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/required.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/required.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/ceguilua/required.h	(revision 5707)
@@ -0,0 +1,113 @@
+/***********************************************************************
+	filename: required.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Header that includes the necessary stuff needed for the Lua bindings
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <fstream>
+
+#define __operator_increment    operator++
+#define __operator_decrement    operator--
+#define __operator_dereference  operator*
+
+//This is used to keep compilers happy
+#define CEGUIDeadException(e) &
+
+#define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent
+
+#if defined(_MSC_VER) && !defined(snprintf)
+#   define snprintf   _snprintf
+#endif
+
+typedef CEGUI::String string;
+
+namespace CEGUI
+{
+
+typedef Event::Connection EventConnection;
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max);
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max);
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete);
+
+
+/************************************************************************
+    Stuff needed to make the iterators work
+*************************************************************************/
+typedef PropertySet::Iterator PropertyIterator;
+typedef EventSet::Iterator EventIterator;
+typedef WindowManager::WindowIterator WindowIterator;
+typedef WindowFactoryManager::WindowFactoryIterator WindowFactoryIterator;
+typedef WindowFactoryManager::FalagardMappingIterator FalagardMappingIterator;
+typedef WindowFactoryManager::FalagardWindowMapping FalagardWindowMapping;
+typedef ImagesetManager::ImagesetIterator ImagesetIterator;
+typedef Imageset::ImageIterator ImageIterator;
+typedef SchemeManager::SchemeIterator SchemeIterator;
+typedef FontManager::FontIterator FontIterator;
+
+template <typename T>
+inline PropertyIterator ceguiLua_getPropertyIterator(const T* self)
+{
+    return static_cast<const PropertySet*>(self)->getIterator();
+}
+
+template <typename T>
+inline EventIterator ceguiLua_getEventIterator(const T* self)
+{
+    return static_cast<const EventSet*>(self)->getIterator();
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+typedef std::ofstream FileStream;
+void ceguiLua_FileStream_open(FileStream*, const char* filename);
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k);
+
+}
+
+// the binding file generates alot of
+// warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
+#if defined(_MSC_VER)
+#   pragma warning(disable : 4800)
+#endif
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Basic.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Basic.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Basic.pkg	(revision 5707)
@@ -0,0 +1,190 @@
+/***********************************************************************
+    Vector2
+***********************************************************************/
+class Vector2
+{
+    // rename 'd_x' and 'd_y' to just 'x' and 'y'
+    float d_x @ x;
+    float d_y @ y;
+
+    Vector2 operator+ (const Vector2& vec) const;
+    Vector2 operator- (const Vector2& vec) const;
+    Vector2 operator* (const Vector2& vec) const;
+    bool operator== (const Vector2& vec) const;
+
+    Vector2();
+    Vector2(float x, float y);
+};
+
+// do a simple copy of Point to Vector2
+$[
+CEGUI.Point = CEGUI.Vector2
+$]
+
+
+
+/***********************************************************************
+	Size
+***********************************************************************/
+class Size
+{
+	// rename 'd_width' and 'd_height' to just 'width' and 'height'
+	float d_width @ width;
+	float d_height @ height;
+
+	bool operator== (const Size& sz) const;
+
+	Size();
+	Size(float w, float h);
+};
+
+
+
+/***********************************************************************
+	Rect
+***********************************************************************/
+class Rect
+{
+	// remove member variable 'd_' prefix
+	float d_top @ top;
+	float d_bottom @ bottom;
+	float d_left @ left;
+	float d_right @ right;
+
+	Vector2 getPosition() const;
+	float getWidth() const;
+	float getHeight() const;
+	Size getSize() const;
+
+	Rect getIntersection(const Rect& rect) const;
+	bool isPointInRect(const Vector2& p) const;
+
+	void setPosition(const Vector2& p);
+	void setWidth(float w);
+	void setHeight(float h);
+	void setSize(const Size& sz);
+
+	Rect& offset(const Vector2& p);
+	Rect& constrainSizeMax(const Size& sz);
+	Rect& constrainSizeMin(const Size& sz);
+	Rect& constrainSize(const Size& min, const Size& max);
+
+	bool operator== (const Rect& r) const;
+
+	Rect();
+	Rect(float l, float t, float r, float b);
+};
+
+
+
+/***********************************************************************
+	colour
+***********************************************************************/
+class colour
+{
+	float getAlpha() const;
+	float getRed() const;
+	float getGreen() const;
+	float getBlue() const;
+	float getHue() const;
+	float getSaturation() const;
+	float getLumination() const;
+
+	void set(float r, float g, float b, float a);
+	void setAlpha(float a);
+	void setRed(float r);
+	void setGreen(float g);
+	void setBlue(float b);
+	void setRGB(float r, float g, float b);
+	void setHSL(float hue, float saturation, float luminance, float alpha=1);
+
+	colour operator+ (const colour& c) const;
+	colour operator- (const colour& c) const;
+	//colour operator* (const colour& c) const; // gives a warning about argb_t to colour conversion
+	bool operator== (const colour& c) const;
+
+	colour();
+	colour(float r, float g, float b, float a);
+};
+
+
+
+/***********************************************************************
+	ColourRect
+***********************************************************************/
+class ColourRect
+{
+	colour d_top_left @ top_left;
+	colour d_top_right @ top_right;
+	colour d_bottom_left @ bottom_left;
+	colour d_bottom_right @ bottom_right;
+
+	void	setAlpha(float alpha);
+	void	setTopAlpha(float alpha);
+	void	setBottomAlpha(float alpha);
+	void	setLeftAlpha(float alpha);
+	void	setRightAlpha(float alpha);
+	void	modulateAlpha(float alpha);
+
+	void	setColours(const colour& col);
+
+	bool	isMonochromatic() const;
+
+	ColourRect getSubRectangle( float left, float right, float top, float bottom ) const;
+	colour getColourAtPoint( float x, float y ) const;
+
+	//ColourRect& operator*= (const ColourRect& other); // no support for *= operators
+
+	ColourRect();
+	ColourRect(const colour& col);
+	ColourRect(const colour& top_left, const colour& top_right, const colour& bottom_left, const colour& bottom_right);
+};
+
+
+
+/************************************************************************
+    String
+*************************************************************************/
+class String
+{
+    static const unsigned long npos;
+
+    unsigned long size() const;
+    unsigned long length() const;
+    bool empty() const;
+    unsigned long capacity() const;
+
+    unsigned long& operator[] (unsigned long i);
+    unsigned long& at(unsigned long i);
+    string c_str() const;
+
+    void reserve(unsigned long num=0);
+    void resize(unsigned long num);
+    void resize(unsigned long num, unsigned long codepoint);
+
+    void clear();
+    String& erase();
+    // default len is different from usual to handle ambiguity issue
+    String& erase(unsigned long idx, unsigned long len=1);
+
+    String& replace(unsigned long begin, unsigned long len, const String&s);
+    //String& replace(unsigned long begin, unsigned long len, unsigned long codepoint);
+
+    void swap(String& s);
+    String& insert(unsigned long pos, const String& s);
+    //String& insert(unsigned long pos, unsigned long codepoint);
+
+    unsigned long find(unsigned long codepoint, unsigned long idx=0) const;
+    unsigned long rfind(unsigned long codepoint, unsigned long idx=-1) const;
+    unsigned long find(const String& sub, unsigned long idx=0) const;
+    unsigned long rfind(const String& sub, unsigned long idx=-1) const;
+
+    String substr(unsigned long idx=0, unsigned long len=-1) const;
+
+    void push_back(unsigned long codepoint);
+
+    String();
+    String(unsigned long num, unsigned long codepoint);
+    String(string s);
+    String(const String& s);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/CEGUI.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/CEGUI.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/CEGUI.pkg	(revision 5707)
@@ -0,0 +1,116 @@
+// include the header that makes these files generate valid code
+$#include "ceguilua/required.h"
+$#include "CEGUIPropertyHelper.h"
+
+// start the CEGUI namespace and include everything inside that
+namespace CEGUI
+{
+
+$pfile "Basic.pkg"
+$pfile "UnifiedCoordSystem.pkg"
+$pfile "Logger.pkg"
+
+$pfile "Font.pkg"
+$pfile "FontManager.pkg"
+
+$pfile "Image.pkg"
+$pfile "Texture.pkg"
+$pfile "Imageset.pkg"
+$pfile "ImagesetManager.pkg"
+
+$pfile "Iterators.pkg"
+
+$pfile "Key.pkg"
+$pfile "InputEvent.pkg"
+$pfile "EventSet.pkg"
+
+$pfile "MouseCursor.pkg"
+$pfile "Window.pkg"
+$pfile "CoordConverter.pkg"
+$pfile "Renderer.pkg"
+$pfile "System.pkg"
+
+$pfile "WindowManager.pkg"
+$pfile "WindowFactoryManager.pkg"
+
+$pfile "Scheme.pkg"
+$pfile "SchemeManager.pkg"
+
+$pfile "PropertyHelper.pkg"
+
+// elements
+$pfile "elements/GUISheet.pkg"
+
+$pfile "elements/ButtonBase.pkg"
+$pfile "elements/Checkbox.pkg"
+$pfile "elements/PushButton.pkg"
+$pfile "elements/Thumb.pkg"
+$pfile "elements/RadioButton.pkg"
+
+$pfile "elements/TabButton.pkg"
+$pfile "elements/TabControl.pkg"
+
+$pfile "elements/Titlebar.pkg"
+$pfile "elements/FrameWindow.pkg"
+
+$pfile "elements/Tooltip.pkg"
+
+$pfile "elements/DragContainer.pkg"
+
+$pfile "elements/Scrollbar.pkg"
+$pfile "elements/ScrolledContainer.pkg"
+$pfile "elements/ScrollablePane.pkg"
+
+$pfile "elements/Slider.pkg"
+
+$pfile "elements/Spinner.pkg"
+
+$pfile "elements/ProgressBar.pkg"
+
+$pfile "elements/Editbox.pkg"
+$pfile "elements/MultiLineEditbox.pkg"
+
+$pfile "elements/ListboxItem.pkg"
+$pfile "elements/ListboxTextItem.pkg"
+
+$pfile "elements/Combobox.pkg"
+$pfile "elements/Listbox.pkg"
+$pfile "elements/ComboDropList.pkg"
+
+$pfile "elements/ListHeaderSegment.pkg"
+$pfile "elements/ListHeader.pkg"
+$pfile "elements/MultiColumnList.pkg"
+
+$pfile "elements/ItemEntry.pkg"
+$pfile "elements/ItemListBase.pkg"
+$pfile "elements/MenuBase.pkg"
+$pfile "elements/Menubar.pkg"
+$pfile "elements/PopupMenu.pkg"
+$pfile "elements/MenuItem.pkg"
+$pfile "elements/ScrolledItemListBase.pkg"
+$pfile "elements/ItemListbox.pkg"
+
+$pfile "falagard/Enums.pkg"
+$pfile "falagard/Dimension.pkg"
+$pfile "falagard/NamedArea.pkg"
+$pfile "falagard/PropertyDefinitionBase.pkg"
+$pfile "falagard/PropertyDefinition.pkg"
+$pfile "falagard/PropertyInitialiser.pkg"
+$pfile "falagard/PropertyLinkDefinition.pkg"
+$pfile "falagard/FalagardComponentBase.pkg"
+$pfile "falagard/FrameComponent.pkg"
+$pfile "falagard/ImageryComponent.pkg"
+$pfile "falagard/TextComponent.pkg"
+$pfile "falagard/ImagerySection.pkg"
+$pfile "falagard/SectionSpecification.pkg"
+$pfile "falagard/LayerSpecification.pkg"
+$pfile "falagard/StateImagery.pkg"
+$pfile "falagard/WidgetComponent.pkg"
+$pfile "falagard/WidgetLookFeel.pkg"
+$pfile "falagard/WidgetLookManager.pkg"
+
+$pfile "HelperFunctions.pkg"
+
+$pfile "OutStream.pkg"
+
+}
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/CoordConverter.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/CoordConverter.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/CoordConverter.pkg	(revision 5707)
@@ -0,0 +1,30 @@
+/***********************************************************************
+    CoordConverter utility class
+***********************************************************************/
+class CoordConverter
+{
+    static float windowToScreenX(const Window& window, const UDim& x);
+    static float windowToScreenX(const Window& window, const float x);
+
+    static float windowToScreenY(const Window& window, const UDim& y);
+    static float windowToScreenY(const Window& window, const float y);
+
+    static Vector2 windowToScreen(const Window& window, const UVector2& vec);
+    static Vector2 windowToScreen(const Window& window, const Vector2& vec);
+
+    static Rect windowToScreen(const Window& window, const URect& rect);
+    static Rect windowToScreen(const Window& window, const Rect& rect);
+
+    static float screenToWindowX(const Window& window, const UDim& x);
+    static float screenToWindowX(const Window& window, const float x);
+
+    static float screenToWindowY(const Window& window, const UDim& y);
+    static float screenToWindowY(const Window& window, const float y);
+
+    static Vector2 screenToWindow(const Window& window, const UVector2& vec);
+    static Vector2 screenToWindow(const Window& window, const Vector2& vec);
+
+    static Rect screenToWindow(const Window& window, const URect& rect);
+    static Rect screenToWindow(const Window& window, const Rect& rect);
+
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/EventSet.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/EventSet.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/EventSet.pkg	(revision 5707)
@@ -0,0 +1,46 @@
+/************************************************************************
+    Event
+*************************************************************************/
+class Event
+{
+    string getName() const;
+};
+
+class EventConnection
+{
+//    bool connected() const;
+//    void disconnect();
+};
+
+
+/***********************************************************************
+	EventSet
+***********************************************************************/
+class EventSet
+{
+	void addEvent(string name);
+	void removeEvent(string name);
+	void removeAllEvents();
+	bool isEventPresent(string name);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| tolua_outside EventConnection LuaFunctorSubscribeEvent @ subscribeEvent(string name, lua_Object funcIndex, lua_Object selfIndex=LUA_NOREF, lua_State*);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| EventConnection subscribeScriptedEvent @ subscribeEvent(string name, string callback_name);
+
+	void fireEvent(string name, EventArgs& args, string eventnamespace="");
+
+	bool isMuted() const;
+	void setMutedState(bool setting);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
+
+
+
+/***********************************************************************
+	GlobalEventSet
+***********************************************************************/
+class GlobalEventSet : public EventSet
+{
+	static GlobalEventSet& getSingleton();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Font.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Font.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Font.pkg	(revision 5707)
@@ -0,0 +1,53 @@
+/***********************************************************************
+	TextFormatting
+***********************************************************************/
+enum TextFormatting
+{
+	LeftAligned,
+	RightAligned,
+	Centred,
+	Justified,
+	WordWrapLeftAligned,
+	WordWrapRightAligned,
+	WordWrapCentred,
+	WordWrapJustified
+};
+
+
+/***********************************************************************
+	Font
+***********************************************************************/
+class Font //: public PropertySet
+{
+	//////////////////////////////////////////////
+	// PropertySet
+	void setProperty(string name, string value);
+	string getProperty(string name) const;
+	string getPropertyDefault(string name) const;
+	string getPropertyHelp(string name) const;
+
+	bool isPropertyPresent(string name) const;
+	bool isPropertyDefault(string name) const;
+
+    tolua_outside PropertyIterator ceguiLua_getPropertyIterator @ getPropertyIterator() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string getDefaultResourceGroup();
+
+    void load ();
+
+	bool isCodepointAvailable(unsigned long cp) const;
+
+	void setNativeResolution(const Size& sz);
+	void notifyScreenResolution(const Size& sz);
+
+	float getTextExtent(string text, float xscale=1);
+	float getLineSpacing(float yscale=1) const;
+	float getFontHeight(float yscale=1) const;
+
+	unsigned long getCharAtPixel(string text, unsigned long start_char, float pixel, float xscale=1);
+	unsigned long getCharAtPixel(string text, float pixel, float xscale=1);
+
+	unsigned long getFormattedLineCount(string text, const Rect& format_area, TextFormatting fmt, float xscale=1);
+	float getFormattedTextExtent(string text, const Rect& format_area, TextFormatting fmt, float xscale=1);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/FontManager.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/FontManager.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/FontManager.pkg	(revision 5707)
@@ -0,0 +1,21 @@
+/***********************************************************************
+	FontManager
+***********************************************************************/
+class FontManager
+{
+	static FontManager& getSingleton();
+
+	tolua_throws|CEGUI::AlreadyExistsException,error|CEGUI::InvalidRequestException,error| Font* createFont(string type, string name, string fontname, string resourcegroup="");
+	tolua_throws|CEGUI::AlreadyExistsException,error|CEGUI::InvalidRequestException,error| Font* createFont(string filename, string resourcegroup="");
+
+	void destroyFont(string name);
+	void destroyFont(Font* font);
+	void destroyAllFonts();
+
+	bool isFontPresent(string name) const;
+	Font* getFont(string name) const;
+
+	void notifyScreenResolution(const Size& sz);
+
+    FontIterator getIterator() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/HelperFunctions.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/HelperFunctions.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/HelperFunctions.pkg	(revision 5707)
@@ -0,0 +1,235 @@
+/****************************************************
+	EventArgs casting helper functions.
+	These are not part of the core CEGUI API, merely here for
+	convenience
+*****************************************************/
+$[
+
+function CEGUI.toMouseCursorEventArgs(e)
+    return tolua.cast(e,"const CEGUI::MouseCursorEventArgs")
+end
+
+function CEGUI.toWindowEventArgs(e)
+    return tolua.cast(e,"const CEGUI::WindowEventArgs")
+end
+
+function CEGUI.toActivationEventArgs(e)
+    return tolua.cast(e,"const CEGUI::ActivationEventArgs")
+end
+
+function CEGUI.toHeaderSequenceEventArgs(e)
+    return tolua.cast(e,"const CEGUI::HeaderSequenceEventArgs")
+end
+
+function CEGUI.toMouseEventArgs(e)
+    return tolua.cast(e,"const CEGUI::MouseEventArgs")
+end
+
+function CEGUI.toKeyEventArgs(e)
+    return tolua.cast(e,"const CEGUI::KeyEventArgs")
+end
+
+function CEGUI.toDragDropEventArgs(e)
+    return tolua.cast(e,"const CEGUI::DragDropEventArgs")
+end
+
+CEGUI.EventArgs.toMouseCursorEventArgs      = CEGUI.toMouseCursorEventArgs
+CEGUI.EventArgs.toWindowEventArgs           = CEGUI.toWindowEventArgs
+CEGUI.EventArgs.toActivationEventArgs       = CEGUI.toActivationEventArgs
+CEGUI.EventArgs.toHeaderSequenceEventArgs   = CEGUI.toHeaderSequenceEventArgs
+CEGUI.EventArgs.toMouseEventArgs            = CEGUI.toMouseEventArgs
+CEGUI.EventArgs.toKeyEventArgs              = CEGUI.toKeyEventArgs
+CEGUI.EventArgs.toDragDropEventArgs         = CEGUI.toDragDropEventArgs
+
+$]
+
+
+/****************************************************
+	Functions for easy casting CEGUI::Window class
+	to the widget classes derived from it.
+	
+	all widget types gets these and they are made available as:
+	CEGUI.toButtonBase and CEGUI.Window:toButtonBase
+	etc...
+*****************************************************/
+$[
+
+function CEGUI.toButtonBase(w)
+    return tolua.cast(w,"CEGUI::ButtonBase")
+end
+
+function CEGUI.toCheckbox(w)
+    return tolua.cast(w,"CEGUI::Checkbox")
+end
+
+function CEGUI.toCombobox(w)
+    return tolua.cast(w,"CEGUI::Combobox")
+end
+
+function CEGUI.toComboDropList(w)
+    return tolua.cast(w,"CEGUI::ComboDropList")
+end
+
+function CEGUI.toDragContainer(w)
+    return tolua.cast(w,"CEGUI::DragContainer")
+end
+
+function CEGUI.toEditbox(w)
+    return tolua.cast(w,"CEGUI::Editbox")
+end
+
+function CEGUI.toFrameWindow(w)
+    return tolua.cast(w,"CEGUI::FrameWindow")
+end
+
+function CEGUI.toGUISheet(w)
+    return tolua.cast(w,"CEGUI::GUISheet")
+end
+
+function CEGUI.toItemEntry(w)
+    return tolua.cast(w,"CEGUI::ItemEntry")
+end
+
+function CEGUI.toItemListBase(w)
+    return tolua.cast(w,"CEGUI::ItemListBase")
+end
+
+function CEGUI.toItemListbox(w)
+    return tolua.cast(w,"CEGUI::ItemListbox")
+end
+
+function CEGUI.toListbox(w)
+    return tolua.cast(w,"CEGUI::Listbox")
+end
+
+function CEGUI.toListHeader(w)
+    return tolua.cast(w,"CEGUI::ListHeader")
+end
+
+function CEGUI.toListHeaderSegment(w)
+    return tolua.cast(w,"CEGUI::ListHeaderSegment")
+end
+
+function CEGUI.toMenubar(w)
+    return tolua.cast(w,"CEGUI::Menubar")
+end
+
+function CEGUI.toMenuBase(w)
+    return tolua.cast(w,"CEGUI::MenuBase")
+end
+
+function CEGUI.toMenuItem(w)
+    return tolua.cast(w,"CEGUI::MenuItem")
+end
+
+function CEGUI.toMultiColumnList(w)
+    return tolua.cast(w,"CEGUI::MultiColumnList")
+end
+
+function CEGUI.toMultiLineEditbox(w)
+    return tolua.cast(w,"CEGUI::MultiLineEditbox")
+end
+
+function CEGUI.toPopupMenu(w)
+    return tolua.cast(w,"CEGUI::PopupMenu")
+end
+
+function CEGUI.toProgressBar(w)
+    return tolua.cast(w,"CEGUI::ProgressBar")
+end
+
+function CEGUI.toPushButton(w)
+    return tolua.cast(w,"CEGUI::PushButton")
+end
+
+function CEGUI.toRadioButton(w)
+    return tolua.cast(w,"CEGUI::RadioButton")
+end
+
+function CEGUI.toScrollablePane(w)
+    return tolua.cast(w,"CEGUI::ScrollablePane")
+end
+
+function CEGUI.toScrollbar(w)
+    return tolua.cast(w,"CEGUI::Scrollbar")
+end
+
+function CEGUI.toScrolledContainer(w)
+    return tolua.cast(w,"CEGUI::ScrolledContainer")
+end
+
+function CEGUI.toScrolledItemListBase(w)
+    return tolua.cast(w,"CEGUI::ScrolledItemListBase")
+end
+
+function CEGUI.toSlider(w)
+    return tolua.cast(w,"CEGUI::Slider")
+end
+
+function CEGUI.toSpinner(w)
+    return tolua.cast(w,"CEGUI::Spinner")
+end
+
+function CEGUI.toTabButton(w)
+    return tolua.cast(w,"CEGUI::TabButton")
+end
+
+function CEGUI.toTabControl(w)
+    return tolua.cast(w,"CEGUI::TabControl")
+end
+
+function CEGUI.toTabPane(w)
+    return tolua.cast(w,"CEGUI::TabPane")
+end
+
+function CEGUI.toThumb(w)
+    return tolua.cast(w,"CEGUI::Thumb")
+end
+
+function CEGUI.toTooltip(w)
+    return tolua.cast(w,"CEGUI::Tooltip")
+end
+
+CEGUI.Window.toButtonBase = CEGUI.toButtonBase
+CEGUI.Window.toCheckbox = CEGUI.toCheckbox
+CEGUI.Window.toCombobox = CEGUI.toCombobox
+CEGUI.Window.toComboDropList = CEGUI.toComboDropList
+CEGUI.Window.toDragContainer = CEGUI.toDragContainer
+CEGUI.Window.toEditbox = CEGUI.toEditbox
+CEGUI.Window.toFrameWindow = CEGUI.toFrameWindow
+CEGUI.Window.toGUISheet = CEGUI.toGUISheet
+CEGUI.Window.toItemEntry = CEGUI.toItemEntry
+CEGUI.Window.toItemListBase = CEGUI.toItemListBase
+CEGUI.Window.toItemListbox = CEGUI.toItemListBase
+CEGUI.Window.toListbox = CEGUI.toListbox
+CEGUI.Window.toListHeader = CEGUI.toListHeader
+CEGUI.Window.toListHeaderSegment = CEGUI.toListHeaderSegment
+CEGUI.Window.toMenubar = CEGUI.toMenubar
+CEGUI.Window.toMenuBase = CEGUI.toMenuBase
+CEGUI.Window.toMenuItem = CEGUI.toMenuItem
+CEGUI.Window.toMultiColumnList = CEGUI.toMultiColumnList
+CEGUI.Window.toMultiLineEditbox = CEGUI.toMultiLineEditbox
+CEGUI.Window.toPopupMenu = CEGUI.toPopupMenu
+CEGUI.Window.toProgressBar = CEGUI.toProgressBar
+CEGUI.Window.toPushButton = CEGUI.toPushButton
+CEGUI.Window.toRadioButton = CEGUI.toRadioButton
+CEGUI.Window.toScrollablePane = CEGUI.toScrollablePane
+CEGUI.Window.toScrollbar = CEGUI.toScrollbar
+CEGUI.Window.toScrolledContainer = CEGUI.toScrolledContainer
+CEGUI.Window.toScrolledItemListBase = CEGUI.toScrolledItemListBase
+CEGUI.Window.toSlider = CEGUI.toSlider
+CEGUI.Window.toSpinner = CEGUI.toSpinner
+CEGUI.Window.toTabButton = CEGUI.toTabButton
+CEGUI.Window.toTabControl = CEGUI.toTabControl
+CEGUI.Window.toTabPane = CEGUI.toTabPane
+CEGUI.Window.toThumb = CEGUI.toThumb
+CEGUI.Window.toTooltip = CEGUI.toTooltip
+
+$]
+
+
+/****************************************************
+	Helper to create a ListboxTextItem.
+	Mimics the constructor
+*****************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem @ createListboxTextItem(string text, unsigned int item_id=0, void* item_data=0, bool disabled=false, bool auto_delete=true);
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Image.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Image.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Image.pkg	(revision 5707)
@@ -0,0 +1,15 @@
+/***********************************************************************
+	Image
+***********************************************************************/
+class Image
+{
+	Size getSize() const;
+	float getWidth() const;
+	float getHeight() const;
+	Vector2 getOffsets() const;
+	float getOffsetX() const;
+	float getOffsetY() const;
+	string getName() const;
+	string getImagesetName() const;
+	Rect getSourceTextureArea() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Imageset.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Imageset.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Imageset.pkg	(revision 5707)
@@ -0,0 +1,31 @@
+/***********************************************************************
+	Imageset
+***********************************************************************/
+class Imageset
+{
+	Texture* getTexture() const;
+	string getName() const;
+	unsigned int getImageCount() const;
+	bool isImageDefined(string name) const;
+	const Image& getImage(string name) const;
+	void undefineImage(string name);
+	void undefineAllImages();
+	Size getImageSize(string name) const;
+	float getImageWidth(string name) const;
+	float getImageHeight(string name) const;
+	Vector2 getImageOffset(string name) const;
+	float getImageOffsetX(string name) const;
+	float getImageOffsetY(string name) const;
+	void defineImage(string name, const Vector2& pos, const Size& size, const Vector2& render_offset);
+	void defineImage(string name, const Rect& rect, const Vector2& render_offset);
+	bool isAutoScaled() const;
+	void setAutoScalingEnabled(bool setting);
+	Size getNativeResolution() const;
+	void setNativeResolution(const Size& sz);
+	void notifyScreenResolution(const Size& sz);
+
+    ImageIterator getIterator() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string getDefaultResourceGroup();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/ImagesetManager.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/ImagesetManager.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/ImagesetManager.pkg	(revision 5707)
@@ -0,0 +1,22 @@
+/***********************************************************************
+	ImagesetManager
+***********************************************************************/
+class ImagesetManager
+{
+	static ImagesetManager& getSingleton();
+
+	tolua_throws|CEGUI::Exception,error| Imageset* createImageset(string name, Texture* texture);
+	tolua_throws|CEGUI::Exception,error| Imageset* createImageset(string filename, string resourcegroup="");
+	tolua_throws|CEGUI::Exception,error| Imageset* createImagesetFromImageFile(string name, string filename, string resourcegroup="");
+
+	void destroyImageset(Imageset* imageset);
+	void destroyImageset(string name);
+	void destroyAllImagesets();
+
+	tolua_throws|CEGUI::Exception,nil| Imageset* getImageset(string name) const;
+	bool isImagesetPresent(string name) const;
+
+	void notifyScreenResolution(const Size& size);
+
+    ImagesetIterator getIterator() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/InputEvent.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/InputEvent.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/InputEvent.pkg	(revision 5707)
@@ -0,0 +1,118 @@
+/***********************************************************************
+	EventArgs
+***********************************************************************/
+class EventArgs
+{
+	bool handled;
+
+	EventArgs();
+};
+
+
+
+/***********************************************************************
+	MouseCursorEventArgs
+***********************************************************************/
+class MouseCursorEventArgs : public EventArgs
+{
+	MouseCursor* mouseCursor;
+	const Image* image;
+
+	MouseCursorEventArgs(MouseCursor* cursor);
+};
+
+
+
+/***********************************************************************
+	WindowEventArgs
+***********************************************************************/
+class WindowEventArgs : public EventArgs
+{
+	Window* window;
+
+	WindowEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	ActivationEventArgs
+***********************************************************************/
+class ActivationEventArgs : public WindowEventArgs
+{
+	Window* otherWindow;
+
+	ActivationEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	HeaderSequenceEventArgs
+***********************************************************************/
+class HeaderSequenceEventArgs : public WindowEventArgs
+{
+	// remove 'd_' member variable prefix
+	unsigned int d_oldIdx @ oldIdx;
+	unsigned int d_newIdx @ newIdx;
+
+	HeaderSequenceEventArgs(Window* wnd, unsigned int old_index, unsigned int new_index);
+};
+
+
+
+/***********************************************************************
+	MouseButton
+***********************************************************************/
+enum MouseButton
+{
+	LeftButton,
+	RightButton,
+	MiddleButton,
+	X1Button,
+	X2Button,
+	MouseButtonCount,
+	NoButton
+};
+
+
+
+/***********************************************************************
+	MouseEventArgs
+***********************************************************************/
+class MouseEventArgs : public WindowEventArgs
+{
+	Vector2 position;
+	Vector2 moveDelta;
+	MouseButton button;
+	unsigned int sysKeys;
+	float wheelChange;
+
+	MouseEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	KeyEventArgs
+***********************************************************************/
+class KeyEventArgs : public WindowEventArgs
+{
+	unsigned long codepoint;
+	Key::Scan scancode;
+	unsigned int sysKeys;
+
+	KeyEventArgs(Window* wnd);
+};
+
+
+
+/************************************************************************
+    DragDropEventArgs
+*************************************************************************/
+class DragDropEventArgs : public WindowEventArgs
+{
+    DragContainer* dragDropItem;
+
+    DragDropEventArgs(Window* wnd);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Iterators.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Iterators.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Iterators.pkg	(revision 5707)
@@ -0,0 +1,295 @@
+/************************************************************************
+    Lua iterator implementation
+*************************************************************************/
+$[
+
+function CEGUI.iterator_impl_next(p)
+    if p:isAtEnd() then
+        return nil;
+    end
+    local k,v = p:key(), p:value();
+    p:next();
+    return k,v;
+end
+
+function CEGUI.iterator_impl(self)
+   return CEGUI.iterator_impl_next, self; 
+end
+
+$]
+
+
+
+/************************************************************************
+    PropertyIterator
+*************************************************************************/
+class Property
+{
+    string getHelp() const;
+    string getName() const;
+};
+
+class PropertyIterator
+{
+    string getCurrentKey @ key() const;
+    Property* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    PropertyIterator& __operator_increment @ next();
+    PropertyIterator& __operator_decrement @ previous();
+    bool operator== (const PropertyIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    PropertyIterator(const PropertyIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.PropertyIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    EventIterator
+*************************************************************************/
+class EventIterator
+{
+    string getCurrentKey @ key() const;
+    Event* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    EventIterator& __operator_increment @ next();
+    EventIterator& __operator_decrement @ previous();
+    bool operator== (const EventIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    EventIterator(const EventIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.EventIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    WindowIterator
+*************************************************************************/
+class WindowIterator
+{
+    string getCurrentKey @ key() const;
+    Window* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    WindowIterator& __operator_increment @ next();
+    WindowIterator& __operator_decrement @ previous();
+    bool operator== (const WindowIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    WindowIterator(const WindowIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.WindowIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    WindowFactoryIterator
+*************************************************************************/
+class WindowFactoryIterator
+{
+    string getCurrentKey @ key() const;
+    WindowFactory* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    WindowFactoryIterator& __operator_increment @ next();
+    WindowFactoryIterator& __operator_decrement @ previous();
+    bool operator== (const WindowFactoryIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    WindowFactoryIterator(const WindowFactoryIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.WindowFactoryIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    FalagardMappingIterator
+*************************************************************************/
+class FalagardMappingIterator
+{
+    string getCurrentKey @ key() const;
+    FalagardWindowMapping getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    FalagardMappingIterator& __operator_increment @ next();
+    FalagardMappingIterator& __operator_decrement @ previous();
+    bool operator== (const FalagardMappingIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    FalagardMappingIterator(const FalagardMappingIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.FalagardMappingIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    ImagesetIterator
+*************************************************************************/
+class ImagesetIterator
+{
+    string getCurrentKey @ key() const;
+    Imageset* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    ImagesetIterator& __operator_increment @ next();
+    ImagesetIterator& __operator_decrement @ previous();
+    bool operator== (const ImagesetIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    ImagesetIterator(const ImagesetIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.ImagesetIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    ImageIterator
+*************************************************************************/
+class ImageIterator
+{
+    string getCurrentKey @ key() const;
+    Image getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    ImageIterator& __operator_increment @ next();
+    ImageIterator& __operator_decrement @ previous();
+    bool operator== (const ImageIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    ImageIterator(const ImageIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.ImageIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    SchemeIterator
+*************************************************************************/
+class SchemeIterator
+{
+    string getCurrentKey @ key() const;
+    Scheme* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    SchemeIterator& __operator_increment @ next();
+    SchemeIterator& __operator_decrement @ previous();
+    bool operator== (const SchemeIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    SchemeIterator(const SchemeIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.SchemeIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    FontIterator
+*************************************************************************/
+class FontIterator
+{
+    string getCurrentKey @ key() const;
+    Font* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    FontIterator& __operator_increment @ next();
+    FontIterator& __operator_decrement @ previous();
+    bool operator== (const FontIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    FontIterator(const FontIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.FontIterator.iterator = CEGUI.iterator_impl;
+
+$]
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Key.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Key.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Key.pkg	(revision 5707)
@@ -0,0 +1,175 @@
+/***********************************************************************
+	Key::Scan
+
+	This is'nt exactly how it's done in the C++ code, but it works
+	fine anyway :)
+***********************************************************************/
+namespace Key
+{
+
+enum Scan
+{
+	Escape          =0x01,
+	One             =0x02,
+	Two             =0x03,
+	Three           =0x04,
+	Four            =0x05,
+	Five            =0x06,
+	Six             =0x07,
+	Seven           =0x08,
+	Eight           =0x09,
+	Nine            =0x0A,
+	Zero            =0x0B,
+	Minus           =0x0C,    /* - on main keyboard */
+	Equals			=0x0D,
+	Backspace		=0x0E,    /* backspace */
+	Tab				=0x0F,
+	Q               =0x10,
+	W               =0x11,
+	E               =0x12,
+	R               =0x13,
+	T               =0x14,
+	Y               =0x15,
+	U               =0x16,
+	I               =0x17,
+	O               =0x18,
+	P               =0x19,
+	LeftBracket     =0x1A,
+	RightBracket    =0x1B,
+	Return			=0x1C,    /* Enter on main keyboard */
+	LeftControl		=0x1D,
+	A               =0x1E,
+	S               =0x1F,
+	D               =0x20,
+	F               =0x21,
+	G               =0x22,
+	H               =0x23,
+	J               =0x24,
+	K               =0x25,
+	L               =0x26,
+	Semicolon       =0x27,
+	Apostrophe		=0x28,
+	Grave           =0x29,    /* accent grave */
+	LeftShift       =0x2A,
+	Backslash       =0x2B,
+	Z               =0x2C,
+	X               =0x2D,
+	C               =0x2E,
+	V               =0x2F,
+	B               =0x30,
+	N               =0x31,
+	M               =0x32,
+	Comma           =0x33,
+	Period          =0x34,    /* . on main keyboard */
+	Slash           =0x35,    /* '/' on main keyboard */
+	RightShift      =0x36,
+	Multiply        =0x37,    /* * on numeric keypad */
+	LeftAlt         =0x38,    /* left Alt */
+	Space           =0x39,
+	Capital         =0x3A,
+	F1              =0x3B,
+	F2              =0x3C,
+	F3              =0x3D,
+	F4              =0x3E,
+	F5              =0x3F,
+	F6              =0x40,
+	F7              =0x41,
+	F8              =0x42,
+	F9              =0x43,
+	F10             =0x44,
+	NumLock         =0x45,
+	ScrollLock      =0x46,    /* Scroll Lock */
+	Numpad7         =0x47,
+	Numpad8         =0x48,
+	Numpad9         =0x49,
+	Subtract        =0x4A,    /* - on numeric keypad */
+	Numpad4         =0x4B,
+	Numpad5         =0x4C,
+	Numpad6         =0x4D,
+	Add				=0x4E,    /* + on numeric keypad */
+	Numpad1         =0x4F,
+	Numpad2         =0x50,
+	Numpad3         =0x51,
+	Numpad0         =0x52,
+	Decimal			=0x53,    /* . on numeric keypad */
+	OEM_102         =0x56,    /* < > | on UK/Germany keyboards */
+	F11             =0x57,
+	F12             =0x58,
+	F13             =0x64,    /*                     (NEC PC98) */
+	F14             =0x65,    /*                     (NEC PC98) */
+	F15             =0x66,    /*                     (NEC PC98) */
+	Kana            =0x70,    /* (Japanese keyboard)            */
+	ABNT_C1         =0x73,    /* / ? on Portugese (Brazilian) keyboards */
+	Convert         =0x79,    /* (Japanese keyboard)            */
+	NoConvert       =0x7B,    /* (Japanese keyboard)            */
+	Yen             =0x7D,    /* (Japanese keyboard)            */
+	ABNT_C2         =0x7E,    /* Numpad . on Portugese (Brazilian) keyboards */
+	NumpadEquals    =0x8D,    /* = on numeric keypad (NEC PC98) */
+	PrevTrack       =0x90,    /* Previous Track (KC_CIRCUMFLEX on Japanese keyboard) */
+	At              =0x91,    /*                     (NEC PC98) */
+	Colon           =0x92,    /*                     (NEC PC98) */
+	Underline       =0x93,    /*                     (NEC PC98) */
+	Kanji           =0x94,    /* (Japanese keyboard)            */
+	Stop            =0x95,    /*                     (NEC PC98) */
+	AX              =0x96,    /*                     (Japan AX) */
+	Unlabeled       =0x97,    /*                        (J3100) */
+	NextTrack       =0x99,    /* Next Track */
+	NumpadEnter     =0x9C,    /* Enter on numeric keypad */
+	RightControl    =0x9D,
+	Mute            =0xA0,    /* Mute */
+	Calculator      =0xA1,    /* Calculator */
+	PlayPause       =0xA2,    /* Play / Pause */
+	MediaStop       =0xA4,    /* Media Stop */
+	VolumeDown      =0xAE,    /* Volume - */
+	VolumeUp        =0xB0,    /* Volume + */
+	WebHome         =0xB2,    /* Web home */
+	NumpadComma     =0xB3,    /* , on numeric keypad (NEC PC98) */
+	Divide          =0xB5,    /* / on numeric keypad */
+	SysRq           =0xB7,
+	RightAlt        =0xB8,    /* right Alt */
+	Pause           =0xC5,    /* Pause */
+	Home            =0xC7,    /* Home on arrow keypad */
+	ArrowUp         =0xC8,    /* UpArrow on arrow keypad */
+	PageUp          =0xC9,    /* PgUp on arrow keypad */
+	ArrowLeft       =0xCB,    /* LeftArrow on arrow keypad */
+	ArrowRight      =0xCD,    /* RightArrow on arrow keypad */
+	End             =0xCF,    /* End on arrow keypad */
+	ArrowDown       =0xD0,    /* DownArrow on arrow keypad */
+	PageDown		=0xD1,    /* PgDn on arrow keypad */
+	Insert          =0xD2,    /* Insert on arrow keypad */
+	Delete          =0xD3,    /* Delete on arrow keypad */
+	LeftWindows     =0xDB,    /* Left Windows key */
+	RightWindow     =0xDC,    /* Right Windows key */
+	AppMenu         =0xDD,    /* AppMenu key */
+	Power           =0xDE,    /* System Power */
+	Sleep           =0xDF,    /* System Sleep */
+	Wake			=0xE3,    /* System Wake */
+	WebSearch		=0xE5,    /* Web Search */
+	WebFavorites	=0xE6,    /* Web Favorites */
+	WebRefresh		=0xE7,    /* Web Refresh */
+	WebStop			=0xE8,    /* Web Stop */
+	WebForward		=0xE9,    /* Web Forward */
+	WebBack			=0xEA,    /* Web Back */
+	MyComputer		=0xEB,    /* My Computer */
+	Mail			=0xEC,    /* Mail */
+	MediaSelect		=0xED     /* Media Select */
+
+}; // Key::Scan
+
+} // Key
+
+
+
+/***********************************************************************
+	SystemKey
+***********************************************************************/
+enum SystemKey
+{
+	LeftMouse		= 0x01,			//!< The left mouse button.
+	RightMouse		= 0x02,			//!< The right mouse button.
+	Shift			= 0x04,			//!< Either shift key.
+	Control			= 0x08,			//!< Either control key.
+	MiddleMouse		= 0x10,			//!< The middle mouse button.
+	X1Mouse			= 0x20,			//!< The first 'extra' mouse button
+	X2Mouse			= 0x40			//!< The second 'extra' mouse button.
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Logger.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Logger.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Logger.pkg	(revision 5707)
@@ -0,0 +1,25 @@
+/***********************************************************************
+	LoggingLevel
+***********************************************************************/
+enum LoggingLevel
+{
+	Errors,
+	Standard,
+	Informative,
+	Insane
+};
+
+
+
+/***********************************************************************
+	Logger
+***********************************************************************/
+class Logger
+{
+	static Logger& getSingleton();
+
+	void setLoggingLevel(LoggingLevel level);
+	LoggingLevel getLoggingLevel() const;
+
+	void logEvent(string message, LoggingLevel level=Standard);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/MouseCursor.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/MouseCursor.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/MouseCursor.pkg	(revision 5707)
@@ -0,0 +1,40 @@
+/***********************************************************************
+	MouseCursorImage
+***********************************************************************/
+enum MouseCursorImage
+{
+	BlankMouseCursor	= 0,
+	DefaultMouseCursor	= -1
+};
+
+
+
+/***********************************************************************
+	MouseCursor
+***********************************************************************/
+class MouseCursor : public EventSet
+{
+	static MouseCursor& getSingleton();
+
+	void setImage(const Image* image);
+	void setImage(string imageset, string image);
+	const Image* getImage() const;
+
+	void setPosition(const Vector2& pos);
+	void offsetPosition(const Vector2& offset);
+	void setConstraintArea(const Rect* area);
+	Vector2 getPosition() const;
+	Rect getConstraintArea() const;
+	Vector2 getDisplayIndependantPosition() const;
+
+	void setUnifiedConstraintArea(const URect* area);
+	const URect& getUnifiedConstraintArea(void) const;
+
+	void hide();
+	void show();
+
+    void setVisible(bool visible);
+	bool isVisible() const;
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/OutStream.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/OutStream.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/OutStream.pkg	(revision 5707)
@@ -0,0 +1,16 @@
+/***********************************************************************
+    OutStream
+***********************************************************************/
+
+class OutStream
+{
+};
+
+class FileStream : public OutStream
+{
+    FileStream();
+
+    bool is_open();
+    tolua_outside void CEGUI::ceguiLua_FileStream_open @ open(const char* filename);
+    void close();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/PropertyHelper.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/PropertyHelper.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/PropertyHelper.pkg	(revision 5707)
@@ -0,0 +1,33 @@
+/***********************************************************************
+	PropertyHelper
+***********************************************************************/
+class PropertyHelper
+{
+	static	float			stringToFloat(string str);
+	static	unsigned int	stringToUint(string str);
+	static	bool			stringToBool(string str);
+	static	Size			stringToSize(string str);
+	static	Vector2			stringToPoint(string str);
+	static	Rect			stringToRect(string str);
+	static	const Image*	stringToImage(string str);
+	static	colour			stringToColour(string str);
+	static	ColourRect		stringToColourRect(string str);
+
+	static	UDim			stringToUDim(string str);
+	static	UVector2		stringToUVector2(string str);
+	static	URect			stringToURect(string str);
+
+	static string	floatToString(float val);
+	static string	uintToString(unsigned int val);
+	static string	boolToString(bool val);
+	static string	sizeToString(const Size& val);
+	static string	pointToString(const Vector2& val);
+	static string	rectToString(const Rect& val);
+	static string	imageToString(const Image* val);
+	static string	colourToString(const colour& val);
+	static string	colourRectToString(const ColourRect& val);
+
+	static string	udimToString(const UDim& val);
+	static string	uvector2ToString(const UVector2& val);
+	static string	urectToString(const URect& val);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Renderer.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Renderer.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Renderer.pkg	(revision 5707)
@@ -0,0 +1,34 @@
+/***********************************************************************
+	Renderer
+***********************************************************************/
+class Renderer : public EventSet
+{
+	//void doRender();
+	//void clearRenderList();
+
+	//void resetZValue();
+	//void advanceZValue();
+	float getCurrentZ() const;
+	float getZLayer(unsigned int layer) const;
+
+	//void setQueueingEnabled(bool setting);
+	bool isQueueingEnabled() const;
+
+	Texture* createTexture();
+	Texture* createTexture(float size);
+	Texture* createTexture(string filename, string resourcegroup);
+
+	void destroyTexture(Texture* tex);
+	void destroyAllTextures();
+
+	float getWidth() const;
+	float getHeight() const;
+	Size getSize() const;
+	Rect getRect() const;
+
+	unsigned int getMaxTextureSize() const;
+	unsigned int getHorzScreenDPI() const;
+	unsigned int getVertScreenDPI() const;
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Scheme.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Scheme.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Scheme.pkg	(revision 5707)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	Scheme
+***********************************************************************/
+class Scheme
+{
+	void loadResources();
+	void unloadResources();
+	bool resourcesLoaded() const;
+	string getName() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string getDefaultResourceGroup();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/SchemeManager.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/SchemeManager.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/SchemeManager.pkg	(revision 5707)
@@ -0,0 +1,15 @@
+/***********************************************************************
+	SchemeManager
+***********************************************************************/
+class SchemeManager
+{
+	static SchemeManager& getSingleton();
+
+	Scheme* loadScheme(string filename, string resourcegroup="");
+	void unloadScheme(string name);
+	bool isSchemePresent(string name) const;
+	Scheme* getScheme(string name) const;
+	void unloadAllSchemes();
+
+    SchemeIterator getIterator() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/System.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/System.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/System.pkg	(revision 5707)
@@ -0,0 +1,64 @@
+/***********************************************************************
+	System
+***********************************************************************/
+class System : public EventSet
+{
+	static System& getSingleton();
+
+	Renderer* getRenderer() const;
+
+	void setDefaultFont(string name);
+	void setDefaultFont(Font* font);
+    Font* getDefaultFont() const;
+
+	void signalRedraw();
+	bool isRedrawRequested() const;
+	void renderGUI();
+
+	Window* setGUISheet(Window* sheet);
+	Window* getGUISheet() const;
+
+	void setSingleClickTimeout(double timeout);
+	void setMultiClickTimeout(double timeout);
+	void setMultiClickToleranceAreaSize(const Size& sz);
+	double getSingleClickTimeout() const;
+	double getMultiClickTimeout() const;
+	const Size& getMultiClickToleranceAreaSize() const;
+
+	void setDefaultMouseCursor(MouseCursorImage image);
+	void setDefaultMouseCursor(const Image* image);
+	void setDefaultMouseCursor(string imageset_name, string image_name);
+	const Image* getDefaultMouseCursor() const;
+
+	Window* getWindowContainingMouse() const;
+
+	void executeScriptFile(string filename) const;
+	int executeScriptGlobal(string global_name) const;
+	void executeScriptString(string lua_string) const;
+
+	float getMouseMoveScaling() const;
+	void setMouseMoveScaling(float scaling);
+
+	void notifyWindowDestroyed(const Window* window);
+
+    // commented because we can't do 'bitwise and' in Lua
+	//unsigned int getSystemKeys() const;
+	tolua_outside bool ceguiLua_System_isSystemKeyDown @ isSystemKeyDown(SystemKey k) const;
+
+	void setDefaultTooltip(Tooltip* tooltip);
+	void setDefaultTooltip(string tooltipType);
+	Tooltip* getDefaultTooltip(void) const;
+
+	bool injectMouseMove(float dx, float dy);
+	bool injectMouseLeaves();
+	bool injectMouseButtonDown(MouseButton btn);
+	bool injectMouseButtonUp(MouseButton btn);
+	bool injectKeyDown(unsigned int keycode);
+	bool injectKeyUp(unsigned int keycode);
+	bool injectChar(unsigned long code_point);
+	bool injectMouseWheelChange(float delta);
+	bool injectMousePosition(float x, float y);
+	bool injectTimePulse(float timeElapsed);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Texture.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Texture.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Texture.pkg	(revision 5707)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	Texture
+***********************************************************************/
+class Texture
+{
+	unsigned short getWidth() const;
+	unsigned short getHeight() const;
+	void loadFromFile(string filename, string resourcegroup="");
+
+	// no memory loading
+
+	Renderer* getRenderer() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/UnifiedCoordSystem.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/UnifiedCoordSystem.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/UnifiedCoordSystem.pkg	(revision 5707)
@@ -0,0 +1,73 @@
+/***********************************************************************
+	UDim
+***********************************************************************/
+class UDim
+{
+	float d_scale @ scale;
+	float d_offset @ offset;
+
+	float asAbsolute(float base) const;
+	float asRelative(float base) const;
+
+	UDim operator+ (const UDim& other) const;
+	UDim operator- (const UDim& other) const;
+	UDim operator/ (const UDim& other) const;
+	UDim operator* (const UDim& other) const;
+
+	bool operator== (const UDim& other) const;
+
+	UDim();
+	UDim(float scale, float offset);
+};
+
+
+/***********************************************************************
+	UVector2
+***********************************************************************/
+class UVector2
+{
+	UDim d_x @ x;
+	UDim d_y @ y;
+
+	Vector2 asAbsolute(const Size& base) const;
+	Vector2 asRelative(const Size& base) const;
+
+	UVector2 operator+ (const UVector2& other) const;
+	UVector2 operator- (const UVector2& other) const;
+	UVector2 operator/ (const UVector2& other) const;
+	UVector2 operator* (const UVector2& other) const;
+
+	bool operator== (const UVector2& other) const;
+
+	UVector2();
+	UVector2(UDim& scale, UDim& offset);
+};
+
+
+/***********************************************************************
+	URect
+***********************************************************************/
+class URect
+{
+	UVector2 d_min @ min;
+	UVector2 d_max @ max;
+
+	Rect asAbsolute(const Size& base) const;
+	Rect asRelative(const Size& base) const;
+
+	const UVector2& getPosition() const;
+	UVector2 getSize() const;
+	UDim getWidth() const;
+	UDim getHeight() const;
+
+	void setPosition(const UVector2& pos);
+	void setSize(const UVector2& sz);
+	void setWidth(const UDim& w);
+	void setHeight(const UDim& h);
+
+	void offset(const UVector2& sz);
+
+	URect();
+	URect(const UVector2& min, const UVector2& max);
+	URect(const UDim& left, const UDim& top, const UDim& right, const UDim& bottom);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Window.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Window.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/Window.pkg	(revision 5707)
@@ -0,0 +1,247 @@
+/****************************************
+	Vertical alignment modes
+*****************************************/
+enum VerticalAlignment
+{
+	VA_TOP,
+	VA_CENTRE,
+	VA_BOTTOM
+};
+
+
+/****************************************
+	Horizontal alignment modes
+*****************************************/
+enum HorizontalAlignment
+{
+	HA_LEFT,
+	HA_CENTRE,
+	HA_RIGHT
+};
+
+
+/****************************************
+	Window
+*****************************************/
+class Window //: public EventSet
+{
+	string getType() const;
+	string getName() const;
+
+	bool isDestroyedByParent() const;
+	bool isAlwaysOnTop() const;
+	bool isDisabled(bool localOnly=false) const;
+	bool isVisible(bool localOnly=false) const;
+	bool isActive() const;
+	bool isClippedByParent() const;
+
+	void setDestroyedByParent(bool setting);
+	void setAlwaysOnTop(bool setting);
+	void setEnabled(bool setting);
+	void enable();
+	void disable();
+	void setVisible(bool setting);
+	void show();
+	void hide();
+	void activate();
+	void deactivate();
+
+	void setClippedByParent(bool setting);
+
+	unsigned int getID() const;
+	void setID(unsigned int ID);
+
+	unsigned int getChildCount() const;
+
+	bool isChild(unsigned int ID) const;
+	bool isChild(string name) const;
+	bool isChild(const Window* window) const;
+	bool isChildRecursive(unsigned int ID) const;
+
+	void addChildWindow(string name);
+	void addChildWindow(Window* window);
+
+	void removeChildWindow(unsigned int ID);
+	void removeChildWindow(string name);
+	void removeChildWindow(Window* window);
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(unsigned int ID) const;
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(string name) const;
+	Window* getChildAtIdx(unsigned int ID) const;
+	Window* getActiveChild() const;
+	Window* getChildAtPosition(const Vector2& pos) const;
+    Window* getTargetChildAtPosition(const Vector2& pos) const;
+    Window* getChildRecursive(unsigned int ID) const;
+
+	Window* getParent() const;
+
+	bool isAncestor(unsigned int ID) const;
+	bool isAncestor(string name) const;
+	bool isAncestor(const Window* window) const;
+
+	void setFont(string name);
+	void setFont(Font* font);
+	Font* getFont() const;
+
+	void setText(string text);
+	string getText() const;
+
+	bool inheritsAlpha() const;
+	float getAlpha() const;
+	float getEffectiveAlpha() const;
+	void setAlpha(float a);
+	void setInheritsAlpha(bool setting);
+
+	void requestRedraw() const;
+
+	bool isZOrderingEnabled() const;
+	void setZOrderingEnabled(bool setting);
+
+	Rect getPixelRect() const;
+	Rect getInnerRect() const;
+	Rect getUnclippedPixelRect() const;
+	Rect getUnclippedInnerRect() const;
+
+    Size getParentPixelSize(void) const;
+    float getParentPixelWidth(void) const;
+    float getParentPixelHeight(void) const;
+
+	static Window* getCaptureWindow();
+	void setRestoreCapture(bool setting);
+	bool restoresOldCapture() const;
+
+	bool distributesCapturedInputs() const;
+	void setDistributesCapturedInputs(bool setting);
+
+	bool captureInput();
+	void releaseInput();
+
+	bool isCapturedByThis() const;
+	bool isCapturedByAncestor() const;
+	bool isCapturedByChild() const;
+
+	bool isHit(const Vector2& pos) const;
+
+	bool isRiseOnClickEnabled() const;
+	void setRiseOnClickEnabled(bool setting);
+
+	const Image* getMouseCursor() const;
+	void setMouseCursor(MouseCursorImage cursor);
+	void setMouseCursor(const Image* image);
+	void setMouseCursor(string imageset, string image);
+
+	void moveToFront();
+	void moveToBack();
+
+	bool wantsMultiClickEvents() const;
+	bool isMouseAutoRepeatEnabled() const;
+	float getAutoRepeatDelay() const;
+	float getAutoRepeatRate() const;
+	void setWantsMultiClickEvents(bool setting);
+	void setMouseAutoRepeatEnabled(bool setting);
+	void setAutoRepeatDelay(float delay);
+	void setAutoRepeatRate(float rate);
+
+	//void destroy();
+
+	bool isUsingDefaultTooltip() const;
+	Tooltip* getTooltip() const;
+	string getTooltipType() const;
+	string getTooltipText() const;
+	bool inheritsTooltipText() const;
+
+	void setTooltip(Tooltip* tooltip);
+	void setTooltipType(string tooltipType);
+	void setTooltipText(string tip);
+	void setInheritsTooltipText(bool setting);
+
+	bool testClassName(string class_name) const;
+
+	void notifyDragDropItemEnters(DragContainer* item);
+	void notifyDragDropItemLeaves(DragContainer* item);
+	void notifyDragDropItemDropped(DragContainer* item);
+
+	VerticalAlignment getVerticalAlignment() const;
+	HorizontalAlignment getHorizontalAlignment() const;
+
+    // these actually have a const, but tolua++ chokes on that
+    void setVerticalAlignment(VerticalAlignment alignment);
+    void setHorizontalAlignment(HorizontalAlignment alignment);
+
+	string getLookNFeel() const;
+    tolua_throws|CEGUI::Exception,error| void setLookNFeel(string lnf);
+
+    tolua_throws|CEGUI::Exception,error| void setWindowRenderer(string name);
+    string getWindowRendererName() const;
+
+	//RenderCache& getRenderCache()
+
+	bool getModalState() const;
+	void setModalState(bool state);
+
+    tolua_throws|CEGUI::UnknownObjectException,nil| string getUserString(string name) const;
+    bool isUserStringDefined(string name) const;
+    void setUserString(string name, string value);
+
+    void beginInitialisation();
+    void endInitialisation();
+
+	// unified stuff
+	void setArea(const UDim& xpos, const UDim& ypos, const UDim& width, const UDim& height);
+	void setArea(const UVector2& pos, const UVector2& size);
+	void setArea(const URect& area);
+	void setPosition(const UVector2& pos);
+	void setXPosition(const UDim& x);
+	void setYPosition(const UDim& y);
+	void setSize(const UVector2& size);
+	void setWidth(const UDim& width);
+	void setHeight(const UDim& height);
+	void setMaxSize(const UVector2& size);
+	void setMinSize(const UVector2& size);
+
+	const URect& getArea() const;
+	const UVector2& getPosition() const;
+	const UDim& getXPosition() const;
+	const UDim& getYPosition() const;
+	UVector2 getSize() const;
+	UDim getWidth() const;
+	UDim getHeight() const;
+	const UVector2& getMaxSize() const;
+	const UVector2& getMinSize() const;
+
+    // event pass through
+    bool isMousePassThroughEnabled() const;
+    void setMousePassThroughEnabled(bool setting);
+    
+    tolua_throws|CEGUI::Exception,error| void rename(string new_name);
+
+	//////////////////////////////////////////////
+	// PropertySet
+	void setProperty(string name, string value);
+	string getProperty(string name) const;
+	string getPropertyDefault(string name) const;
+	string getPropertyHelp(string name) const;
+
+	bool isPropertyPresent(string name) const;
+	bool isPropertyDefault(string name) const;
+
+    tolua_outside PropertyIterator ceguiLua_getPropertyIterator @ getPropertyIterator() const;
+
+	//////////////////////////////////////////////
+	// EventSet
+	void addEvent(string name);
+	void removeEvent(string name);
+	void removeAllEvents();
+	bool isEventPresent(string name);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| tolua_outside EventConnection LuaFunctorSubscribeEvent @ subscribeEvent(string name, lua_Object funcIndex, lua_Object selfIndex=LUA_NOREF, lua_State*);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| EventConnection subscribeScriptedEvent @ subscribeEvent(string name, string callback_name);
+	
+	void fireEvent(string name, EventArgs& args, string eventnamespace="");
+
+	bool isMuted() const;
+	void setMutedState(bool setting);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/WindowFactoryManager.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/WindowFactoryManager.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/WindowFactoryManager.pkg	(revision 5707)
@@ -0,0 +1,34 @@
+/***********************************************************************
+	WindowFactoryManager
+***********************************************************************/
+class FalagardWindowMapping
+{
+    string d_windowType @ windowType;
+    string d_lookName @ lookName;
+    string d_baseType @ baseType;
+    string d_rendererType @ rendererType;
+};
+
+class WindowFactory
+{
+    string getTypeName() const;
+};
+
+class WindowFactoryManager
+{
+    static WindowFactoryManager& getSingleton();
+
+    bool isFactoryPresent(string name) const;
+    void addWindowTypeAlias(string aliasName, string targetType);
+    void removeWindowTypeAlias(string aliasName, string targetType);
+    void addFalagardWindowMapping(string newType, string targetType, string lookName, string renderer);
+    void removeFalagardWindowMapping(string type);
+    bool isFalagardMappedType(string type) const;
+    string getMappedLookForType(string type) const;
+    string getMappedRendererForType(string type) const;
+    String getDereferencedAliasType(string type) const;
+    const FalagardWindowMapping& getFalagardMappingForType(string type) const;
+
+    WindowFactoryIterator getIterator() const;
+    FalagardMappingIterator getFalagardMappingIterator() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/WindowManager.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/WindowManager.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/WindowManager.pkg	(revision 5707)
@@ -0,0 +1,31 @@
+/***********************************************************************
+	WindowManager
+***********************************************************************/
+class WindowManager
+{
+	static WindowManager& getSingleton();
+
+	tolua_throws|CEGUI::AlreadyExistsException,nil| Window* createWindow(string type, string name="");
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| Window* loadWindowLayout(string filename, string name_prefix="", string resourcegroup="");
+
+    void writeWindowLayoutToStream(string window, OutStream& out, bool writeParent=false) const;
+    void writeWindowLayoutToStream(const Window& window, OutStream& out, bool writeParent=false) const;
+
+	void destroyWindow(string name);
+	void destroyWindow(Window* window);
+	void destroyAllWindows();
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getWindow(string name) const;
+	bool isWindowPresent(string name) const;
+
+	bool isDeadPoolEmpty() const;
+	void cleanDeadPool();
+
+    void renameWindow(Window* window, string  new_name);
+    void renameWindow(string window, string new_name);
+
+    WindowIterator getIterator() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string& getDefaultResourceGroup();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ButtonBase.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ButtonBase.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ButtonBase.pkg	(revision 5707)
@@ -0,0 +1,8 @@
+/***********************************************************************
+	ButtonBase
+***********************************************************************/
+class ButtonBase : public Window
+{
+	bool isHovering() const;
+	bool isPushed() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Checkbox.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Checkbox.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Checkbox.pkg	(revision 5707)
@@ -0,0 +1,8 @@
+/***********************************************************************
+	Checkbox
+***********************************************************************/
+class Checkbox : public ButtonBase
+{
+	bool isSelected() const;
+	void setSelected(bool select);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ComboDropList.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ComboDropList.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ComboDropList.pkg	(revision 5707)
@@ -0,0 +1,10 @@
+/***********************************************************************
+	ComboDropList
+***********************************************************************/
+class ComboDropList : public Listbox
+{
+	void	setArmed(bool setting);
+	bool	isArmed(void) const;
+	void	setAutoArmEnabled(bool setting);
+	bool	isAutoArmEnabled(void) const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Combobox.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Combobox.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Combobox.pkg	(revision 5707)
@@ -0,0 +1,59 @@
+/***********************************************************************
+	Combobox
+***********************************************************************/
+class Combobox : public Window
+{
+	bool getSingleClickEnabled() const;
+	bool isDropDownListVisible() const;
+
+    Editbox* getEditbox() const;
+    PushButton* getPushButton() const;
+    ComboDropList* getDropList() const;
+
+	bool hasInputFocus() const;
+	bool isReadOnly() const;
+	bool isTextValid() const;
+	string getValidationString() const;
+
+	unsigned long getCaratIndex() const;
+	unsigned long getSelectionStartIndex() const;
+	unsigned long getSelectionEndIndex() const;
+	unsigned long getSelectionLength() const;
+	unsigned long getMaxTextLength() const;
+
+	void activateEditbox();
+
+	unsigned long getItemCount() const;
+	ListboxItem* getSelectedItem() const;
+	ListboxItem* getListboxItemFromIndex(unsigned long index) const;
+	unsigned long getItemIndex(const ListboxItem* item) const;
+	bool isItemSelected(unsigned long index) const;
+	ListboxItem* findItemWithText(string text, const ListboxItem* start_item);
+	bool isListboxItemInList(const ListboxItem* item) const;
+
+	void resetList();
+	void addItem(ListboxItem* item);
+	void insertItem(ListboxItem* item, const ListboxItem* position);
+	void removeItem(const ListboxItem* item);
+	void clearAllSelections();
+	void setSortingEnabled(bool setting);
+	void setShowVertScrollbar(bool setting);
+	void setShowHorzScrollbar(bool setting);
+	void setItemSelectState(ListboxItem* item, bool state);
+	void setItemSelectState(unsigned long item_index, bool state);
+	void handleUpdatedListItemData();
+
+	bool isSortEnabled() const;
+	bool isVertScrollbarAlwaysShown() const;
+	bool isHorzScrollbarAlwaysShown() const;
+
+	void showDropList();
+	void hideDropList();
+	void setSingleClickEnabled(bool setting);
+
+	void setReadOnly(bool setting);
+	void setValidationString(string validation_string);
+	void setCaratIndex(unsigned long carat_pos);
+	void setSelection(unsigned long start_pos, unsigned long end_pos);
+	void setMaxTextLength(unsigned long max_len);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/DragContainer.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/DragContainer.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/DragContainer.pkg	(revision 5707)
@@ -0,0 +1,23 @@
+/***********************************************************************
+	DragContainer
+***********************************************************************/
+class DragContainer : public Window
+{
+	bool isDraggingEnabled() const;
+	void setDraggingEnabled(bool setting);
+
+	bool isBeingDragged() const;
+
+	float getPixelDragThreshold() const;
+	void setPixelDragThreshold(float pixels);
+
+	float getDragAlpha() const;
+	void setDragAlpha(float alpha);
+
+	const Image* getDragCursorImage() const;
+	void setDragCursorImage(MouseCursorImage image);
+	void setDragCursorImage(string imageset, string image);
+	void setDragCursorImage(const Image* image);
+
+	Window* getCurrentDropTarget() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Editbox.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Editbox.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Editbox.pkg	(revision 5707)
@@ -0,0 +1,27 @@
+/***********************************************************************
+	Editbox
+***********************************************************************/
+class Editbox : public Window
+{
+	bool hasInputFocus() const;
+	bool isReadOnly() const;
+	bool isTextMasked() const;
+	bool isTextValid() const;
+
+	string getValidationString() const;
+
+	unsigned long getCaratIndex() const;
+	unsigned long getSelectionStartIndex() const;
+	unsigned long getSelectionEndIndex() const;
+	unsigned long getSelectionLength() const;
+	unsigned long getMaskCodePoint() const;
+	unsigned long getMaxTextLength() const;
+
+	void setReadOnly(bool setting);
+	void setTextMasked(bool setting);
+	void setValidationString(string validation_string);
+	void setCaratIndex(unsigned long carat_pos);
+	void setSelection(unsigned long start_pos, unsigned long end_pos);
+	void setMaskCodePoint(unsigned long code_point);
+	void setMaxTextLength(unsigned long max_len);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/FrameWindow.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/FrameWindow.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/FrameWindow.pkg	(revision 5707)
@@ -0,0 +1,27 @@
+/***********************************************************************
+	FrameWindow
+***********************************************************************/
+class FrameWindow : public Window
+{
+	bool isSizingEnabled() const;
+	bool isFrameEnabled() const;
+	bool isTitleBarEnabled() const;
+	bool isCloseButtonEnabled() const;
+	bool isRollupEnabled() const;
+	bool isRolledup() const;
+	bool isDragMovingEnabled() const;
+
+	void setSizingEnabled(bool enabled);
+	void setFrameEnabled(bool enabled);
+	void setTitleBarEnabled(bool enabled);
+	void setCloseButtonEnabled(bool enabled);
+	void setRollupEnabled(bool enabled);
+	void setDragMovingEnabled(bool enabled);
+
+	float getSizingBorderThickness() const;
+	void setSizingBorderThickness(float pixels);
+
+	void toggleRollup();
+
+	void offsetPixelPosition(const Vector2& offset);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/GUISheet.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/GUISheet.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/GUISheet.pkg	(revision 5707)
@@ -0,0 +1,6 @@
+/***********************************************************************
+	GUISheet
+***********************************************************************/
+class GUISheet : public Window
+{
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ItemEntry.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ItemEntry.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ItemEntry.pkg	(revision 5707)
@@ -0,0 +1,14 @@
+/***********************************************************************
+	ItemEntry
+***********************************************************************/
+class ItemEntry : public Window
+{
+	Size getItemPixelSize();
+	ItemListBase* getOwnerList() const;
+	bool isSelected() const;
+	bool isSelectable() const;
+	void setSelected(bool setting);
+	void select();
+	void deselect();
+	void setSelectable(bool setting);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ItemListBase.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ItemListBase.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ItemListBase.pkg	(revision 5707)
@@ -0,0 +1,34 @@
+/***********************************************************************
+	ItemListBase
+***********************************************************************/
+class ItemListBase : public Window
+{
+    enum SortMode
+    {
+        Ascending,
+        Descending,
+        UserSort
+    };
+
+	unsigned int getItemCount() const;
+	ItemEntry* getItemFromIndex(unsigned int index) const;
+	unsigned int getItemIndex(const ItemEntry* item) const;
+	ItemEntry* findItemWithText(string text, const ItemEntry* start_item);
+	bool isItemInList(const ItemEntry* item) const;
+	bool isAutoResizeEnabled() const;
+	bool isSortEnabled() const;
+	SortMode getSortMode() const;
+	Rect getItemRenderArea() const;
+    Window* getContentPane() const;
+
+	void resetList();
+	void addItem(ItemEntry* item);
+	void insertItem(ItemEntry* item, const ItemEntry* position);
+	void removeItem(ItemEntry* item);
+	void handleUpdatedItemData();
+	void setAutoResizeEnabled(bool setting);
+	void sizeToContent();
+    void setSortEnabled(bool setting);
+    void setSortMode(SortMode mode);
+    void sortList();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ItemListbox.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ItemListbox.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ItemListbox.pkg	(revision 5707)
@@ -0,0 +1,17 @@
+/***********************************************************************
+	ItemListbox
+***********************************************************************/
+class ItemListbox : public ScrolledItemListBase
+{
+    unsigned long getSelectedCount() const;
+    ItemEntry* getLastSelectedItem() const;
+    ItemEntry* getFirstSelectedItem(unsigned long start_index=0) const;
+    ItemEntry* getNextSelectedItem() const;
+    ItemEntry* getNextSelectedItemAfter(const ItemEntry* start_item) const;
+    bool isMultiSelectEnabled() const;
+    bool isItemSelected(unsigned long index) const;
+    void setMultiSelectEnabled(bool state);
+    void clearAllSelections();
+    void selectRange(unsigned long a, unsigned long z);
+    void selectAllItems();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListHeader.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListHeader.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListHeader.pkg	(revision 5707)
@@ -0,0 +1,55 @@
+/***********************************************************************
+	ListHeader
+***********************************************************************/
+class ListHeader : public Window
+{
+	unsigned int getColumnCount() const;
+
+	ListHeaderSegment& getSegmentFromColumn(unsigned int column) const;
+	ListHeaderSegment& getSegmentFromID(unsigned int id) const;
+	ListHeaderSegment& getSortSegment() const;
+
+	unsigned int getColumnFromSegment(const ListHeaderSegment& segment) const;
+	unsigned int getColumnFromID(unsigned int id) const;
+	unsigned int getSortColumn() const;
+	unsigned int getColumnWithText(string text) const;
+
+	float getPixelOffsetToSegment(const ListHeaderSegment& segment) const;
+	float getPixelOffsetToColumn(unsigned int column) const;
+	float getTotalSegmentsPixelExtent() const;
+	UDim  getColumnWidth(unsigned int column) const;
+
+	ListHeaderSegment::SortDirection getSortDirection() const;
+
+	bool isSortingEnabled() const;
+	bool isColumnSizingEnabled() const;
+	bool isColumnDraggingEnabled() const;
+
+	float getSegmentOffset() const;
+
+
+	void setSortingEnabled(bool setting);
+	void setSortDirection(ListHeaderSegment::SortDirection direction);
+	void setSortSegment(const ListHeaderSegment& segment);
+	void setSortColumn(unsigned int column);
+	void setSortColumnFromID(unsigned int id);
+
+	void setColumnSizingEnabled(bool setting);
+	void setColumnDraggingEnabled(bool setting);
+	void addColumn(string text, unsigned int id, const UDim& width);
+
+	void insertColumn(string text, unsigned int id, const UDim& width, unsigned int position);
+	void insertColumn(string text, unsigned int id, const UDim& width, const ListHeaderSegment& position);
+	void removeColumn(unsigned int column);
+	void removeSegment(const ListHeaderSegment& segment);
+
+	void moveColumn(unsigned int column, unsigned int position);
+	void moveColumn(unsigned int column, const ListHeaderSegment& position);
+
+	void moveSegment(const ListHeaderSegment& segment, unsigned int position);
+	void moveSegment(const ListHeaderSegment& segment, const ListHeaderSegment& position);
+
+	void setSegmentOffset(float offset);
+
+	void setColumnWidth(unsigned int column, const UDim& width);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListHeaderSegment.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListHeaderSegment.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListHeaderSegment.pkg	(revision 5707)
@@ -0,0 +1,23 @@
+/***********************************************************************
+	ListHeaderSegment
+***********************************************************************/
+class ListHeaderSegment : public Window
+{
+	enum SortDirection
+	{
+		None,
+		Ascending,
+		Descending
+	};
+
+	bool isSizingEnabled() const;
+	SortDirection getSortDirection() const;
+	bool isDragMovingEnabled() const;
+	const Vector2& getDragMoveOffset() const;
+	bool isClickable() const;
+
+	void setSizingEnabled(bool setting);
+	void setSortDirection(SortDirection sort_dir);
+	void setDragMovingEnabled(bool setting);
+	void setClickable(bool setting);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Listbox.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Listbox.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Listbox.pkg	(revision 5707)
@@ -0,0 +1,40 @@
+/***********************************************************************
+	Listbox
+***********************************************************************/
+class Listbox : public Window
+{
+	unsigned long getItemCount() const;
+	unsigned long getSelectedCount() const;
+	ListboxItem* getFirstSelectedItem() const;
+	ListboxItem* getNextSelected(const ListboxItem* start_item) const;
+	ListboxItem* getListboxItemFromIndex(unsigned long index) const;
+	unsigned long getItemIndex(const ListboxItem* item) const;
+	ListboxItem* findItemWithText(string text, const ListboxItem* start_item);
+	bool isSortEnabled() const;
+	bool isMultiselectEnabled() const;
+	bool isItemSelected(unsigned long index) const;
+	bool isListboxItemInList(const ListboxItem* item) const;
+	bool isVertScrollbarAlwaysShown() const;
+	bool isHorzScrollbarAlwaysShown() const;
+
+	void resetList(void);
+	void addItem(ListboxItem* item);
+	void insertItem(ListboxItem* item, const ListboxItem* position);
+	void removeItem(const ListboxItem* item);
+	void clearAllSelections(void);
+	void setSortingEnabled(bool setting);
+	void setMultiselectEnabled(bool setting);
+	void setShowVertScrollbar(bool setting);
+	void setShowHorzScrollbar(bool setting);
+	void setItemSelectState(ListboxItem* item, bool state);
+	void setItemSelectState(unsigned long item_index, bool state);
+	void handleUpdatedItemData(void);
+	void ensureItemIsVisible(unsigned long item_index);
+	void ensureItemIsVisible(const ListboxItem* item);
+	
+	Rect getListRenderArea() const;
+	Scrollbar* getVertScrollbar() const;
+	Scrollbar* getHorzScrollbar() const;
+	float getWidestItemWidth() const;
+	float getTotalItemsHeight() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListboxItem.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListboxItem.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListboxItem.pkg	(revision 5707)
@@ -0,0 +1,33 @@
+/***********************************************************************
+	ListboxItem
+***********************************************************************/
+class ListboxItem
+{
+	string getText() const;
+	unsigned int getID() const;
+	void* getUserData() const;
+	bool isSelected() const;
+	bool isDisabled() const;
+	bool isAutoDeleted() const;
+	const Window* getOwnerWindow();
+	ColourRect getSelectionColours() const;
+	const Image* getSelectionBrushImage() const;
+
+	void setText(string text);
+	void setID(unsigned int item_id);
+	void setUserData(void* item_data);
+	void setSelected(bool setting);
+	void setDisabled(bool setting);
+	void setAutoDeleted(bool setting);
+	void setOwnerWindow(const Window* owner);
+	void setSelectionColours(const ColourRect& cols);
+	void setSelectionColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
+	void setSelectionColours(colour col);
+	void setSelectionBrushImage(const Image* image);
+	void setSelectionBrushImage(string imageset, string image);
+
+	Size getPixelSize() const;
+
+	//void draw(const Vector3& position, float alpha, const Rect& clipper) const;
+	// operators missing
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListboxTextItem.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListboxTextItem.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ListboxTextItem.pkg	(revision 5707)
@@ -0,0 +1,21 @@
+/***********************************************************************
+	ListboxTextItem
+
+	The constructor is not exportet, instead a helper function is
+	available (CEGUI.createListboxTextItem).
+
+	I decided to do it like this to avoid any possible memory issues
+	with allocating from Lua.
+***********************************************************************/
+class ListboxTextItem : public ListboxItem
+{
+	Font* getFont() const;
+	ColourRect getTextColours() const;
+
+	void setFont(string font_name);
+	void setFont(Font* font);
+
+	void setTextColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
+	void setTextColours(const ColourRect& cols);
+	void setTextColours(colour col);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MenuBase.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MenuBase.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MenuBase.pkg	(revision 5707)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	MenuBase
+***********************************************************************/
+class MenuBase : public ItemListBase
+{
+	float getItemSpacing() const;
+	bool isMultiplePopupsAllowed() const;
+	MenuItem* getPopupMenuItem() const;
+
+	void setItemSpacing(float spacing);
+	void changePopupMenuItem(MenuItem* item);
+	void setAllowMultiplePopups(bool setting);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MenuItem.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MenuItem.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MenuItem.pkg	(revision 5707)
@@ -0,0 +1,14 @@
+/***********************************************************************
+	Menubar
+***********************************************************************/
+class MenuItem : public ItemEntry
+{
+	bool isHovering() const;
+	bool isPushed() const;
+	PopupMenu* getPopupMenu() const;
+
+	void setPopupMenu(PopupMenu* popup);
+	void openPopupMenu();
+	void closePopupMenu(bool notify=true);
+	bool togglePopupMenu();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Menubar.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Menubar.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Menubar.pkg	(revision 5707)
@@ -0,0 +1,6 @@
+/***********************************************************************
+	Menubar
+***********************************************************************/
+class Menubar : public MenuBase
+{
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MultiColumnList.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MultiColumnList.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MultiColumnList.pkg	(revision 5707)
@@ -0,0 +1,138 @@
+/***********************************************************************
+	MultiColumnList
+***********************************************************************/
+struct MCLGridRef
+{
+	unsigned int row;
+	unsigned int column;
+
+	//bool operator< (const MCLGridRef& rhs) const;
+	//bool operator>= (const MCLGridRef& rhs) const;
+	bool operator== (const MCLGridRef& rhs) const;
+
+	MCLGridRef(unsigned int r, unsigned int c);
+};
+
+
+/***********************************************************************
+	MultiColumnList
+***********************************************************************/
+class MultiColumnList : public Window
+{
+	enum SelectionMode
+	{
+		RowSingle,
+		RowMultiple,
+		CellSingle,
+		CellMultiple,
+		NominatedColumnSingle,
+		NominatedColumnMultiple,
+		ColumnSingle,
+		ColumnMultiple,
+		NominatedRowSingle,
+		NominatedRowMultiple
+	};
+
+	bool isUserSortControlEnabled() const;
+	bool isUserColumnSizingEnabled() const;
+	bool isUserColumnDraggingEnabled() const;
+
+	unsigned int getColumnCount() const;
+	unsigned int getRowCount() const;
+	unsigned int getSortColumn() const;
+	unsigned int getColumnWithID(unsigned int col_id) const;
+	unsigned int getColumnWithHeaderText(string text) const;
+
+	UDim getTotalColumnHeadersWidth() const;
+	UDim getColumnHeaderWidth(unsigned int col_idx) const;
+
+	ListHeaderSegment::SortDirection getSortDirection() const;
+	ListHeaderSegment& getHeaderSegmentForColumn(unsigned int col_idx) const;
+
+	unsigned int getItemRowIndex(const ListboxItem* item) const;
+	unsigned int getItemColumnIndex(const ListboxItem* item) const;
+
+	MCLGridRef getItemGridReference(const ListboxItem* item) const;
+	ListboxItem* getItemAtGridReference(const MCLGridRef& grid_ref) const;
+
+	bool isListboxItemInColumn(const ListboxItem* item, unsigned int col_idx) const;
+	bool isListboxItemInRow(const ListboxItem* item, unsigned int row_idx) const;
+	bool isListboxItemInList(const ListboxItem* item) const;
+
+	ListboxItem* findColumnItemWithText(string text, unsigned int col_idx, const ListboxItem* start_item) const;
+	ListboxItem* findRowItemWithText(string text, unsigned int row_idx, const ListboxItem* start_item) const;
+	ListboxItem* findListItemWithText(string text, const ListboxItem* start_item) const;
+	ListboxItem* getFirstSelectedItem() const;
+	ListboxItem* getNextSelected(const ListboxItem* start_item) const;
+
+	unsigned int getSelectedCount() const;
+	bool isItemSelected(const MCLGridRef& grid_ref) const;
+
+	unsigned int getNominatedSelectionColumnID() const;
+	unsigned int getNominatedSelectionColumn() const;
+	unsigned int getNominatedSelectionRow() const;
+
+	SelectionMode getSelectionMode() const;
+
+	bool isVertScrollbarAlwaysShown() const;
+	bool isHorzScrollbarAlwaysShown() const;
+
+	unsigned int getColumnID(unsigned int col_idx) const;
+	unsigned int getRowID(unsigned int row_idx) const;
+    unsigned int getRowWithID(unsigned int row_id) const;
+
+    Rect getListRenderArea() const;
+
+    Scrollbar* getVertScrollbar() const;
+    Scrollbar* getHorzScrollbar() const;
+    ListHeader* getListHeader() const;
+
+    float getTotalRowsHeight() const;
+    float getWidestColumnItemWidth(unsigned int col_idx) const;
+    float getHighestRowItemHeight(unsigned int row_idx) const;
+
+	void resetList();
+
+	void addColumn(string text, unsigned int col_id, const UDim& width);
+	void insertColumn(string text, unsigned int col_id, const UDim& width, unsigned int position);
+	void removeColumn(unsigned int col_idx);
+	void removeColumnWithID(unsigned int col_id);
+	void moveColumn(unsigned int col_idx, unsigned int position);
+	void moveColumnWithID(unsigned int col_id, unsigned int position);
+
+	unsigned int addRow();
+	unsigned int addRow(ListboxItem* item, unsigned int col_id);
+	unsigned int insertRow(unsigned int row_idx);
+	unsigned int insertRow(ListboxItem* item, unsigned int col_id, unsigned int row_idx);
+	void removeRow(unsigned int row_idx);
+
+	void setItem(ListboxItem* item, const MCLGridRef& position);
+	void setItem(ListboxItem* item, unsigned int col_id, unsigned int row_idx);
+
+	void setSelectionMode(MultiColumnList::SelectionMode sel_mode);
+	void setNominatedSelectionColumnID(unsigned int col_id);
+	void setNominatedSelectionColumn(unsigned int col_idx);
+	void setNominatedSelectionRow(unsigned int row_idx);
+
+	void setSortDirection(ListHeaderSegment::SortDirection direction);
+	void setSortColumn(unsigned int col_idx);
+	void setSortColumnByID(unsigned int col_id);
+
+	void setShowVertScrollbar(bool setting);
+	void setShowHorzScrollbar(bool setting);
+
+	void clearAllSelections();
+
+	void setItemSelectState(ListboxItem* item, bool state);
+	void setItemSelectState(const MCLGridRef& grid_ref, bool state);
+
+	void handleUpdatedItemData();
+
+	void setColumnHeaderWidth(unsigned int col_idx, const UDim& width);
+	void setUserSortControlEnabled(bool setting);
+	void setUserColumnSizingEnabled(bool setting);
+	void setUserColumnDraggingEnabled(bool setting);
+	void autoSizeColumnHeader(unsigned int col_idx);
+	
+	void setRowID(unsigned int row_idx, unsigned int row_id);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MultiLineEditbox.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MultiLineEditbox.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/MultiLineEditbox.pkg	(revision 5707)
@@ -0,0 +1,29 @@
+/***********************************************************************
+	MultiLineEditbox
+***********************************************************************/
+class MultiLineEditbox : public Window
+{
+	bool hasInputFocus() const;
+	bool isReadOnly() const;
+	unsigned long getCaratIndex() const;
+	unsigned long getSelectionStartIndex() const;
+	unsigned long getSelectionEndIndex() const;
+	unsigned long getSelectionLength() const;
+	unsigned long getMaxTextLength() const;
+	bool isWordWrapped() const;
+
+    Scrollbar* getVertScrollbar() const;
+    Scrollbar* getHorzScrollbar() const;
+    Rect getTextRenderArea() const;
+    unsigned long getLineNumberFromIndex(unsigned long index) const;
+
+	void setReadOnly(bool setting);
+	void setCaratIndex(unsigned long carat_pos);
+	void setSelection(unsigned long start_pos, unsigned long end_pos);
+	void setMaxTextLength(unsigned long max_len);
+	void ensureCaratIsVisible();
+	void setWordWrapping(bool setting);
+
+    void setSelectionBrushImage(const Image* image);
+    const Image* getSelectionBrushImage() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/PopupMenu.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/PopupMenu.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/PopupMenu.pkg	(revision 5707)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	PopupMenu
+***********************************************************************/
+class PopupMenu : public MenuBase
+{
+	float getFadeInTime() const;
+	float getFadeOutTime() const;
+
+	void setFadeInTime(float fadetime);
+	void setFadeOutTime(float fadetime);
+	void openPopupMenu();
+	void closePopupMenu();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ProgressBar.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ProgressBar.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ProgressBar.pkg	(revision 5707)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	ProgressBar
+***********************************************************************/
+class ProgressBar : public Window
+{
+	float getProgress() const;
+	float getStep() const;
+
+	void setProgress(float progress);
+	void setStepSize(float step);
+	void step();
+	void adjustProgress(float delta);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/PushButton.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/PushButton.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/PushButton.pkg	(revision 5707)
@@ -0,0 +1,6 @@
+/***********************************************************************
+	PushButton
+***********************************************************************/
+class PushButton : public ButtonBase
+{
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/RadioButton.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/RadioButton.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/RadioButton.pkg	(revision 5707)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	RadioButton
+***********************************************************************/
+class RadioButton : public ButtonBase
+{
+	bool isSelected() const;
+	void setSelected(bool select);
+
+	unsigned long getGroupID() const;
+	void setGroupID(unsigned long group);
+
+	RadioButton* getSelectedButtonInGroup() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ScrollablePane.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ScrollablePane.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ScrollablePane.pkg	(revision 5707)
@@ -0,0 +1,41 @@
+/***********************************************************************
+	ScrollablePane
+***********************************************************************/
+class ScrollablePane : public Window
+{
+	const ScrolledContainer* getContentPane() const;
+
+	bool	isVertScrollbarAlwaysShown() const;
+	void	setShowVertScrollbar(bool setting);
+
+	bool	isHorzScrollbarAlwaysShown() const;
+	void	setShowHorzScrollbar(bool setting);
+
+	bool isContentPaneAutoSized() const;
+	void setContentPaneAutoSized(bool setting);
+
+	const Rect& getContentPaneArea() const;
+	void setContentPaneArea(const Rect& area);
+
+	float getHorizontalStepSize() const;
+	void setHorizontalStepSize(float step);
+
+	float getHorizontalOverlapSize() const;
+	void setHorizontalOverlapSize(float overlap);
+
+	float getHorizontalScrollPosition() const;
+	void setHorizontalScrollPosition(float position);
+
+	float getVerticalStepSize() const;
+	void setVerticalStepSize(float step);
+
+	float getVerticalOverlapSize() const;
+	void setVerticalOverlapSize(float overlap);
+
+	float getVerticalScrollPosition() const;
+	void setVerticalScrollPosition(float position);
+
+    Rect getViewableArea() const;
+    Scrollbar* getVertScrollbar() const;
+    Scrollbar* getHorzScrollbar() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Scrollbar.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Scrollbar.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Scrollbar.pkg	(revision 5707)
@@ -0,0 +1,17 @@
+/***********************************************************************
+	Scrollbar
+***********************************************************************/
+class Scrollbar : public Window
+{
+	float getDocumentSize() const;
+	float getPageSize() const;
+	float getStepSize() const;
+	float getOverlapSize() const;
+	float getScrollPosition() const;
+
+	void setDocumentSize(float document_size);
+	void setPageSize(float page_size);
+	void setStepSize(float step_size);
+	void setOverlapSize(float overlap_size);
+	void setScrollPosition(float position);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ScrolledContainer.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ScrolledContainer.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ScrolledContainer.pkg	(revision 5707)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	ScrolledContainer
+***********************************************************************/
+class ScrolledContainer : public Window
+{
+	bool isContentPaneAutoSized() const;
+	void setContentPaneAutoSized(bool setting);
+
+	const Rect& getContentArea() const;
+	void setContentArea(const Rect& area);
+
+	Rect getChildExtentsArea() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ScrolledItemListBase.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ScrolledItemListBase.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/ScrolledItemListBase.pkg	(revision 5707)
@@ -0,0 +1,12 @@
+/***********************************************************************
+	ScrolledItemListBase
+***********************************************************************/
+class ScrolledItemListBase : public ItemListBase
+{
+	bool isVertScrollbarAlwaysShown() const;
+	bool isHorzScrollbarAlwaysShown() const;
+    Scrollbar* getVertScrollbar() const;
+    Scrollbar* getHorzScrollbar() const;
+    void setShowVertScrollbar(bool mode);
+    void setShowHorzScrollbar(bool mode);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Slider.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Slider.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Slider.pkg	(revision 5707)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	Slider
+***********************************************************************/
+class Slider : public Window
+{
+	float getCurrentValue() const;
+	float getMaxValue() const;
+	float getClickStep() const;
+
+	void setMaxValue(float maxVal);
+	void setCurrentValue(float value);
+	void setClickStep(float step);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Spinner.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Spinner.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Spinner.pkg	(revision 5707)
@@ -0,0 +1,25 @@
+/***********************************************************************
+	Spinner
+***********************************************************************/
+class Spinner : public Window
+{
+	enum TextInputMode
+	{
+		FloatingPoint,
+		Integer,
+		Hexadecimal,
+		Octal
+	};
+
+	float getCurrentValue() const;
+	float getStepSize() const;
+	float getMaximumValue() const;
+	float getMinimumValue() const;
+	TextInputMode getTextInputMode() const;
+
+	void setCurrentValue(float value);
+	void setStepSize(float step);
+	void setMaximumValue(float maxValue);
+	void setMinimumValue(float minVaue);
+	void setTextInputMode(TextInputMode mode);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/TabButton.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/TabButton.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/TabButton.pkg	(revision 5707)
@@ -0,0 +1,11 @@
+/***********************************************************************
+	TabButton
+***********************************************************************/
+class TabButton : public ButtonBase
+{
+	bool isSelected() const;
+	void setSelected(bool select);
+
+	void setTargetWindow(Window* wnd);
+	Window* getTargetWindow();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/TabControl.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/TabControl.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/TabControl.pkg	(revision 5707)
@@ -0,0 +1,29 @@
+/***********************************************************************
+	TabControl
+***********************************************************************/
+class TabControl : public Window
+{
+	unsigned int getTabCount() const;
+
+	void setSelectedTab(string name);
+	void setSelectedTab(unsigned int ID);
+	void setSelectedTabAtIndex(unsigned int index);
+
+	Window* getTabContentsAtIndex(unsigned int index) const;
+	Window* getTabContents(string name) const;
+	Window* getTabContents(unsigned int ID) const;
+
+	bool isTabContentsSelected(Window* wnd) const;
+	unsigned int getSelectedTabIndex() const;
+
+	const UDim& getTabHeight() const;
+	const UDim& getTabTextPadding() const;
+
+	void setTabHeight(const UDim& height);
+	void setTabTextPadding(const UDim& pad);
+
+	void addTab(Window* wnd);
+
+	void removeTab(unsigned int ID);
+	void removeTab(string name);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Thumb.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Thumb.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Thumb.pkg	(revision 5707)
@@ -0,0 +1,22 @@
+/***********************************************************************
+	Thumb
+***********************************************************************/
+class Thumb : public PushButton
+{
+	bool isHotTracked() const;
+	bool isVertFree() const;
+	bool isHorzFree() const;
+
+	void setHotTracked(bool setting);
+	void setVertFree(bool setting);
+	void setHorzFree(bool setting);
+
+
+	// we have a helper function that converts the std::pair to two return values tolua++ style
+	tolua_outside void ceguiLua_Thumb_getVertRange @ getVertRange(float* min=0, float* max=0);
+	tolua_outside void ceguiLua_Thumb_getHorzRange @ getHorzRange(float* min=0, float* max=0);
+
+
+	void setVertRange(float min, float max);
+	void setHorzRange(float min, float max);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Titlebar.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Titlebar.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Titlebar.pkg	(revision 5707)
@@ -0,0 +1,8 @@
+/***********************************************************************
+	Titlebar
+***********************************************************************/
+class Titlebar : public Window
+{
+	bool isDraggingEnabled() const;
+	void setDraggingEnabled(bool setting);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Tooltip.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Tooltip.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/elements/Tooltip.pkg	(revision 5707)
@@ -0,0 +1,14 @@
+/***********************************************************************
+	Tooltip
+***********************************************************************/
+class Tooltip : public Window
+{
+	void setTargetWindow(Window* wnd);
+	void resetTimer();
+	float getHoverTime() const;
+	void setDisplayTime(float seconds);
+	float getFadeTime() const;
+	void setHoverTime(float seconds);
+	float getDisplayTime() const;
+	void setFadeTime(float seconds);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/exceptions.lua
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/exceptions.lua	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/exceptions.lua	(revision 5707)
@@ -0,0 +1,7 @@
+exceptionDefs["CEGUI::Exception"]           = {}
+exceptionDefs["CEGUI::Exception"]["var"]    = "&e"
+exceptionDefs["CEGUI::Exception"]["c_str"]  = "e.getMessage().c_str()"
+
+exceptionDefs["CEGUI::AlreadyExistsException"]  = exceptionDefs["CEGUI::Exception"]
+exceptionDefs["CEGUI::InvalidRequestException"] = exceptionDefs["CEGUI::Exception"]
+exceptionDefs["CEGUI::UnknownObjectException"]  = exceptionDefs["CEGUI::Exception"]
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/Dimension.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/Dimension.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/Dimension.pkg	(revision 5707)
@@ -0,0 +1,102 @@
+/******************************************************************************
+  BaseDim  
+******************************************************************************/
+class BaseDim
+{
+  tolua_throws|CEGUI::InvalidRequestException,error| float getValue(const Window& wnd) const;
+  tolua_throws|CEGUI::InvalidRequestException,error| float getValue(const Window& wnd, const Rect& container) const;
+  BaseDim* clone() const;
+  DimensionOperator getDimensionOperator() const;
+  void setDimensionOperator(DimensionOperator op);
+  const BaseDim* getOperand() const;
+  void setOperand(const BaseDim& operand);
+  //void writeXMLToStream(OutStream& out_stream) const;
+};
+
+/******************************************************************************
+  AbsoluteDim 
+******************************************************************************/
+class AbsoluteDim : public BaseDim
+{
+  void setValue(float val);
+  AbsoluteDim(float val);
+};
+
+/******************************************************************************
+  ImageDim
+******************************************************************************/
+class ImageDim : public BaseDim 
+{
+  void setSourceImage(string imageset, string image);
+  void setSourceDimension(DimensionType dim);
+  ImageDim(string imageset, string image, DimensionType dim);
+};
+
+/******************************************************************************
+  WidgetDim
+******************************************************************************/
+class WidgetDim : public BaseDim
+{
+  void setWidgetName(string name);
+  void setSourceDimension(DimensionType dim); 
+  WidgetDim(string name, DimensionType dim);
+};
+
+/******************************************************************************
+  UnifiedDim
+******************************************************************************/
+class UnifiedDim : public BaseDim 
+{
+  UnifiedDim(const UDim& value, DimensionType dim);
+};
+
+/******************************************************************************
+  FontDim
+******************************************************************************/
+class FontDim : public BaseDim
+{
+  FontDim(string name, string font, string text, FontMetricType metric, float padding = 0);
+};
+
+/******************************************************************************
+  PropertyDim
+******************************************************************************/
+class PropertyDim : public BaseDim
+{
+  PropertyDim(string name, string property, DimensionType type);
+};
+
+/******************************************************************************
+  Dimension
+******************************************************************************/
+class Dimension
+{
+  const BaseDim& getBaseDimension() const;
+  void setBaseDimension(const BaseDim& dim);
+  DimensionType getDimensionType() const;
+  void setDimensionType(DimensionType type);
+
+  //Dimension& operator=(const Dimension& other);
+  //void writeXMLToStream(OutStream& out_stream) const;
+  Dimension(const BaseDim& dim, DimensionType type);
+  Dimension(const Dimension& other);
+  Dimension();
+};
+
+/******************************************************************************
+  ComponentArea 
+******************************************************************************/
+class ComponentArea
+{
+  Rect getPixelRect(const Window& wnd) const;
+  Rect getPixelRect(const Window& wnd, const Rect& container) const;
+  //void writeXMLToStream(OutStream& out_stream) const;
+  bool isAreaFetchedFromProperty() const;
+  string getAreaPropertySource() const;
+  void setAreaPropertySource(string property);
+  Dimension d_left;
+  Dimension d_top;
+  Dimension d_right_or_width;
+  Dimension d_bottom_or_height;
+  ComponentArea();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/Enums.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/Enums.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/Enums.pkg	(revision 5707)
@@ -0,0 +1,108 @@
+/******************************************************************************
+  DimensionType
+*******************************************************************************/
+enum DimensionType
+{
+  DT_LEFT_EDGE,
+  DT_X_POSITION,
+  DT_TOP_EDGE,
+  DT_Y_POSITION,
+  DT_RIGHT_EDGE,
+  DT_BOTTOM_EDGE,
+  DT_WIDTH,
+  DT_HEIGHT,
+  DT_X_OFFSET, 
+  DT_Y_OFFSET,
+  DT_INVALID 
+};
+
+
+/******************************************************************************
+  VerticalFormatting  
+*******************************************************************************/
+enum VerticalFormatting
+{
+  VF_TOP_ALIGNED,
+  VF_CENTRE_ALIGNED,
+  VF_BOTTOM_ALIGNED, 
+  VF_STRETCHED,  
+  VF_TILED 
+};
+
+
+/******************************************************************************
+  HorizontalFormatting  
+*******************************************************************************/
+enum HorizontalFormatting
+{
+  HF_LEFT_ALIGNED,
+  HF_CENTRE_ALIGNED,
+  HF_RIGHT_ALIGNED,
+  HF_STRETCHED,
+  HF_TILED
+};
+
+/******************************************************************************
+  VerticalTextFormatting  
+*******************************************************************************/
+enum VerticalTextFormatting
+{
+  VTF_TOP_ALIGNED,
+  VTF_CENTRE_ALIGNED,
+  VTF_BOTTOM_ALIGNED 
+};
+
+/******************************************************************************
+  HorinzontalTextFormatting  
+*******************************************************************************/
+enum HorizontalTextFormatting
+{
+  HTF_LEFT_ALIGNED,
+  HTF_RIGHT_ALIGNED,
+  HTF_CENTRE_ALIGNED,
+  HTF_JUSTIFIED, 
+  HTF_WORDWRAP_LEFT_ALIGNED,
+  HTF_WORDWRAP_RIGHT_ALIGNED,
+  HTF_WORDWRAP_CENTRE_ALIGNED,
+  HTF_WORDWRAP_JUSTIFIED 
+};
+
+/******************************************************************************
+  FontMetricType   
+*******************************************************************************/
+enum FontMetricType
+{
+  FMT_LINE_SPACING,
+  FMT_BASELINE,
+  FMT_HORZ_EXTENT
+};
+
+/******************************************************************************
+  DimensionOperator 
+*******************************************************************************/
+enum DimensionOperator
+{
+  DOP_NOOP,
+  DOP_ADD,
+  DOP_SUBTRACT,
+  DOP_MULTIPLY,
+  DOP_DIVIDE
+};
+
+/******************************************************************************
+  FrameImageComponent
+*******************************************************************************/
+enum FrameImageComponent
+{
+  FIC_BACKGROUND,
+  FIC_TOP_LEFT_CORNER,
+  FIC_TOP_RIGHT_CORNER,
+  FIC_BOTTOM_LEFT_CORNER,
+  FIC_BOTTOM_RIGHT_CORNER,
+  FIC_LEFT_EDGE,
+  FIC_RIGHT_EDGE,
+  FIC_TOP_EDGE,
+  FIC_BOTTOM_EDGE,
+  FIC_FRAME_IMAGE_COUNT 
+};
+
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/FalagardComponentBase.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/FalagardComponentBase.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/FalagardComponentBase.pkg	(revision 5707)
@@ -0,0 +1,17 @@
+/******************************************************************************
+  FalagardComponentBase
+******************************************************************************/
+
+class FalagardComponentBase
+{
+  void render(Window& srcWindow, float base_z, const ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  void render(Window& srcWindow, const Rect& baseRect, float base_z, const ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  const ComponentArea& getComponentArea() const;
+  void setComponentArea(const ComponentArea& area);
+  const ColourRect& getColours() const;
+  void setColours(const ColourRect& cols);
+  void setColoursPropertySource(string property);
+  void setColoursPropertyIsColourRect(bool setting = true);
+  void setVertFormattingPropertySource(string property);
+  void setHorzFormattingPropertySource(string property);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/FrameComponent.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/FrameComponent.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/FrameComponent.pkg	(revision 5707)
@@ -0,0 +1,17 @@
+/******************************************************************************
+  FrameComponent
+******************************************************************************/
+
+class FrameComponent : public FalagardComponentBase
+{
+
+  VerticalFormatting getBackgroundVerticalFormatting() const;
+  void setBackgroundVerticalFormatting(VerticalFormatting fmt);
+  HorizontalFormatting getBackgroundHorizontalFormatting() const;
+  void setBackgroundHorizontalFormatting(HorizontalFormatting fmt);
+  const Image* getImage(FrameImageComponent part) const;
+  void setImage(FrameImageComponent part, const Image* image);
+  void setImage(FrameImageComponent part, string imageset, string image);
+  //void writeXMLToStream(OutStream& out_stream) const;
+  FrameComponent();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/ImageryComponent.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/ImageryComponent.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/ImageryComponent.pkg	(revision 5707)
@@ -0,0 +1,19 @@
+/******************************************************************************
+  ImageryComponent
+******************************************************************************/
+
+class ImageryComponent : public FalagardComponentBase 
+{
+  const Image* getImage() const;
+  void setImage(const Image* image);
+  void setImage(string imageset, string image);
+  VerticalFormatting getVerticalFormatting() const;
+  void setVerticalFormatting(VerticalFormatting fmt);
+  HorizontalFormatting getHorizontalFormatting() const;
+  void setHorizontalFormatting(HorizontalFormatting fmt);
+  //void writeXMLToStream(OutStream& out_stream) const;
+  bool isImageFetchedFromProperty() const;
+  string getImagePropertySource() const;
+  void setImagePropertySource(string property);
+  ImageryComponent();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/ImagerySection.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/ImagerySection.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/ImagerySection.pkg	(revision 5707)
@@ -0,0 +1,28 @@
+/******************************************************************************
+  ImagerySection
+******************************************************************************/
+
+class ImagerySection
+{
+  void render(Window& srcWindow, float base_z, const ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+  void render(Window& srcWindow, const Rect& baseRect, float base_z, const ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  void addImageryComponent(const ImageryComponent& img);
+  void clearImageryComponents();
+  void addTextComponent(const TextComponent& text);
+  void clearTextComponents();
+  void clearFrameComponents();
+  void addFrameComponent(const FrameComponent& frame);
+  const ColourRect& getMasterColours() const;
+  void setMasterColours(const ColourRect& cols);
+  string getName() const;
+  void setMasterColoursPropertySource(string property);
+  void setMasterColoursPropertyIsColourRect(bool setting = true);
+  Rect getBoundingRect(const Window& wnd) const;
+  Rect getBoundingRect(const Window& wnd, const Rect& rect) const;
+  //void writeXMLToStream(OutStream& out_stream) const;
+
+  ImagerySection();
+  ImagerySection(string name);
+};
+
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/LayerSpecification.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/LayerSpecification.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/LayerSpecification.pkg	(revision 5707)
@@ -0,0 +1,16 @@
+/******************************************************************************
+  LayerSpecification
+******************************************************************************/
+
+class LayerSpecification
+{
+  void render(Window& srcWindow, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  void render(Window& srcWindow, const Rect& baseRect, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  void addSectionSpecification(const SectionSpecification& section);
+  void clearSectionSpecifications();
+  unsigned int getLayerPriority() const;
+  bool operator<(const LayerSpecification& other) const;
+  //void writeXMLToStream(OutStream& out_stream) const;
+  LayerSpecification(unsigned int priority);
+};
+
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/NamedArea.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/NamedArea.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/NamedArea.pkg	(revision 5707)
@@ -0,0 +1,14 @@
+/***********************************************************************
+  NamedArea
+***********************************************************************/
+class NamedArea
+{
+  string getName() const;
+  const ComponentArea& getArea() const;
+  void setArea(ComponentArea area);
+  //void writeXMLToStream(OutStream& out_stream) const;
+
+  NamedArea();
+  NamedArea(string name);
+};
+
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinition.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinition.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinition.pkg	(revision 5707)
@@ -0,0 +1,13 @@
+/******************************************************************************
+  PropertyDefinition
+******************************************************************************/
+
+class PropertyDefinition : public PropertyDefinitionBase
+{
+  //string get(const PropertyReceiver* receiver) const;
+  //void set(PropertyReceiver* receiver, string value);
+  string get(const Window* receiver) const;
+  void set(Window* receiver, string value);
+
+  PropertyDefinition(string name, string initialValue, bool redrawOnWrite, bool layoutOnWrite);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinitionBase.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinitionBase.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinitionBase.pkg	(revision 5707)
@@ -0,0 +1,10 @@
+/******************************************************************************
+  PropertyDefinitionBase 
+*******************************************************************************/
+
+class PropertyDefinitionBase : public Property 
+{
+  //void set(PropertyReceiver* receiver, string value);
+  void set(Window* receiver, string value);
+  //virtual void writeXMLToStream(OutStream& out_stream) const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyInitialiser.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyInitialiser.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyInitialiser.pkg	(revision 5707)
@@ -0,0 +1,14 @@
+/******************************************************************************
+  PropertyInitialiser
+******************************************************************************/
+
+class PropertyInitialiser
+{
+  //void apply(PropertySet& target) const;
+  void apply(Window& target) const;
+
+  string getTargetPropertyName() const;
+  string getInitialiserValue() const;
+  //void writeXMLToStream(OutStream& out_stream) const;
+  PropertyInitialiser(string property, string value);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyLinkDefinition.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyLinkDefinition.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/PropertyLinkDefinition.pkg	(revision 5707)
@@ -0,0 +1,12 @@
+/******************************************************************************
+  PropertyLinkDefinition
+******************************************************************************/
+
+class PropertyLinkDefinition : public PropertyDefinitionBase
+{
+  //string get(const PropertyReceiver* receiver) const;
+  //void set(PropertyReceiver* receiver, string value);
+  string get(const Window* receiver) const;
+  void set(Window* receiver, string value);
+  PropertyLinkDefinition(string propertyName, string widgetNameSuffix, string targetProperty, string initialValue, bool redrawOnWrite, bool layoutOnWrite);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/SectionSpecification.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/SectionSpecification.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/SectionSpecification.pkg	(revision 5707)
@@ -0,0 +1,23 @@
+/******************************************************************************
+  SectionSpecification
+******************************************************************************/
+
+class SectionSpecification
+{
+  void render(Window& srcWindow, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  void render(Window& srcWindow, const Rect& baseRect, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+  string getOwnerWidgetLookFeel() const;
+  string getSectionName() const;
+  const ColourRect& getOverrideColours() const;
+  void setOverrideColours(const ColourRect& cols);
+  bool isUsingOverrideColours() const;
+  void setUsingOverrideColours(bool setting = true);
+  void setOverrideColoursPropertySource(string property);
+  void setOverrideColoursPropertyIsColourRect(bool setting = true);  
+  void setRenderControlPropertySource(string property);
+  // void writeXMLToStream(OutStream& out_stream) const;
+  SectionSpecification(string owner, string sectionName, const string controlPropertySource);
+  SectionSpecification(string owner, string sectionName, string controlPropertySource, const ColourRect& cols);
+  
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/StateImagery.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/StateImagery.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/StateImagery.pkg	(revision 5707)
@@ -0,0 +1,19 @@
+/******************************************************************************
+  StateImagery
+******************************************************************************/
+
+class StateImagery
+{
+  void render(Window& srcWindow, const ColourRect* modcols = 0, const Rect* clipper = 0) const;
+  void render(Window& srcWindow, const Rect& baseRect, const ColourRect* modcols = 0, const Rect* clipper = 0) const;
+
+  void addLayer(const LayerSpecification& layer);
+  void clearLayers();
+  string getName() const;
+  bool isClippedToDisplay() const;
+  void setClippedToDisplay(bool setting);
+  //void writeXMLToStream(OutStream& out_stream) const;
+  StateImagery(string name);
+  StateImagery();
+};
+
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/TextComponent.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/TextComponent.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/TextComponent.pkg	(revision 5707)
@@ -0,0 +1,22 @@
+/*********************************************************************
+ TextComponent
+**********************************************************************/
+class TextComponent : public FalagardComponentBase 
+{
+    string getText() const;
+    void setText(string text);
+    string getFont() const;
+    void setFont(string font);
+    VerticalTextFormatting getVerticalFormatting() const;
+    void setVerticalFormatting(VerticalTextFormatting fmt);
+    HorizontalTextFormatting getHorizontalFormatting() const;
+    void setHorizontalFormatting(HorizontalTextFormatting fmt);
+    //void writeXMLToStream(OutStream& out_stream) const;
+    bool isTextFetchedFromProperty() const;
+    string getTextPropertySource() const;
+    void setTextPropertySource(string property);
+    bool isFontFetchedFromProperty() const;
+    string getFontPropertySource() const;
+    void setFontPropertySource(string property);
+    TextComponent();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/WidgetComponent.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/WidgetComponent.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/WidgetComponent.pkg	(revision 5707)
@@ -0,0 +1,33 @@
+/******************************************************************************
+  WidgetComponent
+******************************************************************************/
+
+class WidgetComponent
+{
+  void create(Window& parent) const;
+  const ComponentArea& getComponentArea() const;
+  void setComponentArea(const ComponentArea& area);
+  string getBaseWidgetType() const;
+  void setBaseWidgetType(string type);
+  string getWidgetLookName() const;
+  void setWidgetLookName(string look);
+  string getWidgetNameSuffix() const;
+  void setWidgetNameSuffix(string suffix);
+  string getWindowRendererType() const;
+  void setWindowRendererType(string type);
+  VerticalAlignment getVerticalWidgetAlignment() const;
+  void setVerticalWidgetAlignment(VerticalAlignment alignment);
+  HorizontalAlignment getHorizontalWidgetAlignment() const;
+  void setHorizontalWidgetAlignment(HorizontalAlignment alignment);
+  void addPropertyInitialiser(const PropertyInitialiser& initialiser);
+  void clearPropertyInitialisers();
+  void layout(const Window& owner) const;
+
+  //void writeXMLToStream(OutStream& out_stream) const;
+
+  const PropertyInitialiser* findPropertyInitialiser(string propertyName) const;
+
+  WidgetComponent();
+  WidgetComponent(string type, string look, string suffix, string renderer);
+};
+
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookFeel.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookFeel.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookFeel.pkg	(revision 5707)
@@ -0,0 +1,37 @@
+/**************************************************************************************
+    WidgetLookFeel
+**************************************************************************************/
+
+class WidgetLookFeel
+{
+    StateImagery& getStateImagery(string state) const;
+    ImagerySection& getImagerySection(string section) const;
+    string getName() const;
+    void addImagerySection(const ImagerySection& section);
+    void addWidgetComponent(const WidgetComponent& widget);
+    void addStateSpecification(const StateImagery& state);
+    void addPropertyInitialiser(const PropertyInitialiser& initialiser);
+    void clearImagerySections();
+    void clearWidgetComponents();
+    void clearStateSpecifications();
+    void clearPropertyInitialisers();
+    void initialiseWidget(Window& widget) const;
+    bool isStateImageryPresent(string state) const;
+    void addNamedArea(const NamedArea& area);
+    void clearNamedAreas();
+    const NamedArea& getNamedArea(string name) const;
+    bool isNamedAreaDefined(string name) const;
+    void layoutChildWidgets(const Window& owner) const;
+    void addPropertyDefinition(const PropertyDefinition& propdef);
+    void addPropertyLinkDefinition(const PropertyLinkDefinition& propdef);
+    void clearPropertyDefinitions();
+    void clearPropertyLinkDefinitions();
+    //void writeXMLToStream(XMLSerializer& out_stream) const;
+    void renameChildren(const Window& widget, string newBaseName) const;
+
+    const PropertyInitialiser* findPropertyInitialiser(string propertyName) const;
+    const WidgetComponent* findWidgetComponent(string nameSuffix) const;
+
+    WidgetLookFeel(string name);
+    WidgetLookFeel();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookManager.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookManager.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookManager.pkg	(revision 5707)
@@ -0,0 +1,22 @@
+/***********************************************************************
+  WidgetLookManager
+***********************************************************************/
+
+class WidgetLookManager
+{
+  static WidgetLookManager& getSingleton(void);
+
+  void parseLookNFeelSpecification(string filename, string resourceGroup = "");
+  bool isWidgetLookAvailable(string widget) const;
+  const WidgetLookFeel& getWidgetLook(string widget) const;
+  void eraseWidgetLook(string widget);
+  void addWidgetLook(WidgetLookFeel& look);
+
+  void writeWidgetLookToStream(string name, OutStream& out_stream) const;
+  void writeWidgetLookSeriesToStream(string prefix, OutStream& out_stream) const;
+
+  WidgetLookManager();
+
+  static void setDefaultResourceGroup(string resourceGroup);
+  static string getDefaultResourceGroup();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/CMakeLists.txt
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/CMakeLists.txt	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/CMakeLists.txt	(revision 5707)
@@ -0,0 +1,12 @@
+SET(_package_files
+  CEGUI.pkg
+  Logger.pkg
+  ScriptWindowHelper.pkg
+  WindowManager.pkg
+  elements/GroupBox.pkg
+  elements/MultiLineEditbox.pkg
+  elements/Tree.pkg
+  elements/TreeItem.pkg
+
+  PARENT_SCOPE
+)
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.cpp	(revision 5707)
@@ -0,0 +1,336 @@
+/***********************************************************************
+	filename: CEGUILua.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Implementation for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUIPropertyHelper.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <vector>
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// prototype for bindings initialisation function
+int tolua_CEGUI_open(lua_State* tolua_S);
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Constructor (creates Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule()
+{
+    #if LUA_VERSION_NUM >= 501
+        static const luaL_Reg lualibs[] = {
+            {"", luaopen_base},
+            {LUA_LOADLIBNAME, luaopen_package},
+            {LUA_TABLIBNAME, luaopen_table},
+            {LUA_IOLIBNAME, luaopen_io},
+            {LUA_OSLIBNAME, luaopen_os},
+            {LUA_STRLIBNAME, luaopen_string},
+            {LUA_MATHLIBNAME, luaopen_math},
+        #if defined(DEBUG) || defined (_DEBUG)
+                {LUA_DBLIBNAME, luaopen_debug},
+        #endif
+            {0, 0}
+        };
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    // create a lua state
+    d_ownsState = true;
+    d_state = lua_open();
+
+    // init all standard libraries
+    #if LUA_VERSION_NUM >= 501
+            const luaL_Reg *lib = lualibs;
+            for (; lib->func; lib++)
+            {
+                lua_pushcfunction(d_state, lib->func);
+                lua_pushstring(d_state, lib->name);
+                lua_call(d_state, 1, 0);
+            }
+    #else /* LUA_VERSION_NUM >= 501 */
+        luaopen_base(d_state);
+        luaopen_io(d_state);
+        luaopen_string(d_state);
+        luaopen_table(d_state);
+        luaopen_math(d_state);
+        #if defined(DEBUG) || defined (_DEBUG)
+            luaopen_debug(d_state);
+        #endif
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Constructor (uses given Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule(lua_State* state)
+{
+	// just use the given state
+	d_ownsState = false;
+	d_state = state;
+
+	setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Destructor
+*************************************************************************/
+LuaScriptModule::~LuaScriptModule()
+{
+	if ( d_ownsState && d_state )
+	{
+		lua_close( d_state );
+	}
+}
+
+
+/*************************************************************************
+	Execute script file
+*************************************************************************/
+void LuaScriptModule::executeScriptFile(const String& filename, const String& resourceGroup)
+{
+	// load file
+	RawDataContainer raw;
+	System::getSingleton().getResourceProvider()->loadRawDataContainer(filename,
+        raw, resourceGroup.empty() ? d_defaultResourceGroup : resourceGroup);
+
+	// load code into lua
+	int top = lua_gettop(d_state);
+	int loaderr = luaL_loadbuffer(d_state, (char*)raw.getDataPtr(), raw.getSize(), filename.c_str());
+	System::getSingleton().getResourceProvider()->unloadRawDataContainer( raw );
+	if (loaderr)
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+
+    // call it
+	if (lua_pcall(d_state,0,0,0))
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+
+	lua_settop(d_state,top); // just in case :P
+}
+
+
+/*************************************************************************
+	Execute global script function
+*************************************************************************/
+int	LuaScriptModule::executeScriptGlobal(const String& function_name)
+{
+    int top = lua_gettop(d_state);
+
+    // get the function from lua
+    lua_getglobal(d_state, function_name.c_str());
+
+    // is it a function
+    if (!lua_isfunction(d_state,-1))
+    {
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to get Lua global: '"+function_name+"' as name not represent a global Lua function" );
+    }
+
+    // call it
+    int error = lua_pcall(d_state,0,1,0);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_pop(d_state,1);
+        throw ScriptException("Unable to evaluate Lua global: '"+function_name+"\n\n"+errMsg+"\n");
+    }
+
+    // get return value
+    if (!lua_isnumber(d_state,-1))
+    {
+        // log that return value is invalid. return -1 and move on.
+        lua_settop(d_state,top);
+        ScriptException("Unable to get Lua global : '"+function_name+"' return value as it's not a number" );
+        return -1;
+    }
+
+    int ret = (int)lua_tonumber(d_state,-1);
+    lua_pop(d_state,1);
+
+    // return it
+    return ret;
+}
+
+
+/*************************************************************************
+	Execute scripted event handler
+*************************************************************************/
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name, const EventArgs& e)
+{
+
+	LuaFunctor::pushNamedFunction(d_state, handler_name);
+
+	ScriptWindowHelper* helper = 0;
+	//If this is an event that was triggered by a window then make a "this" pointer to the window for the script.
+	if(e.d_hasWindow)
+	{
+		WindowEventArgs& we = (WindowEventArgs&)e;
+		helper = new ScriptWindowHelper(we.window);
+		lua_pushlightuserdata(d_state,(void*)helper);
+		lua_setglobal(d_state,"this");
+	} // if(e.d_hasWindow)
+
+    // push EventArgs as the first parameter
+    tolua_pushusertype(d_state,(void*)&e,"const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(d_state,1,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(d_state,-1));
+        lua_pop(d_state,1);
+		//cleanup the helper object if any
+		if(helper)
+		{
+			delete helper;
+			helper = 0;
+		}
+        throw ScriptException("Unable to evaluate the Lua event handler: '"+handler_name+"'\n\n"+errStr+"\n");
+    } // if (error)
+
+	if(helper)
+	{
+		delete helper;
+		helper = 0;
+	}
+
+    return true;
+}
+
+
+/*************************************************************************
+	Execute script code string
+*************************************************************************/
+void LuaScriptModule::executeString(const String& str)
+{
+    int top = lua_gettop(d_state);
+
+    // load code into lua and call it
+    int error =	luaL_loadbuffer(d_state, str.c_str(), str.length(), str.c_str()) || lua_pcall(d_state,0,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script string: '"+str+"'\n\n"+errMsg+"\n");
+    }
+}
+
+
+/*************************************************************************
+	Create Lua bindings
+*************************************************************************/
+void LuaScriptModule::createBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Creating Lua bindings ----" );
+	// init CEGUI module
+	tolua_CEGUI_open(d_state);
+}
+
+
+/*************************************************************************
+	Destroy Lua bindings
+*************************************************************************/
+void LuaScriptModule::destroyBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Destroying Lua bindings ----" );
+	// is this ok ?
+	lua_pushnil(d_state);
+	lua_setglobal(d_state,"CEGUI");
+}
+
+
+/*************************************************************************
+	Set the ID string for the module
+*************************************************************************/
+void LuaScriptModule::setModuleIdentifierString()
+{
+    // set ID string
+    d_identifierString = "CEGUI::LuaScriptModule - Official Lua based scripting module for CEGUI";
+	d_language = "Lua";
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, Event::Subscriber(functor));
+    // make sure we don't release the reference we just made when this call returns
+    functor.index = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, Event::Group group, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // return the event connection
+    return con;
+}
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.h	(revision 5707)
@@ -0,0 +1,253 @@
+/***********************************************************************
+	filename: CEGUILua.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Defines interface for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILua_h_
+#define _CEGUILua_h_
+
+
+/*************************************************************************
+	Import / Export control macros
+*************************************************************************/
+#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
+#   ifdef CEGUILUA_EXPORTS
+#       define CEGUILUA_API __declspec(dllexport)
+#   else
+#       if defined( __MINGW32__ )
+#           define CEGUILUA_API
+#       else
+#           define CEGUILUA_API __declspec(dllimport)
+#       endif
+#   endif
+#else
+#   define CEGUILUA_API
+#endif
+
+
+#include "CEGUIScriptModule.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Interface for the LuaScriptModule class
+*/
+class CEGUILUA_API LuaScriptModule : public CEGUI::ScriptModule
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which create a lua_State
+	*/
+	LuaScriptModule();
+
+
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which takes a lua_State
+
+	\param state
+		Pointer to the lua_State that the script module should attach to.
+	*/
+	LuaScriptModule(lua_State* state);
+
+
+	/*!
+	\brief
+		Destructor for LuaScriptModule class.
+	*/
+	~LuaScriptModule();
+
+
+	/*************************************************************************
+		Script Execution Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Execute a script file.
+
+	\param filename
+		String object holding the filename of the script file that is to be executed
+		
+	\param resourceGroup
+		Resource group idendifier to be passed to the ResourceProvider when loading the script file.
+	*/
+	void executeScriptFile(const String& filename, const String& resourceGroup);
+
+
+	/*!
+	\brief
+		Execute a scripted global function.  The function should not take any parameters and should return an integer.
+
+	\param function_name
+		String object holding the name of the function, in the global script environment, that
+		is to be executed.
+
+	\return
+		The integer value returned from the script function.
+	*/
+	int executeScriptGlobal(const String& function_name);
+
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing a function field.
+        For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means, to the scripted function.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name, const EventArgs& e);
+
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str);
+
+    /*************************************************************************
+        Event subscription
+    *************************************************************************/
+    /*!
+    \brief
+            Subscribes the named Event to a scripted funtion
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, const String& subscriber_name);
+
+    /*!
+    \brief
+            Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param group
+            Group which is to be subscribed to.  Subscription groups are called in ascending order.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, Event::Group group, const String& subscriber_name);
+
+    /*************************************************************************
+        Bindings creation / destruction
+    *************************************************************************/
+    /*!
+    \brief
+        Method called during system initialisation, prior to running any scripts via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to complete initialisation or binding of the script language to the gui system objects.
+
+    \return
+        Nothing.
+    */
+    void createBindings(void);
+
+
+    /*!
+    \brief
+        Method called during system destruction, after all scripts have been run via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to cleanup bindings of the script language to the gui system objects, as set-up in the
+        earlier createBindings call.
+
+    \return
+        Nothing.
+    */
+    void destroyBindings(void);
+
+    /*************************************************************************
+        Accessor type functions
+    *************************************************************************/
+    /*!
+    \brief
+        Method used to get a pointer to the lua_State that the script module is attached to.
+
+    \return
+        A pointer to the lua_State that the script module is attached to.
+    */
+    lua_State* getLuaState(void) const {return d_state;}
+
+private:
+    /*************************************************************************
+        Implementation Functions
+    *************************************************************************/
+    void setModuleIdentifierString();
+
+    /*************************************************************************
+        Implementation Data
+    *************************************************************************/
+    bool d_ownsState;      //!< true when the attached lua_State was created by this script module
+    lua_State* d_state;    //!< The lua_State that this script module uses.
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILua_h_
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.cpp	(revision 5707)
@@ -0,0 +1,280 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.cpp
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Implementation for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUILuaFunctor.h"
+#include "CEGUILogger.h"
+#include "CEGUIExceptions.h"
+#include "CEGUIPropertyHelper.h"
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, int func, int selfIndex) :
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, int selfIndex) :
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(const LuaFunctor& cp) :
+    L(cp.L),
+    index(cp.index),
+    self(cp.self),
+    needs_lookup(cp.needs_lookup),
+    function_name(cp.function_name)
+{
+}
+
+/*************************************************************************
+    Destructor
+*************************************************************************/
+LuaFunctor::~LuaFunctor()
+{
+    if (self!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, self);
+    }
+    if (index!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, index);
+    }
+}
+
+/*************************************************************************
+    Call operator
+*************************************************************************/
+bool LuaFunctor::operator()(const EventArgs& args) const
+{
+    // is this a late binding?
+    if (needs_lookup)
+    {
+        pushNamedFunction(L, function_name);
+        // reference function
+        index = luaL_ref(L, LUA_REGISTRYINDEX);
+        needs_lookup = false;
+        CEGUI_LOGINSANE("Late binding of callback '"+function_name+"' performed");
+        function_name.clear();
+    } // if (needs_lookup)
+
+	ScriptWindowHelper* helper = 0;
+	//Set a global for this window
+	if(args.d_hasWindow)
+	{
+		WindowEventArgs& we = (WindowEventArgs&)args;
+		helper = new ScriptWindowHelper(we.window);
+		tolua_pushusertype(L,(void*)helper,"CEGUI::ScriptWindowHelper");
+		lua_setglobal(L,"this");
+	}
+
+    // retrieve function
+    lua_rawgeti(L, LUA_REGISTRYINDEX, index);
+
+    // possibly self as well?
+    int nargs = 1;
+    if (self != LUA_NOREF)
+    {
+        lua_rawgeti(L, LUA_REGISTRYINDEX, self);
+        ++nargs;
+    }
+
+    // push EventArgs  parameter
+    tolua_pushusertype(L, (void*)&args, "const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(L, nargs, 0, 0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(L, -1));
+        lua_pop(L, 1);
+		if(helper)
+		{
+			delete helper;
+			helper = 0;
+		}
+        throw ScriptException("Unable to call Lua event handler:\n\n"+errStr+"\n");
+    } // if (error)
+
+	if(helper)
+	{
+		delete helper;
+		helper = 0;
+	}
+
+    return true;
+}
+
+/*************************************************************************
+    do event subscription by reference instead of by name
+*************************************************************************/
+Event::Connection LuaFunctor::SubscribeEvent(EventSet* self, const String& event_name, int funcIndex, int selfIndex, lua_State* L)
+{
+    // should we pass a self to the callback?
+    int thisIndex = LUA_NOREF;
+    if (selfIndex != LUA_NOREF)
+    {
+        // reference self
+        thisIndex = luaL_ref(L, LUA_REGISTRYINDEX);
+    }
+
+    // do the real subscription
+    int type = lua_type(L,-1);
+    Event::Connection con;
+    if (type == LUA_TFUNCTION)
+    {
+        // reference function
+        int index = luaL_ref(L, LUA_REGISTRYINDEX);
+        LuaFunctor functor(L,index,thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference(s) we just made when this call returns
+        functor.index = LUA_NOREF;
+        functor.self = LUA_NOREF;
+    }
+    else if (type == LUA_TSTRING)
+    {
+        const char* str = lua_tostring(L, -1);
+        LuaFunctor functor(L,String(str),thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference we just (maybe) made when this call returns
+        functor.self = LUA_NOREF;
+    }
+    else
+    {
+        luaL_error(L,"bad function passed to subscribe function. must be a real function, or a string for late binding");
+    }
+
+    // return the event connection
+    return con;
+}
+
+/*************************************************************************
+    Pushes a named function on the stack
+*************************************************************************/
+void LuaFunctor::pushNamedFunction(lua_State* L, const String& handler_name)
+{
+    int top = lua_gettop(L);
+
+    // do we have any dots in the handler name? if so we grab the function as a table field
+    String::size_type i = handler_name.find_first_of((utf32)'.');
+    if (i!=String::npos)
+    {
+        // split the rest of the string up in parts seperated by '.'
+        // TODO: count the dots and size the vector accordingly from the beginning.
+        std::vector<String> parts;
+        String::size_type start = 0;
+        do
+        {
+            parts.push_back(handler_name.substr(start,i-start));
+            start = i+1;
+            i = handler_name.find_first_of((utf32)'.',start);
+        } while(i!=String::npos);
+
+        // add last part
+        parts.push_back(handler_name.substr(start));
+
+        // first part is the global
+        lua_getglobal(L, parts[0].c_str());
+        if (!lua_istable(L,-1))
+        {
+            lua_settop(L,top);
+            throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as first part is not a table");
+        }
+
+        // if there is more than two parts, we have more tables to go through
+        std::vector<String>::size_type visz = parts.size();
+        if (visz-- > 2) // avoid subtracting one later on
+        {
+            // go through all the remaining parts to (hopefully) have a valid Lua function in the end
+            std::vector<String>::size_type vi = 1;
+            while (vi<visz)
+            {
+                // push key, and get the next table
+                lua_pushstring(L,parts[vi].c_str());
+                lua_gettable(L,-2);
+                if (!lua_istable(L,-1))
+                {
+                    lua_settop(L,top);
+                    throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as part #"+PropertyHelper::uintToString(uint(vi+1))+" ("+parts[vi]+") is not a table");
+                }
+                // get rid of the last table and move on
+                lua_remove(L,-2);
+                vi++;
+            }
+        }
+
+        // now we are ready to get the function to call ... phew :)
+        lua_pushstring(L,parts[visz].c_str());
+        lua_gettable(L,-2);
+        lua_remove(L,-2); // get rid of the table
+    }
+    // just a regular global function
+    else
+    {
+        lua_getglobal(L, handler_name.c_str());
+    }
+
+    // is it a function
+    if (!lua_isfunction(L,-1))
+    {
+        lua_settop(L,top);
+        throw ScriptException("The Lua event handler: '"+handler_name+"' does not represent a Lua function");
+    }
+}
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.h	(revision 5707)
@@ -0,0 +1,86 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.h
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Defines interface for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILuaFunctor_h_
+#define _CEGUILuaFunctor_h_
+
+#include "CEGUIEventSet.h"
+#include "CEGUIScriptWindowHelper.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// forward declaration
+class LuaScriptModule;
+
+/*!
+\brief
+    Functor class used for subscribing Lua functions to CEGUI events
+*/
+class LuaFunctor
+{
+public:
+    LuaFunctor(lua_State* state, int func, int selfIndex);
+    LuaFunctor(lua_State* state, const String& func, int selfIndex);
+    LuaFunctor(const LuaFunctor& cp);
+    ~LuaFunctor();
+
+    bool operator()(const EventArgs& args) const;
+
+    /*!
+    \brief
+        function used to subscribe any Lua function as event handler.
+        References using the Lua registry.
+        To be called from Lua only.
+    */
+    static Event::Connection SubscribeEvent(EventSet* self, const String& eventName, int funcIndex, int selfIndex, lua_State* L);
+
+    /*!
+    \brief
+        Pushes the Lua function named \param name on top of the Lua stack.
+        The name may contain '.' (dots) character for (nested) table values.
+    */
+    static void pushNamedFunction(lua_State* L, const String& name);
+
+private:
+    lua_State* L;
+    mutable int index;
+    int self;
+    mutable bool needs_lookup;
+    mutable String function_name;
+
+    friend class LuaScriptModule;
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILuaFunctor_h_
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/changes_orxonox.diff
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/changes_orxonox.diff	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/changes_orxonox.diff	(revision 5707)
@@ -0,0 +1,92 @@
+--- CEGUILua.cpp	Sun Jan 25 18:30:39 2009
++++ CEGUILua.cpp	Thu Jan 29 10:25:05 2009
+@@ -27,10 +27,6 @@
+  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+  *   OTHER DEALINGS IN THE SOFTWARE.
+  ***************************************************************************/
+-#ifdef HAVE_CONFIG_H
+-#   include "config.h"
+-#endif
+-
+ #include "CEGUI.h"
+ #include "CEGUIPropertyHelper.h"
+ #include "CEGUILua.h"
+@@ -44,7 +40,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // prototype for bindings initialisation function
+ int tolua_CEGUI_open(lua_State* tolua_S);
+@@ -59,7 +55,7 @@
+ *************************************************************************/
+ LuaScriptModule::LuaScriptModule()
+ {
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+         static const luaL_Reg lualibs[] = {
+             {"", luaopen_base},
+             {LUA_LOADLIBNAME, luaopen_package},
+@@ -73,14 +69,14 @@
+         #endif
+             {0, 0}
+         };
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     // create a lua state
+     d_ownsState = true;
+     d_state = lua_open();
+ 
+     // init all standard libraries
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+             const luaL_Reg *lib = lualibs;
+             for (; lib->func; lib++)
+             {
+@@ -88,7 +84,7 @@
+                 lua_pushstring(d_state, lib->name);
+                 lua_call(d_state, 1, 0);
+             }
+-    #else /* CEGUI_LUA_VER >= 51 */
++    #else /* LUA_VERSION_NUM >= 501 */
+         luaopen_base(d_state);
+         luaopen_io(d_state);
+         luaopen_string(d_state);
+@@ -97,7 +93,7 @@
+         #if defined(DEBUG) || defined (_DEBUG)
+             luaopen_debug(d_state);
+         #endif
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     setModuleIdentifierString();
+ }
+--- CEGUILua.h	Wed Jul  9 18:24:49 2008
++++ CEGUILua.h	Thu Jan 29 10:17:07 2009
+@@ -38,7 +38,11 @@
+ #   ifdef CEGUILUA_EXPORTS
+ #       define CEGUILUA_API __declspec(dllexport)
+ #   else
+-#       define CEGUILUA_API __declspec(dllimport)
++#       if defined( __MINGW32__ )
++#           define CEGUILUA_API
++#       else
++#           define CEGUILUA_API __declspec(dllimport)
++#       endif
+ #   endif
+ #else
+ #   define CEGUILUA_API
+--- CEGUILuaFunctor.cpp	Wed Jul  9 18:25:02 2008
++++ CEGUILuaFunctor.cpp	Thu Jan 29 10:26:58 2009
+@@ -39,7 +39,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // Start of CEGUI namespace section
+ namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/required.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/required.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/required.cpp	(revision 5707)
@@ -0,0 +1,88 @@
+/***********************************************************************
+	filename: required.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Implementation of helper functions
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "required.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+
+// returns horizontal range as two values for lua
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getHorzRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+// returns vertical range as two values for lua
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getVertRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+
+// allocates and returns a new ListboxTextItem
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete)
+{
+	return new ListboxTextItem(text,item_id,item_data,disabled,auto_delete);
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+void ceguiLua_FileStream_open(FileStream* os, const char* filename)
+{
+    os->open(filename, std::ios::binary);
+}
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k)
+{
+    return (k & sys->getSystemKeys()) != 0;
+}
+
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/required.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/required.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/ceguilua/required.h	(revision 5707)
@@ -0,0 +1,113 @@
+/***********************************************************************
+	filename: required.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Header that includes the necessary stuff needed for the Lua bindings
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <fstream>
+
+#define __operator_increment    operator++
+#define __operator_decrement    operator--
+#define __operator_dereference  operator*
+
+#define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent
+
+//This is used to keep compilers happy
+#define CEGUIDeadException(e) &
+
+#if defined(_MSC_VER) && !defined(snprintf)
+#   define snprintf   _snprintf
+#endif
+
+typedef CEGUI::String string;
+
+namespace CEGUI
+{
+
+typedef Event::Connection EventConnection;
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max);
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max);
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete);
+
+
+/************************************************************************
+    Stuff needed to make the iterators work
+*************************************************************************/
+typedef PropertySet::Iterator PropertyIterator;
+typedef EventSet::Iterator EventIterator;
+typedef WindowManager::WindowIterator WindowIterator;
+typedef WindowFactoryManager::WindowFactoryIterator WindowFactoryIterator;
+typedef WindowFactoryManager::FalagardMappingIterator FalagardMappingIterator;
+typedef WindowFactoryManager::FalagardWindowMapping FalagardWindowMapping;
+typedef ImagesetManager::ImagesetIterator ImagesetIterator;
+typedef Imageset::ImageIterator ImageIterator;
+typedef SchemeManager::SchemeIterator SchemeIterator;
+typedef FontManager::FontIterator FontIterator;
+
+template <typename T>
+inline PropertyIterator ceguiLua_getPropertyIterator(const T* self)
+{
+    return static_cast<const PropertySet*>(self)->getIterator();
+}
+
+template <typename T>
+inline EventIterator ceguiLua_getEventIterator(const T* self)
+{
+    return static_cast<const EventSet*>(self)->getIterator();
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+typedef std::ofstream FileStream;
+void ceguiLua_FileStream_open(FileStream*, const char* filename);
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k);
+
+}
+
+// the binding file generates alot of
+// warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
+#if defined(_MSC_VER)
+#   pragma warning(disable : 4800)
+#endif
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/CEGUI.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/CEGUI.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/CEGUI.pkg	(revision 5707)
@@ -0,0 +1,121 @@
+// include the header that makes these files generate valid code
+$#include "ceguilua/required.h"
+$#include "CEGUIPropertyHelper.h"
+
+// start the CEGUI namespace and include everything inside that
+namespace CEGUI
+{
+
+$pfile "Basic.pkg"
+$pfile "UnifiedCoordSystem.pkg"
+$pfile "Logger.pkg"
+
+$pfile "Font.pkg"
+$pfile "FontManager.pkg"
+
+$pfile "Image.pkg"
+$pfile "Texture.pkg"
+$pfile "Imageset.pkg"
+$pfile "ImagesetManager.pkg"
+
+$pfile "Iterators.pkg"
+
+$pfile "Key.pkg"
+$pfile "InputEvent.pkg"
+$pfile "EventSet.pkg"
+
+$pfile "MouseCursor.pkg"
+$pfile "Window.pkg"
+$pfile "CoordConverter.pkg"
+$pfile "Renderer.pkg"
+$pfile "ScriptWindowHelper.pkg"
+$pfile "System.pkg"
+
+$pfile "WindowManager.pkg"
+$pfile "WindowFactoryManager.pkg"
+
+$pfile "Scheme.pkg"
+$pfile "SchemeManager.pkg"
+
+$pfile "PropertyHelper.pkg"
+
+// elements
+$pfile "elements/GUISheet.pkg"
+$pfile "elements/Tree.pkg"
+
+$pfile "elements/ButtonBase.pkg"
+$pfile "elements/Checkbox.pkg"
+$pfile "elements/PushButton.pkg"
+$pfile "elements/Thumb.pkg"
+$pfile "elements/RadioButton.pkg"
+
+$pfile "elements/TabButton.pkg"
+$pfile "elements/TabControl.pkg"
+
+$pfile "elements/Titlebar.pkg"
+$pfile "elements/TreeItem.pkg"
+$pfile "elements/FrameWindow.pkg"
+
+$pfile "elements/Tooltip.pkg"
+
+$pfile "elements/DragContainer.pkg"
+
+$pfile "elements/Scrollbar.pkg"
+$pfile "elements/ScrolledContainer.pkg"
+$pfile "elements/ScrollablePane.pkg"
+
+$pfile "elements/Slider.pkg"
+
+$pfile "elements/Spinner.pkg"
+
+$pfile "elements/ProgressBar.pkg"
+
+$pfile "elements/Editbox.pkg"
+$pfile "elements/MultiLineEditbox.pkg"
+
+$pfile "elements/ListboxItem.pkg"
+$pfile "elements/ListboxTextItem.pkg"
+
+$pfile "elements/Combobox.pkg"
+$pfile "elements/Listbox.pkg"
+$pfile "elements/ComboDropList.pkg"
+
+$pfile "elements/ListHeaderSegment.pkg"
+$pfile "elements/ListHeader.pkg"
+$pfile "elements/MultiColumnList.pkg"
+
+$pfile "elements/ItemEntry.pkg"
+$pfile "elements/ItemListBase.pkg"
+$pfile "elements/MenuBase.pkg"
+$pfile "elements/Menubar.pkg"
+$pfile "elements/PopupMenu.pkg"
+$pfile "elements/MenuItem.pkg"
+$pfile "elements/ScrolledItemListBase.pkg"
+$pfile "elements/ItemListbox.pkg"
+
+$pfile "elements/GroupBox.pkg"
+
+$pfile "falagard/Enums.pkg"
+$pfile "falagard/Dimension.pkg"
+$pfile "falagard/NamedArea.pkg"
+$pfile "falagard/PropertyDefinitionBase.pkg"
+$pfile "falagard/PropertyDefinition.pkg"
+$pfile "falagard/PropertyInitialiser.pkg"
+$pfile "falagard/PropertyLinkDefinition.pkg"
+$pfile "falagard/FalagardComponentBase.pkg"
+$pfile "falagard/FrameComponent.pkg"
+$pfile "falagard/ImageryComponent.pkg"
+$pfile "falagard/TextComponent.pkg"
+$pfile "falagard/ImagerySection.pkg"
+$pfile "falagard/SectionSpecification.pkg"
+$pfile "falagard/LayerSpecification.pkg"
+$pfile "falagard/StateImagery.pkg"
+$pfile "falagard/WidgetComponent.pkg"
+$pfile "falagard/WidgetLookFeel.pkg"
+$pfile "falagard/WidgetLookManager.pkg"
+
+$pfile "HelperFunctions.pkg"
+
+$pfile "OutStream.pkg"
+
+}
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/Logger.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/Logger.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/Logger.pkg	(revision 5707)
@@ -0,0 +1,26 @@
+/***********************************************************************
+	LoggingLevel
+***********************************************************************/
+enum LoggingLevel
+{
+	Errors,
+	Warnings,
+	Standard,
+	Informative,
+	Insane
+};
+
+
+
+/***********************************************************************
+	Logger
+***********************************************************************/
+class Logger
+{
+	static Logger& getSingleton();
+
+	void setLoggingLevel(LoggingLevel level);
+	LoggingLevel getLoggingLevel() const;
+
+	void logEvent(string message, LoggingLevel level=Standard);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/ScriptWindowHelper.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/ScriptWindowHelper.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/ScriptWindowHelper.pkg	(revision 5707)
@@ -0,0 +1,8 @@
+/***********************************************************************
+	ScriptWindowHelper
+***********************************************************************/
+class ScriptWindowHelper
+{
+	Window* getWindow(string name);
+	Window* getWindow();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/WindowManager.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/WindowManager.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/WindowManager.pkg	(revision 5707)
@@ -0,0 +1,32 @@
+/***********************************************************************
+	WindowManager
+***********************************************************************/
+class WindowManager
+{
+	static WindowManager& getSingleton();
+
+	tolua_throws|CEGUI::AlreadyExistsException,nil| Window* createWindow(string type, string name="");
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| Window* loadWindowLayout(string filename, string name_prefix="", string resourcegroup="");
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| Window* loadWindowLayout(string filename, bool generateRandomPrefix);
+
+    void writeWindowLayoutToStream(string window, OutStream& out, bool writeParent=false) const;
+    void writeWindowLayoutToStream(const Window& window, OutStream& out, bool writeParent=false) const;
+
+	void destroyWindow(string name);
+	void destroyWindow(Window* window);
+	void destroyAllWindows();
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getWindow(string name) const;
+	bool isWindowPresent(string name) const;
+
+	bool isDeadPoolEmpty() const;
+	void cleanDeadPool();
+
+    void renameWindow(Window* window, string  new_name);
+    void renameWindow(string window, string new_name);
+
+    WindowIterator getIterator() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string& getDefaultResourceGroup();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/GroupBox.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/GroupBox.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/GroupBox.pkg	(revision 5707)
@@ -0,0 +1,7 @@
+/***********************************************************************
+	GroupBox
+***********************************************************************/
+class GroupBox : public Window
+{
+	bool drawAroundWidget(string name);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/MultiLineEditbox.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/MultiLineEditbox.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/MultiLineEditbox.pkg	(revision 5707)
@@ -0,0 +1,31 @@
+/***********************************************************************
+	MultiLineEditbox
+***********************************************************************/
+class MultiLineEditbox : public Window
+{
+	bool hasInputFocus() const;
+	bool isReadOnly() const;
+	unsigned long getCaratIndex() const;
+	unsigned long getSelectionStartIndex() const;
+	unsigned long getSelectionEndIndex() const;
+	unsigned long getSelectionLength() const;
+	unsigned long getMaxTextLength() const;
+	bool isWordWrapped() const;
+
+    Scrollbar* getVertScrollbar() const;
+    bool isVertScrollbarAlwaysShown() const;
+    Scrollbar* getHorzScrollbar() const;
+    Rect getTextRenderArea() const;
+    unsigned long getLineNumberFromIndex(unsigned long index) const;
+
+	void setReadOnly(bool setting);
+	void setCaratIndex(unsigned long carat_pos);
+	void setSelection(unsigned long start_pos, unsigned long end_pos);
+	void setMaxTextLength(unsigned long max_len);
+	void ensureCaratIsVisible();
+	void setWordWrapping(bool setting);
+    void setShowVertScrollbar(bool setting);
+
+    void setSelectionBrushImage(const Image* image);
+    const Image* getSelectionBrushImage() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/Tree.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/Tree.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/Tree.pkg	(revision 5707)
@@ -0,0 +1,33 @@
+/***********************************************************************
+	Tree
+***********************************************************************/
+class Tree : public Window
+{
+	size_t	getItemCount(void) const;
+	size_t	getSelectedCount(void) const;
+	
+	TreeItem*	getFirstSelectedItem(void) const;
+	TreeItem*	getLastSelectedItem(void) const;
+	
+	bool	isSortEnabled(void) const;
+	bool	isMultiselectEnabled(void) const;
+	bool	isItemTooltipsEnabled(void) const;
+	
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| TreeItem*	findFirstItemWithText(string text);
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| TreeItem*	findNextItemWithText(string text, const TreeItem* start_item);
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| TreeItem*	findFirstItemWithID(unsigned int searchID);
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| TreeItem*	findNextItemWithID(unsigned int searchID, const TreeItem* start_item);
+	
+	bool	isTreeItemInList(const TreeItem* item) const;
+	void	resetList(void);
+	void	addItem(TreeItem* item);
+	
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| void	insertItem(TreeItem* item, const TreeItem* position);
+	void	removeItem(const TreeItem* item);
+	void	clearAllSelections(void);
+	void	setSortingEnabled(bool setting);
+	void	setMultiselectEnabled(bool setting);
+	void	setItemSelectState(TreeItem* item, bool state);
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| void	setItemSelectState(size_t item_index, bool state);
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| void	ensureItemIsVisible(const TreeItem* item);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/TreeItem.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/TreeItem.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.0/package/elements/TreeItem.pkg	(revision 5707)
@@ -0,0 +1,33 @@
+/***********************************************************************
+	TreeItem
+***********************************************************************/
+class TreeItem
+{
+	ColourRect  getTextColours(void) const;
+	void  setTextColours(ColourRect& cols);
+	void  setTextColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
+	void  setTextColours(colour col);
+	string getText(void) const;
+	string getTooltipText(void) const;
+	unsigned int  getID(void) const;
+	void* getUserData(void) const;
+	bool  isSelected(void) const;
+	bool  isDisabled(void) const;
+	bool  isAutoDeleted(void) const;
+	Window*  getOwnerWindow(void);
+	ColourRect  getSelectionColours(void) const;
+	void  setText(string text);
+	void  setTooltipText(string text);
+	void  setUserData(void* item_data);
+	void  setSelected(bool setting);
+	void  setDisabled(bool setting);
+	void  setAutoDeleted(bool setting);
+	void  setSelectionColours(ColourRect& cols);
+	void  setSelectionColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
+	void  setSelectionColours(colour col);
+	bool  getIsOpen();
+	void toggleIsOpen();
+	size_t getItemCount();
+	void addItem(TreeItem* item);
+	void setIcon(Image& icon);		
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/CMakeLists.txt
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/CMakeLists.txt	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/CMakeLists.txt	(revision 5707)
@@ -0,0 +1,5 @@
+SET(_package_files
+  Window.pkg
+
+  PARENT_SCOPE
+)
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.cpp	(revision 5707)
@@ -0,0 +1,337 @@
+/***********************************************************************
+	filename: CEGUILua.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Implementation for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUIConfig.h"
+#include "CEGUIPropertyHelper.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <vector>
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// prototype for bindings initialisation function
+int tolua_CEGUI_open(lua_State* tolua_S);
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Constructor (creates Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule()
+{
+    #if LUA_VERSION_NUM >= 501
+        static const luaL_Reg lualibs[] = {
+            {"", luaopen_base},
+            {LUA_LOADLIBNAME, luaopen_package},
+            {LUA_TABLIBNAME, luaopen_table},
+            {LUA_IOLIBNAME, luaopen_io},
+            {LUA_OSLIBNAME, luaopen_os},
+            {LUA_STRLIBNAME, luaopen_string},
+            {LUA_MATHLIBNAME, luaopen_math},
+        #if defined(DEBUG) || defined (_DEBUG)
+                {LUA_DBLIBNAME, luaopen_debug},
+        #endif
+            {0, 0}
+        };
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    // create a lua state
+    d_ownsState = true;
+    d_state = lua_open();
+
+    // init all standard libraries
+    #if LUA_VERSION_NUM >= 501
+            const luaL_Reg *lib = lualibs;
+            for (; lib->func; lib++)
+            {
+                lua_pushcfunction(d_state, lib->func);
+                lua_pushstring(d_state, lib->name);
+                lua_call(d_state, 1, 0);
+            }
+    #else /* LUA_VERSION_NUM >= 501 */
+        luaopen_base(d_state);
+        luaopen_io(d_state);
+        luaopen_string(d_state);
+        luaopen_table(d_state);
+        luaopen_math(d_state);
+        #if defined(DEBUG) || defined (_DEBUG)
+            luaopen_debug(d_state);
+        #endif
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Constructor (uses given Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule(lua_State* state)
+{
+	// just use the given state
+	d_ownsState = false;
+	d_state = state;
+
+	setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Destructor
+*************************************************************************/
+LuaScriptModule::~LuaScriptModule()
+{
+	if ( d_ownsState && d_state )
+	{
+		lua_close( d_state );
+	}
+}
+
+
+/*************************************************************************
+	Execute script file
+*************************************************************************/
+void LuaScriptModule::executeScriptFile(const String& filename, const String& resourceGroup)
+{
+	// load file
+	RawDataContainer raw;
+	System::getSingleton().getResourceProvider()->loadRawDataContainer(filename,
+        raw, resourceGroup.empty() ? d_defaultResourceGroup : resourceGroup);
+
+	// load code into lua
+	int top = lua_gettop(d_state);
+	int loaderr = luaL_loadbuffer(d_state, (char*)raw.getDataPtr(), raw.getSize(), filename.c_str());
+	System::getSingleton().getResourceProvider()->unloadRawDataContainer( raw );
+	if (loaderr)
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+
+    // call it
+	if (lua_pcall(d_state,0,0,0))
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+
+	lua_settop(d_state,top); // just in case :P
+}
+
+
+/*************************************************************************
+	Execute global script function
+*************************************************************************/
+int	LuaScriptModule::executeScriptGlobal(const String& function_name)
+{
+    int top = lua_gettop(d_state);
+
+    // get the function from lua
+    lua_getglobal(d_state, function_name.c_str());
+
+    // is it a function
+    if (!lua_isfunction(d_state,-1))
+    {
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to get Lua global: '"+function_name+"' as name not represent a global Lua function" );
+    }
+
+    // call it
+    int error = lua_pcall(d_state,0,1,0);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_pop(d_state,1);
+        throw ScriptException("Unable to evaluate Lua global: '"+function_name+"\n\n"+errMsg+"\n");
+    }
+
+    // get return value
+    if (!lua_isnumber(d_state,-1))
+    {
+        // log that return value is invalid. return -1 and move on.
+        lua_settop(d_state,top);
+        ScriptException("Unable to get Lua global : '"+function_name+"' return value as it's not a number" );
+        return -1;
+    }
+
+    int ret = (int)lua_tonumber(d_state,-1);
+    lua_pop(d_state,1);
+
+    // return it
+    return ret;
+}
+
+
+/*************************************************************************
+	Execute scripted event handler
+*************************************************************************/
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name, const EventArgs& e)
+{
+
+	LuaFunctor::pushNamedFunction(d_state, handler_name);
+
+	ScriptWindowHelper* helper = 0;
+	//If this is an event that was triggered by a window then make a "this" pointer to the window for the script.
+	if(e.d_hasWindow)
+	{
+		WindowEventArgs& we = (WindowEventArgs&)e;
+		helper = new ScriptWindowHelper(we.window);
+		lua_pushlightuserdata(d_state,(void*)helper);
+		lua_setglobal(d_state,"this");
+	} // if(e.d_hasWindow)
+
+    // push EventArgs as the first parameter
+    tolua_pushusertype(d_state,(void*)&e,"const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(d_state,1,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(d_state,-1));
+        lua_pop(d_state,1);
+		//cleanup the helper object if any
+		if(helper)
+		{
+			delete helper;
+			helper = 0;
+		}
+        throw ScriptException("Unable to evaluate the Lua event handler: '"+handler_name+"'\n\n"+errStr+"\n");
+    } // if (error)
+
+	if(helper)
+	{
+		delete helper;
+		helper = 0;
+	}
+
+    return true;
+}
+
+
+/*************************************************************************
+	Execute script code string
+*************************************************************************/
+void LuaScriptModule::executeString(const String& str)
+{
+    int top = lua_gettop(d_state);
+
+    // load code into lua and call it
+    int error =	luaL_loadbuffer(d_state, str.c_str(), str.length(), str.c_str()) || lua_pcall(d_state,0,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script string: '"+str+"'\n\n"+errMsg+"\n");
+    }
+}
+
+
+/*************************************************************************
+	Create Lua bindings
+*************************************************************************/
+void LuaScriptModule::createBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Creating Lua bindings ----" );
+	// init CEGUI module
+	tolua_CEGUI_open(d_state);
+}
+
+
+/*************************************************************************
+	Destroy Lua bindings
+*************************************************************************/
+void LuaScriptModule::destroyBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Destroying Lua bindings ----" );
+	// is this ok ?
+	lua_pushnil(d_state);
+	lua_setglobal(d_state,"CEGUI");
+}
+
+
+/*************************************************************************
+	Set the ID string for the module
+*************************************************************************/
+void LuaScriptModule::setModuleIdentifierString()
+{
+    // set ID string
+    d_identifierString = "CEGUI::LuaScriptModule - Official Lua based scripting module for CEGUI";
+	d_language = "Lua";
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, Event::Subscriber(functor));
+    // make sure we don't release the reference we just made when this call returns
+    functor.index = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, Event::Group group, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // return the event connection
+    return con;
+}
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.h	(revision 5707)
@@ -0,0 +1,253 @@
+/***********************************************************************
+	filename: CEGUILua.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Defines interface for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILua_h_
+#define _CEGUILua_h_
+
+
+/*************************************************************************
+	Import / Export control macros
+*************************************************************************/
+#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
+#   ifdef CEGUILUA_EXPORTS
+#       define CEGUILUA_API __declspec(dllexport)
+#   else
+#       if defined( __MINGW32__ )
+#           define CEGUILUA_API
+#       else
+#           define CEGUILUA_API __declspec(dllimport)
+#       endif
+#   endif
+#else
+#   define CEGUILUA_API
+#endif
+
+
+#include "CEGUIScriptModule.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Interface for the LuaScriptModule class
+*/
+class CEGUILUA_API LuaScriptModule : public CEGUI::ScriptModule
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which create a lua_State
+	*/
+	LuaScriptModule();
+
+
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which takes a lua_State
+
+	\param state
+		Pointer to the lua_State that the script module should attach to.
+	*/
+	LuaScriptModule(lua_State* state);
+
+
+	/*!
+	\brief
+		Destructor for LuaScriptModule class.
+	*/
+	~LuaScriptModule();
+
+
+	/*************************************************************************
+		Script Execution Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Execute a script file.
+
+	\param filename
+		String object holding the filename of the script file that is to be executed
+		
+	\param resourceGroup
+		Resource group idendifier to be passed to the ResourceProvider when loading the script file.
+	*/
+	void executeScriptFile(const String& filename, const String& resourceGroup);
+
+
+	/*!
+	\brief
+		Execute a scripted global function.  The function should not take any parameters and should return an integer.
+
+	\param function_name
+		String object holding the name of the function, in the global script environment, that
+		is to be executed.
+
+	\return
+		The integer value returned from the script function.
+	*/
+	int executeScriptGlobal(const String& function_name);
+
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing a function field.
+        For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means, to the scripted function.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name, const EventArgs& e);
+
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str);
+
+    /*************************************************************************
+        Event subscription
+    *************************************************************************/
+    /*!
+    \brief
+            Subscribes the named Event to a scripted funtion
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, const String& subscriber_name);
+
+    /*!
+    \brief
+            Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param group
+            Group which is to be subscribed to.  Subscription groups are called in ascending order.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, Event::Group group, const String& subscriber_name);
+
+    /*************************************************************************
+        Bindings creation / destruction
+    *************************************************************************/
+    /*!
+    \brief
+        Method called during system initialisation, prior to running any scripts via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to complete initialisation or binding of the script language to the gui system objects.
+
+    \return
+        Nothing.
+    */
+    void createBindings(void);
+
+
+    /*!
+    \brief
+        Method called during system destruction, after all scripts have been run via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to cleanup bindings of the script language to the gui system objects, as set-up in the
+        earlier createBindings call.
+
+    \return
+        Nothing.
+    */
+    void destroyBindings(void);
+
+    /*************************************************************************
+        Accessor type functions
+    *************************************************************************/
+    /*!
+    \brief
+        Method used to get a pointer to the lua_State that the script module is attached to.
+
+    \return
+        A pointer to the lua_State that the script module is attached to.
+    */
+    lua_State* getLuaState(void) const {return d_state;}
+
+private:
+    /*************************************************************************
+        Implementation Functions
+    *************************************************************************/
+    void setModuleIdentifierString();
+
+    /*************************************************************************
+        Implementation Data
+    *************************************************************************/
+    bool d_ownsState;      //!< true when the attached lua_State was created by this script module
+    lua_State* d_state;    //!< The lua_State that this script module uses.
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILua_h_
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp	(revision 5707)
@@ -0,0 +1,280 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.cpp
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Implementation for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUILuaFunctor.h"
+#include "CEGUILogger.h"
+#include "CEGUIExceptions.h"
+#include "CEGUIPropertyHelper.h"
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, int func, int selfIndex) :
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, int selfIndex) :
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(const LuaFunctor& cp) :
+    L(cp.L),
+    index(cp.index),
+    self(cp.self),
+    needs_lookup(cp.needs_lookup),
+    function_name(cp.function_name)
+{
+}
+
+/*************************************************************************
+    Destructor
+*************************************************************************/
+LuaFunctor::~LuaFunctor()
+{
+    if (self!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, self);
+    }
+    if (index!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, index);
+    }
+}
+
+/*************************************************************************
+    Call operator
+*************************************************************************/
+bool LuaFunctor::operator()(const EventArgs& args) const
+{
+    // is this a late binding?
+    if (needs_lookup)
+    {
+        pushNamedFunction(L, function_name);
+        // reference function
+        index = luaL_ref(L, LUA_REGISTRYINDEX);
+        needs_lookup = false;
+        CEGUI_LOGINSANE("Late binding of callback '"+function_name+"' performed");
+        function_name.clear();
+    } // if (needs_lookup)
+
+	ScriptWindowHelper* helper = 0;
+	//Set a global for this window
+	if(args.d_hasWindow)
+	{
+		WindowEventArgs& we = (WindowEventArgs&)args;
+		helper = new ScriptWindowHelper(we.window);
+		tolua_pushusertype(L,(void*)helper,"CEGUI::ScriptWindowHelper");
+		lua_setglobal(L,"this");
+	}
+
+    // retrieve function
+    lua_rawgeti(L, LUA_REGISTRYINDEX, index);
+
+    // possibly self as well?
+    int nargs = 1;
+    if (self != LUA_NOREF)
+    {
+        lua_rawgeti(L, LUA_REGISTRYINDEX, self);
+        ++nargs;
+    }
+
+    // push EventArgs  parameter
+    tolua_pushusertype(L, (void*)&args, "const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(L, nargs, 0, 0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(L, -1));
+        lua_pop(L, 1);
+		if(helper)
+		{
+			delete helper;
+			helper = 0;
+		}
+        throw ScriptException("Unable to call Lua event handler:\n\n"+errStr+"\n");
+    } // if (error)
+
+	if(helper)
+	{
+		delete helper;
+		helper = 0;
+	}
+
+    return true;
+}
+
+/*************************************************************************
+    do event subscription by reference instead of by name
+*************************************************************************/
+Event::Connection LuaFunctor::SubscribeEvent(EventSet* self, const String& event_name, int funcIndex, int selfIndex, lua_State* L)
+{
+    // should we pass a self to the callback?
+    int thisIndex = LUA_NOREF;
+    if (selfIndex != LUA_NOREF)
+    {
+        // reference self
+        thisIndex = luaL_ref(L, LUA_REGISTRYINDEX);
+    }
+
+    // do the real subscription
+    int type = lua_type(L,-1);
+    Event::Connection con;
+    if (type == LUA_TFUNCTION)
+    {
+        // reference function
+        int index = luaL_ref(L, LUA_REGISTRYINDEX);
+        LuaFunctor functor(L,index,thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference(s) we just made when this call returns
+        functor.index = LUA_NOREF;
+        functor.self = LUA_NOREF;
+    }
+    else if (type == LUA_TSTRING)
+    {
+        const char* str = lua_tostring(L, -1);
+        LuaFunctor functor(L,String(str),thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference we just (maybe) made when this call returns
+        functor.self = LUA_NOREF;
+    }
+    else
+    {
+        luaL_error(L,"bad function passed to subscribe function. must be a real function, or a string for late binding");
+    }
+
+    // return the event connection
+    return con;
+}
+
+/*************************************************************************
+    Pushes a named function on the stack
+*************************************************************************/
+void LuaFunctor::pushNamedFunction(lua_State* L, const String& handler_name)
+{
+    int top = lua_gettop(L);
+
+    // do we have any dots in the handler name? if so we grab the function as a table field
+    String::size_type i = handler_name.find_first_of((utf32)'.');
+    if (i!=String::npos)
+    {
+        // split the rest of the string up in parts seperated by '.'
+        // TODO: count the dots and size the vector accordingly from the beginning.
+        std::vector<String> parts;
+        String::size_type start = 0;
+        do
+        {
+            parts.push_back(handler_name.substr(start,i-start));
+            start = i+1;
+            i = handler_name.find_first_of((utf32)'.',start);
+        } while(i!=String::npos);
+
+        // add last part
+        parts.push_back(handler_name.substr(start));
+
+        // first part is the global
+        lua_getglobal(L, parts[0].c_str());
+        if (!lua_istable(L,-1))
+        {
+            lua_settop(L,top);
+            throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as first part is not a table");
+        }
+
+        // if there is more than two parts, we have more tables to go through
+        std::vector<String>::size_type visz = parts.size();
+        if (visz-- > 2) // avoid subtracting one later on
+        {
+            // go through all the remaining parts to (hopefully) have a valid Lua function in the end
+            std::vector<String>::size_type vi = 1;
+            while (vi<visz)
+            {
+                // push key, and get the next table
+                lua_pushstring(L,parts[vi].c_str());
+                lua_gettable(L,-2);
+                if (!lua_istable(L,-1))
+                {
+                    lua_settop(L,top);
+                    throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as part #"+PropertyHelper::uintToString(uint(vi+1))+" ("+parts[vi]+") is not a table");
+                }
+                // get rid of the last table and move on
+                lua_remove(L,-2);
+                vi++;
+            }
+        }
+
+        // now we are ready to get the function to call ... phew :)
+        lua_pushstring(L,parts[visz].c_str());
+        lua_gettable(L,-2);
+        lua_remove(L,-2); // get rid of the table
+    }
+    // just a regular global function
+    else
+    {
+        lua_getglobal(L, handler_name.c_str());
+    }
+
+    // is it a function
+    if (!lua_isfunction(L,-1))
+    {
+        lua_settop(L,top);
+        throw ScriptException("The Lua event handler: '"+handler_name+"' does not represent a Lua function");
+    }
+}
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.h	(revision 5707)
@@ -0,0 +1,86 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.h
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Defines interface for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILuaFunctor_h_
+#define _CEGUILuaFunctor_h_
+
+#include "CEGUIEventSet.h"
+#include "CEGUIScriptWindowHelper.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// forward declaration
+class LuaScriptModule;
+
+/*!
+\brief
+    Functor class used for subscribing Lua functions to CEGUI events
+*/
+class LuaFunctor
+{
+public:
+    LuaFunctor(lua_State* state, int func, int selfIndex);
+    LuaFunctor(lua_State* state, const String& func, int selfIndex);
+    LuaFunctor(const LuaFunctor& cp);
+    ~LuaFunctor();
+
+    bool operator()(const EventArgs& args) const;
+
+    /*!
+    \brief
+        function used to subscribe any Lua function as event handler.
+        References using the Lua registry.
+        To be called from Lua only.
+    */
+    static Event::Connection SubscribeEvent(EventSet* self, const String& eventName, int funcIndex, int selfIndex, lua_State* L);
+
+    /*!
+    \brief
+        Pushes the Lua function named \param name on top of the Lua stack.
+        The name may contain '.' (dots) character for (nested) table values.
+    */
+    static void pushNamedFunction(lua_State* L, const String& name);
+
+private:
+    lua_State* L;
+    mutable int index;
+    int self;
+    mutable bool needs_lookup;
+    mutable String function_name;
+
+    friend class LuaScriptModule;
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILuaFunctor_h_
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/changes_orxonox.diff
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/changes_orxonox.diff	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/changes_orxonox.diff	(revision 5707)
@@ -0,0 +1,92 @@
+--- CEGUILua.h	Mi Jul  9 18:24:49 2008
++++ CEGUILua.h	Do Jan 29 10:18:14 2009
+@@ -38,7 +38,11 @@
+ #   ifdef CEGUILUA_EXPORTS
+ #       define CEGUILUA_API __declspec(dllexport)
+ #   else
+-#       define CEGUILUA_API __declspec(dllimport)
++#       if defined( __MINGW32__ )
++#           define CEGUILUA_API
++#       else
++#           define CEGUILUA_API __declspec(dllimport)
++#       endif
+ #   endif
+ #else
+ #   define CEGUILUA_API
+--- CEGUILuaFunctor.cpp	Mi Jul  9 18:25:01 2008
++++ CEGUILuaFunctor.cpp	Do Jan 29 10:26:27 2009
+@@ -39,7 +39,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // Start of CEGUI namespace section
+ namespace CEGUI
+--- CEGUILua.cpp	Mi Jul  9 18:25:01 2008
++++ CEGUILua.cpp	Do Jan 29 10:24:53 2009
+@@ -27,10 +27,6 @@
+  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+  *   OTHER DEALINGS IN THE SOFTWARE.
+  ***************************************************************************/
+-#ifdef HAVE_CONFIG_H
+-#   include "config.h"
+-#endif
+-
+ #include "CEGUI.h"
+ #include "CEGUIConfig.h"
+ #include "CEGUIPropertyHelper.h"
+@@ -45,7 +41,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // prototype for bindings initialisation function
+ int tolua_CEGUI_open(lua_State* tolua_S);
+@@ -60,7 +56,7 @@
+ *************************************************************************/
+ LuaScriptModule::LuaScriptModule()
+ {
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+         static const luaL_Reg lualibs[] = {
+             {"", luaopen_base},
+             {LUA_LOADLIBNAME, luaopen_package},
+@@ -74,14 +70,14 @@
+         #endif
+             {0, 0}
+         };
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     // create a lua state
+     d_ownsState = true;
+     d_state = lua_open();
+ 
+     // init all standard libraries
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+             const luaL_Reg *lib = lualibs;
+             for (; lib->func; lib++)
+             {
+@@ -89,7 +85,7 @@
+                 lua_pushstring(d_state, lib->name);
+                 lua_call(d_state, 1, 0);
+             }
+-    #else /* CEGUI_LUA_VER >= 51 */
++    #else /* LUA_VERSION_NUM >= 501 */
+         luaopen_base(d_state);
+         luaopen_io(d_state);
+         luaopen_string(d_state);
+@@ -98,7 +94,7 @@
+         #if defined(DEBUG) || defined (_DEBUG)
+             luaopen_debug(d_state);
+         #endif
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     setModuleIdentifierString();
+ }
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/required.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/required.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/required.cpp	(revision 5707)
@@ -0,0 +1,88 @@
+/***********************************************************************
+	filename: required.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Implementation of helper functions
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "required.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+
+// returns horizontal range as two values for lua
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getHorzRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+// returns vertical range as two values for lua
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getVertRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+
+// allocates and returns a new ListboxTextItem
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete)
+{
+	return new ListboxTextItem(text,item_id,item_data,disabled,auto_delete);
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+void ceguiLua_FileStream_open(FileStream* os, const char* filename)
+{
+    os->open(filename, std::ios::binary);
+}
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k)
+{
+    return (k & sys->getSystemKeys()) != 0;
+}
+
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/required.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/required.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/ceguilua/required.h	(revision 5707)
@@ -0,0 +1,113 @@
+/***********************************************************************
+	filename: required.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Header that includes the necessary stuff needed for the Lua bindings
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <fstream>
+
+#define __operator_increment    operator++
+#define __operator_decrement    operator--
+#define __operator_dereference  operator*
+
+#define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent
+
+//This is used to keep compilers happy
+#define CEGUIDeadException(e) &
+
+#if defined(_MSC_VER) && !defined(snprintf)
+#   define snprintf   _snprintf
+#endif
+
+typedef CEGUI::String string;
+
+namespace CEGUI
+{
+
+typedef Event::Connection EventConnection;
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max);
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max);
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete);
+
+
+/************************************************************************
+    Stuff needed to make the iterators work
+*************************************************************************/
+typedef PropertySet::Iterator PropertyIterator;
+typedef EventSet::Iterator EventIterator;
+typedef WindowManager::WindowIterator WindowIterator;
+typedef WindowFactoryManager::WindowFactoryIterator WindowFactoryIterator;
+typedef WindowFactoryManager::FalagardMappingIterator FalagardMappingIterator;
+typedef WindowFactoryManager::FalagardWindowMapping FalagardWindowMapping;
+typedef ImagesetManager::ImagesetIterator ImagesetIterator;
+typedef Imageset::ImageIterator ImageIterator;
+typedef SchemeManager::SchemeIterator SchemeIterator;
+typedef FontManager::FontIterator FontIterator;
+
+template <typename T>
+inline PropertyIterator ceguiLua_getPropertyIterator(const T* self)
+{
+    return static_cast<const PropertySet*>(self)->getIterator();
+}
+
+template <typename T>
+inline EventIterator ceguiLua_getEventIterator(const T* self)
+{
+    return static_cast<const EventSet*>(self)->getIterator();
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+typedef std::ofstream FileStream;
+void ceguiLua_FileStream_open(FileStream*, const char* filename);
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k);
+
+}
+
+// the binding file generates alot of
+// warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
+#if defined(_MSC_VER)
+#   pragma warning(disable : 4800)
+#endif
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/package/Window.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/package/Window.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.1/package/Window.pkg	(revision 5707)
@@ -0,0 +1,249 @@
+/****************************************
+	Vertical alignment modes
+*****************************************/
+enum VerticalAlignment
+{
+	VA_TOP,
+	VA_CENTRE,
+	VA_BOTTOM
+};
+
+
+/****************************************
+	Horizontal alignment modes
+*****************************************/
+enum HorizontalAlignment
+{
+	HA_LEFT,
+	HA_CENTRE,
+	HA_RIGHT
+};
+
+
+/****************************************
+	Window
+*****************************************/
+class Window //: public EventSet
+{
+	string getType() const;
+	string getName() const;
+
+	bool isDestroyedByParent() const;
+	bool isAlwaysOnTop() const;
+	bool isDisabled(bool localOnly=false) const;
+	bool isVisible(bool localOnly=false) const;
+	bool isActive() const;
+	bool isClippedByParent() const;
+
+	void setDestroyedByParent(bool setting);
+	void setAlwaysOnTop(bool setting);
+	void setEnabled(bool setting);
+	void enable();
+	void disable();
+	void setVisible(bool setting);
+	void show();
+	void hide();
+	void activate();
+	void deactivate();
+
+	void setClippedByParent(bool setting);
+
+	unsigned int getID() const;
+	void setID(unsigned int ID);
+
+	unsigned int getChildCount() const;
+
+	bool isChild(unsigned int ID) const;
+	bool isChild(string name) const;
+	bool isChild(const Window* window) const;
+	bool isChildRecursive(unsigned int ID) const;
+
+	void addChildWindow(string name);
+	void addChildWindow(Window* window);
+
+	void removeChildWindow(unsigned int ID);
+	void removeChildWindow(string name);
+	void removeChildWindow(Window* window);
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(unsigned int ID) const;
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(string name) const;
+	Window* getChildAtIdx(unsigned int ID) const;
+	Window* getActiveChild() const;
+	Window* getChildAtPosition(const Vector2& pos) const;
+    Window* getTargetChildAtPosition(const Vector2& pos) const;
+    Window* getChildRecursive(unsigned int ID) const;
+
+	Window* getParent() const;
+
+	bool isAncestor(unsigned int ID) const;
+	bool isAncestor(string name) const;
+	bool isAncestor(const Window* window) const;
+
+	void setFont(string name);
+	void setFont(Font* font);
+	Font* getFont() const;
+
+	void setText(string text);
+    void insertText(string text, unsigned long position);
+    void appendText(string text);
+	string getText() const;
+
+	bool inheritsAlpha() const;
+	float getAlpha() const;
+	float getEffectiveAlpha() const;
+	void setAlpha(float a);
+	void setInheritsAlpha(bool setting);
+
+	void requestRedraw() const;
+
+	bool isZOrderingEnabled() const;
+	void setZOrderingEnabled(bool setting);
+
+	Rect getPixelRect() const;
+	Rect getInnerRect() const;
+	Rect getUnclippedPixelRect() const;
+	Rect getUnclippedInnerRect() const;
+
+    Size getParentPixelSize(void) const;
+    float getParentPixelWidth(void) const;
+    float getParentPixelHeight(void) const;
+
+	static Window* getCaptureWindow();
+	void setRestoreCapture(bool setting);
+	bool restoresOldCapture() const;
+
+	bool distributesCapturedInputs() const;
+	void setDistributesCapturedInputs(bool setting);
+
+	bool captureInput();
+	void releaseInput();
+
+	bool isCapturedByThis() const;
+	bool isCapturedByAncestor() const;
+	bool isCapturedByChild() const;
+
+	bool isHit(const Vector2& pos) const;
+
+	bool isRiseOnClickEnabled() const;
+	void setRiseOnClickEnabled(bool setting);
+
+	const Image* getMouseCursor() const;
+	void setMouseCursor(MouseCursorImage cursor);
+	void setMouseCursor(const Image* image);
+	void setMouseCursor(string imageset, string image);
+
+	void moveToFront();
+	void moveToBack();
+
+	bool wantsMultiClickEvents() const;
+	bool isMouseAutoRepeatEnabled() const;
+	float getAutoRepeatDelay() const;
+	float getAutoRepeatRate() const;
+	void setWantsMultiClickEvents(bool setting);
+	void setMouseAutoRepeatEnabled(bool setting);
+	void setAutoRepeatDelay(float delay);
+	void setAutoRepeatRate(float rate);
+
+	//void destroy();
+
+	bool isUsingDefaultTooltip() const;
+	Tooltip* getTooltip() const;
+	string getTooltipType() const;
+	string getTooltipText() const;
+	bool inheritsTooltipText() const;
+
+	void setTooltip(Tooltip* tooltip);
+	void setTooltipType(string tooltipType);
+	void setTooltipText(string tip);
+	void setInheritsTooltipText(bool setting);
+
+	bool testClassName(string class_name) const;
+
+	void notifyDragDropItemEnters(DragContainer* item);
+	void notifyDragDropItemLeaves(DragContainer* item);
+	void notifyDragDropItemDropped(DragContainer* item);
+
+	VerticalAlignment getVerticalAlignment() const;
+	HorizontalAlignment getHorizontalAlignment() const;
+
+    // these actually have a const, but tolua++ chokes on that
+    void setVerticalAlignment(VerticalAlignment alignment);
+    void setHorizontalAlignment(HorizontalAlignment alignment);
+
+	string getLookNFeel() const;
+    tolua_throws|CEGUI::Exception,error| void setLookNFeel(string lnf);
+
+    tolua_throws|CEGUI::Exception,error| void setWindowRenderer(string name);
+    string getWindowRendererName() const;
+
+	//RenderCache& getRenderCache()
+
+	bool getModalState() const;
+	void setModalState(bool state);
+
+    tolua_throws|CEGUI::UnknownObjectException,nil| string getUserString(string name) const;
+    bool isUserStringDefined(string name) const;
+    void setUserString(string name, string value);
+
+    void beginInitialisation();
+    void endInitialisation();
+
+	// unified stuff
+	void setArea(const UDim& xpos, const UDim& ypos, const UDim& width, const UDim& height);
+	void setArea(const UVector2& pos, const UVector2& size);
+	void setArea(const URect& area);
+	void setPosition(const UVector2& pos);
+	void setXPosition(const UDim& x);
+	void setYPosition(const UDim& y);
+	void setSize(const UVector2& size);
+	void setWidth(const UDim& width);
+	void setHeight(const UDim& height);
+	void setMaxSize(const UVector2& size);
+	void setMinSize(const UVector2& size);
+
+	const URect& getArea() const;
+	const UVector2& getPosition() const;
+	const UDim& getXPosition() const;
+	const UDim& getYPosition() const;
+	UVector2 getSize() const;
+	UDim getWidth() const;
+	UDim getHeight() const;
+	const UVector2& getMaxSize() const;
+	const UVector2& getMinSize() const;
+
+    // event pass through
+    bool isMousePassThroughEnabled() const;
+    void setMousePassThroughEnabled(bool setting);
+    
+    tolua_throws|CEGUI::Exception,error| void rename(string new_name);
+
+	//////////////////////////////////////////////
+	// PropertySet
+	void setProperty(string name, string value);
+	string getProperty(string name) const;
+	string getPropertyDefault(string name) const;
+	string getPropertyHelp(string name) const;
+
+	bool isPropertyPresent(string name) const;
+	bool isPropertyDefault(string name) const;
+
+    tolua_outside PropertyIterator ceguiLua_getPropertyIterator @ getPropertyIterator() const;
+
+	//////////////////////////////////////////////
+	// EventSet
+	void addEvent(string name);
+	void removeEvent(string name);
+	void removeAllEvents();
+	bool isEventPresent(string name);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| tolua_outside EventConnection LuaFunctorSubscribeEvent @ subscribeEvent(string name, lua_Object funcIndex, lua_Object selfIndex=LUA_NOREF, lua_State*);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| EventConnection subscribeScriptedEvent @ subscribeEvent(string name, string callback_name);
+	
+	void fireEvent(string name, EventArgs& args, string eventnamespace="");
+
+	bool isMuted() const;
+	void setMutedState(bool setting);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/CMakeLists.txt
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/CMakeLists.txt	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/CMakeLists.txt	(revision 5707)
@@ -0,0 +1,9 @@
+SET(_package_files
+  EventSet.pkg
+  HelperFunctions.pkg
+  InputEvent.pkg
+  Window.pkg
+  WindowManager.pkg
+
+  PARENT_SCOPE
+)
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.cpp	(revision 5707)
@@ -0,0 +1,709 @@
+/***********************************************************************
+	filename: CEGUILua.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Implementation for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUIConfig.h"
+#include "CEGUIPropertyHelper.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <vector>
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// prototype for bindings initialisation function
+int tolua_CEGUI_open(lua_State* tolua_S);
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Constructor (creates Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule() :
+    d_errFuncIndex(LUA_NOREF)
+{
+    #if LUA_VERSION_NUM >= 501
+        static const luaL_Reg lualibs[] = {
+            {"", luaopen_base},
+            {LUA_LOADLIBNAME, luaopen_package},
+            {LUA_TABLIBNAME, luaopen_table},
+            {LUA_IOLIBNAME, luaopen_io},
+            {LUA_OSLIBNAME, luaopen_os},
+            {LUA_STRLIBNAME, luaopen_string},
+            {LUA_MATHLIBNAME, luaopen_math},
+        #if defined(DEBUG) || defined (_DEBUG)
+                {LUA_DBLIBNAME, luaopen_debug},
+        #endif
+            {0, 0}
+        };
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    // create a lua state
+    d_ownsState = true;
+    d_state = lua_open();
+
+    // init all standard libraries
+    #if LUA_VERSION_NUM >= 501
+            const luaL_Reg *lib = lualibs;
+            for (; lib->func; lib++)
+            {
+                lua_pushcfunction(d_state, lib->func);
+                lua_pushstring(d_state, lib->name);
+                lua_call(d_state, 1, 0);
+            }
+    #else /* LUA_VERSION_NUM >= 501 */
+        luaopen_base(d_state);
+        luaopen_io(d_state);
+        luaopen_string(d_state);
+        luaopen_table(d_state);
+        luaopen_math(d_state);
+        #if defined(DEBUG) || defined (_DEBUG)
+            luaopen_debug(d_state);
+        #endif
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Constructor (uses given Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule(lua_State* state)
+{
+	// just use the given state
+	d_ownsState = false;
+	d_state = state;
+
+	setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Destructor
+*************************************************************************/
+LuaScriptModule::~LuaScriptModule()
+{
+    if (d_state)
+    {
+        unrefErrorFunc();
+
+        if (d_ownsState)
+            lua_close( d_state );
+    }
+}
+
+
+/*************************************************************************
+	Execute script file
+*************************************************************************/
+void LuaScriptModule::executeScriptFile(const String& filename,
+    const String& resourceGroup)
+{
+    int top = lua_gettop(d_state);
+
+    executeScriptFile_impl(filename, resourceGroup,
+                           initErrorHandlerFunc(),
+                           top);
+
+    cleanupErrorHandlerFunc();
+}
+
+
+/*************************************************************************
+	Execute global script function
+*************************************************************************/
+int	LuaScriptModule::executeScriptGlobal(const String& function_name)
+{
+    int top = lua_gettop(d_state);
+    int r = executeScriptGlobal_impl(function_name, initErrorHandlerFunc(), top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+
+/*************************************************************************
+	Execute scripted event handler
+*************************************************************************/
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name,
+    const EventArgs& e)
+{
+    int top = lua_gettop(d_state);
+    bool r = executeScriptedEventHandler_impl(handler_name, e,
+                                              initErrorHandlerFunc(), top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+
+/*************************************************************************
+	Execute script code string
+*************************************************************************/
+void LuaScriptModule::executeString(const String& str)
+{
+    int top = lua_gettop(d_state);
+
+    executeString_impl(str, initErrorHandlerFunc(), top);
+    cleanupErrorHandlerFunc();
+}
+
+
+/*************************************************************************
+	Create Lua bindings
+*************************************************************************/
+void LuaScriptModule::createBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Creating Lua bindings ----" );
+	// init CEGUI module
+	tolua_CEGUI_open(d_state);
+}
+
+
+/*************************************************************************
+	Destroy Lua bindings
+*************************************************************************/
+void LuaScriptModule::destroyBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Destroying Lua bindings ----" );
+	// is this ok ?
+	lua_pushnil(d_state);
+	lua_setglobal(d_state,"CEGUI");
+}
+
+
+/*************************************************************************
+	Set the ID string for the module
+*************************************************************************/
+void LuaScriptModule::setModuleIdentifierString()
+{
+    // set ID string
+    d_identifierString = "CEGUI::LuaScriptModule - Official Lua based scripting module for CEGUI";
+	d_language = "Lua";
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, const String& subscriber_name)
+{
+    const String& err_str = getActivePCallErrorHandlerString();
+    const int err_ref     = getActivePCallErrorHandlerReference();
+
+    // do the real subscription
+    LuaFunctor functor((err_ref == LUA_NOREF) ?
+                LuaFunctor(d_state, subscriber_name, LUA_NOREF, err_str) :
+                LuaFunctor(d_state, subscriber_name, LUA_NOREF, err_ref));
+    Event::Connection con =
+        target->subscribeEvent(event_name, Event::Subscriber(functor));
+
+    // make sure we don't release the reference we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, Event::Group group, const String& subscriber_name)
+{
+    const String& err_str = getActivePCallErrorHandlerString();
+    const int err_ref     = getActivePCallErrorHandlerReference();
+
+    // do the real subscription
+    LuaFunctor functor((err_ref == LUA_NOREF) ?
+                LuaFunctor(d_state, subscriber_name, LUA_NOREF, err_str) :
+                LuaFunctor(d_state, subscriber_name, LUA_NOREF, err_ref));
+    Event::Connection con =
+        target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // make sure we don't release the reference we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::setDefaultPCallErrorHandler(
+    const String& error_handler_function)
+{
+    unrefErrorFunc();
+
+    d_errFuncName = error_handler_function;
+    d_errFuncIndex = LUA_NOREF;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::setDefaultPCallErrorHandler(int function_reference)
+{
+    unrefErrorFunc();
+
+    d_errFuncIndex = function_reference;
+    d_errFuncName.clear();
+}
+
+//----------------------------------------------------------------------------//
+const String& LuaScriptModule::getActivePCallErrorHandlerString() const
+{
+    if ((d_activeErrFuncIndex == LUA_NOREF) && d_activeErrFuncName.empty())
+        return d_errFuncName;
+    else
+        return d_activeErrFuncName;
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::getActivePCallErrorHandlerReference() const
+{
+    if ((d_activeErrFuncIndex == LUA_NOREF) && d_activeErrFuncName.empty())
+        return d_errFuncIndex;
+    else
+        return d_activeErrFuncIndex;
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::initErrorHandlerFunc()
+{
+    d_activeErrFuncName = d_errFuncName;
+
+    // should we create a registry reference for named function
+    if ((d_errFuncIndex == LUA_NOREF) && !d_errFuncName.empty())
+    {
+        int top = lua_gettop(d_state);
+
+        LuaFunctor::pushNamedFunction(d_state, d_errFuncName);
+        // reference function
+        d_errFuncIndex = luaL_ref(d_state, LUA_REGISTRYINDEX);
+
+        lua_settop(d_state, top);
+    }
+
+    // init handler via function index in registry
+    return initErrorHandlerFunc(d_errFuncIndex);
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::initErrorHandlerFunc(const String func_name)
+{
+    d_activeErrFuncName = func_name;
+
+    // string has some text in it?
+    if (!func_name.empty())
+    {
+        LuaFunctor::pushNamedFunction(d_state, func_name);
+        return lua_gettop(d_state);
+    }
+
+    // use no error handler function.
+    return 0;
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::initErrorHandlerFunc(int func)
+{
+    d_activeErrFuncIndex = func;
+
+    // check if we have a valid registry index for the error handler function
+    if (func != LUA_NOREF)
+    {
+        lua_rawgeti(d_state, LUA_REGISTRYINDEX, func);
+        return lua_gettop(d_state);
+    }
+
+    // use no error handler function.
+    return 0;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::cleanupErrorHandlerFunc()
+{
+    d_activeErrFuncIndex = LUA_NOREF;
+    d_activeErrFuncName.clear();
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::unrefErrorFunc()
+{
+    if ((d_errFuncIndex != LUA_NOREF) && !d_errFuncName.empty())
+    {
+        luaL_unref(d_state, LUA_REGISTRYINDEX, d_errFuncIndex);
+        d_errFuncIndex = LUA_NOREF;
+    }
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeScriptFile(const String& filename,
+    const String& resourceGroup, const String& error_handler)
+{
+    int top = lua_gettop(d_state);
+
+    executeScriptFile_impl(filename, resourceGroup,
+                           initErrorHandlerFunc(error_handler),
+                           top);
+    cleanupErrorHandlerFunc();
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeScriptFile(const String& filename,
+    const String& resourceGroup, const int error_handler)
+{
+    int top = lua_gettop(d_state);
+
+    executeScriptFile_impl(filename, resourceGroup,
+                           initErrorHandlerFunc(error_handler),
+                           top);
+    cleanupErrorHandlerFunc();
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::executeScriptGlobal(const String& function_name,
+    const String& error_handler)
+{
+    int top = lua_gettop(d_state);
+    int r = executeScriptGlobal_impl(function_name,
+                                     initErrorHandlerFunc(error_handler),
+                                     top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::executeScriptGlobal(const String& function_name,
+    const int error_handler)
+{
+    int top = lua_gettop(d_state);
+    int r = executeScriptGlobal_impl(function_name,
+                                     initErrorHandlerFunc(error_handler),
+                                     top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+//----------------------------------------------------------------------------//
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name,
+    const EventArgs& e, const String& error_handler)
+{
+    int top = lua_gettop(d_state);
+
+    bool r =executeScriptedEventHandler_impl(handler_name, e,
+                                             initErrorHandlerFunc(error_handler),
+                                             top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+//----------------------------------------------------------------------------//
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name,
+    const EventArgs& e, const int error_handler)
+{
+    int top = lua_gettop(d_state);
+    bool r = executeScriptedEventHandler_impl(handler_name, e,
+                                              initErrorHandlerFunc(error_handler),
+                                              top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeString(const String& str,
+    const String& error_handler)
+{
+    int top = lua_gettop(d_state);
+
+    executeString_impl(str, initErrorHandlerFunc(error_handler), top);
+    cleanupErrorHandlerFunc();
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeString(const String& str, const int error_handler)
+{
+    int top = lua_gettop(d_state);
+
+    executeString_impl(str, initErrorHandlerFunc(error_handler), top);
+    cleanupErrorHandlerFunc();
+}
+
+//----------------------------------------------------------------------------//
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, const String& subscriber_name,
+    const String& error_handler)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state, subscriber_name, LUA_NOREF, error_handler);
+    Event::Connection con =
+        target->subscribeEvent(event_name, Event::Subscriber(functor));
+
+    // make sure we don't release the references we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+//----------------------------------------------------------------------------//
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, const String& subscriber_name,
+    const int error_handler)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state, subscriber_name, LUA_NOREF, error_handler);
+    Event::Connection con =
+        target->subscribeEvent(event_name, Event::Subscriber(functor));
+
+    // make sure we don't release the references we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+
+//----------------------------------------------------------------------------//
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, Event::Group group, const String& subscriber_name,
+    const String& error_handler)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state, subscriber_name, LUA_NOREF, error_handler);
+    Event::Connection con =
+        target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // make sure we don't release the references we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+//----------------------------------------------------------------------------//
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, Event::Group group, const String& subscriber_name,
+    const int error_handler)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state, subscriber_name, LUA_NOREF, error_handler);
+    Event::Connection con =
+        target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // make sure we don't release the references we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeScriptFile_impl(const String& filename,
+    const String& resourceGroup, const int err_idx, const int top)
+{
+    // load file
+    RawDataContainer raw;
+    System::getSingleton().getResourceProvider()->loadRawDataContainer(filename,
+        raw, resourceGroup.empty() ? d_defaultResourceGroup : resourceGroup);
+
+    // load code into lua
+    int loaderr = luaL_loadbuffer(d_state,
+                                  reinterpret_cast<char*>(raw.getDataPtr()),
+                                  raw.getSize(), filename.c_str());
+
+    System::getSingleton().getResourceProvider()->unloadRawDataContainer( raw );
+
+    if (loaderr)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script file: '" +
+                              filename + "'\n\n" + errMsg + "\n");
+    }
+
+    // call it
+    if (lua_pcall(d_state, 0, 0, err_idx))
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script file: '" +
+                              filename + "'\n\n" + errMsg + "\n");
+    }
+
+    lua_settop(d_state,top); // just in case :P
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::executeScriptGlobal_impl(const String& function_name,
+    const int err_idx, const int top)
+{
+    // get the function from lua
+    lua_getglobal(d_state, function_name.c_str());
+
+    // is it a function
+    if (!lua_isfunction(d_state,-1))
+    {
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to get Lua global: '" + function_name +
+                              "' as name not represent a global Lua function" );
+    }
+
+    // call it
+    int error = lua_pcall(d_state, 0, 1, err_idx);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to evaluate Lua global: '" + 
+                              function_name + "\n\n" + errMsg + "\n");
+    }
+
+    // get return value
+    if (!lua_isnumber(d_state,-1))
+    {
+        // log that return value is invalid. return -1 and move on.
+        lua_settop(d_state,top);
+        ScriptException("Unable to get Lua global : '" + function_name +
+                        "' return value as it's not a number");
+        return -1;
+    }
+
+    int ret = static_cast<int>(lua_tonumber(d_state,-1));
+    lua_settop(d_state,top);
+
+    // return it
+    return ret;
+}
+
+//----------------------------------------------------------------------------//
+bool LuaScriptModule::executeScriptedEventHandler_impl(
+    const String& handler_name, const EventArgs& e, const int err_idx,
+    const int top)
+{
+    LuaFunctor::pushNamedFunction(d_state, handler_name);
+
+    ScriptWindowHelper* helper = 0;
+    // If this is an event that was triggered by a window then make a "this"
+    // pointer to the window for the script.
+    if(e.d_hasWindow)
+    {
+        WindowEventArgs& we = (WindowEventArgs&)e;
+        helper = new ScriptWindowHelper(we.window);
+        lua_pushlightuserdata(d_state,(void*)helper);
+        lua_setglobal(d_state,"this");
+    }
+
+    // push EventArgs as the first parameter
+    tolua_pushusertype(d_state, (void*)&e, "const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(d_state, 1, 1, err_idx);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(d_state,-1));
+        lua_settop(d_state,top);
+        //cleanup the helper object if any
+        if(helper)
+        {
+            delete helper;
+            helper = 0;
+        }
+
+        throw ScriptException("Unable to evaluate the Lua event handler: '" +
+                              handler_name + "'\n\n" + errStr + "\n");
+    }
+
+    // retrieve result
+    bool ret = lua_isboolean(d_state, -1) ? lua_toboolean(d_state, -1 ) : true;
+    lua_settop(d_state,top);
+
+    if(helper)
+    {
+        delete helper;
+        helper = 0;
+    }
+
+    return ret;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeString_impl(const String& str, const int err_idx,
+    const int top)
+{
+    // load code into lua and call it
+    int error = luaL_loadbuffer(d_state, str.c_str(), str.length(), str.c_str()) ||
+                lua_pcall(d_state, 0, 0, err_idx);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script string: '" +
+                              str + "'\n\n" + errMsg + "\n");
+    }
+
+    lua_settop(d_state,top);
+}
+
+//----------------------------------------------------------------------------//
+
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.h	(revision 5707)
@@ -0,0 +1,674 @@
+/***********************************************************************
+	filename: CEGUILua.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Defines interface for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILua_h_
+#define _CEGUILua_h_
+
+
+/*************************************************************************
+	Import / Export control macros
+*************************************************************************/
+#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
+#   ifdef CEGUILUA_EXPORTS
+#       define CEGUILUA_API __declspec(dllexport)
+#   else
+#       if defined( __MINGW32__ )
+#           define CEGUILUA_API
+#       else
+#           define CEGUILUA_API __declspec(dllimport)
+#       endif
+#   endif
+#else
+#   define CEGUILUA_API
+#endif
+
+
+#include "CEGUIScriptModule.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Interface for the LuaScriptModule class
+*/
+class CEGUILUA_API LuaScriptModule : public CEGUI::ScriptModule
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which create a lua_State
+	*/
+	LuaScriptModule();
+
+
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which takes a lua_State
+
+	\param state
+		Pointer to the lua_State that the script module should attach to.
+	*/
+	LuaScriptModule(lua_State* state);
+
+
+	/*!
+	\brief
+		Destructor for LuaScriptModule class.
+	*/
+	~LuaScriptModule();
+
+
+	/*************************************************************************
+		Script Execution Functions
+	*************************************************************************/
+    /*!
+    \brief
+        Execute a script file.
+
+    \param filename
+        String object holding the filename of the script file that is to be
+        executed.
+
+    \param resourceGroup
+        Resource group idendifier to be passed to the ResourceProvider when
+        loading the script file.
+    */
+    void executeScriptFile(const String& filename, const String& resourceGroup);
+
+    /*!
+    \brief
+        Execute a script file.
+
+    \param filename
+        String object holding the filename of the script file that is to be
+        executed.
+
+    \param resourceGroup
+        Resource group idendifier to be passed to the ResourceProvider when
+        loading the script file.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+    */
+    void executeScriptFile(const String& filename,
+                           const String& resourceGroup,
+                           const String& error_handler);
+
+    /*!
+    \brief
+        Execute a script file.
+
+    \param filename
+        String object holding the filename of the script file that is to be
+        executed.
+
+    \param resourceGroup
+        Resource group idendifier to be passed to the ResourceProvider when
+        loading the script file.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+    */
+    void executeScriptFile(const String& filename,
+                           const String& resourceGroup,
+                           const int error_handler);
+
+    /*!
+    \brief
+        Execute a scripted global function.  The function should not take any
+        parameters and should return an integer.
+
+    \param function_name
+        String object holding the name of the function, in the global script
+        environment, that is to be executed.
+
+    \return
+        The integer value returned from the script function.
+    */
+    int executeScriptGlobal(const String& function_name);
+
+    /*!
+    \brief
+        Execute a scripted global function.  The function should not take any
+        parameters and should return an integer.
+
+    \param function_name
+        String object holding the name of the function, in the global script
+        environment, that is to be executed.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+
+    \return
+        The integer value returned from the script function.
+    */
+    int executeScriptGlobal(const String& function_name,
+                            const String& error_handler);
+
+    /*!
+    \brief
+        Execute a scripted global function.  The function should not take any
+        parameters and should return an integer.
+
+    \param function_name
+        String object holding the name of the function, in the global script
+        environment, that is to be executed.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+
+    \return
+        The integer value returned from the script function.
+    */
+    int executeScriptGlobal(const String& function_name,
+                            const int error_handler);
+
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by
+        name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing
+        a function field.  For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means,
+        to the scripted function.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name,
+                                     const EventArgs& e);
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by
+        name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing
+        a function field.  For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means,
+        to the scripted function.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name,
+                                     const EventArgs& e,
+                                     const String& error_handler);
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by
+        name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing
+        a function field.  For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means,
+        to the scripted function.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name,
+                                     const EventArgs& e,
+                                     const int error_handler);
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str);
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str, const String& error_handler);
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str, const int error_handler);
+
+    /*************************************************************************
+        Event subscription
+    *************************************************************************/
+    /*!
+    \brief
+        Subscribes the named Event to a scripted funtion
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection subscribeEvent(EventSet* target, const String& name,
+                                     const String& subscriber_name);
+
+    /*!
+    \brief
+        Subscribes the named Event to a scripted funtion
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection subscribeEvent(EventSet* target, const String& name,
+                                     const String& subscriber_name,
+                                     const String& error_handler);
+
+    /*!
+    \brief
+        Subscribes the named Event to a scripted funtion
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection subscribeEvent(EventSet* target, const String& name,
+                                     const String& subscriber_name,
+                                     const int error_handler);
+
+    /*!
+    \brief
+        Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param group
+        Group which is to be subscribed to.  Subscription groups are called in
+        ascending order.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name,
+                                       Event::Group group,
+                                       const String& subscriber_name);
+
+    /*!
+    \brief
+        Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param group
+        Group which is to be subscribed to.  Subscription groups are called in
+        ascending order.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection subscribeEvent(EventSet* target, const String& name,
+                                     Event::Group group,
+                                     const String& subscriber_name,
+                                     const String& error_handler);
+
+    /*!
+    \brief
+        Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param group
+        Group which is to be subscribed to.  Subscription groups are called in
+        ascending order.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection subscribeEvent(EventSet* target, const String& name,
+                                     Event::Group group,
+                                     const String& subscriber_name,
+                                     const int error_handler);
+
+    /*************************************************************************
+        Bindings creation / destruction
+    *************************************************************************/
+    /*!
+    \brief
+        Method called during system initialisation, prior to running any scripts
+        via the ScriptModule, to enable the ScriptModule to perform any
+        operations required to complete initialisation or binding of the script
+        language to the gui system objects.
+
+    \return
+        Nothing.
+    */
+    void createBindings(void);
+
+    /*!
+    \brief
+        Method called during system destruction, after all scripts have been run
+        via the ScriptModule, to enable the ScriptModule to perform any
+        operations required to cleanup bindings of the script language to the
+        gui system objects, as set-up in the earlier createBindings call.
+
+    \return
+        Nothing.
+    */
+    void destroyBindings(void);
+
+    /*************************************************************************
+        Accessor type functions
+    *************************************************************************/
+    /*!
+    \brief
+        Method used to get a pointer to the lua_State that the script module is
+        attached to.
+
+    \return
+        A pointer to the lua_State that the script module is attached to.
+    */
+    lua_State* getLuaState(void) const {return d_state;}
+
+    /*************************************************************************
+        Lua error handler related functions
+    *************************************************************************/
+    /*!
+    \brief
+        Set the name of the lua function that will be passed as the error
+        handler in calls to lua_pcall, unless an alternative is specified
+        in some other function call.
+
+    \param error_handler_function
+        Name of the lua function to be called.  This is looked up / bound on
+        first usage.
+    */
+    void setDefaultPCallErrorHandler(const String& error_handler_function);
+
+    /*!
+    \brief
+        Set the function that will be passed as the error handler in calls to
+        lua_pcall, unless an alternative is specified in some other function
+        call.
+
+    \param function_reference
+        Lua function registry index of the function to be called.
+    */
+    void setDefaultPCallErrorHandler(int function_reference);
+
+    /*!
+    \brief
+        Return the function name string of the active error handler function.
+
+        The 'active' error handler for the LuaScriptModule is either the
+        default as specified by calling setDefaultPCallErrorHandler, or
+        whatever might have been set up by a call to the internal
+        initErrorHandlerFunc function.
+
+    \note
+        This function is really intended for use internally by other parts of
+        the lua scripting support.  Although it could be useful elsewhere for
+        advanced uses, so long as you're careful!
+    */
+    const String& getActivePCallErrorHandlerString() const;
+
+    /*!
+    \brief
+        return the lua registry index of the active error handler function.
+
+        The 'active' error handler for the LuaScriptModule is either the
+        default as specified by calling setDefaultPCallErrorHandler, or
+        whatever might have been set up by a call to the internal
+        initErrorHandlerFunc function.
+        \par This may return a value previously set by the user, or the value as
+        bound internally by the script module for an error handler specified by
+        function name.
+
+    \note
+        This function is really intended for use internally by other parts of
+        the lua scripting support.  Although it could be useful elsewhere for
+        advanced uses, so long as you're careful!
+
+    \warning
+        You should never call luaL_unref on the value returned by this function
+        unless you created tge reference in the first place, and even then only
+        after having called setDefaultPCallErrorHandler passing LUA_NOREF.
+    */
+    int getActivePCallErrorHandlerReference() const;
+
+private:
+    /*************************************************************************
+        Implementation Functions
+    *************************************************************************/
+    void setModuleIdentifierString();
+    /** Init the error handler function.  Return the lua stack index that
+     *  should be passed to lua_pcall.  NB: This should be called prior to
+     *  pushing any function parameters onto the lua stack.
+     */
+    int initErrorHandlerFunc();
+    /** Init the error handler function.  Return the lua stack index that
+     *  should be passed to lua_pcall.  NB: This should be called prior to
+     *  pushing any function parameters onto the lua stack.
+     */
+    int initErrorHandlerFunc(const String func_name);
+    /** Init the error handler function.  Return the lua stack index that
+     *  should be passed to lua_pcall.  NB: This should be called prior to
+     *  pushing any function parameters onto the lua stack.
+     */
+    int initErrorHandlerFunc(int func);
+
+    /** do any needed cleanup after having called initErrorHandlerFunc and
+     * (possible) executed a script.
+     *
+     * NB: This probably does less than you think ;)
+     */
+    void cleanupErrorHandlerFunc();
+
+    //! release any reference we might have made to an error handling function.
+    void unrefErrorFunc();
+
+    //! Implementation function that executes a scipt file.
+    void executeScriptFile_impl(const String& filename,
+                                const String& resourceGroup,
+                                const int err_idx, const int top);
+
+    //! Implementation function that executes a global script function.
+    int executeScriptGlobal_impl(const String& function_name,
+                                 const int err_idx, const int top);
+
+    //! Implementation function that executes a scripted event handler.
+    bool executeScriptedEventHandler_impl(const String& handler_name,
+                                          const EventArgs& e,
+                                          const int err_idx, const int top);
+
+    //! Implementation function that executes script contained in a String.
+    void executeString_impl(const String& str, const int err_idx, const int top);
+
+    /*************************************************************************
+        Implementation Data
+    *************************************************************************/
+    //! true when the attached lua_State was created by this script module
+    bool d_ownsState;
+    //! The lua_State that this script module uses.
+    lua_State* d_state;
+    //! Default error handler function to pass to lua_pcall.
+    String d_errFuncName;
+    //! Default registry index of the function to pass to lua_pcall.
+    int d_errFuncIndex;
+    /** Error handler function that is currently in use (as setup via a call
+        to initErrorHandlerFunc)
+    */
+    String d_activeErrFuncName;
+    /** Registry index of the function that is currently in use (as setup via a
+        call to initErrorHandlerFunc)
+    */
+    int d_activeErrFuncIndex;
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILua_h_
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.cpp	(revision 5707)
@@ -0,0 +1,426 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.cpp
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Implementation for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUILuaFunctor.h"
+#include "CEGUILogger.h"
+#include "CEGUIExceptions.h"
+#include "CEGUIPropertyHelper.h"
+#include "CEGUILua.h"
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, int func, int selfIndex) :
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false),
+    d_ourErrFuncIndex(false)
+{
+    // TODO: This would perhaps be better done another way, to avoid the
+    // TODO: interdependence.
+    LuaScriptModule* sm =
+        static_cast<LuaScriptModule*>(System::getSingleton().getScriptingModule());
+
+    if (sm)
+    {
+        d_errFuncName  = sm->getActivePCallErrorHandlerString();
+        d_errFuncIndex = sm->getActivePCallErrorHandlerReference();
+    }
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, int selfIndex) :
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func),
+    d_ourErrFuncIndex(false)
+{
+    // TODO: This would perhaps be better done another way, to avoid the
+    // TODO: interdependence.
+    LuaScriptModule* sm =
+        static_cast<LuaScriptModule*>(System::getSingleton().getScriptingModule());
+
+    if (sm)
+    {
+        d_errFuncName  = sm->getActivePCallErrorHandlerString();
+        d_errFuncIndex = sm->getActivePCallErrorHandlerReference();
+    }
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(const LuaFunctor& cp) :
+    L(cp.L),
+    index(cp.index),
+    self(cp.self),
+    needs_lookup(cp.needs_lookup),
+    function_name(cp.function_name),
+    d_errFuncName(cp.d_errFuncName),
+    d_errFuncIndex(cp.d_errFuncIndex),
+    d_ourErrFuncIndex(cp.d_ourErrFuncIndex)
+{
+}
+
+/*************************************************************************
+    Destructor
+*************************************************************************/
+LuaFunctor::~LuaFunctor()
+{
+    if (self != LUA_NOREF)
+        luaL_unref(L, LUA_REGISTRYINDEX, self);
+
+    if (index != LUA_NOREF)
+        luaL_unref(L, LUA_REGISTRYINDEX, index);
+
+    if (d_ourErrFuncIndex &&
+        (d_errFuncIndex != LUA_NOREF) &&
+        !d_errFuncName.empty())
+            luaL_unref(L, LUA_REGISTRYINDEX, d_errFuncIndex);
+}
+
+/*************************************************************************
+    Call operator
+*************************************************************************/
+bool LuaFunctor::operator()(const EventArgs& args) const
+{
+    // named error handler needs binding?
+    if ((d_errFuncIndex == LUA_NOREF) && !d_errFuncName.empty())
+    {
+        pushNamedFunction(L, d_errFuncName);
+        d_errFuncIndex = luaL_ref(L, LUA_REGISTRYINDEX);
+        d_ourErrFuncIndex = true;
+    }
+
+    // is this a late binding?
+    if (needs_lookup)
+    {
+        pushNamedFunction(L, function_name);
+        // reference function
+        index = luaL_ref(L, LUA_REGISTRYINDEX);
+        needs_lookup = false;
+        CEGUI_LOGINSANE("Late binding of callback '"+function_name+"' performed");
+        function_name.clear();
+    } // if (needs_lookup)
+
+    // put error handler on stack if we're using such a thing
+    int err_idx = 0;
+    if (d_errFuncIndex != LUA_NOREF)
+    {
+        lua_rawgeti(L, LUA_REGISTRYINDEX, d_errFuncIndex);
+        err_idx = lua_gettop(L);
+    }
+
+	ScriptWindowHelper* helper = 0;
+	//Set a global for this window
+	if(args.d_hasWindow)
+	{
+		WindowEventArgs& we = (WindowEventArgs&)args;
+		helper = new ScriptWindowHelper(we.window);
+		tolua_pushusertype(L,(void*)helper,"CEGUI::ScriptWindowHelper");
+		lua_setglobal(L,"this");
+	}
+
+    // retrieve function
+    lua_rawgeti(L, LUA_REGISTRYINDEX, index);
+
+    // possibly self as well?
+    int nargs = 1;
+    if (self != LUA_NOREF)
+    {
+        lua_rawgeti(L, LUA_REGISTRYINDEX, self);
+        ++nargs;
+    }
+
+    // push EventArgs  parameter
+    tolua_pushusertype(L, (void*)&args, "const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(L, nargs, 1, err_idx);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(L, -1));
+        lua_pop(L, 1);
+		if(helper)
+		{
+			delete helper;
+			helper = 0;
+		}
+        throw ScriptException("Unable to call Lua event handler:\n\n"+errStr+"\n");
+    } // if (error)
+
+    // retrieve result
+    bool ret = lua_isboolean(L, -1) ? lua_toboolean(L, -1 ) : true;
+    lua_pop(L, 1);
+
+	if(helper)
+	{
+		delete helper;
+		helper = 0;
+	}
+
+    return ret;
+}
+
+/*************************************************************************
+    Pushes a named function on the stack
+*************************************************************************/
+void LuaFunctor::pushNamedFunction(lua_State* L, const String& handler_name)
+{
+    int top = lua_gettop(L);
+
+    // do we have any dots in the handler name? if so we grab the function as a table field
+    String::size_type i = handler_name.find_first_of((utf32)'.');
+    if (i!=String::npos)
+    {
+        // split the rest of the string up in parts seperated by '.'
+        // TODO: count the dots and size the vector accordingly from the beginning.
+        std::vector<String> parts;
+        String::size_type start = 0;
+        do
+        {
+            parts.push_back(handler_name.substr(start,i-start));
+            start = i+1;
+            i = handler_name.find_first_of((utf32)'.',start);
+        } while(i!=String::npos);
+
+        // add last part
+        parts.push_back(handler_name.substr(start));
+
+        // first part is the global
+        lua_getglobal(L, parts[0].c_str());
+        if (!lua_istable(L,-1))
+        {
+            lua_settop(L,top);
+            throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as first part is not a table");
+        }
+
+        // if there is more than two parts, we have more tables to go through
+        std::vector<String>::size_type visz = parts.size();
+        if (visz-- > 2) // avoid subtracting one later on
+        {
+            // go through all the remaining parts to (hopefully) have a valid Lua function in the end
+            std::vector<String>::size_type vi = 1;
+            while (vi<visz)
+            {
+                // push key, and get the next table
+                lua_pushstring(L,parts[vi].c_str());
+                lua_gettable(L,-2);
+                if (!lua_istable(L,-1))
+                {
+                    lua_settop(L,top);
+                    throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as part #"+PropertyHelper::uintToString(uint(vi+1))+" ("+parts[vi]+") is not a table");
+                }
+                // get rid of the last table and move on
+                lua_remove(L,-2);
+                vi++;
+            }
+        }
+
+        // now we are ready to get the function to call ... phew :)
+        lua_pushstring(L,parts[visz].c_str());
+        lua_gettable(L,-2);
+        lua_remove(L,-2); // get rid of the table
+    }
+    // just a regular global function
+    else
+    {
+        lua_getglobal(L, handler_name.c_str());
+    }
+
+    // is it a function
+    if (!lua_isfunction(L,-1))
+    {
+        lua_settop(L,top);
+        throw ScriptException("The Lua event handler: '"+handler_name+"' does not represent a Lua function");
+    }
+}
+
+//----------------------------------------------------------------------------//
+LuaFunctor::LuaFunctor(lua_State* state, const int func, const int selfIndex,
+    const String& error_handler) :
+    // State initialisation
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false),
+    d_errFuncName(error_handler),
+    d_errFuncIndex(LUA_NOREF),
+    d_ourErrFuncIndex(false)
+{
+}
+
+//----------------------------------------------------------------------------//
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, const int selfIndex,
+    const String& error_handler) :
+    // State initialisation
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func),
+    d_errFuncName(error_handler),
+    d_errFuncIndex(LUA_NOREF),
+    d_ourErrFuncIndex(false)
+{
+}
+
+//----------------------------------------------------------------------------//
+LuaFunctor::LuaFunctor(lua_State* state, const int func, const int selfIndex,
+    const int error_handler) :
+    // State initialisation
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false),
+    d_errFuncIndex(error_handler),
+    d_ourErrFuncIndex(false)
+{
+}
+
+//----------------------------------------------------------------------------//
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, const int selfIndex,
+    const int error_handler) :
+    // State initialisation
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func),
+    d_errFuncIndex(error_handler),
+    d_ourErrFuncIndex(false)
+{
+}
+
+//----------------------------------------------------------------------------//
+Event::Connection LuaFunctor::SubscribeEvent(EventSet* self,
+    const String& event_name, const int funcIndex, const int selfIndex,
+    const int error_handler, lua_State* L)
+{
+    // deal with error handler function
+    int err_idx = LUA_NOREF;
+    String err_str;
+    if (error_handler != LUA_NOREF)
+    {
+        int err_handler_type = lua_type(L,-1);
+        switch (err_handler_type)
+        {
+        case LUA_TFUNCTION:
+            // reference function
+            err_idx = luaL_ref(L, LUA_REGISTRYINDEX);
+            break;
+        case LUA_TSTRING:
+            err_str = lua_tostring(L, -1);
+            lua_pop(L, 1);
+            break;
+        default:
+            luaL_error(L, "bad error handler function passed to subscribe "
+                          "function. must be a real function, or a string for "
+                          "late binding");
+            break;
+        }
+
+    }
+
+    // should we pass a self to the callback?
+    int thisIndex = LUA_NOREF;
+    if (selfIndex != LUA_NOREF)
+    {
+        // reference self
+        thisIndex = luaL_ref(L, LUA_REGISTRYINDEX);
+    }
+
+    // do the real subscription
+    int type = lua_type(L,-1);
+    Event::Connection con;
+    if (type == LUA_TFUNCTION)
+    {
+        // reference function
+        int index = luaL_ref(L, LUA_REGISTRYINDEX);
+
+        LuaFunctor functor((err_idx != LUA_NOREF) ?
+                        LuaFunctor(L, index, thisIndex, err_idx) :
+                        (!err_str.empty()) ?
+                            LuaFunctor(L, index, thisIndex, err_str) :
+                            LuaFunctor(L, index, thisIndex));
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference(s) we just made when the
+        // 'functor' object is destroyed (goes out of scope)
+        functor.index = LUA_NOREF;
+        functor.self = LUA_NOREF;
+        functor.d_errFuncIndex = LUA_NOREF;
+    }
+    else if (type == LUA_TSTRING)
+    {
+        const char* str = lua_tostring(L, -1);
+        LuaFunctor functor((err_idx != LUA_NOREF) ?
+                        LuaFunctor(L, String(str), thisIndex, err_idx) :
+                        (!err_str.empty()) ?
+                            LuaFunctor(L, String(str), thisIndex, err_str) :
+                            LuaFunctor(L, String(str), thisIndex));
+
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference(s) we just made when the
+        // 'functor' object is destroyed (goes out of scope)
+        functor.self = LUA_NOREF;
+        functor.d_errFuncIndex = LUA_NOREF;
+    }
+    else
+    {
+        luaL_error(L, "bad function passed to subscribe function. must be a "
+                      "real function, or a string for late binding");
+    }
+
+    // return the event connection
+    return con;
+}
+
+//----------------------------------------------------------------------------//
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.h	(revision 5707)
@@ -0,0 +1,108 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.h
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Defines interface for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILuaFunctor_h_
+#define _CEGUILuaFunctor_h_
+
+#include "CEGUIEventSet.h"
+#include "CEGUIScriptWindowHelper.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// forward declaration
+class LuaScriptModule;
+
+/*!
+\brief
+    Functor class used for subscribing Lua functions to CEGUI events
+*/
+class LuaFunctor
+{
+public:
+    LuaFunctor(lua_State* state, int func, int selfIndex);
+    LuaFunctor(lua_State* state, const String& func, int selfIndex);
+
+    LuaFunctor(lua_State* state, const int func, const int selfIndex,
+               const String& error_handler);
+    LuaFunctor(lua_State* state, const String& func, const int selfIndex,
+               const String& error_handler);
+    LuaFunctor(lua_State* state, const int func, const int selfIndex,
+               const int error_handler);
+    LuaFunctor(lua_State* state, const String& func, const int selfIndex,
+               const int error_handler);
+
+    LuaFunctor(const LuaFunctor& cp);
+    ~LuaFunctor();
+
+    bool operator()(const EventArgs& args) const;
+
+    /*!
+    \brief
+        function used to subscribe any Lua function as event handler.
+        References using the Lua registry.
+        To be called from Lua only.
+    */
+    static Event::Connection SubscribeEvent(EventSet* self,
+                                            const String& eventName,
+                                            const int funcIndex,
+                                            const int selfIndex,
+                                            const int error_handler,
+                                            lua_State* L);
+
+    /*!
+    \brief
+        Pushes the Lua function named \param name on top of the Lua stack.
+        The name may contain '.' (dots) character for (nested) table values.
+    */
+    static void pushNamedFunction(lua_State* L, const String& name);
+
+private:
+    lua_State* L;
+    mutable int index;
+    int self;
+    mutable bool needs_lookup;
+    mutable String function_name;
+
+    //! Error handler function to pass to lua_pcall.
+    mutable String d_errFuncName;
+    //! registry index of the function to pass to lua_pcall.
+    mutable int d_errFuncIndex;
+    //! signfies whether we made the reference index at d_errFuncIndex.
+    mutable bool d_ourErrFuncIndex;
+
+    friend class LuaScriptModule;
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILuaFunctor_h_
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/changes_orxonox.diff
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/changes_orxonox.diff	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/changes_orxonox.diff	(revision 5707)
@@ -0,0 +1,92 @@
+--- CEGUILua.cpp	Sun Jan 25 18:32:57 2009
++++ CEGUILua.cpp	Thu Jan 29 10:24:44 2009
+@@ -27,10 +27,6 @@
+  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+  *   OTHER DEALINGS IN THE SOFTWARE.
+  ***************************************************************************/
+-#ifdef HAVE_CONFIG_H
+-#   include "config.h"
+-#endif
+-
+ #include "CEGUI.h"
+ #include "CEGUIConfig.h"
+ #include "CEGUIPropertyHelper.h"
+@@ -45,7 +41,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // prototype for bindings initialisation function
+ int tolua_CEGUI_open(lua_State* tolua_S);
+@@ -61,7 +57,7 @@
+ LuaScriptModule::LuaScriptModule() :
+     d_errFuncIndex(LUA_NOREF)
+ {
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+         static const luaL_Reg lualibs[] = {
+             {"", luaopen_base},
+             {LUA_LOADLIBNAME, luaopen_package},
+@@ -75,14 +71,14 @@
+         #endif
+             {0, 0}
+         };
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     // create a lua state
+     d_ownsState = true;
+     d_state = lua_open();
+ 
+     // init all standard libraries
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+             const luaL_Reg *lib = lualibs;
+             for (; lib->func; lib++)
+             {
+@@ -90,7 +86,7 @@
+                 lua_pushstring(d_state, lib->name);
+                 lua_call(d_state, 1, 0);
+             }
+-    #else /* CEGUI_LUA_VER >= 51 */
++    #else /* LUA_VERSION_NUM >= 501 */
+         luaopen_base(d_state);
+         luaopen_io(d_state);
+         luaopen_string(d_state);
+@@ -99,7 +95,7 @@
+         #if defined(DEBUG) || defined (_DEBUG)
+             luaopen_debug(d_state);
+         #endif
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     setModuleIdentifierString();
+ }
+--- CEGUILua.h	Sun Jan 25 18:32:57 2009
++++ CEGUILua.h	Thu Jan 29 10:17:42 2009
+@@ -38,7 +38,11 @@
+ #   ifdef CEGUILUA_EXPORTS
+ #       define CEGUILUA_API __declspec(dllexport)
+ #   else
+-#       define CEGUILUA_API __declspec(dllimport)
++#       if defined( __MINGW32__ )
++#           define CEGUILUA_API
++#       else
++#           define CEGUILUA_API __declspec(dllimport)
++#       endif
+ #   endif
+ #else
+ #   define CEGUILUA_API
+--- CEGUILuaFunctor.cpp	Sun Jan 25 18:32:57 2009
++++ CEGUILuaFunctor.cpp	Thu Jan 29 10:25:48 2009
+@@ -40,7 +40,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // Start of CEGUI namespace section
+ namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/required.cpp
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/required.cpp	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/required.cpp	(revision 5707)
@@ -0,0 +1,108 @@
+/***********************************************************************
+	filename: required.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Implementation of helper functions
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "required.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+
+// returns horizontal range as two values for lua
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getHorzRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+// returns vertical range as two values for lua
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getVertRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+
+// allocates and returns a new ListboxTextItem
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete)
+{
+	return new ListboxTextItem(text,item_id,item_data,disabled,auto_delete);
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+void ceguiLua_FileStream_open(FileStream* os, const char* filename)
+{
+    os->open(filename, std::ios::binary);
+}
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k)
+{
+    return (k & sys->getSystemKeys()) != 0;
+}
+
+/************************************************************************
+    EventConnection helper class implementation
+*************************************************************************/
+EventConnection::EventConnection(RefCounted<BoundSlot> slot) :
+    d_slot(slot)
+{}
+
+//----------------------------------------------------------------------------//
+bool EventConnection::connected() const
+{
+    return d_slot->connected();
+}
+
+//----------------------------------------------------------------------------//
+void EventConnection::disconnect()
+{
+    d_slot->disconnect();
+}
+
+//----------------------------------------------------------------------------//
+
+} // namespace CEGUI
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/required.h
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/required.h	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/ceguilua/required.h	(revision 5707)
@@ -0,0 +1,125 @@
+/***********************************************************************
+	filename: required.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Header that includes the necessary stuff needed for the Lua bindings
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <fstream>
+
+#define __operator_increment    operator++
+#define __operator_decrement    operator--
+#define __operator_dereference  operator*
+
+#define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent
+
+//This is used to keep compilers happy
+#define CEGUIDeadException(e) &
+
+#if defined(_MSC_VER) && !defined(snprintf)
+#   define snprintf   _snprintf
+#endif
+
+typedef CEGUI::String string;
+
+namespace CEGUI
+{
+
+/*************************************************************************
+    Helper class to enable us to represent an Event::Connection object
+    (which is actually a RefCounted<BoundSlot> object)
+*************************************************************************/
+class EventConnection
+{
+    RefCounted<BoundSlot> d_slot;
+
+public:
+    EventConnection(RefCounted<BoundSlot> slot);
+    bool connected() const;
+    void disconnect();
+};
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max);
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max);
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete);
+
+
+/************************************************************************
+    Stuff needed to make the iterators work
+*************************************************************************/
+typedef PropertySet::Iterator PropertyIterator;
+typedef EventSet::Iterator EventIterator;
+typedef WindowManager::WindowIterator WindowIterator;
+typedef WindowFactoryManager::WindowFactoryIterator WindowFactoryIterator;
+typedef WindowFactoryManager::FalagardMappingIterator FalagardMappingIterator;
+typedef WindowFactoryManager::FalagardWindowMapping FalagardWindowMapping;
+typedef ImagesetManager::ImagesetIterator ImagesetIterator;
+typedef Imageset::ImageIterator ImageIterator;
+typedef SchemeManager::SchemeIterator SchemeIterator;
+typedef FontManager::FontIterator FontIterator;
+
+template <typename T>
+inline PropertyIterator ceguiLua_getPropertyIterator(const T* self)
+{
+    return static_cast<const PropertySet*>(self)->getIterator();
+}
+
+template <typename T>
+inline EventIterator ceguiLua_getEventIterator(const T* self)
+{
+    return static_cast<const EventSet*>(self)->getIterator();
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+typedef std::ofstream FileStream;
+void ceguiLua_FileStream_open(FileStream*, const char* filename);
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k);
+
+}
+
+// the binding file generates alot of
+// warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
+#if defined(_MSC_VER)
+#   pragma warning(disable : 4800)
+#endif
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/EventSet.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/EventSet.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/EventSet.pkg	(revision 5707)
@@ -0,0 +1,46 @@
+/************************************************************************
+    Event
+*************************************************************************/
+class Event
+{
+    string getName() const;
+};
+
+class EventConnection
+{
+    bool connected() const;
+    void disconnect();
+};
+
+
+/***********************************************************************
+	EventSet
+***********************************************************************/
+class EventSet
+{
+	void addEvent(string name);
+	void removeEvent(string name);
+	void removeAllEvents();
+	bool isEventPresent(string name);
+
+    tolua_throws|CEGUI::UnknownObjectException,error| tolua_outside EventConnection LuaFunctorSubscribeEvent @ subscribeEvent(string name, lua_Object funcIndex, lua_Object selfIndex=LUA_NOREF, lua_Object error_handler = LUA_NOREF, lua_State*);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| EventConnection subscribeScriptedEvent @ subscribeEvent(string name, string callback_name);
+
+	void fireEvent(string name, EventArgs& args, string eventnamespace="");
+
+	bool isMuted() const;
+	void setMutedState(bool setting);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
+
+
+
+/***********************************************************************
+	GlobalEventSet
+***********************************************************************/
+class GlobalEventSet : public EventSet
+{
+	static GlobalEventSet& getSingleton();
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/HelperFunctions.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/HelperFunctions.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/HelperFunctions.pkg	(revision 5707)
@@ -0,0 +1,240 @@
+/****************************************************
+	EventArgs casting helper functions.
+	These are not part of the core CEGUI API, merely here for
+	convenience
+*****************************************************/
+$[
+
+function CEGUI.toMouseCursorEventArgs(e)
+    return tolua.cast(e,"const CEGUI::MouseCursorEventArgs")
+end
+
+function CEGUI.toWindowEventArgs(e)
+    return tolua.cast(e,"const CEGUI::WindowEventArgs")
+end
+
+function CEGUI.toActivationEventArgs(e)
+    return tolua.cast(e,"const CEGUI::ActivationEventArgs")
+end
+
+function CEGUI.toHeaderSequenceEventArgs(e)
+    return tolua.cast(e,"const CEGUI::HeaderSequenceEventArgs")
+end
+
+function CEGUI.toMouseEventArgs(e)
+    return tolua.cast(e,"const CEGUI::MouseEventArgs")
+end
+
+function CEGUI.toKeyEventArgs(e)
+    return tolua.cast(e,"const CEGUI::KeyEventArgs")
+end
+
+function CEGUI.toDragDropEventArgs(e)
+    return tolua.cast(e,"const CEGUI::DragDropEventArgs")
+end
+
+function CEGUI.toTreeEventArgs(e)
+    return tolua.cast(e,"const CEGUI::TreeEventArgs")
+end
+
+CEGUI.EventArgs.toMouseCursorEventArgs      = CEGUI.toMouseCursorEventArgs
+CEGUI.EventArgs.toWindowEventArgs           = CEGUI.toWindowEventArgs
+CEGUI.EventArgs.toActivationEventArgs       = CEGUI.toActivationEventArgs
+CEGUI.EventArgs.toHeaderSequenceEventArgs   = CEGUI.toHeaderSequenceEventArgs
+CEGUI.EventArgs.toMouseEventArgs            = CEGUI.toMouseEventArgs
+CEGUI.EventArgs.toKeyEventArgs              = CEGUI.toKeyEventArgs
+CEGUI.EventArgs.toDragDropEventArgs         = CEGUI.toDragDropEventArgs
+CEGUI.EventArgs.toTreeEventArgs             = CEGUI.toTreeEventArgs
+
+$]
+
+
+/****************************************************
+	Functions for easy casting CEGUI::Window class
+	to the widget classes derived from it.
+	
+	all widget types gets these and they are made available as:
+	CEGUI.toButtonBase and CEGUI.Window:toButtonBase
+	etc...
+*****************************************************/
+$[
+
+function CEGUI.toButtonBase(w)
+    return tolua.cast(w,"CEGUI::ButtonBase")
+end
+
+function CEGUI.toCheckbox(w)
+    return tolua.cast(w,"CEGUI::Checkbox")
+end
+
+function CEGUI.toCombobox(w)
+    return tolua.cast(w,"CEGUI::Combobox")
+end
+
+function CEGUI.toComboDropList(w)
+    return tolua.cast(w,"CEGUI::ComboDropList")
+end
+
+function CEGUI.toDragContainer(w)
+    return tolua.cast(w,"CEGUI::DragContainer")
+end
+
+function CEGUI.toEditbox(w)
+    return tolua.cast(w,"CEGUI::Editbox")
+end
+
+function CEGUI.toFrameWindow(w)
+    return tolua.cast(w,"CEGUI::FrameWindow")
+end
+
+function CEGUI.toGUISheet(w)
+    return tolua.cast(w,"CEGUI::GUISheet")
+end
+
+function CEGUI.toItemEntry(w)
+    return tolua.cast(w,"CEGUI::ItemEntry")
+end
+
+function CEGUI.toItemListBase(w)
+    return tolua.cast(w,"CEGUI::ItemListBase")
+end
+
+function CEGUI.toItemListbox(w)
+    return tolua.cast(w,"CEGUI::ItemListbox")
+end
+
+function CEGUI.toListbox(w)
+    return tolua.cast(w,"CEGUI::Listbox")
+end
+
+function CEGUI.toListHeader(w)
+    return tolua.cast(w,"CEGUI::ListHeader")
+end
+
+function CEGUI.toListHeaderSegment(w)
+    return tolua.cast(w,"CEGUI::ListHeaderSegment")
+end
+
+function CEGUI.toMenubar(w)
+    return tolua.cast(w,"CEGUI::Menubar")
+end
+
+function CEGUI.toMenuBase(w)
+    return tolua.cast(w,"CEGUI::MenuBase")
+end
+
+function CEGUI.toMenuItem(w)
+    return tolua.cast(w,"CEGUI::MenuItem")
+end
+
+function CEGUI.toMultiColumnList(w)
+    return tolua.cast(w,"CEGUI::MultiColumnList")
+end
+
+function CEGUI.toMultiLineEditbox(w)
+    return tolua.cast(w,"CEGUI::MultiLineEditbox")
+end
+
+function CEGUI.toPopupMenu(w)
+    return tolua.cast(w,"CEGUI::PopupMenu")
+end
+
+function CEGUI.toProgressBar(w)
+    return tolua.cast(w,"CEGUI::ProgressBar")
+end
+
+function CEGUI.toPushButton(w)
+    return tolua.cast(w,"CEGUI::PushButton")
+end
+
+function CEGUI.toRadioButton(w)
+    return tolua.cast(w,"CEGUI::RadioButton")
+end
+
+function CEGUI.toScrollablePane(w)
+    return tolua.cast(w,"CEGUI::ScrollablePane")
+end
+
+function CEGUI.toScrollbar(w)
+    return tolua.cast(w,"CEGUI::Scrollbar")
+end
+
+function CEGUI.toScrolledContainer(w)
+    return tolua.cast(w,"CEGUI::ScrolledContainer")
+end
+
+function CEGUI.toScrolledItemListBase(w)
+    return tolua.cast(w,"CEGUI::ScrolledItemListBase")
+end
+
+function CEGUI.toSlider(w)
+    return tolua.cast(w,"CEGUI::Slider")
+end
+
+function CEGUI.toSpinner(w)
+    return tolua.cast(w,"CEGUI::Spinner")
+end
+
+function CEGUI.toTabButton(w)
+    return tolua.cast(w,"CEGUI::TabButton")
+end
+
+function CEGUI.toTabControl(w)
+    return tolua.cast(w,"CEGUI::TabControl")
+end
+
+function CEGUI.toTabPane(w)
+    return tolua.cast(w,"CEGUI::TabPane")
+end
+
+function CEGUI.toThumb(w)
+    return tolua.cast(w,"CEGUI::Thumb")
+end
+
+function CEGUI.toTooltip(w)
+    return tolua.cast(w,"CEGUI::Tooltip")
+end
+
+CEGUI.Window.toButtonBase = CEGUI.toButtonBase
+CEGUI.Window.toCheckbox = CEGUI.toCheckbox
+CEGUI.Window.toCombobox = CEGUI.toCombobox
+CEGUI.Window.toComboDropList = CEGUI.toComboDropList
+CEGUI.Window.toDragContainer = CEGUI.toDragContainer
+CEGUI.Window.toEditbox = CEGUI.toEditbox
+CEGUI.Window.toFrameWindow = CEGUI.toFrameWindow
+CEGUI.Window.toGUISheet = CEGUI.toGUISheet
+CEGUI.Window.toItemEntry = CEGUI.toItemEntry
+CEGUI.Window.toItemListBase = CEGUI.toItemListBase
+CEGUI.Window.toItemListbox = CEGUI.toItemListBase
+CEGUI.Window.toListbox = CEGUI.toListbox
+CEGUI.Window.toListHeader = CEGUI.toListHeader
+CEGUI.Window.toListHeaderSegment = CEGUI.toListHeaderSegment
+CEGUI.Window.toMenubar = CEGUI.toMenubar
+CEGUI.Window.toMenuBase = CEGUI.toMenuBase
+CEGUI.Window.toMenuItem = CEGUI.toMenuItem
+CEGUI.Window.toMultiColumnList = CEGUI.toMultiColumnList
+CEGUI.Window.toMultiLineEditbox = CEGUI.toMultiLineEditbox
+CEGUI.Window.toPopupMenu = CEGUI.toPopupMenu
+CEGUI.Window.toProgressBar = CEGUI.toProgressBar
+CEGUI.Window.toPushButton = CEGUI.toPushButton
+CEGUI.Window.toRadioButton = CEGUI.toRadioButton
+CEGUI.Window.toScrollablePane = CEGUI.toScrollablePane
+CEGUI.Window.toScrollbar = CEGUI.toScrollbar
+CEGUI.Window.toScrolledContainer = CEGUI.toScrolledContainer
+CEGUI.Window.toScrolledItemListBase = CEGUI.toScrolledItemListBase
+CEGUI.Window.toSlider = CEGUI.toSlider
+CEGUI.Window.toSpinner = CEGUI.toSpinner
+CEGUI.Window.toTabButton = CEGUI.toTabButton
+CEGUI.Window.toTabControl = CEGUI.toTabControl
+CEGUI.Window.toTabPane = CEGUI.toTabPane
+CEGUI.Window.toThumb = CEGUI.toThumb
+CEGUI.Window.toTooltip = CEGUI.toTooltip
+
+$]
+
+
+/****************************************************
+	Helper to create a ListboxTextItem.
+	Mimics the constructor
+*****************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem @ createListboxTextItem(string text, unsigned int item_id=0, void* item_data=0, bool disabled=false, bool auto_delete=true);
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/InputEvent.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/InputEvent.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/InputEvent.pkg	(revision 5707)
@@ -0,0 +1,129 @@
+/***********************************************************************
+	EventArgs
+***********************************************************************/
+class EventArgs
+{
+	bool handled;
+
+	EventArgs();
+};
+
+
+
+/***********************************************************************
+	MouseCursorEventArgs
+***********************************************************************/
+class MouseCursorEventArgs : public EventArgs
+{
+	MouseCursor* mouseCursor;
+	const Image* image;
+
+	MouseCursorEventArgs(MouseCursor* cursor);
+};
+
+
+
+/***********************************************************************
+	WindowEventArgs
+***********************************************************************/
+class WindowEventArgs : public EventArgs
+{
+	Window* window;
+
+	WindowEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	ActivationEventArgs
+***********************************************************************/
+class ActivationEventArgs : public WindowEventArgs
+{
+	Window* otherWindow;
+
+	ActivationEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	HeaderSequenceEventArgs
+***********************************************************************/
+class HeaderSequenceEventArgs : public WindowEventArgs
+{
+	// remove 'd_' member variable prefix
+	unsigned int d_oldIdx @ oldIdx;
+	unsigned int d_newIdx @ newIdx;
+
+	HeaderSequenceEventArgs(Window* wnd, unsigned int old_index, unsigned int new_index);
+};
+
+
+
+/***********************************************************************
+	MouseButton
+***********************************************************************/
+enum MouseButton
+{
+	LeftButton,
+	RightButton,
+	MiddleButton,
+	X1Button,
+	X2Button,
+	MouseButtonCount,
+	NoButton
+};
+
+
+
+/***********************************************************************
+	MouseEventArgs
+***********************************************************************/
+class MouseEventArgs : public WindowEventArgs
+{
+	Vector2 position;
+	Vector2 moveDelta;
+	MouseButton button;
+	unsigned int sysKeys;
+	float wheelChange;
+
+	MouseEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	KeyEventArgs
+***********************************************************************/
+class KeyEventArgs : public WindowEventArgs
+{
+	unsigned long codepoint;
+	Key::Scan scancode;
+	unsigned int sysKeys;
+
+	KeyEventArgs(Window* wnd);
+};
+
+
+
+/************************************************************************
+    DragDropEventArgs
+*************************************************************************/
+class DragDropEventArgs : public WindowEventArgs
+{
+    DragContainer* dragDropItem;
+
+    DragDropEventArgs(Window* wnd);
+};
+
+
+/***********************************************************************
+   TreeEventArgs
+***********************************************************************/
+class TreeEventArgs : public WindowEventArgs
+{
+   TreeItem *treeItem;
+
+   TreeEventArgs(Window* wnd);
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/Window.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/Window.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/Window.pkg	(revision 5707)
@@ -0,0 +1,250 @@
+/****************************************
+	Vertical alignment modes
+*****************************************/
+enum VerticalAlignment
+{
+	VA_TOP,
+	VA_CENTRE,
+	VA_BOTTOM
+};
+
+
+/****************************************
+	Horizontal alignment modes
+*****************************************/
+enum HorizontalAlignment
+{
+	HA_LEFT,
+	HA_CENTRE,
+	HA_RIGHT
+};
+
+
+/****************************************
+	Window
+*****************************************/
+class Window //: public EventSet
+{
+	string getType() const;
+	string getName() const;
+
+	bool isDestroyedByParent() const;
+	bool isAlwaysOnTop() const;
+	bool isDisabled(bool localOnly=false) const;
+	bool isVisible(bool localOnly=false) const;
+	bool isActive() const;
+	bool isClippedByParent() const;
+
+	void setDestroyedByParent(bool setting);
+	void setAlwaysOnTop(bool setting);
+	void setEnabled(bool setting);
+	void enable();
+	void disable();
+	void setVisible(bool setting);
+	void show();
+	void hide();
+	void activate();
+	void deactivate();
+
+	void setClippedByParent(bool setting);
+
+	unsigned int getID() const;
+	void setID(unsigned int ID);
+
+	unsigned int getChildCount() const;
+
+	bool isChild(unsigned int ID) const;
+	bool isChild(string name) const;
+	bool isChild(const Window* window) const;
+	bool isChildRecursive(unsigned int ID) const;
+
+	void addChildWindow(string name);
+	void addChildWindow(Window* window);
+
+	void removeChildWindow(unsigned int ID);
+	void removeChildWindow(string name);
+	void removeChildWindow(Window* window);
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(unsigned int ID) const;
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(string name) const;
+    Window* getChildRecursive(unsigned int ID) const;
+    Window* getChildRecursive(string name) const;
+	Window* getChildAtIdx(unsigned int ID) const;
+	Window* getActiveChild() const;
+	Window* getChildAtPosition(const Vector2& pos) const;
+    Window* getTargetChildAtPosition(const Vector2& pos) const;
+
+	Window* getParent() const;
+
+	bool isAncestor(unsigned int ID) const;
+	bool isAncestor(string name) const;
+	bool isAncestor(const Window* window) const;
+
+	void setFont(string name);
+	void setFont(Font* font);
+	Font* getFont() const;
+
+	void setText(string text);
+    void insertText(string text, unsigned long position);
+    void appendText(string text);
+	string getText() const;
+
+	bool inheritsAlpha() const;
+	float getAlpha() const;
+	float getEffectiveAlpha() const;
+	void setAlpha(float a);
+	void setInheritsAlpha(bool setting);
+
+	void requestRedraw() const;
+
+	bool isZOrderingEnabled() const;
+	void setZOrderingEnabled(bool setting);
+
+	Rect getPixelRect() const;
+	Rect getInnerRect() const;
+	Rect getUnclippedPixelRect() const;
+	Rect getUnclippedInnerRect() const;
+
+    Size getParentPixelSize(void) const;
+    float getParentPixelWidth(void) const;
+    float getParentPixelHeight(void) const;
+
+	static Window* getCaptureWindow();
+	void setRestoreCapture(bool setting);
+	bool restoresOldCapture() const;
+
+	bool distributesCapturedInputs() const;
+	void setDistributesCapturedInputs(bool setting);
+
+	bool captureInput();
+	void releaseInput();
+
+	bool isCapturedByThis() const;
+	bool isCapturedByAncestor() const;
+	bool isCapturedByChild() const;
+
+	bool isHit(const Vector2& pos) const;
+
+	bool isRiseOnClickEnabled() const;
+	void setRiseOnClickEnabled(bool setting);
+
+	const Image* getMouseCursor() const;
+	void setMouseCursor(MouseCursorImage cursor);
+	void setMouseCursor(const Image* image);
+	void setMouseCursor(string imageset, string image);
+
+	void moveToFront();
+	void moveToBack();
+
+	bool wantsMultiClickEvents() const;
+	bool isMouseAutoRepeatEnabled() const;
+	float getAutoRepeatDelay() const;
+	float getAutoRepeatRate() const;
+	void setWantsMultiClickEvents(bool setting);
+	void setMouseAutoRepeatEnabled(bool setting);
+	void setAutoRepeatDelay(float delay);
+	void setAutoRepeatRate(float rate);
+
+	//void destroy();
+
+	bool isUsingDefaultTooltip() const;
+	Tooltip* getTooltip() const;
+	string getTooltipType() const;
+	string getTooltipText() const;
+	bool inheritsTooltipText() const;
+
+	void setTooltip(Tooltip* tooltip);
+	void setTooltipType(string tooltipType);
+	void setTooltipText(string tip);
+	void setInheritsTooltipText(bool setting);
+
+	bool testClassName(string class_name) const;
+
+	void notifyDragDropItemEnters(DragContainer* item);
+	void notifyDragDropItemLeaves(DragContainer* item);
+	void notifyDragDropItemDropped(DragContainer* item);
+
+	VerticalAlignment getVerticalAlignment() const;
+	HorizontalAlignment getHorizontalAlignment() const;
+
+    // these actually have a const, but tolua++ chokes on that
+    void setVerticalAlignment(VerticalAlignment alignment);
+    void setHorizontalAlignment(HorizontalAlignment alignment);
+
+	string getLookNFeel() const;
+    tolua_throws|CEGUI::Exception,error| void setLookNFeel(string lnf);
+
+    tolua_throws|CEGUI::Exception,error| void setWindowRenderer(string name);
+    string getWindowRendererName() const;
+
+	//RenderCache& getRenderCache()
+
+	bool getModalState() const;
+	void setModalState(bool state);
+
+    tolua_throws|CEGUI::UnknownObjectException,nil| string getUserString(string name) const;
+    bool isUserStringDefined(string name) const;
+    void setUserString(string name, string value);
+
+    void beginInitialisation();
+    void endInitialisation();
+
+	// unified stuff
+	void setArea(const UDim& xpos, const UDim& ypos, const UDim& width, const UDim& height);
+	void setArea(const UVector2& pos, const UVector2& size);
+	void setArea(const URect& area);
+	void setPosition(const UVector2& pos);
+	void setXPosition(const UDim& x);
+	void setYPosition(const UDim& y);
+	void setSize(const UVector2& size);
+	void setWidth(const UDim& width);
+	void setHeight(const UDim& height);
+	void setMaxSize(const UVector2& size);
+	void setMinSize(const UVector2& size);
+
+	const URect& getArea() const;
+	const UVector2& getPosition() const;
+	const UDim& getXPosition() const;
+	const UDim& getYPosition() const;
+	UVector2 getSize() const;
+	UDim getWidth() const;
+	UDim getHeight() const;
+	const UVector2& getMaxSize() const;
+	const UVector2& getMinSize() const;
+
+    // event pass through
+    bool isMousePassThroughEnabled() const;
+    void setMousePassThroughEnabled(bool setting);
+    
+    tolua_throws|CEGUI::Exception,error| void rename(string new_name);
+
+	//////////////////////////////////////////////
+	// PropertySet
+	void setProperty(string name, string value);
+	string getProperty(string name) const;
+	string getPropertyDefault(string name) const;
+	string getPropertyHelp(string name) const;
+
+	bool isPropertyPresent(string name) const;
+	bool isPropertyDefault(string name) const;
+
+    tolua_outside PropertyIterator ceguiLua_getPropertyIterator @ getPropertyIterator() const;
+
+	//////////////////////////////////////////////
+	// EventSet
+	void addEvent(string name);
+	void removeEvent(string name);
+	void removeAllEvents();
+	bool isEventPresent(string name);
+
+    tolua_throws|CEGUI::UnknownObjectException,error| tolua_outside EventConnection LuaFunctorSubscribeEvent @ subscribeEvent(string name, lua_Object funcIndex, lua_Object selfIndex=LUA_NOREF, lua_Object error_handler = LUA_NOREF, lua_State*);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| EventConnection subscribeScriptedEvent @ subscribeEvent(string name, string callback_name);
+	
+	void fireEvent(string name, EventArgs& args, string eventnamespace="");
+
+	bool isMuted() const;
+	void setMutedState(bool setting);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/WindowManager.pkg
===================================================================
--- /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/WindowManager.pkg	(revision 5707)
+++ /code/branches/libraries2/src/external/ceguilua/ceguilua-0.6.2/package/WindowManager.pkg	(revision 5707)
@@ -0,0 +1,36 @@
+/***********************************************************************
+	WindowManager
+***********************************************************************/
+class WindowManager
+{
+	static WindowManager& getSingleton();
+
+	tolua_throws|CEGUI::AlreadyExistsException,nil|CEGUI::InvalidRequestException,nil| Window* createWindow(string type, string name="");
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| Window* loadWindowLayout(string filename, string name_prefix="", string resourcegroup="");
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| Window* loadWindowLayout(string filename, bool generateRandomPrefix);
+
+    void writeWindowLayoutToStream(string window, OutStream& out, bool writeParent=false) const;
+    void writeWindowLayoutToStream(const Window& window, OutStream& out, bool writeParent=false) const;
+
+	void destroyWindow(string name);
+	void destroyWindow(Window* window);
+	void destroyAllWindows();
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getWindow(string name) const;
+	bool isWindowPresent(string name) const;
+
+	bool isDeadPoolEmpty() const;
+	void cleanDeadPool();
+
+    void renameWindow(Window* window, string  new_name);
+    void renameWindow(string window, string new_name);
+
+    WindowIterator getIterator() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string& getDefaultResourceGroup();
+
+    void lock();
+    void unlock();
+    bool isLocked() const;
+};
