diff --git a/builder/dali-builder.cpp b/builder/dali-builder.cpp index 1ce2ec4..d423d85 100644 --- a/builder/dali-builder.cpp +++ b/builder/dali-builder.cpp @@ -28,8 +28,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/com.samsung.dali-demo.xml b/com.samsung.dali-demo.xml index 3ced582..fd65a57 100644 --- a/com.samsung.dali-demo.xml +++ b/com.samsung.dali-demo.xml @@ -86,7 +86,7 @@ - + diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index 78c2aae..c2320eb 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -31,7 +31,7 @@ int main(int argc, char **argv) textdomain(DALI_DEMO_DOMAIN_LOCAL); setlocale(LC_ALL, DALI_LANG); - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); // Create the demo launcher DaliTableView demo(app); @@ -53,6 +53,7 @@ int main(int argc, char **argv) demo.AddExample(Example("builder.example", DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI)); demo.AddExample(Example("image-scaling-and-filtering.example", DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING)); demo.AddExample(Example("image-scaling-irregular-grid.example", DALI_DEMO_STR_TITLE_IMAGE_SCALING)); + demo.AddExample(Example("text-field.example", DALI_DEMO_STR_TITLE_TEXT_FIELD)); demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL)); demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE)); demo.AddExample(Example("text-label-emojis.example", DALI_DEMO_STR_TITLE_EMOJI_TEXT)); diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 392e582..96d33b5 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include // INTERNAL INCLUDES #include "shared/view.h" @@ -202,8 +204,6 @@ void DaliTableView::SortAlphabetically( bool sortAlphabetically ) void DaliTableView::Initialize( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect( this, &DaliTableView::OnKeyEvent ); const Vector2 stageSize = Stage::GetCurrent().GetSize(); @@ -317,12 +317,10 @@ void DaliTableView::Initialize( Application& application ) winHandle.RemoveAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); // Set initial orientation - Dali::Orientation orientation = winHandle.GetOrientation(); - - unsigned int degrees = winHandle.GetOrientation().GetDegrees(); + unsigned int degrees = 0; Rotate( degrees ); - orientation.ChangedSignal().Connect( this, &DaliTableView::OrientationChanged ); + //orientation.ChangedSignal().Connect( this, &DaliTableView::OrientationChanged ); winHandle.ShowIndicator( Dali::Window::INVISIBLE ); @@ -389,12 +387,12 @@ void DaliTableView::Populate() const Example& example = ( *iter ); Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), true ); - FocusManager focusManager = FocusManager::Get(); - focusManager.SetFocusOrder( tile, ++exampleCount ); - focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_LABEL, + AccessibilityFocusManager accessibilityFocusManager = AccessibilityFocusManager::Get(); + accessibilityFocusManager.SetFocusOrder( tile, ++exampleCount ); + accessibilityFocusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityFocusManager::ACCESSIBILITY_LABEL, example.title ); - focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_TRAIT, "Tile" ); - focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_HINT, + accessibilityFocusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityFocusManager::ACCESSIBILITY_TRAIT, "Tile" ); + accessibilityFocusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityFocusManager::ACCESSIBILITY_HINT, "You can run this example" ); tile.SetPadding( Padding( margin, margin, margin, margin ) ); @@ -553,7 +551,7 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event ) std::string name = actor.GetName(); ExampleMapConstIter iter = mExampleMap.find( name ); - FocusManager focusManager = FocusManager::Get(); + AccessibilityFocusManager accessibilityFocusManager = AccessibilityFocusManager::Get(); if( iter != mExampleMap.end() ) { @@ -596,11 +594,11 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation& source ) if( name == BUTTON_QUIT ) { // Move focus to the OK button - FocusManager focusManager = FocusManager::Get(); + AccessibilityFocusManager accessibilityFocusManager = AccessibilityFocusManager::Get(); // Enable the group mode and wrap mode - focusManager.SetGroupMode( true ); - focusManager.SetWrapMode( true ); + accessibilityFocusManager.SetGroupMode( true ); + accessibilityFocusManager.SetWrapMode( true ); } } else @@ -632,8 +630,8 @@ void DaliTableView::OnScrollComplete( const Dali::Vector2& position ) mScrolling = false; // move focus to 1st item of new page - FocusManager focusManager = FocusManager::Get(); - focusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) ); + AccessibilityFocusManager accessibilityFocusManager = AccessibilityFocusManager::Get(); + accessibilityFocusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) ); } bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event ) @@ -892,7 +890,7 @@ void DaliTableView::PlayAnimation() mAnimationTimer.SetInterval( BACKGROUND_ANIMATION_DURATION ); } -Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction ) +Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction ) { Actor nextFocusActor = proposed; @@ -907,22 +905,22 @@ Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali:: // in the given direction. We should work out which page to scroll to next. int currentPage = mScrollView.GetCurrentPage(); int newPage = currentPage; - if( direction == Dali::Toolkit::Control::Left ) + if( direction == Dali::Toolkit::Control::KeyboardFocus::LEFT ) { newPage--; } - else if( direction == Dali::Toolkit::Control::Right ) + else if( direction == Dali::Toolkit::Control::KeyboardFocus::RIGHT ) { newPage++; } - newPage = std::max(0, std::min(static_cast(mScrollRulerX->GetTotalPages() - 1), newPage)); + newPage = std::max(0, std::min(mTotalPages - 1, newPage)); if( newPage == currentPage ) { - if( direction == Dali::Toolkit::Control::Left ) + if( direction == Dali::Toolkit::Control::KeyboardFocus::LEFT ) { - newPage = mScrollRulerX->GetTotalPages() - 1; - } else if( direction == Dali::Toolkit::Control::Right ) + newPage = mTotalPages - 1; + } else if( direction == Dali::Toolkit::Control::KeyboardFocus::RIGHT ) { newPage = 0; } @@ -931,7 +929,7 @@ Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali:: // Scroll to the page in the given direction mScrollView.ScrollTo(newPage); - if( direction == Dali::Toolkit::Control::Left ) + if( direction == Dali::Toolkit::Control::KeyboardFocus::LEFT ) { // Work out the cell position for the last tile int remainingExamples = mExampleList.size() - newPage * EXAMPLES_PER_PAGE; @@ -939,7 +937,7 @@ Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali:: int colPos = remainingExamples >= EXAMPLES_PER_PAGE ? EXAMPLES_PER_ROW - 1 : ( remainingExamples % EXAMPLES_PER_PAGE - rowPos * EXAMPLES_PER_ROW - 1 ); // Move the focus to the last tile in the new page. - nextFocusActor = mPages[newPage].GetChildAt(colPos * EXAMPLES_PER_ROW + rowPos); + nextFocusActor = mPages[newPage].GetChildAt(rowPos * EXAMPLES_PER_ROW + colPos); } else { diff --git a/demo/dali-table-view.h b/demo/dali-table-view.h index 163b52d..c8fcf58 100644 --- a/demo/dali-table-view.h +++ b/demo/dali-table-view.h @@ -22,6 +22,7 @@ #include #include +#include class Example; @@ -344,7 +345,7 @@ private: // Application callbacks & implementation * @param[in] direction The direction to move the focus * @return The actor to move the keyboard focus to. */ - Dali::Actor OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction ); + Dali::Actor OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction ); /** * Callback when the keyboard focused actor is activated. diff --git a/examples/atlas/atlas-example.cpp b/examples/atlas/atlas-example.cpp index c6cc76f..5cce8fb 100644 --- a/examples/atlas/atlas-example.cpp +++ b/examples/atlas/atlas-example.cpp @@ -226,7 +226,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - gApplication = Application::New( &argc, &argv ); + gApplication = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( gApplication ); diff --git a/examples/blocks/blocks-example.cpp b/examples/blocks/blocks-example.cpp index 23775b2..20a3e93 100644 --- a/examples/blocks/blocks-example.cpp +++ b/examples/blocks/blocks-example.cpp @@ -226,8 +226,6 @@ public: */ void Create(Application& application) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent); // Creates a default view with a default tool bar. @@ -841,7 +839,7 @@ void RunTest(Application& app) int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/bubble-effect/bubble-effect-example.cpp b/examples/bubble-effect/bubble-effect-example.cpp index 15b7ba1..0ac4d76 100644 --- a/examples/bubble-effect/bubble-effect-example.cpp +++ b/examples/bubble-effect/bubble-effect-example.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "shared/view.h" using namespace Dali; @@ -91,8 +92,6 @@ private: // The Init signal is received once (only) during the Application lifetime void Create(Application& app) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); Vector2 stageSize = stage.GetSize(); @@ -101,9 +100,8 @@ private: // Creates a default view with a default tool bar. // The view is added to the stage. Toolkit::ToolBar toolBar; - Toolkit::Control view; Layer content = DemoHelper::CreateView( app, - view, + mBackground, toolBar, "", TOOLBAR_IMAGE, @@ -141,16 +139,14 @@ private: content.Add( bubbleRoot ); // Add the background image actor to stage - mBackgroundActor = ImageActor::New( mBackgroundImage ); - mBackgroundActor.SetParentOrigin( ParentOrigin::CENTER ); - content.Add(mBackgroundActor); + mBackground.SetBackgroundImage( mBackgroundImage ); // Set up the timer to emit bubble regularly when the finger is touched down but not moved mTimerForBubbleEmission = Timer::New( mTimerInterval ); mTimerForBubbleEmission.TickSignal().Connect(this, &BubbleEffectExample::OnTimerTick); // Connect the callback to the touch signal on the background - mBackgroundActor.TouchedSignal().Connect( this, &BubbleEffectExample::OnTouch ); + mBackground.TouchedSignal().Connect( this, &BubbleEffectExample::OnTouch ); } @@ -260,7 +256,7 @@ private: mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); - mBackgroundActor.SetImage( mBackgroundImage ); + mBackground.SetBackgroundImage( mBackgroundImage ); } else if( button == mChangeBubbleShapeButton ) { @@ -287,7 +283,7 @@ private: Application& mApp; Image mBackgroundImage; - ImageActor mBackgroundActor; + Dali::Toolkit::Control mBackground; Toolkit::BubbleEmitter mBubbleEmitter; Animation mEmitAnimation; @@ -322,7 +318,7 @@ RunTest(Application& app) int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index e958659..79f50a1 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -22,9 +22,10 @@ #include #include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -492,8 +493,6 @@ public: void Create(Application& app) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleApp::OnKeyEvent); @@ -617,7 +616,7 @@ int main(int argc, char **argv) } } - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); ExampleApp dali_app(app); diff --git a/examples/buttons/buttons-example.cpp b/examples/buttons/buttons-example.cpp index 739d357..1dea9c4 100644 --- a/examples/buttons/buttons-example.cpp +++ b/examples/buttons/buttons-example.cpp @@ -96,8 +96,6 @@ class ButtonsController: public ConnectionTracker { // The Init signal is received once (only) during the Application lifetime - DemoHelper::RequestThemeChange(); - // Respond to key events Stage::GetCurrent().KeyEventSignal().Connect(this, &ButtonsController::OnKeyEvent); @@ -527,7 +525,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/cluster/cluster-example.cpp b/examples/cluster/cluster-example.cpp index 2de4b3d..268bf57 100644 --- a/examples/cluster/cluster-example.cpp +++ b/examples/cluster/cluster-example.cpp @@ -21,6 +21,9 @@ #include "shared/view.h" #include #include +#include +#include +#include #include "cluster.h" #include "cluster-style.h" @@ -357,8 +360,6 @@ public: */ void Create(Application& application) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &ClusterController::OnKeyEvent); // The Init signal is received once (only) during the Application lifetime @@ -779,7 +780,7 @@ void RunTest(Application& app) // int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/cluster/cluster-impl.cpp b/examples/cluster/cluster-impl.cpp index 1185549..a37214e 100644 --- a/examples/cluster/cluster-impl.cpp +++ b/examples/cluster/cluster-impl.cpp @@ -23,7 +23,9 @@ #include // for strcmp #include #include +#include #include +#include #include // INTERNAL INCLUDES @@ -92,7 +94,7 @@ void Cluster::OnInitialize() { } -void Cluster::OnControlSizeSet( const Vector3& targetSize ) +void Cluster::OnSizeSet( const Vector3& targetSize ) { mClusterSize = targetSize; GetImpl(mClusterStyle).SetClusterSize(targetSize); @@ -475,17 +477,21 @@ void Cluster::UpdateTitle(float duration) } } -void Cluster::DoExpandAction(const PropertyValueContainer& attributes) +void Cluster::DoExpandAction(const Property::Map& attributes) { - if(attributes.size() >= 1) + Property::Value* value = attributes.Find( "indices" ); + + if( value ) { - for(PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter) + if( value->GetType() == Property::ARRAY ) { - const Property::Value& value = *iter; - - DALI_ASSERT_ALWAYS(value.GetType() == Property::FLOAT); - unsigned int index = value.Get(); - ExpandChild( index ); + Property::Array array = value->Get(); + for( size_t i = 0; i < array.Size(); i++ ) + { + Property::Value& item = array[i]; + DALI_ASSERT_ALWAYS(item.GetType() == Property::INTEGER); + ExpandChild( item.Get() ); + } } } else @@ -494,17 +500,21 @@ void Cluster::DoExpandAction(const PropertyValueContainer& attributes) } } -void Cluster::DoCollapseAction(const PropertyValueContainer& attributes) +void Cluster::DoCollapseAction(const Property::Map& attributes) { - if(attributes.size() >= 1) + Property::Value* value = attributes.Find( "indices" ); + + if( value ) { - for(PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter) + if( value->GetType() == Property::ARRAY ) { - const Property::Value& value = *iter; - - DALI_ASSERT_ALWAYS(value.GetType() == Property::FLOAT); - unsigned int index = value.Get(); - CollapseChild( index, false ); + Property::Array array = value->Get(); + for( size_t i = 0; i < array.Size(); i++ ) + { + Property::Value& item = array[i]; + DALI_ASSERT_ALWAYS(item.GetType() == Property::INTEGER); + CollapseChild( item.Get(), false ); + } } } else @@ -513,27 +523,33 @@ void Cluster::DoCollapseAction(const PropertyValueContainer& attributes) } } -void Cluster::DoTransformAction(const PropertyValueContainer& attributes) + +void Cluster::DoTransformAction(const Property::Map& attributes) { - DALI_ASSERT_ALWAYS(attributes.size() >= 2); + typedef Dali::StringValuePair StringValuePair; - DALI_ASSERT_ALWAYS(attributes[0].GetType() == Property::FLOAT); - unsigned int index = attributes[0].Get(); + int index = 0; Vector3 position; Vector3 scale(Vector3::ONE); Quaternion rotation( Dali::ANGLE_0, Vector3::ZAXIS ); - DALI_ASSERT_ALWAYS(attributes[1].GetType() == Property::VECTOR3); - attributes[1].Get(position); - - if(attributes.size()>2) + for(size_t i = 0; i < attributes.Count(); i++) { - attributes[2].Get(scale); - } + StringValuePair& stringValue = attributes.GetPair(i); + Property::Type type = stringValue.second.GetType(); - if(attributes.size()>3) - { - attributes[3].Get(rotation); + if( Property::VECTOR3 == type && "position" == stringValue.first ) + { + stringValue.second.Get(position); + } + else if( Property::VECTOR3 == type && "scale" == stringValue.first ) + { + stringValue.second.Get(scale); + } + else if( "rotation" == stringValue.first ) + { + (void)Scripting::SetRotation(stringValue.second, rotation); + } } // wrap index around -1 => size - 1 @@ -547,7 +563,7 @@ void Cluster::OnControlChildRemove(Actor& child) child.RemoveConstraints(); } -bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes) +bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes) { bool ret = false; diff --git a/examples/cluster/cluster-impl.h b/examples/cluster/cluster-impl.h index f57c221..a81a5ea 100644 --- a/examples/cluster/cluster-impl.h +++ b/examples/cluster/cluster-impl.h @@ -212,7 +212,7 @@ private: * @param[in] attributes list of indices of actors to expand. * (if no attributes specifies, then all actors expand) */ - void DoExpandAction(const PropertyValueContainer& attributes); + void DoExpandAction(const Property::Map& attributes); /** * Action: Collapse @@ -221,7 +221,7 @@ private: * @param[in] attributes list of indices of actors to collapse. * (if no attributes specifies, then all actors collapse) */ - void DoCollapseAction(const PropertyValueContainer& attributes); + void DoCollapseAction(const Property::Map& attributes); /** * Action: Transform @@ -230,7 +230,7 @@ private: * * @param[in] attributes index and transform values. */ - void DoTransformAction(const PropertyValueContainer& attributes); + void DoTransformAction(const Property::Map& attributes); private: // From Control /** @@ -248,20 +248,20 @@ public: * @param[in] attributes The attributes with which to perfrom this action. * @return true if action has been accepted by this control */ - static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes); + static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes); private: // From Control /** - * @copydoc Demo::Control::OnInitialize() + * @copydoc Control::OnInitialize() */ virtual void OnInitialize(); /** * - * @copydoc Demo::Control::OnControlSizeSet( const Vector3& targetSize ) + * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize ) */ - virtual void OnControlSizeSet( const Vector3& targetSize ); + virtual void OnSizeSet( const Vector3& targetSize ); protected: diff --git a/examples/cube-transition-effect/cube-transition-effect-example.cpp b/examples/cube-transition-effect/cube-transition-effect-example.cpp index 5961390..73da808 100644 --- a/examples/cube-transition-effect/cube-transition-effect-example.cpp +++ b/examples/cube-transition-effect/cube-transition-effect-example.cpp @@ -23,6 +23,11 @@ #include #include +#include +#include +#include +#include + using namespace Dali; @@ -219,8 +224,6 @@ CubeTransitionApp::~CubeTransitionApp() void CubeTransitionApp::OnInit( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &CubeTransitionApp::OnKeyEvent); // Creates a default view with a default tool bar, the view is added to the stage. @@ -430,7 +433,7 @@ void CubeTransitionApp::OnKeyEvent(const KeyEvent& event) // Entry point for Linux & Tizen applications int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); CubeTransitionApp test( application ); application.MainLoop(); diff --git a/examples/dissolve-effect/dissolve-effect-example.cpp b/examples/dissolve-effect/dissolve-effect-example.cpp index 1267dc8..37e8d6b 100644 --- a/examples/dissolve-effect/dissolve-effect-example.cpp +++ b/examples/dissolve-effect/dissolve-effect-example.cpp @@ -23,6 +23,7 @@ #include #include +#include using namespace Dali; @@ -203,8 +204,6 @@ DissolveEffectApp::~DissolveEffectApp() void DissolveEffectApp::OnInit( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &DissolveEffectApp::OnKeyEvent); // Creates a default view with a default tool bar, the view is added to the stage. @@ -429,7 +428,7 @@ bool DissolveEffectApp::OnTimerTick() // Entry point for Linux & Tizen applications int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); DissolveEffectApp test( application ); application.MainLoop(); diff --git a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp index 882687a..a49d306 100644 --- a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp +++ b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "shared/view.h" #include @@ -169,9 +170,6 @@ public: // The Init signal is received once (only) during the Application lifetime void Create( Application& application ) { - // Apply the default theme: - DemoHelper::RequestThemeChange(); - // Get a handle to the stage Stage stage = Stage::GetCurrent(); @@ -730,7 +728,7 @@ void RunTest( Application& application ) // Entry point for Linux & Tizen applications int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp index 259f0d2..6d77a2e 100644 --- a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp +++ b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp @@ -287,8 +287,6 @@ public: { std::cout << "ImageScalingIrregularGridController::Create" << std::endl; - DemoHelper::RequestThemeChange(); - // Get a handle to the stage: Stage stage = Stage::GetCurrent(); @@ -611,7 +609,7 @@ void RunTest( Application& application ) /** Entry point for Linux & Tizen applications */ int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/item-view/item-view-example.cpp b/examples/item-view/item-view-example.cpp index 851cfee..5bbaa1f 100644 --- a/examples/item-view/item-view-example.cpp +++ b/examples/item-view/item-view-example.cpp @@ -203,8 +203,6 @@ public: */ void OnInit(Application& app) { - DemoHelper::RequestThemeChange(); - Stage stage = Dali::Stage::GetCurrent(); stage.KeyEventSignal().Connect(this, &ItemViewExample::OnKeyEvent); @@ -222,7 +220,7 @@ public: TOOLBAR_IMAGE, "" ); - app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &ItemViewExample::OnOrientationChanged ); + //app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &ItemViewExample::OnOrientationChanged ); // Create an edit mode button. (left of toolbar) Toolkit::PushButton editButton = Toolkit::PushButton::New(); @@ -315,7 +313,7 @@ public: mWhiteImage = BufferImage::WHITE(); } - Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocusNavigationDirection direction ) + Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocus::Direction direction ) { if ( !current && !proposed ) { @@ -991,7 +989,7 @@ void RunTest(Application& app) int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/logging/logging-example.cpp b/examples/logging/logging-example.cpp index aa8d0ae..5169629 100644 --- a/examples/logging/logging-example.cpp +++ b/examples/logging/logging-example.cpp @@ -18,7 +18,7 @@ #include "shared/view.h" #include #include -#include +#include #include using namespace Dali; @@ -144,8 +144,6 @@ class LoggingController: public ConnectionTracker { // The Init signal is received once (only) during the Application lifetime - DemoHelper::RequestThemeChange(); - mCurrentLogger = 0; mPerformanceLoggers.reserve( NUM_LOGGERS ); mPerformanceLoggers.resize( NUM_LOGGERS ); @@ -755,7 +753,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/magnifier/magnifier-example.cpp b/examples/magnifier/magnifier-example.cpp index 08c107e..10f104a 100644 --- a/examples/magnifier/magnifier-example.cpp +++ b/examples/magnifier/magnifier-example.cpp @@ -21,7 +21,7 @@ #include "shared/view.h" #include - +#include using namespace Dali; namespace @@ -193,8 +193,6 @@ public: */ void Create( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent); mStageSize = Stage::GetCurrent().GetSize(); @@ -415,7 +413,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/motion-blur/motion-blur-example.cpp b/examples/motion-blur/motion-blur-example.cpp index dbf58f9..0e9ae80 100644 --- a/examples/motion-blur/motion-blur-example.cpp +++ b/examples/motion-blur/motion-blur-example.cpp @@ -21,6 +21,8 @@ #include "shared/view.h" #include #include +#include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -189,8 +191,8 @@ public: winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); // set initial orientation - winHandle.GetOrientation().ChangedSignal().Connect( this, &MotionBlurExampleApp::OnOrientationChanged ); - unsigned int degrees = winHandle.GetOrientation().GetDegrees(); + // winHandle.GetOrientation().ChangedSignal().Connect( this, &MotionBlurExampleApp::OnOrientationChanged ); + unsigned int degrees = 0; Rotate( static_cast< DeviceOrientation >( degrees ) ); @@ -564,7 +566,7 @@ void RunTest(Application& app) // int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/motion-stretch/motion-stretch-example.cpp b/examples/motion-stretch/motion-stretch-example.cpp index 713a34f..0084cdd 100644 --- a/examples/motion-stretch/motion-stretch-example.cpp +++ b/examples/motion-stretch/motion-stretch-example.cpp @@ -21,6 +21,7 @@ #include "shared/view.h" #include #include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -124,8 +125,6 @@ public: { // The Init signal is received once (only) during the Application lifetime - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &MotionStretchExampleApp::OnKeyEvent); // Creates a default view with a default tool bar. @@ -166,8 +165,8 @@ public: winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE ); winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); - winHandle.GetOrientation().ChangedSignal().Connect( this, &MotionStretchExampleApp::OnOrientationChanged ); - unsigned int degrees = winHandle.GetOrientation().GetDegrees(); + // winHandle.GetOrientation().ChangedSignal().Connect( this, &MotionStretchExampleApp::OnOrientationChanged ); + unsigned int degrees = 0; Rotate( static_cast< DeviceOrientation >( degrees ) ); @@ -446,7 +445,7 @@ void RunTest(Application& app) // int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/new-window/new-window-example.cpp b/examples/new-window/new-window-example.cpp index 7e854b0..7ea4753 100644 --- a/examples/new-window/new-window-example.cpp +++ b/examples/new-window/new-window-example.cpp @@ -15,6 +15,8 @@ */ #include +#include + #include "shared/view.h" #include #include @@ -159,8 +161,6 @@ NewWindowController::NewWindowController( Application& application ) void NewWindowController::Create( Application& app ) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); stage.SetBackgroundColor(Color::YELLOW); @@ -540,7 +540,7 @@ void RunTest(Application& app) // int main(int argc, char **argv) { - gApplication = Application::New(&argc, &argv); + gApplication = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(gApplication); return 0; diff --git a/examples/page-turn-view/page-turn-view-example.cpp b/examples/page-turn-view/page-turn-view-example.cpp index 3596034..79b6ac2 100644 --- a/examples/page-turn-view/page-turn-view-example.cpp +++ b/examples/page-turn-view/page-turn-view-example.cpp @@ -17,6 +17,11 @@ #include #include +#include +#include +#include +#include + #include #include #include @@ -221,8 +226,6 @@ void PageTurnController::OnInit( Application& app ) { // The Init signal is received once ( only ) during the Application lifetime - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &PageTurnController::OnKeyEvent); Stage stage = Stage::GetCurrent(); @@ -242,7 +245,7 @@ void PageTurnController::OnInit( Application& app ) winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); // view will response to orientation change to display portrait or landscape views - app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted ); + //app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted ); mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize ); mPageTurnPortraitView.SetSpineShadowParameter( Vector2(70.f, 30.f) ); @@ -342,7 +345,7 @@ void PageTurnController::OnPageFinishedPan( PageTurnView pageTurnView ) // Entry point for applications int main( int argc, char **argv ) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); PageTurnController test ( app ); app.MainLoop(); diff --git a/examples/radial-menu/radial-menu-example.cpp b/examples/radial-menu/radial-menu-example.cpp index be8d6ee..7c96410 100644 --- a/examples/radial-menu/radial-menu-example.cpp +++ b/examples/radial-menu/radial-menu-example.cpp @@ -130,8 +130,6 @@ RadialMenuExample::~RadialMenuExample() void RadialMenuExample::OnInit(Application& app) { - DemoHelper::RequestThemeChange(); - Stage stage = Dali::Stage::GetCurrent(); // The Init signal is received once (only) during the Application lifetime @@ -300,7 +298,7 @@ void RunTest(Application app) // Entry point for Linux & Tizen applications int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/refraction-effect/refraction-effect-example.cpp b/examples/refraction-effect/refraction-effect-example.cpp index 8626c38..e98f0e1 100644 --- a/examples/refraction-effect/refraction-effect-example.cpp +++ b/examples/refraction-effect/refraction-effect-example.cpp @@ -233,8 +233,6 @@ private: // The Init signal is received once (only) during the Application lifetime void Create(Application& application) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); Vector2 stageSize = stage.GetSize(); @@ -601,7 +599,7 @@ RunTest(Application& app) int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/scripting/launcher.cpp b/examples/scripting/launcher.cpp index 9c48b3f..5c81a9b 100644 --- a/examples/scripting/launcher.cpp +++ b/examples/scripting/launcher.cpp @@ -48,7 +48,6 @@ Launcher::Launcher( Dali::Application application, std::string layoutFileName, s mJSONFileName(layoutFileName ), mJavaScriptFileName( scriptFileName ) { - mApplication.InitSignal().Connect( this, &Launcher::Create ); } @@ -58,8 +57,6 @@ Launcher::~Launcher() void Launcher::Create( Dali::Application& application ) { - DemoHelper::RequestThemeChange(); - TextLabel textActor = TextLabel::New( "JSON & JavaScript Launcher..." ); // Reposition the actor diff --git a/examples/scripting/launcher.h b/examples/scripting/launcher.h index dc56b42..0b5f97f 100644 --- a/examples/scripting/launcher.h +++ b/examples/scripting/launcher.h @@ -21,6 +21,8 @@ // EXTERNAL INCLUDES #include #include +#include +#include /** * Example app that can load both JSON and JavaScript files from command line diff --git a/examples/scripting/scripting-example.cpp b/examples/scripting/scripting-example.cpp index 6a9c4b9..a09a3d8 100644 --- a/examples/scripting/scripting-example.cpp +++ b/examples/scripting/scripting-example.cpp @@ -88,7 +88,7 @@ int main( int argc, char* argv[] ) } - Launcher daliApplication( Dali::Application::New( &argc, &argv ), jSONFileName, javaScriptFileName ); + Launcher daliApplication( Dali::Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ), jSONFileName, javaScriptFileName ); daliApplication.MainLoop(); diff --git a/examples/scroll-view/scroll-view-example.cpp b/examples/scroll-view/scroll-view-example.cpp index b5b511a..0485cad 100644 --- a/examples/scroll-view/scroll-view-example.cpp +++ b/examples/scroll-view/scroll-view-example.cpp @@ -157,8 +157,6 @@ public: */ void OnInit(Application& app) { - DemoHelper::RequestThemeChange(); - Stage stage = Dali::Stage::GetCurrent(); stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent); @@ -584,7 +582,7 @@ private: int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); ExampleController test(app); app.MainLoop(); return 0; diff --git a/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp b/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp index 7e3a22a..49e6142 100644 --- a/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp +++ b/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp @@ -20,6 +20,8 @@ #include #include +#include + #include using namespace Dali; @@ -120,8 +122,6 @@ public: */ void Create(Application& app) { - DemoHelper::RequestThemeChange(); - srand(0); // Want repeatable path Stage::GetCurrent().KeyEventSignal().Connect(this, &TestApp::OnKeyEvent); @@ -501,7 +501,7 @@ RunTest(Application& app) int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/size-negotiation/size-negotiation-example.cpp b/examples/size-negotiation/size-negotiation-example.cpp index af19e24..d2a92b9 100644 --- a/examples/size-negotiation/size-negotiation-example.cpp +++ b/examples/size-negotiation/size-negotiation-example.cpp @@ -18,6 +18,7 @@ #include "shared/view.h" #include #include +#include using namespace Dali; @@ -157,8 +158,6 @@ public: { // The Init signal is received once (only) during the Application lifetime - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); // Respond to key events @@ -1298,7 +1297,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/text-field/text-field-example.cpp b/examples/text-field/text-field-example.cpp index 12a29a9..3de4caf 100644 --- a/examples/text-field/text-field-example.cpp +++ b/examples/text-field/text-field-example.cpp @@ -22,7 +22,9 @@ // EXTERNAL INCLUDES #include +#include #include +#include // INTERNAL INCLUDES #include "shared/multi-language-strings.h" @@ -35,38 +37,11 @@ using namespace MultiLanguageStrings; namespace { - const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "button-up.9.png"; + const char* const FOLDER_ICON_IMAGE = DALI_IMAGE_DIR "folder_appicon_empty_bg.png"; const float BORDER_WIDTH = 4.0f; - const unsigned int KEY_ZERO = 10; - const unsigned int KEY_ONE = 11; - const unsigned int KEY_F = 41; - const unsigned int KEY_H = 43; - const unsigned int KEY_V = 55; - const unsigned int KEY_M = 58; - const unsigned int KEY_L = 46; - const unsigned int KEY_S = 39; - const unsigned int KEY_PLUS = 21; - const unsigned int KEY_MINUS = 20; - - const char* H_ALIGNMENT_STRING_TABLE[] = - { - "BEGIN", - "CENTER", - "END" - }; - - const unsigned int H_ALIGNMENT_STRING_COUNT = sizeof( H_ALIGNMENT_STRING_TABLE ) / sizeof( H_ALIGNMENT_STRING_TABLE[0u] ); - - const char* V_ALIGNMENT_STRING_TABLE[] = - { - "TOP", - "CENTER", - "BOTTOM" - }; - - const unsigned int V_ALIGNMENT_STRING_COUNT = sizeof( V_ALIGNMENT_STRING_TABLE ) / sizeof( V_ALIGNMENT_STRING_TABLE[0u] ); + const Vector3 POPUP_SIZE_FACTOR_TO_PARENT = Vector3( 0.0, 0.25, 0.0 ); } // unnamed namespace @@ -78,9 +53,7 @@ class TextFieldExample : public ConnectionTracker public: TextFieldExample( Application& application ) - : mApplication( application ), - mLanguageId( 0u ), - mAlignment( 0u ) + : mApplication( application ) { // Connect to the Application's Init signal mApplication.InitSignal().Connect( this, &TextFieldExample::Create ); @@ -96,44 +69,121 @@ public: */ void Create( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); - mTapGestureDetector = TapGestureDetector::New(); - mTapGestureDetector.Attach( stage.GetRootLayer() ); - mTapGestureDetector.DetectedSignal().Connect( this, &TextFieldExample::OnTap ); - + stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) ); stage.KeyEventSignal().Connect(this, &TextFieldExample::OnKeyEvent); + mButton = CreateFolderButton(); + mButton.ClickedSignal().Connect( this, &TextFieldExample::OnButtonClicked ); + stage.Add( mButton ); + } + + PushButton CreateFolderButton() + { + PushButton button = PushButton::New(); + ResourceImage image = ResourceImage::New( FOLDER_ICON_IMAGE ); + ImageActor folderButton = ImageActor::New( image ); + folderButton.SetColor( Color::WHITE ); + button.SetButtonImage( folderButton ); + button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + button.SetSize( image.GetWidth(), image.GetHeight() ); + + return button; + } + + bool OnButtonClicked( Toolkit::Button button ) + { + Stage stage = Stage::GetCurrent(); Vector2 stageSize = stage.GetSize(); - Control container = Control::New(); - container.SetName( "Container" ); - container.SetParentOrigin( ParentOrigin::CENTER ); - container.SetSize( Vector2(stageSize.width*0.6f, stageSize.width*0.6f) ); - container.SetBackgroundColor( Color::WHITE ); - container.GetChildAt(0).SetZ(-1.0f); - stage.Add( container ); + // Launch a pop-up containing TextField + mField = CreateTextField( stageSize, mButtonLabel ); + mPopup = CreatePopup( stageSize.width * 0.8f ); + mPopup.Add( mField ); + mPopup.OutsideTouchedSignal().Connect( this, &TextFieldExample::OnPopupOutsideTouched ); + mPopup.Show(); + + return true; + } - mField = TextField::New(); - mField.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - mField.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); - mField.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); - mField.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder" ); - mField.SetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name." ); - mField.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect( BORDER_WIDTH, BORDER_WIDTH, stageSize.width - BORDER_WIDTH*2, stageSize.height - BORDER_WIDTH*2 ) ); + TextField CreateTextField( const Vector2& stageSize, const std::string& text ) + { + TextField field = TextField::New(); + field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + field.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); + field.SetProperty( TextField::Property::TEXT, text ); + field.SetProperty( TextField::Property::TEXT_COLOR, Vector4( 0.0f, 1.0f, 1.0f, 1.0f ) ); // CYAN + field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder" ); + field.SetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name." ); + field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect( BORDER_WIDTH, BORDER_WIDTH, stageSize.width - BORDER_WIDTH*2, stageSize.height - BORDER_WIDTH*2 ) ); + + return field; + } - container.Add( mField ); + Popup CreatePopup( float width ) + { + Popup popup = Popup::New(); + popup.SetParentOrigin( ParentOrigin::CENTER ); + popup.SetAnchorPoint( AnchorPoint::CENTER ); + popup.SetSize( width, 0.0f ); + popup.HideTail(); + popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT ); + popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT ); + popup.TouchedSignal().Connect( this, &TextFieldExample::OnPopupTouched ); + + return popup; + } - Property::Value fieldText = mField.GetProperty( TextField::Property::TEXT ); + void OnPopupOutsideTouched() + { + // Update the folder text + if( mButton && mField ) + { + Property::Value text = mField.GetProperty( TextField::Property::TEXT ); + mButtonLabel = text.Get< std::string >(); + mButton.SetLabel( mButtonLabel ); + } - std::cout << "Displaying text: " << fieldText.Get< std::string >() << std::endl; + // Hide & discard the pop-up + if( mPopup ) + { + mPopup.Hide(); + } + mField.Reset(); + mPopup.Reset(); } - void OnTap( Actor actor, const TapGesture& tapGesture ) + bool OnPopupTouched( Actor actor, const TouchEvent& event ) { - mField.ClearKeyInputFocus(); + // End edit mode for TextField if parent Popup touched. + if(event.GetPointCount() > 0) + { + const TouchPoint& point = event.GetPoint(0); + switch(point.state) + { + case TouchPoint::Down: + { + // Update the folder text and lose focus for Key events + if( mButton && mField ) + { + Property::Value text = mField.GetProperty( TextField::Property::TEXT ); + mButtonLabel = text.Get< std::string >(); + mButton.SetLabel( mButtonLabel ); + mField.ClearKeyInputFocus(); + } + break; + } + default: + { + break; + } + } // end switch + } + + return true; } /** @@ -147,73 +197,6 @@ public: { mApplication.Quit(); } - else if( event.IsCtrlModifier() ) - { - switch( event.keyCode ) - { - // Select rendering back-end - case KEY_ZERO: // fall through - case KEY_ONE: - { - mField.SetProperty( TextField::Property::RENDERING_BACKEND, event.keyCode - 10 ); - break; - } - case KEY_H: // Horizontal alignment - { - if( ++mAlignment >= H_ALIGNMENT_STRING_COUNT ) - { - mAlignment = 0u; - } - - mField.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, H_ALIGNMENT_STRING_TABLE[ mAlignment ] ); - break; - } - case KEY_V: // Vertical alignment - { - if( ++mAlignment >= V_ALIGNMENT_STRING_COUNT ) - { - mAlignment = 0u; - } - - mField.SetProperty( TextField::Property::VERTICAL_ALIGNMENT, V_ALIGNMENT_STRING_TABLE[ mAlignment ] ); - break; - } - case KEY_L: // Language - { - const Language& language = LANGUAGES[ mLanguageId ]; - - mField.SetProperty( TextField::Property::TEXT, language.text ); - - if( ++mLanguageId >= NUMBER_OF_LANGUAGES ) - { - mLanguageId = 0u; - } - break; - } - case KEY_S: // Shadow color - { - if( Color::BLACK == mField.GetProperty( TextField::Property::SHADOW_COLOR ) ) - { - mField.SetProperty( TextField::Property::SHADOW_COLOR, Color::RED ); - } - else - { - mField.SetProperty( TextField::Property::SHADOW_COLOR, Color::BLACK ); - } - break; - } - case KEY_PLUS: // Increase shadow offset - { - mField.SetProperty( TextField::Property::SHADOW_OFFSET, mField.GetProperty( TextField::Property::SHADOW_OFFSET ) + Vector2( 1.0f, 1.0f ) ); - break; - } - case KEY_MINUS: // Decrease shadow offset - { - mField.SetProperty( TextField::Property::SHADOW_OFFSET, mField.GetProperty( TextField::Property::SHADOW_OFFSET ) - Vector2( 1.0f, 1.0f ) ); - break; - } - } - } } } @@ -221,12 +204,13 @@ private: Application& mApplication; - TextField mField; - - TapGestureDetector mTapGestureDetector; + // This button launches a pop-up containing TextField + PushButton mButton; + std::string mButtonLabel; - unsigned int mLanguageId; - unsigned int mAlignment; + // Pop-up contents + TextField mField; + Popup mPopup; }; void RunTest( Application& application ) @@ -239,7 +223,7 @@ void RunTest( Application& application ) /** Entry point for Linux & Tizen applications */ int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/text-label-emojis/text-label-emojis.cpp b/examples/text-label-emojis/text-label-emojis.cpp index bb1703b..7ec8f1e 100644 --- a/examples/text-label-emojis/text-label-emojis.cpp +++ b/examples/text-label-emojis/text-label-emojis.cpp @@ -142,7 +142,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/text-label-multi-language/text-label-multi-language-example.cpp b/examples/text-label-multi-language/text-label-multi-language-example.cpp index 6c30eb9..61af222 100644 --- a/examples/text-label-multi-language/text-label-multi-language-example.cpp +++ b/examples/text-label-multi-language/text-label-multi-language-example.cpp @@ -56,8 +56,6 @@ public: */ void Create( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent); @@ -146,7 +144,7 @@ void RunTest( Application& application ) /** Entry point for Linux & Tizen applications */ int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/text-label/text-label-example.cpp b/examples/text-label/text-label-example.cpp index 5c1b7b0..9d12f7d 100644 --- a/examples/text-label/text-label-example.cpp +++ b/examples/text-label/text-label-example.cpp @@ -34,7 +34,7 @@ using namespace MultiLanguageStrings; namespace { - const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "button-up.9.png"; + const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "grab-handle.png"; const unsigned int KEY_ZERO = 10; const unsigned int KEY_ONE = 11; @@ -97,8 +97,6 @@ public: */ void Create( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); stage.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent); @@ -109,16 +107,16 @@ public: mContainer.SetParentOrigin( ParentOrigin::CENTER ); mLayoutSize = Vector2(stageSize.width*0.6f, stageSize.width*0.6f); mContainer.SetSize( mLayoutSize ); + mContainer.SetDrawMode( DrawMode::OVERLAY ); stage.Add( mContainer ); // Resize the center layout when the corner is grabbed mGrabCorner = Control::New(); mGrabCorner.SetName( "GrabCorner" ); - mGrabCorner.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT ); + mGrabCorner.SetAnchorPoint( AnchorPoint::TOP_CENTER ); mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT ); - mGrabCorner.SetSize( Vector2(stageSize.width*0.1f, stageSize.width*0.1f) ); - mGrabCorner.SetZ(1.0f); - mGrabCorner.SetBackgroundColor( Color::YELLOW ); + mGrabCorner.SetBackgroundImage( ResourceImage::New( BACKGROUND_IMAGE ) ); + mGrabCorner.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); mContainer.Add( mGrabCorner ); mPanGestureDetector = PanGestureDetector::New(); @@ -285,7 +283,7 @@ void RunTest( Application& application ) /** Entry point for Linux & Tizen applications */ int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/text-message-field/text-message-field-example.cpp b/examples/text-message-field/text-message-field-example.cpp index d7403c0..d801c3b 100644 --- a/examples/text-message-field/text-message-field-example.cpp +++ b/examples/text-message-field/text-message-field-example.cpp @@ -158,7 +158,7 @@ void RunTest( Application& application ) /** Entry point for Linux & Tizen applications */ int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index 49866ef..673f133 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 1.0.41 +Version: 1.0.43 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/images/folder_appicon_empty_bg.png b/resources/images/folder_appicon_empty_bg.png new file mode 100644 index 0000000..32a47a5 --- /dev/null +++ b/resources/images/folder_appicon_empty_bg.png diff --git a/resources/images/grab-handle.png b/resources/images/grab-handle.png new file mode 100644 index 0000000..61ab852 --- /dev/null +++ b/resources/images/grab-handle.png diff --git a/resources/scripts/animated-colors.json b/resources/scripts/animated-colors.json index a7e268c..e60b7ab 100644 --- a/resources/scripts/animated-colors.json +++ b/resources/scripts/animated-colors.json @@ -18,12 +18,10 @@ "stage": [ { "type": "Control", - "relayout-enabled": false, + "draw-mode": "OVERLAY", "actors": [ { "type": "Control", - "relayout-enabled": true, - "actors": [], "name": "Control 8", "position": [ 0, @@ -62,12 +60,9 @@ }, { "type": "Control", - "relayout-enabled": false, "actors": [ { "type": "Control", - "relayout-enabled": false, - "actors": [], "name": "Container 2", "position": [ 0, @@ -106,12 +101,9 @@ }, { "type": "Control", - "relayout-enabled": false, "actors": [ { "type": "Control", - "relayout-enabled": false, - "actors": [], "name": "Container 4", "position": [ 0, @@ -187,12 +179,9 @@ }, { "type": "Control", - "relayout-enabled": false, "actors": [ { "type": "Control", - "relayout-enabled": false, - "actors": [], "name": "Container 5", "position": [ 0, @@ -231,12 +220,9 @@ }, { "type": "Control", - "relayout-enabled": false, "actors": [ { "type": "Control", - "relayout-enabled": false, - "actors": [], "name": "Container 7", "position": [ 0, @@ -312,12 +298,9 @@ }, { "type": "Control", - "relayout-enabled": false, "actors": [ { "type": "Control", - "relayout-enabled": false, - "actors": [], "name": "Container 8", "position": [ 0, @@ -356,12 +339,9 @@ }, { "type": "Control", - "relayout-enabled": false, "actors": [ { "type": "Control", - "relayout-enabled": false, - "actors": [], "name": "Container 10", "position": [ 0, @@ -548,12 +528,9 @@ }, { "type": "Control", - "relayout-enabled": false, "actors": [ { "type": "Control", - "relayout-enabled": false, - "actors": [], "name": "Control 4", "position": [ 0, @@ -629,15 +606,12 @@ }, { "type": "Control", - "relayout-enabled": false, "actors": [ { "type": "Control", - "relayout-enabled": false, "actors": [ { "type": "Control", - "actors": [], "name": "Container 13", "position": [ 0, @@ -713,8 +687,6 @@ }, { "type": "Control", - "relayout-enabled": false, - "actors": [], "name": "Container 11", "position": [ 0, @@ -753,16 +725,12 @@ }, { "type": "Control", - "relayout-enabled": false, "actors": [ { "type": "Control", - "relayout-enabled": false, "actors": [ { "type": "Control", - "relayout-enabled": false, - "actors": [], "name": "Container 15", "position": [ 0, @@ -838,8 +806,6 @@ }, { "type": "Control", - "relayout-enabled": false, - "actors": [], "name": "Container 16", "position": [ 0, @@ -949,7 +915,27 @@ 0.3411764705882353, 1 ] + }, + { + "type": "TextLabel", + "name": "text", + "parent-origin": "CENTER", + "anchor-point": "CENTER", + "text": "START", + "point-size": 20, + "signals": [ + { + "name": "tapped", + "action": "play", + "animation": "Animation_1" + }, + { + "name": "tapped", + "action": "play", + "animation": "HideText" } + ] + } ], "name": "Container 1", "position": [ @@ -986,26 +972,6 @@ 0.32941176470588235, 1 ] - }, - { - "type": "TextLabel", - "name": "text", - "parent-origin": "CENTER", - "anchor-point": "CENTER", - "text": "START", - "point-size": 20, - "signals": [ - { - "name": "tapped", - "action": "play", - "animation": "Animation_1" - }, - { - "name": "tapped", - "action": "play", - "animation": "HideText" - } - ] } ], "animations": { diff --git a/resources/scripts/background-color.json b/resources/scripts/background-color.json index 4d6051b..562b88e 100644 --- a/resources/scripts/background-color.json +++ b/resources/scripts/background-color.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,13 @@ // A TextLabel with a red background { "type": "TextLabel", + "draw-mode": "OVERLAY", "text": "Hello World", "parent-origin": "TOP_CENTER", "anchor-point": "TOP_CENTER", "background-color": [1, 0, 0, 1], + "position": [0, 50, 0], + "point-size": 40, "size": [400, 150, 1] }, diff --git a/resources/scripts/table-view.json b/resources/scripts/table-view.json index 0a9fdca..14b90c3 100644 --- a/resources/scripts/table-view.json +++ b/resources/scripts/table-view.json @@ -21,6 +21,7 @@ "type":"TableView", "background-color": [0.5,0.5,0,1], "parent-origin": "CENTER", + "draw-mode": "OVERLAY", "size":[400,500,1], "cell-padding": [10, 5], "layout-rows": { // set the height of the rows diff --git a/shared/dali-demo-strings.h b/shared/dali-demo-strings.h index 6f408d5..af8ace8 100644 --- a/shared/dali-demo-strings.h +++ b/shared/dali-demo-strings.h @@ -49,6 +49,7 @@ extern "C" #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI") #define DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING") #define DALI_DEMO_STR_TITLE_IMAGE_SCALING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_SCALING") +#define DALI_DEMO_STR_TITLE_TEXT_FIELD dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_FIELD") #define DALI_DEMO_STR_TITLE_TEXT_LABEL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL") #define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE") #define DALI_DEMO_STR_TITLE_EMOJI_TEXT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_EMOJI_TEXT") @@ -77,6 +78,7 @@ extern "C" #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI" #define DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING "Image Fitting and Sampling" #define DALI_DEMO_STR_TITLE_IMAGE_SCALING "Image Scaling Grid" +#define DALI_DEMO_STR_TITLE_TEXT_FIELD "Text Field" #define DALI_DEMO_STR_TITLE_TEXT_LABEL "Text Label" #define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE "Text Scripts" #define DALI_DEMO_STR_TITLE_EMOJI_TEXT "Emoji Text" diff --git a/shared/view.h b/shared/view.h index 44b6663..dcf8e9a 100644 --- a/shared/view.h +++ b/shared/view.h @@ -19,6 +19,9 @@ */ #include +#include +#include + namespace DemoHelper { @@ -50,13 +53,6 @@ const float DEFAULT_TEXT_STYLE_POINT_SIZE( 8.0f ); const Dali::Toolkit::Alignment::Padding DEFAULT_PLAY_PADDING(12.0f, 12.0f, 12.0f, 12.0f); const Dali::Toolkit::Alignment::Padding DEFAULT_MODE_SWITCH_PADDING(8.0f, 8.0f, 8.0f, 8.0f); -void RequestThemeChange() -{ - // Provide the stylesheet - Dali::Toolkit::StyleManager styleManager = Dali::Toolkit::StyleManager::Get(); - styleManager.RequestThemeChange( DALI_DEMO_THEME_PATH ); -} - float ScalePointSize(int pointSize) { Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi(); @@ -83,16 +79,12 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, // Tool bar Dali::Image image = Dali::ResourceImage::New( toolbarImagePath ); - Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image ); - toolBarBackground.SetName( "TOOLBAR_BACKGROUND" ); - toolBarBackground.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); toolBar = Dali::Toolkit::ToolBar::New(); toolBar.SetName( "TOOLBAR" ); - toolBar.SetBackground( toolBarBackground ); + toolBar.SetBackgroundImage( image ); toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); toolBar.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); - toolBarBackground.SetSortModifier(1.0f); // Add the tool bar to the too bar layer. toolBarLayer.Add( toolBar );