src/gui/lua/lua_cc_text.cpp if dx and dy is not set and text have parent use Height and Width size from parent

Origin commit data
------------------
Branch: ni/coolstream
Commit: a648daba75
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2016-08-19 (Fri, 19 Aug 2016)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2016-08-19 21:17:45 +02:00
parent 59d3c49084
commit 0dc1041788

View File

@@ -77,7 +77,7 @@ int CLuaInstCCText::CCTextNew(lua_State *L)
lua_assert(lua_istable(L,1)); lua_assert(lua_istable(L,1));
CLuaCCWindow* parent = NULL; CLuaCCWindow* parent = NULL;
lua_Integer x=10, y=10, dx=100, dy=100; lua_Integer x=10, y=10, dx=-1, dy=-1;
std::string text = ""; std::string text = "";
std::string tmpMode = ""; std::string tmpMode = "";
lua_Integer mode = CTextBox::AUTO_WIDTH; lua_Integer mode = CTextBox::AUTO_WIDTH;
@@ -139,6 +139,16 @@ int CLuaInstCCText::CCTextNew(lua_State *L)
} }
CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL; CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL;
if(pw){
if(dx == -1)
dx = pw->getHeight();
if(dy == -1)
dy = pw->getWidth();
}
if(dx == -1)
dx = 100;
if(dy == -1)
dy = 100;
CLuaCCText **udata = (CLuaCCText **) lua_newuserdata(L, sizeof(CLuaCCText *)); CLuaCCText **udata = (CLuaCCText **) lua_newuserdata(L, sizeof(CLuaCCText *));
*udata = new CLuaCCText(); *udata = new CLuaCCText();