//! Connects to mouseDown, mouseDrag, mouseWheel and resize signals of \a window, with optional priority \a signalPriority void CameraUi::connect( const app::WindowRef &window, int signalPriority ) { mWindow = window; mSignalPriority = signalPriority; if( window ) { mMouseDownConnection = window->getSignalMouseDown().connect( signalPriority, [this]( app::MouseEvent &event ) { mouseDown( event ); } ); mMouseUpConnection = window->getSignalMouseUp().connect( signalPriority, [this]( app::MouseEvent &event ) { mouseUp( event ); } ); mMouseDragConnection = window->getSignalMouseDrag().connect( signalPriority, [this]( app::MouseEvent &event ) { mouseDrag( event ); } ); mMouseWheelConnection = window->getSignalMouseWheel().connect( signalPriority, [this]( app::MouseEvent &event ) { mouseWheel( event ); } ); mWindowResizeConnection = window->getSignalResize().connect( signalPriority, [this]() { setWindowSize( mWindow->getSize() ); if( mCamera ) mCamera->setAspectRatio( mWindow->getAspectRatio() ); } ); } else disconnect(); mLastAction = ACTION_NONE; }
void TreentTest::connect( app::WindowRef window ) { storeConnection( window->getSignalMouseDown().connect( [this]( const MouseEvent &e ) { mouseDown( e ); } ) ); storeConnection( window->getSignalMouseDrag().connect( [this]( const MouseEvent &e ) { mouseDrag( e ); } ) ); storeConnection( window->getSignalMouseUp().connect( [this]( const MouseEvent &e ) { mouseUp( e ); } ) ); }