From 17945d24b03b7c0d135085888f39dacb5233a1bd Mon Sep 17 00:00:00 2001 From: Inky Date: Tue, 30 Apr 2019 01:33:39 +0300 Subject: [PATCH] Added: CGroup menu set action handler --HG-- branch : develop --- code/nel/include/nel/gui/group_menu.h | 5 ++++ code/nel/src/gui/group_menu.cpp | 36 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/code/nel/include/nel/gui/group_menu.h b/code/nel/include/nel/gui/group_menu.h index cfe91f7f9..ecdd8aff0 100644 --- a/code/nel/include/nel/gui/group_menu.h +++ b/code/nel/include/nel/gui/group_menu.h @@ -137,6 +137,9 @@ namespace NLGUI const std::string getActionHandler(uint lineIndex) const; const std::string getActionHandlerParam(uint lineIndex) const; + void setActionHandler(uint lineIndex, const std::string &ah = ""); + void setActionHandlerParam(uint lineIndex, const std::string ¶ms = ""); + void openSubMenu (sint32 nb); void hideSubMenus (); @@ -330,6 +333,8 @@ namespace NLGUI const std::string getActionHandler(uint lineIndex) const; const std::string getActionHandlerParam(uint lineIndex) const; + void setActionHandler(uint lineIndex, const std::string &ah = ""); + void setActionHandlerParam(uint lineIndex, const std::string ¶ms = ""); void addLine (const ucstring &name, const std::string &ah = "", const std::string ¶ms = "", const std::string &id = std::string(), diff --git a/code/nel/src/gui/group_menu.cpp b/code/nel/src/gui/group_menu.cpp index d8b3452ed..15a655d76 100644 --- a/code/nel/src/gui/group_menu.cpp +++ b/code/nel/src/gui/group_menu.cpp @@ -1663,6 +1663,28 @@ namespace NLGUI return _Lines[lineIndex].AHParams; } + // ------------------------------------------------------------------------------------------------ + void CGroupSubMenu::setActionHandler(uint lineIndex, const std::string &ah) + { + if (lineIndex > _Lines.size()) + { + nlwarning("Bad index"); + return; + } + _Lines[lineIndex].AHName = ah; + } + + // ------------------------------------------------------------------------------------------------ + void CGroupSubMenu::setActionHandlerParam(uint lineIndex, const std::string ¶ms) + { + if (lineIndex > _Lines.size()) + { + nlwarning("Bad index"); + return; + } + _Lines[lineIndex].AHParams = params; + } + // ------------------------------------------------------------------------------------------------ void CGroupSubMenu::setSelectable(uint lineIndex, bool selectable) { @@ -2596,6 +2618,20 @@ namespace NLGUI return _RootMenu ? _RootMenu->getActionHandlerParam(lineIndex) : ""; } + // ------------------------------------------------------------------------------------------------ + void CGroupMenu::setActionHandler(uint lineIndex, const std::string &ah) + { + if (_RootMenu) + _RootMenu->setActionHandler(lineIndex, ah); + } + + // ------------------------------------------------------------------------------------------------ + void CGroupMenu::setActionHandlerParam(uint lineIndex, const std::string ¶ms) + { + if (_RootMenu) + _RootMenu->setActionHandlerParam(lineIndex, params); + } + // ------------------------------------------------------------------------------------------------ void CGroupMenu::setUserGroupRight(uint line, CInterfaceGroup *gr, bool ownerShip /*=true*/) {