From fd458d575164ada0070a06fb719d01266c6c8104 Mon Sep 17 00:00:00 2001 From: ulukyn Date: Wed, 21 Feb 2018 20:33:50 +0100 Subject: [PATCH] Added: setBackground lua method for group_html --HG-- branch : patches-from-atys --- code/nel/include/nel/gui/group_html.h | 2 ++ code/nel/src/gui/group_html.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 571ad7e35..ee87741d5 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -239,6 +239,7 @@ namespace NLGUI int luaShowDiv(CLuaState &ls); int luaParseHtml(CLuaState &ls); int luaRenderHtml(CLuaState &ls); + int luaSetBackground(CLuaState &ls); REFLECT_EXPORT_START(CGroupHTML, CGroupScrollText) REFLECT_LUA_METHOD("browse", luaBrowse) @@ -252,6 +253,7 @@ namespace NLGUI REFLECT_LUA_METHOD("showDiv", luaShowDiv) REFLECT_LUA_METHOD("parseHtml", luaParseHtml) REFLECT_LUA_METHOD("renderHtml", luaRenderHtml) + REFLECT_LUA_METHOD("setBackground", luaSetBackground) REFLECT_STRING("url", getURL, setURL) REFLECT_STRING("html", getHTML, setHTML) REFLECT_FLOAT("timeout", getTimeout, setTimeout) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index c0721f3ed..a2906f017 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -4509,6 +4509,23 @@ namespace NLGUI return 0; } +// *************************************************************************** + int CGroupHTML::luaSetBackground(CLuaState &ls) + { + const char *funcName = "renderHtml"; + CLuaIHM::checkArgCount(ls, funcName, 3); + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); + CLuaIHM::checkArgType(ls, funcName, 2, LUA_TBOOLEAN); + CLuaIHM::checkArgType(ls, funcName, 3, LUA_TBOOLEAN); + std::string image = ls.toString(1); + bool scale = ls.toBoolean(2); + bool repeat = ls.toBoolean(3); + + setBackground(image, scale, repeat); + + return 0; + } + // *************************************************************************** int CGroupHTML::luaInsertText(CLuaState &ls) {