00001 /*********************************************************************** 00002 filename: required.h 00003 created: 16/3/2005 00004 author: Tomas Lindquist Olsen 00005 00006 purpose: Header that includes the necessary stuff needed for the Lua bindings 00007 *************************************************************************/ 00008 /*************************************************************************** 00009 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining 00012 * a copy of this software and associated documentation files (the 00013 * "Software"), to deal in the Software without restriction, including 00014 * without limitation the rights to use, copy, modify, merge, publish, 00015 * distribute, sublicense, and/or sell copies of the Software, and to 00016 * permit persons to whom the Software is furnished to do so, subject to 00017 * the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be 00020 * included in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00023 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00024 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00025 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00026 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00027 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00028 * OTHER DEALINGS IN THE SOFTWARE. 00029 ***************************************************************************/ 00030 #include "CEGUI.h" 00031 #include "CEGUILua.h" 00032 #include "CEGUILuaFunctor.h" 00033 #include <fstream> 00034 00035 #define __operator_increment operator++ 00036 #define __operator_decrement operator-- 00037 #define __operator_dereference operator* 00038 00039 #define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent 00040 00041 //This is used to keep compilers happy 00042 #define CEGUIDeadException(e) & 00043 00044 #if defined(_MSC_VER) && !defined(snprintf) 00045 # define snprintf _snprintf 00046 #endif 00047 00048 typedef CEGUI::String string; 00049 00050 namespace CEGUI 00051 { 00052 00053 /************************************************************************* 00054 Helper class to enable us to represent an Event::Connection object 00055 (which is actually a RefCounted<BoundSlot> object) 00056 *************************************************************************/ 00057 class EventConnection 00058 { 00059 RefCounted<BoundSlot> d_slot; 00060 00061 public: 00062 EventConnection(RefCounted<BoundSlot> slot); 00063 bool connected() const; 00064 void disconnect(); 00065 }; 00066 00067 /************************************************************************* 00068 Functions for getting Thumb range pairs as two return values 00069 *************************************************************************/ 00070 void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max); 00071 void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max); 00072 00073 00074 /************************************************************************* 00075 Functions for creating list box items 00076 *************************************************************************/ 00077 ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete); 00078 00079 00080 /************************************************************************ 00081 Stuff needed to make the iterators work 00082 *************************************************************************/ 00083 typedef PropertySet::Iterator PropertyIterator; 00084 typedef EventSet::Iterator EventIterator; 00085 typedef WindowManager::WindowIterator WindowIterator; 00086 typedef WindowFactoryManager::WindowFactoryIterator WindowFactoryIterator; 00087 typedef WindowFactoryManager::FalagardMappingIterator FalagardMappingIterator; 00088 typedef WindowFactoryManager::FalagardWindowMapping FalagardWindowMapping; 00089 typedef ImagesetManager::ImagesetIterator ImagesetIterator; 00090 typedef Imageset::ImageIterator ImageIterator; 00091 typedef SchemeManager::SchemeIterator SchemeIterator; 00092 typedef FontManager::FontIterator FontIterator; 00093 00094 template <typename T> 00095 inline PropertyIterator ceguiLua_getPropertyIterator(const T* self) 00096 { 00097 return static_cast<const PropertySet*>(self)->getIterator(); 00098 } 00099 00100 template <typename T> 00101 inline EventIterator ceguiLua_getEventIterator(const T* self) 00102 { 00103 return static_cast<const EventSet*>(self)->getIterator(); 00104 } 00105 00106 00107 /************************************************************************ 00108 OutStream 00109 *************************************************************************/ 00110 typedef std::ofstream FileStream; 00111 void ceguiLua_FileStream_open(FileStream*, const char* filename); 00112 00113 00114 /************************************************************************ 00115 CEGUI::System::getSystemKeys alternative 00116 *************************************************************************/ 00117 bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k); 00118 00119 } 00120 00121 // the binding file generates alot of 00122 // warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) 00123 #if defined(_MSC_VER) 00124 # pragma warning(disable : 4800) 00125 #endif