2006-07-18 23:21:48 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2004-08-02 17:11:31 +08:00
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
|
2006-03-08 22:09:47 +08:00
|
|
|
#include <osgGA/GUIEventAdapter>
|
2004-08-02 17:11:31 +08:00
|
|
|
|
|
|
|
using namespace osgGA;
|
|
|
|
|
2006-03-08 22:09:47 +08:00
|
|
|
GUIEventAdapter::GUIEventAdapter():
|
2007-01-24 20:21:29 +08:00
|
|
|
_handled(false),
|
2006-03-08 22:09:47 +08:00
|
|
|
_eventType(NONE),
|
|
|
|
_time(0.0),
|
2006-09-26 00:25:53 +08:00
|
|
|
_windowX(0),
|
|
|
|
_windowY(0),
|
|
|
|
_windowWidth(1280),
|
|
|
|
_windowHeight(1024),
|
2006-03-08 22:09:47 +08:00
|
|
|
_key(0),
|
|
|
|
_button(0),
|
|
|
|
_Xmin(0.0),
|
|
|
|
_Xmax(1.0),
|
|
|
|
_Ymin(0.0),
|
|
|
|
_Ymax(1.0),
|
|
|
|
_mx(0.5),
|
|
|
|
_my(0.5),
|
2006-07-04 22:18:44 +08:00
|
|
|
_pressure(0.0),
|
2006-03-08 22:09:47 +08:00
|
|
|
_buttonMask(0),
|
|
|
|
_modKeyMask(0),
|
2006-07-04 22:18:44 +08:00
|
|
|
_scrollingMotion(SCROLL_NONE),
|
|
|
|
_scrollingDeltaX(0),
|
|
|
|
_scrollingDeltaY(0),
|
|
|
|
_mouseYOrientation(Y_INCREASING_DOWNWARDS),
|
|
|
|
_tabletPointerType(UNKNOWN)
|
2006-03-08 22:09:47 +08:00
|
|
|
{}
|
|
|
|
|
2007-05-19 21:39:55 +08:00
|
|
|
GUIEventAdapter::GUIEventAdapter(const GUIEventAdapter& rhs,const osg::CopyOp& copyop):
|
|
|
|
osg::Object(rhs,copyop),
|
2007-01-24 20:21:29 +08:00
|
|
|
_handled(rhs._handled),
|
2006-03-08 22:09:47 +08:00
|
|
|
_eventType(rhs._eventType),
|
|
|
|
_time(rhs._time),
|
2006-09-26 00:25:53 +08:00
|
|
|
_windowX(rhs._windowX),
|
|
|
|
_windowY(rhs._windowY),
|
|
|
|
_windowWidth(rhs._windowWidth),
|
|
|
|
_windowHeight(rhs._windowHeight),
|
2006-03-08 22:09:47 +08:00
|
|
|
_key(rhs._key),
|
|
|
|
_button(rhs._button),
|
|
|
|
_Xmin(rhs._Xmin),
|
|
|
|
_Xmax(rhs._Xmax),
|
|
|
|
_Ymin(rhs._Ymin),
|
|
|
|
_Ymax(rhs._Ymax),
|
|
|
|
_mx(rhs._mx),
|
|
|
|
_my(rhs._my),
|
2006-07-04 22:18:44 +08:00
|
|
|
_pressure(rhs._pressure),
|
2006-03-08 22:09:47 +08:00
|
|
|
_buttonMask(rhs._buttonMask),
|
|
|
|
_modKeyMask(rhs._modKeyMask),
|
|
|
|
_scrollingMotion(rhs._scrollingMotion),
|
2006-07-04 22:18:44 +08:00
|
|
|
_scrollingDeltaX(rhs._scrollingDeltaX),
|
|
|
|
_scrollingDeltaY(rhs._scrollingDeltaY),
|
|
|
|
_mouseYOrientation(rhs._mouseYOrientation),
|
|
|
|
_tabletPointerType(rhs._tabletPointerType)
|
2006-03-08 22:09:47 +08:00
|
|
|
{}
|
|
|
|
|
2004-08-02 17:11:31 +08:00
|
|
|
GUIEventAdapter::~GUIEventAdapter()
|
|
|
|
{
|
|
|
|
}
|
2006-03-08 22:09:47 +08:00
|
|
|
|
2007-01-02 02:20:10 +08:00
|
|
|
void GUIEventAdapter::setWindowRectangle(int x, int y, int width, int height, bool updateMouseRange)
|
2006-09-26 00:25:53 +08:00
|
|
|
{
|
|
|
|
_windowX = x;
|
|
|
|
_windowY = y;
|
|
|
|
_windowWidth = width;
|
|
|
|
_windowHeight = height;
|
|
|
|
|
|
|
|
if (updateMouseRange)
|
|
|
|
{
|
2007-01-11 22:53:34 +08:00
|
|
|
setInputRange(0, 0, width, height);
|
2006-09-26 00:25:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void GUIEventAdapter::setInputRange(float Xmin, float Ymin, float Xmax, float Ymax)
|
2006-03-08 22:09:47 +08:00
|
|
|
{
|
|
|
|
_Xmin = Xmin;
|
|
|
|
_Ymin = Ymin;
|
|
|
|
_Xmax = Xmax;
|
|
|
|
_Ymax = Ymax;
|
|
|
|
}
|