From 1fde33cf8fcd7c716b97439f193cc4eb9efb1680 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 14 Apr 2019 15:01:18 +0300 Subject: [PATCH] Added: Allow to set webig window title from lua --HG-- branch : develop --- code/nel/include/nel/gui/group_html.h | 3 +++ code/nel/src/gui/group_html.cpp | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 20584b04e..55daa3c52 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -309,6 +309,7 @@ namespace NLGUI REFLECT_LUA_METHOD("renderHtml", luaRenderHtml) REFLECT_STRING("url", getURL, setURL) REFLECT_FLOAT("timeout", getTimeout, setTimeout) + REFLECT_STRING("title", getTitle, setTitle) REFLECT_EXPORT_END protected : @@ -407,6 +408,8 @@ namespace NLGUI // Set the title void setTitle (const ucstring &title); + void setTitle (const std::string &title); + std::string getTitle() const; // Lookup a url in local file system bool lookupLocalFile (std::string &result, const char *url, bool isUrl); diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 5e0812aaa..0bdebf865 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -5153,6 +5153,25 @@ namespace NLGUI } } + void CGroupHTML::setTitle(const std::string &title) + { + ucstring uctitle; + uctitle.fromUtf8(title); + + _TitleString.clear(); + if(!_TitlePrefix.empty()) + { + _TitleString = _TitlePrefix + " - "; + } + _TitleString += uctitle; + + setTitle(_TitleString); + } + + std::string CGroupHTML::getTitle() const { + return _TitleString.toUtf8(); + }; + // *************************************************************************** bool CGroupHTML::lookupLocalFile (string &result, const char *url, bool isUrl)