CHANGED: #1471 Moved the stuff I moved to NELGUI library, under the NLGUI namespace.

--HG--
branch : gui-refactoring
This commit is contained in:
dfighter1985 2012-05-23 19:40:41 +02:00
parent 5a2a89b4fc
commit f769f6fb0c
21 changed files with 2318 additions and 2274 deletions

View file

@ -19,8 +19,9 @@
#include "nel/misc/types_nl.h"
#include "nel/gui/lua_helper.h"
using namespace NLGUI;
#define IHM_LUA_METATABLE "__ui_metatable"
#define IHM_LUA_ENVTABLE "__ui_envtable"
namespace NLMISC
{
@ -29,6 +30,9 @@ namespace NLMISC
class CRGBA;
}
namespace NLGUI
{
class CReflectable;
class CReflectedProperty;
@ -57,12 +61,6 @@ public:
}
};
// ***************************************************************************
#define IHM_LUA_METATABLE "__ui_metatable"
#define IHM_LUA_ENVTABLE "__ui_envtable"
// ***************************************************************************
/**
* Define Functions to export from C to LUA
@ -128,34 +126,26 @@ public:
private:
static void registerBasics(CLuaState &ls);
static void registerIHM(CLuaState &ls);
static void createLuaEnumTable(CLuaState &ls, const std::string &str);
/// \name Exported Functions
// @{
//////////////////////////////////////////// Exported functions //////////////////////////////////////////////////////
// LUA exported Functions with luabind
static uint32 getLocalTime();
static double getPreciseLocalTime();
static std::string findReplaceAll(const std::string &str, const std::string &search, const std::string &replace);
static ucstring findReplaceAll(const ucstring &str, const ucstring &search, const ucstring &replace);
// just for ease of use
static ucstring findReplaceAll(const ucstring &str, const std::string &search, const std::string &replace);
static ucstring findReplaceAll(const ucstring &str, const std::string &search, const ucstring &replace);
static ucstring findReplaceAll(const ucstring &str, const ucstring &search, const std::string &replace);
// @}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Function export tools
// Function to forward lua call to C++ to a 'lua method' exported from a reflected object
static int luaMethodCall(lua_State *ls);
};
}
#endif // NL_LUA_IHM_H

View file

@ -22,7 +22,6 @@
namespace NLGUI
{
class CLuaState;
}
/// Provides a single global access point to the Lua state, and related stuff. :(
class CLuaManager
@ -53,5 +52,6 @@ private:
NLMISC::CSmartPtr< NLGUI::CLuaState > luaState;
};
}
#endif

View file

@ -20,11 +20,10 @@
#include "nel/misc/smart_ptr.h"
#include "nel/misc/rgba.h"
//
#include "nel/gui/lua_helper.h"
using namespace NLGUI;
namespace NLGUI
{
class CLuaEnumeration;
@ -298,4 +297,7 @@ public:
bool operator()(const char *lhs, const char *rhs) const { return lhs < rhs; }
};
}
#endif

View file

@ -14,22 +14,17 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_REFLECT_H
#define CL_REFLECT_H
#include "nel/misc/rgba.h"
#include "nel/gui/lua_object.h"
//
#include <string>
class CReflectable;
namespace NLGUI
{
class CReflectable;
class CLuaState;
}
struct CClassInfo;
/** A property of a reflectable object
@ -367,5 +362,7 @@ private:
};
}
#endif

View file

@ -16,7 +16,6 @@
#include "nel/gui/lua_helper.h"
using namespace NLGUI;
#include <algorithm>
@ -92,6 +91,9 @@ std::ostream &operator<<(std::ostream &str, const ucstring &value)
return str << value.toString();
}
namespace NLGUI
{
struct CMiscFunctions
{
static std::string fileLookup(const std::string &fileName)
@ -220,6 +222,8 @@ CLuaState * ELuaIHMException::getLuaState()
return CLuaManager::getInstance().getLuaState();
}
}
// ***************************************************************************
#define LUA_REGISTER_BASIC(_type_) \
luabind::detail::yes_t is_user_defined(luabind::detail::by_value<_type_>); \
@ -252,6 +256,9 @@ namespace luabind
}
}
namespace NLGUI
{
// ***************************************************************************
void CLuaIHM::registerBasics(CLuaState &ls)
{
@ -928,4 +935,4 @@ void CLuaIHM::getPoly2DOnStack(CLuaState &ls, sint index, NLMISC::CPolygon2D &de
}
}
}

View file

@ -18,6 +18,9 @@
#include "nel/gui/lua_manager.h"
#include "nel/gui/lua_helper.h"
namespace NLGUI
{
bool CLuaManager::debugLua = false;
CLuaManager* CLuaManager::instance = NULL;
@ -32,3 +35,5 @@ CLuaManager::~CLuaManager()
}
}

View file

@ -14,18 +14,12 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//#include "stdpch.h"
#include "nel/gui/lua_object.h"
#include "nel/gui/lua_ihm.h"
//#include "lua_ihm_ryzom.h"
#include "nel/gui/lua_helper.h"
using namespace NLGUI;
//
//#include "interface_manager.h"
////////////////
// CLuaObject //
////////////////
namespace NLGUI
{
// *************************************************
CLuaObject::CLuaObject(CLuaState &state, const char *id)
@ -654,3 +648,4 @@ void CLuaEnumeration::next()
}
}
}

View file

@ -17,6 +17,8 @@
#include "nel/gui/reflect.h"
namespace NLGUI
{
// Yoyo: Act like a singleton, else registerClass may crash.
CReflectSystem::TClassMap *CReflectSystem::_ClassMap= NULL;
@ -128,9 +130,12 @@ const CReflectedProperty *CReflectable::getReflectedProperty(const std::string &
return CReflectSystem::getProperty(this->getReflectedClassName(), propertyName, dspWarning);
}
}
#include "nel/gui/lua_manager.h"
namespace NLGUI
{
CReflectableRefPtrTarget::~CReflectableRefPtrTarget()
{
CLuaState *lua= CLuaManager::getInstance().getLuaState();
@ -189,3 +194,5 @@ const CReflectedProperty *CReflectableLuaRef::getProp(const char *luaStringPtr)
ci.LuaStrToProp[luaStringPtr] = lip;
return prop;
}
}

View file

@ -23,7 +23,13 @@ namespace NLMISC
class CVector2f;
}
namespace NLGUI
{
class CLuaObject;
}
using namespace NLGUI;
class CDecal;
// TODO nico : this would fit nicely in the particle system animation system (would be more flexible)

View file

@ -25,6 +25,8 @@
#include "interface_property.h"
#include "nel/gui/reflect.h"
using namespace NLGUI;
// ----------------------------------------------------------------------------
class CInterfaceGroup;

View file

@ -22,12 +22,20 @@
#include "nel/misc/cdb_branch.h"
#include "nel/misc/cdb_branch_observing_handler.h"
class CInterfaceElement;
namespace NLGUI
{
class CReflectedProperty;
}
class CInterfaceElement;
class CInterfaceExprValue;
class CInterfaceGroup;
class CInterfaceExprNode;
using namespace NLGUI;
/** A link in an interface.
* A link is an object that can read one or several values from the database, that can evaluate an expression
* on these database entries (simple computation, using the CInterfaceExpr class), and that can affect the result to

View file

@ -3,10 +3,12 @@
#include "nel/gui/lua_ihm.h"
using namespace NLGUI;
class CLuaIHMRyzom
{
public:
static void RegisterRyzomFunctions( NLGUI::CLuaState &ls );
static void RegisterRyzomFunctions( CLuaState &ls );
private:
static void createLuaEnumTable(CLuaState &ls, const std::string &str);

View file

@ -21,8 +21,10 @@
#include "nel/misc/class_registry.h"
#include "../interface_v3/interface_element.h"
namespace NLGUI
{
class CLuaObject;
}
namespace R2
{

View file

@ -21,7 +21,12 @@
#include "nel/gui/lua_object.h"
#include <map>
namespace NLGUI
{
class CLuaObject;
}
using namespace NLGUI;
namespace R2
{

View file

@ -20,8 +20,10 @@
namespace NLGUI
{
class CLuaState;
}
class CLuaString;
}
using namespace NLGUI;
namespace R2
{

View file

@ -24,8 +24,12 @@
#include "../interface_v3/group_map.h"
class CEntityCL;
namespace NLGUI
{
class CLuaObject;
}
class CEntityCL;
class CCtrlPolygon;
namespace R2

View file

@ -29,8 +29,9 @@ class CInterfaceManager;
namespace NLGUI
{
class CEventDescriptor;
}
class CLuaObject;
}
class CGroupMap;
namespace NLMISC

View file

@ -25,8 +25,10 @@
class CEntity;
class CEntityCL;
namespace NLGUI
{
class CLuaObject;
}
namespace R2
{

View file

@ -22,8 +22,11 @@
#include "nel/gui/lua_object.h"
class CEntity;
class CLuaObject;
namespace NLGUI
{
class CLuaObject;
}
namespace R2
{

View file

@ -25,8 +25,10 @@
#include "displayer_visual_entity.h"
class CEntity;
namespace NLGUI
{
class CLuaObject;
}
namespace R2
{

View file

@ -25,8 +25,10 @@
class CEntity;
namespace NLGUI
{
class CLuaObject;
}
namespace R2
{