Added: Lua function to render html string as new webpage

--HG--
branch : develop
This commit is contained in:
Nimetu 2016-09-21 20:11:13 +03:00
parent 338c1883bc
commit 02dd8db21f
2 changed files with 15 additions and 0 deletions

View file

@ -253,6 +253,7 @@ namespace NLGUI
int luaEndElement(CLuaState &ls);
int luaShowDiv(CLuaState &ls);
int luaParseHtml(CLuaState &ls);
int luaRenderHtml(CLuaState &ls);
REFLECT_EXPORT_START(CGroupHTML, CGroupScrollText)
REFLECT_LUA_METHOD("browse", luaBrowse)
@ -265,6 +266,7 @@ namespace NLGUI
REFLECT_LUA_METHOD("endElement", luaEndElement)
REFLECT_LUA_METHOD("showDiv", luaShowDiv)
REFLECT_LUA_METHOD("parseHtml", luaParseHtml)
REFLECT_LUA_METHOD("renderHtml", luaRenderHtml)
REFLECT_STRING("url", getURL, setURL)
REFLECT_FLOAT("timeout", getTimeout, setTimeout)
REFLECT_EXPORT_END

View file

@ -5500,6 +5500,19 @@ namespace NLGUI
return 0;
}
// ***************************************************************************
int CGroupHTML::luaRenderHtml(CLuaState &ls)
{
const char *funcName = "renderHtml";
CLuaIHM::checkArgCount(ls, funcName, 1);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING);
std::string html = ls.toString(1);
renderHtmlString(html);
return 0;
}
// ***************************************************************************
int CGroupHTML::luaInsertText(CLuaState &ls)
{