diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-02 22:55:08 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-02 22:55:08 (GMT) |
| commit | 4e09a077a4d7494d1c1e1f494cbc36fa9abcb19c (patch) | |
| tree | f76cf74aa260678cd230dba8955d378c5fa392f0 /src/cat/LuaLabel.cpp | |
| parent | b7616a91d860871a3e4ac46cba957633a93acb59 (diff) | |
| download | powder-4e09a077a4d7494d1c1e1f494cbc36fa9abcb19c.zip powder-4e09a077a4d7494d1c1e1f494cbc36fa9abcb19c.tar.gz | |
Textbox component for Lua interface API
Diffstat (limited to 'src/cat/LuaLabel.cpp')
| -rw-r--r-- | src/cat/LuaLabel.cpp | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/src/cat/LuaLabel.cpp b/src/cat/LuaLabel.cpp index c1d9497..e2ca56d 100644 --- a/src/cat/LuaLabel.cpp +++ b/src/cat/LuaLabel.cpp @@ -17,10 +17,12 @@ Luna<LuaLabel>::RegType LuaLabel::methods[] = { method(LuaLabel, text), method(LuaLabel, position), method(LuaLabel, size), + method(LuaLabel, visible), {0, 0} }; -LuaLabel::LuaLabel(lua_State * l) +LuaLabel::LuaLabel(lua_State * l) : + LuaComponent(l) { this->l = l; int posX = luaL_optinteger(l, 1, 0); @@ -29,12 +31,8 @@ LuaLabel::LuaLabel(lua_State * l) int sizeY = luaL_optinteger(l, 4, 10); std::string text = luaL_optstring(l, 5, ""); - lua_pushstring(l, "Luacon_ci"); - lua_gettable(l, LUA_REGISTRYINDEX); - ci = (LuaScriptInterface*)lua_touserdata(l, -1); - lua_pop(l, 1); - label = new ui::Label(ui::Point(posX, posY), ui::Point(sizeX, sizeY), text); + component = label; } int LuaLabel::text(lua_State * l) @@ -53,46 +51,6 @@ int LuaLabel::text(lua_State * l) } } -int LuaLabel::position(lua_State * l) -{ - int args = lua_gettop(l); - if(args) - { - luaL_checktype(l, 1, LUA_TNUMBER); - luaL_checktype(l, 2, LUA_TNUMBER); - label->Position = ui::Point(lua_tointeger(l, 1), lua_tointeger(l, 2)); - return 0; - } - else - { - lua_pushinteger(l, label->Position.X); - lua_pushinteger(l, label->Position.Y); - return 2; - } -} - -int LuaLabel::size(lua_State * l) -{ - int args = lua_gettop(l); - if(args) - { - luaL_checktype(l, 1, LUA_TNUMBER); - luaL_checktype(l, 2, LUA_TNUMBER); - label->Size = ui::Point(lua_tointeger(l, 1), lua_tointeger(l, 2)); - label->Invalidate(); - return 0; - } - else - { - lua_pushinteger(l, label->Size.X); - lua_pushinteger(l, label->Size.Y); - return 2; - } -} - LuaLabel::~LuaLabel() { - if(label->GetParentWindow()) - label->GetParentWindow()->RemoveComponent(label); - delete label; }
\ No newline at end of file |
