Merge branch 'cst-next' of git://coolstreamtech.de/cst-public-gui-neutrino into ni/cst-next

Origin commit data
------------------
Branch: ni/coolstream
Commit: ed9d7b641c
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-08-21 (Sun, 21 Aug 2016)


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

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-08-21 21:08:03 +02:00
6 changed files with 59 additions and 6 deletions

View File

@@ -170,8 +170,13 @@ void CComponentsWindow::initWindowSize()
if (width == 0)
width = frameBuffer->getScreenWidth();
else if ((unsigned)width > frameBuffer->getScreenWidth())
width = frameBuffer->getScreenWidth();
if (height == 0)
height = frameBuffer->getScreenHeight();
else if((unsigned)height > frameBuffer->getScreenHeight())
height = frameBuffer->getScreenHeight();
}
void CComponentsWindow::initWindowPos()

View File

@@ -57,6 +57,8 @@ void CLuaInstCCPicture::CCPictureRegister(lua_State *L)
{ "hide", CLuaInstCCPicture::CCPictureHide },
{ "setPicture", CLuaInstCCPicture::CCPictureSetPicture },
{ "setCenterPos", CLuaInstCCPicture::CCPictureSetCenterPos },
{ "getHeight", CLuaInstCCPicture::CCPictureGetHeight },
{ "getWidth", CLuaInstCCPicture::CCPictureGetWidth },
{ "__gc", CLuaInstCCPicture::CCPictureDelete },
{ NULL, NULL }
};
@@ -126,6 +128,26 @@ int CLuaInstCCPicture::CCPictureNew(lua_State *L)
return 1;
}
int CLuaInstCCPicture::CCPictureGetHeight(lua_State *L)
{
CLuaCCPicture *D = CCPictureCheck(L, 1);
if (!D) return 0;
int h = D->cp->getHeight();
lua_pushinteger(L, h);
return 1;
}
int CLuaInstCCPicture::CCPictureGetWidth(lua_State *L)
{
CLuaCCPicture *D = CCPictureCheck(L, 1);
if (!D) return 0;
int w = D->cp->getWidth();
lua_pushinteger(L, w);
return 1;
}
int CLuaInstCCPicture::CCPicturePaint(lua_State *L)
{
lua_assert(lua_istable(L,1));

View File

@@ -46,6 +46,8 @@ class CLuaInstCCPicture
static int CCPictureHide(lua_State *L);
static int CCPictureSetPicture(lua_State *L);
static int CCPictureSetCenterPos(lua_State *L);
static int CCPictureGetHeight(lua_State *L);
static int CCPictureGetWidth(lua_State *L);
static int CCPictureDelete(lua_State *L);
};

View File

@@ -140,14 +140,14 @@ int CLuaInstCCText::CCTextNew(lua_State *L)
CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL;
if(pw){
if(dx == -1)
dx = pw->getHeight();
if(dy == -1)
dy = pw->getWidth();
if(dy < 1)
dy = pw->getHeight();
if(dx < 1)
dx = pw->getWidth();
}
if(dx == -1)
if(dx < 1)
dx = 100;
if(dy == -1)
if(dy < 1)
dy = 100;
CLuaCCText **udata = (CLuaCCText **) lua_newuserdata(L, sizeof(CLuaCCText *));

View File

@@ -56,6 +56,7 @@ void CLuaInstCCWindow::CCWindowRegister(lua_State *L)
{ "header_height", CLuaInstCCWindow::CCWindowGetHeaderHeight_dep }, /* function 'header_height' is deprecated */
{ "footer_height", CLuaInstCCWindow::CCWindowGetFooterHeight_dep }, /* function 'footer_height' is deprecated */
{ "setCenterPos", CLuaInstCCWindow::CCWindowSetCenterPos },
{ "setDimensionsAll", CLuaInstCCWindow::CCWindowSetDimensionsAll },
{ "__gc", CLuaInstCCWindow::CCWindowDelete },
{ NULL, NULL }
};
@@ -295,6 +296,28 @@ int CLuaInstCCWindow::CCWindowGetFooterHeight(lua_State *L)
return 1;
}
int CLuaInstCCWindow::CCWindowSetDimensionsAll(lua_State *L)
{
CLuaCCWindow *D = CCWindowCheck(L, 1);
if (!D) return 0;
lua_Integer x = luaL_checkint(L, 2);
lua_Integer y = luaL_checkint(L, 3);
lua_Integer w = luaL_checkint(L, 4);
lua_Integer h = luaL_checkint(L, 5);
if(x>-1 && y > -1 && w > 1 && h > 1){
if (h > (lua_Integer)CFrameBuffer::getInstance()->getScreenHeight())
h = (lua_Integer)CFrameBuffer::getInstance()->getScreenHeight();
if (w > (lua_Integer)CFrameBuffer::getInstance()->getScreenWidth())
w = (lua_Integer)CFrameBuffer::getInstance()->getScreenWidth();
if(x > w)
x = 0;
if(y > h)
y = 0;
D->w->setDimensionsAll(x,y,w,h);
}
return 0;
}
int CLuaInstCCWindow::CCWindowSetCenterPos(lua_State *L)
{
lua_assert(lua_istable(L,1));

View File

@@ -51,6 +51,7 @@ class CLuaInstCCWindow
static int CCWindowGetFooterHeight_dep(lua_State *L); // function 'footer_height' is deprecated
static int CCWindowSetCenterPos(lua_State *L);
static int CCWindowDelete(lua_State *L);
static int CCWindowSetDimensionsAll(lua_State *L);
};
#endif //_LUACCWINDOW_H