From 84d826462de4a9629c729ef733f5ecbe83dc93c6 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 17 Jun 2012 21:21:20 +0200 Subject: [PATCH] CHANGED: #1471 CGroupWheel is now in NELGUI library and is under the NLGUI namespace. --HG-- branch : gui-refactoring --- .../include/nel/gui}/group_wheel.h | 35 +++++----- code/nel/src/gui/group_wheel.cpp | 69 +++++++++++++++++++ .../client/src/interface_v3/group_wheel.cpp | 69 ------------------- 3 files changed, 88 insertions(+), 85 deletions(-) rename code/{ryzom/client/src/interface_v3 => nel/include/nel/gui}/group_wheel.h (61%) create mode 100644 code/nel/src/gui/group_wheel.cpp delete mode 100644 code/ryzom/client/src/interface_v3/group_wheel.cpp diff --git a/code/ryzom/client/src/interface_v3/group_wheel.h b/code/nel/include/nel/gui/group_wheel.h similarity index 61% rename from code/ryzom/client/src/interface_v3/group_wheel.h rename to code/nel/include/nel/gui/group_wheel.h index d2f12ca3c..c2c80dd46 100644 --- a/code/ryzom/client/src/interface_v3/group_wheel.h +++ b/code/nel/include/nel/gui/group_wheel.h @@ -21,22 +21,25 @@ #include "nel/gui/interface_group.h" - - -// Special group to handle the mouse wheel message -class CInterfaceGroupWheel : public CInterfaceGroup +namespace NLGUI { -public: - /// Constructor - CInterfaceGroupWheel(const TCtorParam ¶m); - /// Coming from CInterfaceElement - virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup); - virtual bool handleEvent (const NLGUI::CEventDescriptor &event); -private: - IActionHandler *_AHWheelUp; - CStringShared _AHWheelUpParams; - IActionHandler *_AHWheelDown; - CStringShared _AHWheelDownParams; -}; + + // Special group to handle the mouse wheel message + class CInterfaceGroupWheel : public CInterfaceGroup + { + public: + /// Constructor + CInterfaceGroupWheel(const TCtorParam ¶m); + /// Coming from CInterfaceElement + virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup); + virtual bool handleEvent (const NLGUI::CEventDescriptor &event); + private: + IActionHandler *_AHWheelUp; + CStringShared _AHWheelUpParams; + IActionHandler *_AHWheelDown; + CStringShared _AHWheelDownParams; + }; + +} #endif diff --git a/code/nel/src/gui/group_wheel.cpp b/code/nel/src/gui/group_wheel.cpp new file mode 100644 index 000000000..c7d6a57e2 --- /dev/null +++ b/code/nel/src/gui/group_wheel.cpp @@ -0,0 +1,69 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + + +// ---------------------------------------------------------------------------- +#include "nel/gui/group_wheel.h" + + +NLMISC_REGISTER_OBJECT(CViewBase, CInterfaceGroupWheel, std::string, "group_wheel"); + +namespace NLGUI +{ + + // ***************************************************************************************************************** + CInterfaceGroupWheel::CInterfaceGroupWheel(const TCtorParam ¶m) : CInterfaceGroup(param) + { + _AHWheelUp = NULL; + _AHWheelDown = NULL; + } + + // ***************************************************************************************************************** + bool CInterfaceGroupWheel::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) + { + if (!CInterfaceGroup::parse(cur, parentGroup)) return false; + CAHManager::getInstance()->parseAH(cur, "on_wheel_up", "on_wheel_up_params", _AHWheelUp, _AHWheelUpParams); + CAHManager::getInstance()->parseAH(cur, "on_wheel_down", "on_wheel_down_params", _AHWheelDown, _AHWheelDownParams); + return true; + } + + // ***************************************************************************************************************** + bool CInterfaceGroupWheel::handleEvent(const NLGUI::CEventDescriptor &event) + { + if (CInterfaceGroup::handleEvent(event)) return true; + if (event.getType() == NLGUI::CEventDescriptor::mouse) + { + const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event; + if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousewheel) + { + if (eventDesc.getWheel() > 0 && _AHWheelUp) + { + CAHManager::getInstance()->runActionHandler (_AHWheelUp, this, _AHWheelUpParams); + return true; + } + else if (_AHWheelDown) + { + CAHManager::getInstance()->runActionHandler (_AHWheelDown, this, _AHWheelDownParams); + return true; + } + } + } + return false; + } + +} + diff --git a/code/ryzom/client/src/interface_v3/group_wheel.cpp b/code/ryzom/client/src/interface_v3/group_wheel.cpp deleted file mode 100644 index b8b25c70b..000000000 --- a/code/ryzom/client/src/interface_v3/group_wheel.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - - -// ---------------------------------------------------------------------------- -#include "stdpch.h" -// -#include "group_wheel.h" -#include "interface_manager.h" - - - -NLMISC_REGISTER_OBJECT(CViewBase, CInterfaceGroupWheel, std::string, "group_wheel"); - -// ***************************************************************************************************************** -CInterfaceGroupWheel::CInterfaceGroupWheel(const TCtorParam ¶m) : CInterfaceGroup(param) -{ - _AHWheelUp = NULL; - _AHWheelDown = NULL; -} - -// ***************************************************************************************************************** -bool CInterfaceGroupWheel::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) -{ - if (!CInterfaceGroup::parse(cur, parentGroup)) return false; - CAHManager::getInstance()->parseAH(cur, "on_wheel_up", "on_wheel_up_params", _AHWheelUp, _AHWheelUpParams); - CAHManager::getInstance()->parseAH(cur, "on_wheel_down", "on_wheel_down_params", _AHWheelDown, _AHWheelDownParams); - return true; -} - -// ***************************************************************************************************************** -bool CInterfaceGroupWheel::handleEvent(const NLGUI::CEventDescriptor &event) -{ - if (CInterfaceGroup::handleEvent(event)) return true; - if (event.getType() == NLGUI::CEventDescriptor::mouse) - { - const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event; - if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousewheel) - { - CInterfaceManager *im = CInterfaceManager::getInstance(); - if (eventDesc.getWheel() > 0 && _AHWheelUp) - { - CAHManager::getInstance()->runActionHandler (_AHWheelUp, this, _AHWheelUpParams); - return true; - } - else if (_AHWheelDown) - { - CAHManager::getInstance()->runActionHandler (_AHWheelDown, this, _AHWheelDownParams); - return true; - } - } - } - return false; -} -