Added: CGroupHTML::clearRefresh() lua function

--HG--
branch : develop
This commit is contained in:
Nimetu 2018-12-27 09:03:02 +02:00
parent 2607db5b51
commit 06c0f6800c
2 changed files with 22 additions and 1 deletions

View file

@ -262,6 +262,8 @@ namespace NLGUI
void browseUndo (); void browseUndo ();
// Redo browse: Browse the precedent url undoed. no op if none // Redo browse: Browse the precedent url undoed. no op if none
void browseRedo (); void browseRedo ();
// disable refresh button
void clearRefresh();
// clear undo/redo // clear undo/redo
void clearUndoRedo(); void clearUndoRedo();
@ -270,6 +272,7 @@ namespace NLGUI
void setURL(const std::string &url); void setURL(const std::string &url);
int luaClearRefresh(CLuaState &ls);
int luaClearUndoRedo(CLuaState &ls); int luaClearUndoRedo(CLuaState &ls);
int luaBrowse(CLuaState &ls); int luaBrowse(CLuaState &ls);
int luaRefresh(CLuaState &ls); int luaRefresh(CLuaState &ls);
@ -287,6 +290,7 @@ namespace NLGUI
REFLECT_LUA_METHOD("browse", luaBrowse) REFLECT_LUA_METHOD("browse", luaBrowse)
REFLECT_LUA_METHOD("refresh", luaRefresh) REFLECT_LUA_METHOD("refresh", luaRefresh)
REFLECT_LUA_METHOD("clearUndoRedo", luaClearUndoRedo) REFLECT_LUA_METHOD("clearUndoRedo", luaClearUndoRedo)
REFLECT_LUA_METHOD("clearRefresh", luaClearRefresh)
REFLECT_LUA_METHOD("removeContent", luaRemoveContent) REFLECT_LUA_METHOD("removeContent", luaRemoveContent)
REFLECT_LUA_METHOD("insertText", luaInsertText) REFLECT_LUA_METHOD("insertText", luaInsertText)
REFLECT_LUA_METHOD("addString", luaAddString) REFLECT_LUA_METHOD("addString", luaAddString)

View file

@ -5787,6 +5787,13 @@ namespace NLGUI
return false; return false;
} }
// ***************************************************************************
void CGroupHTML::clearRefresh()
{
_URL.clear();
updateRefreshButton();
}
// *************************************************************************** // ***************************************************************************
void CGroupHTML::clearUndoRedo() void CGroupHTML::clearUndoRedo()
{ {
@ -5873,7 +5880,7 @@ namespace NLGUI
{ {
CCtrlBaseButton *butRefresh = dynamic_cast<CCtrlBaseButton *>(CWidgetManager::getInstance()->getElementFromId(_BrowseRefreshButton)); CCtrlBaseButton *butRefresh = dynamic_cast<CCtrlBaseButton *>(CWidgetManager::getInstance()->getElementFromId(_BrowseRefreshButton));
bool enabled = !_Browsing && !_Connecting; bool enabled = !_Browsing && !_Connecting && !_URL.empty();
if(butRefresh) if(butRefresh)
butRefresh->setFrozen(!enabled); butRefresh->setFrozen(!enabled);
} }
@ -5912,6 +5919,16 @@ namespace NLGUI
return true; return true;
} }
int CGroupHTML::luaClearRefresh(CLuaState &ls)
{
const char *funcName = "clearRefresh";
CLuaIHM::checkArgCount(ls, funcName, 0);
clearRefresh();
return 0;
}
int CGroupHTML::luaClearUndoRedo(CLuaState &ls) int CGroupHTML::luaClearUndoRedo(CLuaState &ls)
{ {
const char *funcName = "clearUndoRedo"; const char *funcName = "clearUndoRedo";