Added: Allow to set webig window title from lua

--HG--
branch : develop
This commit is contained in:
Nimetu 2019-04-14 15:01:18 +03:00
parent 86db1f29ac
commit 1fde33cf8f
2 changed files with 22 additions and 0 deletions

View file

@ -309,6 +309,7 @@ namespace NLGUI
REFLECT_LUA_METHOD("renderHtml", luaRenderHtml) REFLECT_LUA_METHOD("renderHtml", luaRenderHtml)
REFLECT_STRING("url", getURL, setURL) REFLECT_STRING("url", getURL, setURL)
REFLECT_FLOAT("timeout", getTimeout, setTimeout) REFLECT_FLOAT("timeout", getTimeout, setTimeout)
REFLECT_STRING("title", getTitle, setTitle)
REFLECT_EXPORT_END REFLECT_EXPORT_END
protected : protected :
@ -407,6 +408,8 @@ namespace NLGUI
// Set the title // Set the title
void setTitle (const ucstring &title); void setTitle (const ucstring &title);
void setTitle (const std::string &title);
std::string getTitle() const;
// Lookup a url in local file system // Lookup a url in local file system
bool lookupLocalFile (std::string &result, const char *url, bool isUrl); bool lookupLocalFile (std::string &result, const char *url, bool isUrl);

View file

@ -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) bool CGroupHTML::lookupLocalFile (string &result, const char *url, bool isUrl)