khanat-opennel-code/code/ryzom/client/src/interface_v3/group_wheel.cpp

70 lines
2.7 KiB
C++
Raw Normal View History

2010-05-06 00:08:41 +00:00
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#include "stdpch.h"
//
#include "group_wheel.h"
#include "interface_manager.h"
NLMISC_REGISTER_OBJECT(CViewBase, CInterfaceGroupWheel, std::string, "group_wheel");
// *****************************************************************************************************************
2010-05-06 00:08:41 +00:00
CInterfaceGroupWheel::CInterfaceGroupWheel(const TCtorParam &param) : CInterfaceGroup(param)
{
_AHWheelUp = NULL;
_AHWheelDown = NULL;
}
// *****************************************************************************************************************
2010-05-06 00:08:41 +00:00
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);
2010-05-06 00:08:41 +00:00
return true;
}
// *****************************************************************************************************************
bool CInterfaceGroupWheel::handleEvent(const NLGUI::CEventDescriptor &event)
2010-05-06 00:08:41 +00:00
{
if (CInterfaceGroup::handleEvent(event)) return true;
if (event.getType() == NLGUI::CEventDescriptor::mouse)
2010-05-06 00:08:41 +00:00
{
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousewheel)
2010-05-06 00:08:41 +00:00
{
CInterfaceManager *im = CInterfaceManager::getInstance();
if (eventDesc.getWheel() > 0 && _AHWheelUp)
{
CAHManager::getInstance()->runActionHandler (_AHWheelUp, this, _AHWheelUpParams);
2010-05-06 00:08:41 +00:00
return true;
}
else if (_AHWheelDown)
{
CAHManager::getInstance()->runActionHandler (_AHWheelDown, this, _AHWheelDownParams);
2010-05-06 00:08:41 +00:00
return true;
}
}
}
return false;
}