mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 17:01:15 +02:00
CLuaInstance::SignalBoxNew: Add 'parent' parameter...
...for the integration of signalbox in a parent cwindow
This commit is contained in:
@@ -1636,15 +1636,19 @@ int CLuaInstance::SignalBoxNew(lua_State *L)
|
|||||||
std::string name, icon = std::string(NEUTRINO_ICON_INFO);
|
std::string name, icon = std::string(NEUTRINO_ICON_INFO);
|
||||||
int x = 110, y = 150, dx = 430, dy = 150;
|
int x = 110, y = 150, dx = 430, dy = 150;
|
||||||
int vertical = true;
|
int vertical = true;
|
||||||
|
CLuaCWindow* parent = NULL;
|
||||||
tableLookup(L, "x", x);
|
tableLookup(L, "x", x);
|
||||||
tableLookup(L, "y", y);
|
tableLookup(L, "y", y);
|
||||||
tableLookup(L, "dx", dx);
|
tableLookup(L, "dx", dx);
|
||||||
tableLookup(L, "dy", dy);
|
tableLookup(L, "dy", dy);
|
||||||
tableLookup(L, "vertical", vertical);
|
tableLookup(L, "vertical", vertical);
|
||||||
|
tableLookup(L, "parent", (void**)&parent);
|
||||||
|
|
||||||
|
CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL;
|
||||||
CLuaSignalBox **udata = (CLuaSignalBox **) lua_newuserdata(L, sizeof(CLuaSignalBox *));
|
CLuaSignalBox **udata = (CLuaSignalBox **) lua_newuserdata(L, sizeof(CLuaSignalBox *));
|
||||||
*udata = new CLuaSignalBox();
|
*udata = new CLuaSignalBox();
|
||||||
(*udata)->s = new CSignalBox(x, y, dx, dy, NULL, (vertical!=0)?true:false);
|
(*udata)->s = new CSignalBox(x, y, dx, dy, NULL, (vertical!=0)?true:false, pw);
|
||||||
|
(*udata)->parent = pw;
|
||||||
luaL_getmetatable(L, "signalbox");
|
luaL_getmetatable(L, "signalbox");
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -131,8 +131,9 @@ class CLuaSignalBox
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSignalBox *s;
|
CSignalBox *s;
|
||||||
CLuaSignalBox() { s = NULL; }
|
CComponentsForm *parent;
|
||||||
~CLuaSignalBox() { delete s; }
|
CLuaSignalBox() { s = NULL; parent = NULL;}
|
||||||
|
~CLuaSignalBox() { if (parent == NULL) delete s; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CLuaComponentsText
|
class CLuaComponentsText
|
||||||
|
Reference in New Issue
Block a user