diff --git a/include/osgGA/EventQueue b/include/osgGA/EventQueue index b92fcbac8..27ece7762 100644 --- a/include/osgGA/EventQueue +++ b/include/osgGA/EventQueue @@ -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); diff --git a/src/osgGA/EventQueue.cpp b/src/osgGA/EventQueue.cpp index 267914b08..586c541c2 100644 --- a/src/osgGA/EventQueue.cpp +++ b/src/osgGA/EventQueue.cpp @@ -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);