X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fbuilder%2Fexamples.cpp;h=15ba8e97419a0c78c36ff7679d6466f30fdcbca1;hb=d59e156051bffbef9e31abbb217a929427017f72;hp=4e02c7b3535962445ca01d06bfd5e772a9b3be36;hpb=23c1d23c92a09021d428949981b0d3a1865ff4e8;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index 4e02c7b..15ba8e9 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -242,17 +242,7 @@ public: void SetTitle(const std::string& title) { - if(!mTitleActor) - { - mTitleActor = TextView::New(); - // Add title to the tool bar. - mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter ); - } - - Font font = Font::New(); - mTitleActor.SetText( title ); - mTitleActor.SetSize( font.MeasureText( title ) ); - mTitleActor.SetStyleToCurrentText(DemoHelper::GetDefaultTextStyle()); + // TODO } bool OnToolSelectLayout( Toolkit::Button button ) @@ -280,6 +270,9 @@ public: { Stage stage = Stage::GetCurrent(); + mTapDetector = TapGestureDetector::New(); + mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap ); + if( mItemView ) { stage.Remove( mItemView ); @@ -361,15 +354,6 @@ public: } } - mTapDetector = TapGestureDetector::New(); - - for( unsigned int i = 0u; i < mItemView.GetChildCount(); ++i ) - { - mTapDetector.Attach( mItemView.GetChildAt(i) ); - } - - mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap ); - // Display item view on the stage stage.Add( mItemView ); @@ -393,7 +377,7 @@ public: SetTitle("View"); } - void OnTap( Actor actor, TapGesture tap ) + void OnTap( Actor actor, const TapGesture& tap ) { ItemId id = mItemView.GetItemId( actor ); @@ -402,11 +386,7 @@ public: Actor MenuItem(const std::string& text) { - TextView t = TextView::New(); - t.SetMarkupProcessingEnabled(true); - t.SetText( std::string("") + ShortName( text ) + std::string("") ); - t.SetTextAlignment( Alignment::HorizontalLeft ); - return t; + return Actor(); } bool OnTimer() @@ -424,8 +404,9 @@ public: Stage stage = Stage::GetCurrent(); builder = Builder::New(); + builder.QuitSignal().Connect( this, &ExampleApp::OnBuilderQuit ); - PropertyValueMap defaultDirs; + Property::Map defaultDirs; defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR; defaultDirs[ TOKEN_STRING(DALI_MODEL_DIR) ] = DALI_MODEL_DIR; defaultDirs[ TOKEN_STRING(DALI_SCRIPT_DIR) ] = DALI_SCRIPT_DIR; @@ -559,11 +540,33 @@ public: { if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) { - mApp.Quit(); + if ( mItemView.IsVisible() ) + { + mApp.Quit(); + } + else + { + EnterSelection(); + } } } } + /** + * 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; @@ -574,7 +577,6 @@ private: unsigned int mOrientation; Toolkit::ToolBar mToolBar; - TextView mTitleActor; ///< The Toolbar's Title. Layer mBuilderLayer;