From 713d2ab5b86b28ce95f6385ff11d6ac100658181 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Mon, 8 Sep 2014 17:15:15 +0100 Subject: [PATCH] (Builder) Enabled Quitting functionality via scripting Change-Id: I00f7d809e7f0b409813420e0fda539a64d0659de --- examples/builder/dali-builder.cpp | 6 ++++++ examples/builder/examples.cpp | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/examples/builder/dali-builder.cpp b/examples/builder/dali-builder.cpp index 100924a1..246daabc 100644 --- a/examples/builder/dali-builder.cpp +++ b/examples/builder/dali-builder.cpp @@ -196,6 +196,7 @@ private: Stage stage = Stage::GetCurrent(); builder = Builder::New(); + builder.QuitSignal().Connect( this, &ExampleApp::OnBuilderQuit ); PropertyValueMap defaultDirs; defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR; @@ -281,6 +282,11 @@ private: } } + void OnBuilderQuit() + { + mApp.Quit(); + } + Builder mBuilder; }; diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index b2c1106f..eaa59396 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -431,6 +431,7 @@ public: Stage stage = Stage::GetCurrent(); builder = Builder::New(); + builder.QuitSignal().Connect( this, &ExampleApp::OnBuilderQuit ); PropertyValueMap defaultDirs; defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR; @@ -578,6 +579,21 @@ public: } } + /** + * Event handler when Builder wants to quit (we only want to close the shown json unless we're at the top-level) + */ + void OnBuilderQuit() + { + if ( mItemView.IsVisible() ) + { + mApp.Quit(); + } + else + { + EnterSelection(); + } + } + private: Application& mApp; -- 2.34.1