From 02dd8db21f1f1ac521e5b80eb483aba1eb15abe1 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 21 Sep 2016 20:11:13 +0300 Subject: [PATCH] Added: Lua function to render html string as new webpage --HG-- branch : develop --- code/nel/include/nel/gui/group_html.h | 2 ++ code/nel/src/gui/group_html.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 6b8212c6e..a794f349b 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -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 diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index f64fc631c..fa8265876 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -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) {