1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef R2_DISPLAYER_LUA_H
21 #define R2_DISPLAYER_LUA_H
23 #include "displayer_base.h"
24 #include "nel/gui/lua_object.h"
25 #include "lua_event_forwarder.h"
30 class CDisplayerLua
: public CDisplayerBase
33 NLMISC_DECLARE_CLASS(R2::CDisplayerLua
);
35 // expected parameter is a ctor function
36 virtual bool init(const CLuaObject
¶meters
);
37 virtual void pushLuaAccess(CLuaState
&ls
);
38 // from CDisplayerBase
39 virtual void onActChanged();
40 virtual void onContinentChanged();
41 virtual void onPostCreate();
42 virtual void onCreate();
43 virtual void onErase();
44 virtual void onPreHrcMove(); // instance is about to move in the hierarchy of object
45 virtual void onPostHrcMove(); // instance has moved in the hierarchy of objects
46 virtual void onFocus(bool focused
);
47 virtual void onSelect(bool selected
);
48 virtual void onAttrModified(const std::string
&attrName
, sint32 index
);
49 //virtual void onTableModified(const std::string &tableName, const std::string &keyInTable, sint32 indexInTable);
50 // from CDisplayerBase : event from targeted instances
51 virtual void onTargetInstancePreHrcMove(const std::string
&refMakerAttr
, sint32 refMakerAttrIndex
);
52 virtual void onTargetInstancePostHrcMove(const std::string
&refMakerAttr
, sint32 refMakerAttrIndex
);
53 virtual void onTargetInstanceCreated(const std::string
&refMakerAttr
, sint32 refMakerAttrIndex
);
54 virtual void onTargetInstanceErased(const std::string
&refMakerAttr
, sint32 refMakerAttrIndex
);
55 virtual void onTargetInstanceEraseRequested(const std::string
&refMakerAttr
, sint32 refMakerAttrIndex
);
56 virtual void onTargetInstanceAttrModified( const std::string
&refMakerAttr
, sint32 refMakerAttrIndex
,
57 const std::string
&targetAttrName
, sint32 targetAttrIndex
);
59 class CToLua
: public CLuaEventForwarder
63 CLuaObject _LuaTable
; // reference to lua version of the displayer
64 CDisplayerLua
*_Displayer
;
65 virtual CLuaState
*getLua();
66 virtual void executeHandler(const CLuaString
&eventName
, int numArgs
);
67 void pushLuaAccess(CLuaState
&ls
);
68 CDisplayerLua
* getEnclosing();