From 06c0f6800c0c1b933b6b274da02227d9f0b7d226 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 27 Dec 2018 09:03:02 +0200 Subject: [PATCH] Added: CGroupHTML::clearRefresh() lua function --HG-- branch : develop --- code/nel/include/nel/gui/group_html.h | 4 ++++ code/nel/src/gui/group_html.cpp | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index dfd80dba9..7820cbd6a 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -262,6 +262,8 @@ namespace NLGUI void browseUndo (); // Redo browse: Browse the precedent url undoed. no op if none void browseRedo (); + // disable refresh button + void clearRefresh(); // clear undo/redo void clearUndoRedo(); @@ -270,6 +272,7 @@ namespace NLGUI void setURL(const std::string &url); + int luaClearRefresh(CLuaState &ls); int luaClearUndoRedo(CLuaState &ls); int luaBrowse(CLuaState &ls); int luaRefresh(CLuaState &ls); @@ -287,6 +290,7 @@ namespace NLGUI REFLECT_LUA_METHOD("browse", luaBrowse) REFLECT_LUA_METHOD("refresh", luaRefresh) REFLECT_LUA_METHOD("clearUndoRedo", luaClearUndoRedo) + REFLECT_LUA_METHOD("clearRefresh", luaClearRefresh) REFLECT_LUA_METHOD("removeContent", luaRemoveContent) REFLECT_LUA_METHOD("insertText", luaInsertText) REFLECT_LUA_METHOD("addString", luaAddString) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 032ffb666..6c1444f5c 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -5787,6 +5787,13 @@ namespace NLGUI return false; } + // *************************************************************************** + void CGroupHTML::clearRefresh() + { + _URL.clear(); + updateRefreshButton(); + } + // *************************************************************************** void CGroupHTML::clearUndoRedo() { @@ -5873,7 +5880,7 @@ namespace NLGUI { CCtrlBaseButton *butRefresh = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(_BrowseRefreshButton)); - bool enabled = !_Browsing && !_Connecting; + bool enabled = !_Browsing && !_Connecting && !_URL.empty(); if(butRefresh) butRefresh->setFrozen(!enabled); } @@ -5912,6 +5919,16 @@ namespace NLGUI return true; } + int CGroupHTML::luaClearRefresh(CLuaState &ls) + { + const char *funcName = "clearRefresh"; + CLuaIHM::checkArgCount(ls, funcName, 0); + + clearRefresh(); + + return 0; + } + int CGroupHTML::luaClearUndoRedo(CLuaState &ls) { const char *funcName = "clearUndoRedo";