From Michael Polak, double click fixes/additions

This commit is contained in:
Robert Osfield
2006-07-27 12:32:40 +00:00
parent cd4a24731a
commit c0c5e73ff9
2 changed files with 40 additions and 0 deletions

View File

@@ -74,6 +74,9 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced
/** method for adapting mouse button pressed events, placing this event on the back of the event queue.*/
void mouseButtonPress(float x, float y, unsigned int button);
/** method for adapting mouse button pressed events, placing this event on the back of the event queue.*/
void mouseDoubleButtonPress(float x, float y, unsigned int button);
/** method for adapting mouse button release events, placing this event on the back of the event queue.*/
void mouseButtonRelease(float x, float y, unsigned int button);

View File

@@ -179,6 +179,43 @@ void EventQueue::mouseButtonPress(float x, float y, unsigned int button)
addEvent(event);
}
void EventQueue::mouseDoubleButtonPress(float x, float y, unsigned int button)
{
_accumulateEventState->setX(x);
_accumulateEventState->setY(y);
switch(button)
{
case(1):
_accumulateEventState->setButtonMask(GUIEventAdapter::LEFT_MOUSE_BUTTON | _accumulateEventState->getButtonMask());
break;
case(2):
_accumulateEventState->setButtonMask(GUIEventAdapter::MIDDLE_MOUSE_BUTTON | _accumulateEventState->getButtonMask());
break;
case(3):
_accumulateEventState->setButtonMask(GUIEventAdapter::RIGHT_MOUSE_BUTTON | _accumulateEventState->getButtonMask());
break;
}
GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
event->setEventType(GUIEventAdapter::DOUBLECLICK);
switch(button)
{
case(1):
event->setButton(GUIEventAdapter::LEFT_MOUSE_BUTTON);
break;
case(2):
event->setButton(GUIEventAdapter::MIDDLE_MOUSE_BUTTON);
break;
case(3):
event->setButton(GUIEventAdapter::RIGHT_MOUSE_BUTTON);
break;
}
addEvent(event);
}
void EventQueue::mouseButtonRelease(float x, float y, unsigned int button)
{
_accumulateEventState->setX(x);