X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Frendering-radial-progress%2Fradial-progress.cpp;h=eb0fb7e9e56b947f5f0b5b175fb8bf1e90344f11;hb=daa23b3e551b781808cc9afc90e027975a4a765e;hp=69d6e46fb8e47bd47ff3ea040476743f2d4dcd1e;hpb=924ffe8fead8c95748015d4f6d0f2be3f2a3ebba;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/rendering-radial-progress/radial-progress.cpp b/examples/rendering-radial-progress/radial-progress.cpp index 69d6e46..eb0fb7e 100644 --- a/examples/rendering-radial-progress/radial-progress.cpp +++ b/examples/rendering-radial-progress/radial-progress.cpp @@ -127,6 +127,9 @@ public: Stage stage = Stage::GetCurrent(); stage.SetBackgroundColor( Color::BLACK ); + // Connect to the stage's key signal to allow Back and Escape to exit. + stage.KeyEventSignal().Connect( this, &RadialProgressController::OnKeyEvent ); + // 1. Create actor to show the effect mActor = Actor::New(); mActor.SetAnchorPoint( AnchorPoint::CENTER ); @@ -283,6 +286,23 @@ public: return renderer; } + /** + * @brief Called when any key event is received + * + * Will use this to quit the application if Back or the Escape key is received + * @param[in] event The key event information + */ + void OnKeyEvent( const KeyEvent& event ) + { + if( event.state == KeyEvent::Down ) + { + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) + { + mApplication.Quit(); + } + } + } + private: Application& mApplication; @@ -290,20 +310,10 @@ private: Actor mActor; }; -void RunTest( Application& application ) -{ - RadialProgressController test( application ); - - application.MainLoop(); -} - -// Entry point for Linux & Tizen applications -// int DALI_EXPORT_API main( int argc, char **argv ) { Application application = Application::New( &argc, &argv ); - - RunTest( application ); - + RadialProgressController test( application ); + application.MainLoop(); return 0; }