X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Ftilt%2Ftilt-example.cpp;h=230704aef1e535cf529f5cd5890225cca42844bf;hb=334d1039d9372312a8f89666d007fb6803df53d0;hp=0adc72e3ab0aaeed34dd224b72fdbba6e19b8bd9;hpb=5b615fdbce6a5874deb62b0806a0bbef17c5f8df;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/tilt/tilt-example.cpp b/examples/tilt/tilt-example.cpp index 0adc72e..230704a 100644 --- a/examples/tilt/tilt-example.cpp +++ b/examples/tilt/tilt-example.cpp @@ -59,6 +59,9 @@ public: stage.GetRootLayer().TouchSignal().Connect( this, &TiltController::OnTouch ); CreateSensor(); + + // Connect signals to allow Back and Escape to exit. + stage.KeyEventSignal().Connect( this, &TiltController::OnKeyEvent ); } void CreateSensor() @@ -88,6 +91,21 @@ public: mTextLabel.RotateBy(pitchRot);; } + /** + * @brief OnKeyEvent signal handler. + * @param[in] event The key event information + */ + void OnKeyEvent( const KeyEvent& event ) + { + if( event.state == KeyEvent::Down ) + { + if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) + { + mApplication.Quit(); + } + } + } + private: Application& mApplication; TiltSensor mTiltSensor;