| 1 | /*********************************************************************** | 
|---|
| 2 |         filename: required.h | 
|---|
| 3 |         created:  16/3/2005 | 
|---|
| 4 |         author:   Tomas Lindquist Olsen | 
|---|
| 5 |  | 
|---|
| 6 |         purpose:  Header that includes the necessary stuff needed for the Lua bindings | 
|---|
| 7 | *************************************************************************/ | 
|---|
| 8 | /*************************************************************************** | 
|---|
| 9 |  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team | 
|---|
| 10 |  * | 
|---|
| 11 |  *   Permission is hereby granted, free of charge, to any person obtaining | 
|---|
| 12 |  *   a copy of this software and associated documentation files (the | 
|---|
| 13 |  *   "Software"), to deal in the Software without restriction, including | 
|---|
| 14 |  *   without limitation the rights to use, copy, modify, merge, publish, | 
|---|
| 15 |  *   distribute, sublicense, and/or sell copies of the Software, and to | 
|---|
| 16 |  *   permit persons to whom the Software is furnished to do so, subject to | 
|---|
| 17 |  *   the following conditions: | 
|---|
| 18 |  * | 
|---|
| 19 |  *   The above copyright notice and this permission notice shall be | 
|---|
| 20 |  *   included in all copies or substantial portions of the Software. | 
|---|
| 21 |  * | 
|---|
| 22 |  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | 
|---|
| 23 |  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | 
|---|
| 24 |  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | 
|---|
| 25 |  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | 
|---|
| 26 |  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 
|---|
| 27 |  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 
|---|
| 28 |  *   OTHER DEALINGS IN THE SOFTWARE. | 
|---|
| 29 |  ***************************************************************************/ | 
|---|
| 30 | #include "CEGUI.h" | 
|---|
| 31 | #include "CEGUILua.h" | 
|---|
| 32 | #include "CEGUILuaFunctor.h" | 
|---|
| 33 | #include <fstream> | 
|---|
| 34 |  | 
|---|
| 35 | #define __operator_increment    operator++ | 
|---|
| 36 | #define __operator_decrement    operator-- | 
|---|
| 37 | #define __operator_dereference  operator* | 
|---|
| 38 |  | 
|---|
| 39 | #define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent | 
|---|
| 40 |  | 
|---|
| 41 | //This is used to keep compilers happy | 
|---|
| 42 | #define CEGUIDeadException(e) & | 
|---|
| 43 |  | 
|---|
| 44 | #if defined(_MSC_VER) && !defined(snprintf) | 
|---|
| 45 | #   define snprintf   _snprintf | 
|---|
| 46 | #endif | 
|---|
| 47 |  | 
|---|
| 48 | typedef CEGUI::String string; | 
|---|
| 49 |  | 
|---|
| 50 | namespace CEGUI | 
|---|
| 51 | { | 
|---|
| 52 |  | 
|---|
| 53 | typedef Event::Connection EventConnection; | 
|---|
| 54 |  | 
|---|
| 55 | /************************************************************************* | 
|---|
| 56 |         Functions for getting Thumb range pairs as two return values | 
|---|
| 57 | *************************************************************************/ | 
|---|
| 58 | void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max); | 
|---|
| 59 | void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max); | 
|---|
| 60 |  | 
|---|
| 61 |  | 
|---|
| 62 | /************************************************************************* | 
|---|
| 63 |         Functions for creating list box items | 
|---|
| 64 | *************************************************************************/ | 
|---|
| 65 | ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete); | 
|---|
| 66 |  | 
|---|
| 67 |  | 
|---|
| 68 | /************************************************************************ | 
|---|
| 69 |     Stuff needed to make the iterators work | 
|---|
| 70 | *************************************************************************/ | 
|---|
| 71 | typedef PropertySet::Iterator PropertyIterator; | 
|---|
| 72 | typedef EventSet::Iterator EventIterator; | 
|---|
| 73 | typedef WindowManager::WindowIterator WindowIterator; | 
|---|
| 74 | typedef WindowFactoryManager::WindowFactoryIterator WindowFactoryIterator; | 
|---|
| 75 | typedef WindowFactoryManager::FalagardMappingIterator FalagardMappingIterator; | 
|---|
| 76 | typedef WindowFactoryManager::FalagardWindowMapping FalagardWindowMapping; | 
|---|
| 77 | typedef ImagesetManager::ImagesetIterator ImagesetIterator; | 
|---|
| 78 | typedef Imageset::ImageIterator ImageIterator; | 
|---|
| 79 | typedef SchemeManager::SchemeIterator SchemeIterator; | 
|---|
| 80 | typedef FontManager::FontIterator FontIterator; | 
|---|
| 81 |  | 
|---|
| 82 | template <typename T> | 
|---|
| 83 | inline PropertyIterator ceguiLua_getPropertyIterator(const T* self) | 
|---|
| 84 | { | 
|---|
| 85 |     return static_cast<const PropertySet*>(self)->getIterator(); | 
|---|
| 86 | } | 
|---|
| 87 |  | 
|---|
| 88 | template <typename T> | 
|---|
| 89 | inline EventIterator ceguiLua_getEventIterator(const T* self) | 
|---|
| 90 | { | 
|---|
| 91 |     return static_cast<const EventSet*>(self)->getIterator(); | 
|---|
| 92 | } | 
|---|
| 93 |  | 
|---|
| 94 |  | 
|---|
| 95 | /************************************************************************ | 
|---|
| 96 |     OutStream | 
|---|
| 97 | *************************************************************************/ | 
|---|
| 98 | typedef std::ofstream FileStream; | 
|---|
| 99 | void ceguiLua_FileStream_open(FileStream*, const char* filename); | 
|---|
| 100 |  | 
|---|
| 101 |  | 
|---|
| 102 | /************************************************************************ | 
|---|
| 103 |     CEGUI::System::getSystemKeys alternative | 
|---|
| 104 | *************************************************************************/ | 
|---|
| 105 | bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k); | 
|---|
| 106 |  | 
|---|
| 107 | } | 
|---|
| 108 |  | 
|---|
| 109 | // the binding file generates alot of | 
|---|
| 110 | // warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) | 
|---|
| 111 | #if defined(_MSC_VER) | 
|---|
| 112 | #   pragma warning(disable : 4800) | 
|---|
| 113 | #endif | 
|---|