/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
END_TEST;
}
+int UtcDaliControlWrapperRegisterVisualWithDepthIndexToSelf(void)
+{
+ ToolkitTestApplication application;
+
+ Test::ObjectDestructionTracker objectDestructionTracker;
+
+ {
+ Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
+ ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
+
+ objectDestructionTracker.Start( controlWrapper );
+
+ Property::Index index = 1;
+
+ Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
+ Toolkit::Visual::Base visual;
+
+ Property::Map map;
+ map[Visual::Property::TYPE] = Visual::COLOR;
+ map[ColorVisual::Property::MIX_COLOR] = Color::RED;
+
+ visual = visualFactory.CreateVisual( map );
+ DALI_TEST_CHECK( visual );
+
+ // Register to self
+ controlWrapperImpl->RegisterVisual( index, visual, 4 );
+
+ DALI_TEST_EQUALS( objectDestructionTracker.IsDestroyed(), false, TEST_LOCATION ); // Control not destroyed yet
+ DALI_TEST_EQUALS( controlWrapperImpl->GetVisual( index ), visual, TEST_LOCATION );
+ DALI_TEST_EQUALS( visual.GetDepthIndex(), 4, TEST_LOCATION );
+ }
+
+ DALI_TEST_EQUALS( objectDestructionTracker.IsDestroyed(), true, TEST_LOCATION ); // Should be destroyed
+
+ END_TEST;
+}
+
int UtcDaliControlWrapperRegisterDisabledVisual(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliControlWrapperRegisterDisabledVisualWithDepthIndex(void)
+{
+ ToolkitTestApplication application;
+
+ Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
+ ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
+
+ Property::Index TEST_PROPERTY = 1;
+
+ Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
+ Toolkit::Visual::Base visual;
+
+ Property::Map map;
+ map[Visual::Property::TYPE] = Visual::COLOR;
+ map[ColorVisual::Property::MIX_COLOR] = Color::RED;
+
+ visual = visualFactory.CreateVisual( map );
+ DALI_TEST_CHECK(visual);
+
+ // Register index with a color visual
+ controlWrapperImpl->RegisterVisual( TEST_PROPERTY, visual, false, 10 );
+
+ DALI_TEST_EQUALS( controlWrapperImpl->GetVisual( TEST_PROPERTY ), visual, TEST_LOCATION );
+ DALI_TEST_EQUALS( controlWrapperImpl->IsVisualEnabled( TEST_PROPERTY ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( visual.GetDepthIndex(), 10, TEST_LOCATION );
+
+ Stage::GetCurrent().Add( controlWrapper );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( controlWrapperImpl->IsVisualEnabled( TEST_PROPERTY ), false, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( controlWrapper.OnStage(), true, TEST_LOCATION );
+
+ controlWrapperImpl->EnableVisual( TEST_PROPERTY, true );
+
+ DALI_TEST_EQUALS( controlWrapperImpl->IsVisualEnabled( TEST_PROPERTY ), true, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliControlWrapperRegisterUnregisterVisual(void)
{
ToolkitTestApplication application;
namespace
{
-const unsigned int TOTAL_ITEM_NUMBER = 100;
+const unsigned int TOTAL_ITEM_NUMBER = 400;
const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
// Remove the item with ID 2
view.RemoveItem(2, 0.0f);
- // Get the new item given the item ID 2
+ // Get the new item given the item ID 2 and 3
Actor newItemActorID2 = view.GetItem(2);
+ Actor newItemActorID3 = view.GetItem(3);
// Check the original item with item ID 2 was deleted and now item ID 2 represents the original item with ID 3
DALI_TEST_CHECK(view.GetItemId(newItemActorID2) == 2);
DALI_TEST_CHECK(oldItemActorID2 != newItemActorID2);
- DALI_TEST_CHECK(newItemActorID2 = oldItemActorID3);
+ DALI_TEST_CHECK(newItemActorID2 == oldItemActorID3);
+
+ // scroll to the end of item view
+ view.ScrollToItem(TOTAL_ITEM_NUMBER - 1, 0.00f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // Refresh the item view
+ view.Refresh();
+
+ Actor itemActorID390 = view.GetItem(390);
+ DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 390);
+
+ // Remove the item with ID 2 (which is now before the current item range)
+ view.RemoveItem(2, 0.0f);
+
+ // Check the original item with item ID 2 was deleted and now item ID 389 represents the original item with ID 390
+ DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 389);
+ DALI_TEST_CHECK(view.GetItem(389) == itemActorID390);
+
END_TEST;
}
TestItemFactory factory;
ItemView view = ItemView::New(factory);
- // Create a depth layout and add it to ItemView
- ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH);
- depthLayout->SetOrientation(ControlOrientation::Left);
- view.AddLayout(*depthLayout);
+ // Create a grid layout and add it to ItemView
+ ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID);
+ gridLayout->SetOrientation(ControlOrientation::Left);
+ view.AddLayout(*gridLayout);
// Activate the grid layout so that the items will be created and added to ItemView
Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
- view.ActivateLayout(0, stageSize, 0.5f);
+ view.ActivateLayout(0, stageSize, 0.0f);
- // Get the item given the item ID
+ // Get the specified item where new item to be inserted before that
Actor itemActor = view.GetItem(2);
ItemId id = view.GetItemId( itemActor );
Actor newActor = Actor::New();
- view.InsertItem(Item(id, newActor), 0.5f);
+ view.InsertItem(Item(id, newActor), 0.0f);
DALI_TEST_CHECK(view.GetItem(2) == newActor);
+
+ DALI_TEST_CHECK(view.GetItemId(itemActor) == 3);
+ DALI_TEST_CHECK(view.GetItem(3) == itemActor);
+
+ // scroll to the end of item view
+ view.ScrollToItem(TOTAL_ITEM_NUMBER - 1, 0.00f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // Refresh the item view
+ view.Refresh();
+
+ Actor itemActorID390 = view.GetItem(390);
+ DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 390);
+
+ // Insert the item with ID 2 (which is now before the current item range)
+ Actor anotherNewActor = Actor::New();
+ view.InsertItem(Item(id, anotherNewActor), 0.0f);
+
+ // Check that item ID 391 now represents the original item with ID 390
+ DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 391);
+ DALI_TEST_CHECK(view.GetItem(391) == itemActorID390);
+
END_TEST;
}
unsigned int itemCount = view.GetChildCount();
+ // Get the specified item where new items to be inserted before that
+ Actor itemActor = view.GetItem(1);
+
+ // Check we are getting the correct Item ID given the specified item
+ DALI_TEST_CHECK(view.GetItemId(itemActor) == 1);
+
ItemContainer insertList;
- for( unsigned int i = 0u; i < 10; ++i )
+ for( unsigned int i = 1u; i < 11; ++i )
{
Actor child = view.GetChildAt( i );
Actor newActor = Actor::New();
DALI_TEST_CHECK(view.GetChildCount() == itemCount + 10);
+ // Check that new items are inserted in the correct positions
+ DALI_TEST_CHECK(view.GetItemId(itemActor) == 11);
+ DALI_TEST_CHECK(view.GetItem(11) == itemActor);
+
ItemIdContainer removeList;
for( unsigned int i = 0u; i < view.GetChildCount(); ++i )
}
DALI_TEST_CHECK(view.GetChildCount() == itemCount);
+
+ // Check that new items are removed correctly so that we are getting the correct Item ID given the specified item
+ DALI_TEST_CHECK(view.GetItemId(itemActor) == 1);
+ DALI_TEST_CHECK(view.GetItem(1) == itemActor);
+
END_TEST;
}
Actor newActor = Actor::New();
- view.ReplaceItem( Item( 0, newActor ), 0.5f );
+ view.ReplaceItem( Item( 5, newActor ), 0.5f );
+
+ DALI_TEST_CHECK(view.GetItem(5) == newActor);
- DALI_TEST_CHECK(view.GetItem(0) == newActor);
END_TEST;
}
#include <dali/integration-api/events/pan-gesture-event.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
using namespace Dali;
const char* const PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION = "scrollBarShowDuration";
const char* const PROPERTY_NAME_SCROLL_BAR_FADE_DURATION = "scrollBarFadeDuration";
const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
+const char* const PROPERTY_NAME_LINE_COUNT = "lineCount";
+const char* const PROPERTY_NAME_PLACEHOLDER_TEXT = "placeholderText";
+const char* const PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR = "placeholderTextColor";
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
+const Vector4 PLACEHOLDER_TEXT_COLOR( 0.8f, 0.8f, 0.8f, 0.8f );
const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color.
const unsigned int CURSOR_BLINK_INTERVAL = 500u; // Cursor blink interval
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION ) == DevelTextEditor::Property::SCROLL_BAR_SHOW_DURATION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SCROLL_BAR_FADE_DURATION ) == DevelTextEditor::Property::SCROLL_BAR_FADE_DURATION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == DevelTextEditor::Property::PIXEL_SIZE );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_LINE_COUNT) == DevelTextEditor::Property::LINE_COUNT );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == DevelTextEditor::Property::PLACEHOLDER_TEXT );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR ) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR );
END_TEST;
}
editor.SetProperty( DevelTextEditor::Property::PIXEL_SIZE, 20.f );
DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Check placeholder text properties.
+ editor.SetProperty( DevelTextEditor::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( DevelTextEditor::Property::PLACEHOLDER_TEXT ), std::string("Setting Placeholder Text"), TEST_LOCATION );
+
+ // Check placeholder text properties when focused.
+ editor.SetProperty( DevelControl::Property::STATE, "FOCUSED" );
+ editor.SetProperty( DevelTextEditor::Property::PLACEHOLDER_TEXT, "Setting Focused Placeholder Text" );
+ DALI_TEST_EQUALS( editor.GetProperty<int>( DevelControl::Property::STATE ), (int)DevelControl::FOCUSED, TEST_LOCATION );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( DevelTextEditor::Property::PLACEHOLDER_TEXT ), std::string("Setting Focused Placeholder Text"), TEST_LOCATION );
+
+ // Check placeholder text's color property.
+ editor.SetProperty( DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR, Color::RED );
+ DALI_TEST_EQUALS( editor.GetProperty<Vector4>( DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR ), Color::RED, TEST_LOCATION );
+
END_TEST;
}
END_TEST;
}
+int utcDaliTextEditorGetPropertyLinecountP(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" utcDaliTextEditorGetPropertyLinecount getting line count property");
+
+ int lineCount =0 ;
+
+ TextEditor editor = TextEditor::New();
+ editor.SetProperty( TextEditor::Property::POINT_SIZE, 10) ;
+ editor.SetProperty( TextEditor::Property::TEXT,
+ "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
+
+ Stage::GetCurrent().Add( editor );
+
+ editor.SetSize( 100.0f, 100.0f );
+ lineCount = editor.GetProperty<int>( DevelTextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 14, TEST_LOCATION );
+
+ editor.SetSize( 50.0f, 100.0f );
+ lineCount = editor.GetProperty<int>( DevelTextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 28, TEST_LOCATION );
+
+ END_TEST;
+}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
ToolkitTestApplication application;
tet_infoline(" UtcDaliToolkitTextLabelScrollingP");
TextLabel labelImmediate = TextLabel::New("Some text to scroll");
- TextLabel labelFinished = TextLabel::New("Some text to scroll");
+ TextLabel labelFinished = TextLabel::New("مرحبا بالعالم");
DALI_TEST_CHECK( labelImmediate );
DALI_TEST_CHECK( labelFinished );
END_TEST;
}
+int UtcDaliToolkitTextlabelScrollingCenterAlignP(void)
+{
+ ToolkitTestApplication application;
+ TextLabel labelShort = TextLabel::New("Some text to scroll");
+ TextLabel labelLong = TextLabel::New("Some text to scroll that is greater than the width of the text. The quick brown fox jumps over the lazy dog. Hello World, we meet again!");
+
+ DALI_TEST_CHECK( labelShort );
+ DALI_TEST_CHECK( labelLong );
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ Stage::GetCurrent().Add( labelShort );
+ // Turn on all the effects
+ labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
+ labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
+ labelShort.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::IMMEDIATE );
+
+ Stage::GetCurrent().Add( labelLong );
+ // Turn on all the effects
+ labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
+ labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
+ labelLong.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::FINISH_LOOP );
+
+ try
+ {
+ // Render some text with the shared atlas backend
+ labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+ labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+ application.SendNotification();
+ application.Render();
+
+ labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
+ labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
+ application.SendNotification();
+ application.Render();
+
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelScrollingCenterAlignRTLP(void)
+{
+ ToolkitTestApplication application;
+ TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
+ TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
+
+ DALI_TEST_CHECK( labelShort );
+ DALI_TEST_CHECK( labelLong );
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ Stage::GetCurrent().Add( labelShort );
+ // Turn on all the effects
+ labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
+ labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
+ labelShort.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::IMMEDIATE );
+
+ Stage::GetCurrent().Add( labelLong );
+ // Turn on all the effects
+ labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
+ labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
+ labelLong.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::FINISH_LOOP );
+
+ try
+ {
+ // Render some text with the shared atlas backend
+ labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+ labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+ application.SendNotification();
+ application.Render();
+
+ labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
+ labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
+ application.SendNotification();
+ application.Render();
+
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelScrollingEndAlignP(void)
+{
+ ToolkitTestApplication application;
+ TextLabel labelShort = TextLabel::New("Some text to scroll");
+ TextLabel labelLong = TextLabel::New("Some text to scroll that is greater than the width of the text. The quick brown fox jumps over the lazy dog. Hello World, we meet again!");
+
+ DALI_TEST_CHECK( labelShort );
+ DALI_TEST_CHECK( labelLong );
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ Stage::GetCurrent().Add( labelShort );
+ // Turn on all the effects
+ labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
+ labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
+ labelShort.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::IMMEDIATE );
+
+ Stage::GetCurrent().Add( labelLong );
+ // Turn on all the effects
+ labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
+ labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
+ labelLong.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::FINISH_LOOP );
+
+ try
+ {
+ // Render some text with the shared atlas backend
+ labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+ labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+ application.SendNotification();
+ application.Render();
+
+ labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
+ labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
+ application.SendNotification();
+ application.Render();
+
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextlabelScrollingEndAlignRTLP(void)
+{
+ ToolkitTestApplication application;
+ TextLabel labelShort = TextLabel::New("مرحبا بالعالم");
+ TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي");
+
+ DALI_TEST_CHECK( labelShort );
+ DALI_TEST_CHECK( labelLong );
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ Stage::GetCurrent().Add( labelShort );
+ // Turn on all the effects
+ labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false );
+ labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
+ labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
+ labelShort.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::IMMEDIATE );
+
+ Stage::GetCurrent().Add( labelLong );
+ // Turn on all the effects
+ labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false );
+ labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
+ labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
+ labelLong.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::FINISH_LOOP );
+
+ try
+ {
+ // Render some text with the shared atlas backend
+ labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+ labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+ application.SendNotification();
+ application.Render();
+
+ labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
+ labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false );
+ application.SendNotification();
+ application.Render();
+
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
int UtcDaliToolkitTextlabelScrollingInterruptedP(void)
{
ToolkitTestApplication application;
#include <dali/public-api/rendering/texture-set.h>
#include <dali/public-api/rendering/shader.h>
#include <dali/devel-api/object/handle-devel.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
transformMap
.Add( Toolkit::DevelVisual::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
.Add( Toolkit::DevelVisual::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
- .Add( Toolkit::DevelVisual::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
- .Add( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
+ .Add( Toolkit::DevelVisual::Transform::Property::ORIGIN, Toolkit::Align::TOP_BEGIN )
+ .Add( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT, Toolkit::Align::TOP_BEGIN )
.Add( Toolkit::DevelVisual::Transform::Property::OFFSET_POLICY, Vector2( Toolkit::DevelVisual::Transform::Policy::RELATIVE, Toolkit::DevelVisual::Transform::Policy::RELATIVE ) )
.Add( Toolkit::DevelVisual::Transform::Property::SIZE_POLICY, Vector2( Toolkit::DevelVisual::Transform::Policy::RELATIVE, Toolkit::DevelVisual::Transform::Policy::RELATIVE ) );
return transformMap;
propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base visual = factory.CreateVisual( propertyMap );
- visual.SetDepthIndex( 1.f );
+ visual.SetDepthIndex( 1 );
DummyControl dummyControl = DummyControl::New(true);
Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
int depthIndex = dummyControl.GetRendererAt(0u).GetProperty<int>( Renderer::Property::DEPTH_INDEX );
DALI_TEST_EQUALS( depthIndex, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( visual.GetDepthIndex(), 1.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( visual.GetDepthIndex(), 1, TEST_LOCATION );
- visual.SetDepthIndex( -1.f );
+ visual.SetDepthIndex( -1 );
depthIndex = dummyControl.GetRendererAt(0u).GetProperty<int>( Renderer::Property::DEPTH_INDEX );
DALI_TEST_EQUALS( depthIndex, -1, TEST_LOCATION );
- DALI_TEST_EQUALS( visual.GetDepthIndex(), -1.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( visual.GetDepthIndex(), -1, TEST_LOCATION );
END_TEST;
}
{
Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::ORIGIN );
DALI_TEST_CHECK( typeValue );
- DALI_TEST_CHECK( (Toolkit::Align::Type)typeValue->Get<int>() == Toolkit::Align::CENTER );
+ DALI_TEST_CHECK( (Toolkit::Align::Type)typeValue->Get<int>() == Toolkit::Align::TOP_BEGIN );
}
{
Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT );
DALI_TEST_CHECK( typeValue );
- DALI_TEST_CHECK( (Toolkit::Align::Type)typeValue->Get<int>() == Toolkit::Align::CENTER );
+ DALI_TEST_CHECK( (Toolkit::Align::Type)typeValue->Get<int>() == Toolkit::Align::TOP_BEGIN );
}
END_TEST;
transform.Insert( DevelVisual::Transform::Property::OFFSET, Vector2(10.0f, 10.0f) );
transform.Insert( DevelVisual::Transform::Property::SIZE, Vector2(0.2f, 0.2f) );
transform.Insert( DevelVisual::Transform::Property::OFFSET_POLICY, Vector2( Toolkit::DevelVisual::Transform::Policy::ABSOLUTE, Toolkit::DevelVisual::Transform::Policy::ABSOLUTE ) );
- transform.Insert( DevelVisual::Transform::Property::ORIGIN, "TOP_BEGIN" );
+ transform.Insert( DevelVisual::Transform::Property::ORIGIN, "CENTER" );
transform.Insert( DevelVisual::Transform::Property::ANCHOR_POINT, Toolkit::Align::BOTTOM_END );
visual.SetTransformAndSize( transform, Vector2(100, 100) );
{
Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::ORIGIN );
DALI_TEST_CHECK( typeValue );
- DALI_TEST_EQUALS( (Toolkit::Align::Type)typeValue->Get<int>(), Toolkit::Align::TOP_BEGIN, TEST_LOCATION );
+ DALI_TEST_EQUALS( (Toolkit::Align::Type)typeValue->Get<int>(), Toolkit::Align::CENTER, TEST_LOCATION );
}
{
Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT );
index = renderer.GetPropertyIndex( "origin" );
DALI_TEST_CHECK( index != Property::INVALID_INDEX );
Vector2 parentOrigin = renderer.GetProperty<Vector2>( index );
- DALI_TEST_EQUALS( parentOrigin, Vector2(-0.5f,-0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS( parentOrigin, Vector2(0.0f,0.0f), TEST_LOCATION );
index = renderer.GetPropertyIndex( "anchorPoint" );
DALI_TEST_CHECK( index != Property::INVALID_INDEX );
offsetSizeMode = renderer.GetProperty<Vector4>( renderer.GetPropertyIndex( "offsetSizeMode" ) );
DALI_TEST_EQUALS( offsetSizeMode, Vector4(0.0f,0.0f,1.0f,1.0f), TEST_LOCATION );
- //Parent origin and anchor point should have default values
+ //Parent origin and anchor point should have the default values
parentOrigin = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "origin" ) );
- DALI_TEST_EQUALS( parentOrigin, Vector2(0.0f,0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( parentOrigin, Vector2(-0.5f,-0.5f), TEST_LOCATION );
anchorPoint = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "anchorPoint" ) );
- DALI_TEST_EQUALS( anchorPoint, Vector2(0.0f,0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( anchorPoint, Vector2(0.5f,0.5f), TEST_LOCATION );
}
int UtcDaliVisualSetTransform0(void)
propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base visual = factory.CreateVisual( propertyMap );
- visual.SetDepthIndex( 1.f );
+ visual.SetDepthIndex( 1 );
DummyControl dummyControl = DummyControl::New(true);
Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
propertyMap.Insert( "verticalAlignment", "CENTER" );
propertyMap.Insert( "textColor", Color::RED );
Visual::Base textVisual = factory.CreateVisual( propertyMap );
- textVisual.SetDepthIndex( 1.f );
+ textVisual.SetDepthIndex( 1 );
DummyControl dummyControl = DummyControl::New(true);
Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
propertyMap.Insert( DevelVisual::Property::TRANSFORM, transformMap );
textVisual = factory.CreateVisual( propertyMap );
- textVisual.SetDepthIndex( 1.f );
+ textVisual.SetDepthIndex( 1 );
dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, textVisual );
dummyControl.SetSize( 720.f, 640.f );
propertyMap.Insert( "verticalAlignment", "CENTER" );
propertyMap.Insert( "textColor", Color::RED );
Visual::Base textVisual = factory.CreateVisual( propertyMap );
- textVisual.SetDepthIndex( 1.f );
+ textVisual.SetDepthIndex( 1 );
DummyControl dummyControl = DummyControl::New(true);
Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
END_TEST;
}
+
+int UtcDaliRegisterVisualOrder(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "Register Visual Order" );
+
+ DummyControl dummyControl = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+
+ tet_infoline( "Register visual, should have depth index of 0.0f" );
+ Visual::Base testVisual = factory.CreateVisual( propertyMap );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, testVisual );
+ DALI_TEST_EQUALS( testVisual.GetDepthIndex(), 0, TEST_LOCATION );
+
+ tet_infoline( "Register more visuals, each added one should have a depth index greater than previous" );
+
+ Visual::Base testVisual2 = factory.CreateVisual( propertyMap );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL2, testVisual2 );
+ DALI_TEST_CHECK( testVisual2.GetDepthIndex() > testVisual.GetDepthIndex() );
+
+ Visual::Base foregroundVisual = factory.CreateVisual( propertyMap );
+ dummyImpl.RegisterVisual( DummyControl::Property::FOREGROUND_VISUAL, foregroundVisual );
+ DALI_TEST_CHECK( foregroundVisual.GetDepthIndex() > testVisual2.GetDepthIndex() );
+
+ Visual::Base focusVisual = factory.CreateVisual( propertyMap );
+ dummyImpl.RegisterVisual( DummyControl::Property::FOCUS_VISUAL, focusVisual );
+ DALI_TEST_CHECK( focusVisual.GetDepthIndex() > foregroundVisual.GetDepthIndex() );
+
+ tet_infoline( "Set depth index on a new visual before registering, the depth index should not have been changed" );
+ Visual::Base labelVisual = factory.CreateVisual( propertyMap );
+ labelVisual.SetDepthIndex( -2000 );
+ dummyImpl.RegisterVisual( DummyControl::Property::LABEL_VISUAL, labelVisual );
+ DALI_TEST_EQUALS( labelVisual.GetDepthIndex(), -2000, TEST_LOCATION );
+
+ tet_infoline( "Replace visual, the depth index should be the same as what was previously set" );
+ const int testVisual2DepthIndex = testVisual2.GetDepthIndex();
+ Visual::Base testVisual2Replacement = factory.CreateVisual( propertyMap );
+ DALI_TEST_CHECK( testVisual2Replacement.GetDepthIndex() != testVisual2DepthIndex );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL2, testVisual2Replacement );
+ DALI_TEST_EQUALS( testVisual2Replacement.GetDepthIndex(), testVisual2DepthIndex, TEST_LOCATION );
+
+ tet_infoline( "Replace visual and set a depth index on the replacement, the depth index of the replacement should be honoured" );
+ Visual::Base anotherTestVisual2Replacement = factory.CreateVisual( propertyMap );
+ anotherTestVisual2Replacement.SetDepthIndex( 2000 );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL2, anotherTestVisual2Replacement );
+ DALI_TEST_EQUALS( anotherTestVisual2Replacement.GetDepthIndex(), 2000, TEST_LOCATION );
+
+ dummyControl.SetSize(200.f, 200.f);
+ Stage::GetCurrent().Add( dummyControl );
+
+ END_TEST;
+}
+
+int UtcDaliRegisterVisualWithDepthIndex(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "Register a Visual With Depth Index" );
+
+ DummyControl dummyControl = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+
+ tet_infoline( "Register a visual with a depth index, it should be enabled by default too" );
+ Visual::Base testVisual = factory.CreateVisual( propertyMap );
+ DevelControl::RegisterVisual( dummyImpl, DummyControl::Property::TEST_VISUAL, testVisual, 203 );
+ DALI_TEST_EQUALS( testVisual.GetDepthIndex(), 203, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelControl::IsVisualEnabled( dummyImpl, DummyControl::Property::TEST_VISUAL ), true, TEST_LOCATION );
+
+ tet_infoline( "Register another visual with a depth index and it disabled" );
+ Visual::Base testVisual2 = factory.CreateVisual( propertyMap );
+ DevelControl::RegisterVisual( dummyImpl, DummyControl::Property::TEST_VISUAL2, testVisual2, false, 450 );
+ DALI_TEST_EQUALS( testVisual2.GetDepthIndex(), 450, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelControl::IsVisualEnabled( dummyImpl, DummyControl::Property::TEST_VISUAL2 ), false, TEST_LOCATION );
+
+ tet_infoline( "Register another visual with a depth index and it enabled using the enabled API" );
+ Visual::Base testVisual3 = factory.CreateVisual( propertyMap );
+ DevelControl::RegisterVisual( dummyImpl, DummyControl::Property::TEST_VISUAL2, testVisual3, true, 300 );
+ DALI_TEST_EQUALS( testVisual3.GetDepthIndex(), 300, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelControl::IsVisualEnabled( dummyImpl, DummyControl::Property::TEST_VISUAL2 ), true, TEST_LOCATION );
+
+ dummyControl.SetSize(200.f, 200.f);
+ Stage::GetCurrent().Add( dummyControl );
+
+ END_TEST;
+}
controlImpl.RegisterVisual( index, visual );
}
+void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, int depthIndex )
+{
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( control );
+ controlImpl.RegisterVisual( index, visual, depthIndex );
+}
+
void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled )
{
Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( control );
controlImpl.RegisterVisual( index, visual, enabled );
}
+void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex )
+{
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( control );
+ controlImpl.RegisterVisual( index, visual, enabled, depthIndex );
+}
+
void UnregisterVisual( Internal::Control& control, Dali::Property::Index index )
{
Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( control );
DALI_IMPORT_API bool IsResourceReady( const Control& control );
/**
- * @brief Register a visual by Property Index, linking an Actor to visual when required.
- * In the case of the visual being an actor or control deeming visual not required then visual should be an empty handle.
- * No parenting is done during registration, this should be done by derived class.
+ * @brief Register a visual by Property Index.
*
* @param[in] control The control
* @param[in] index The Property index of the visual, used to reference visual
* @param[in] visual The visual to register
+ *
* @note Derived class should not call visual.SetOnStage(actor). It is the responsibility of the base class to connect/disconnect registered visual to stage.
* Use below API with enabled set to false if derived class wishes to control when visual is staged.
+ * @note If the depth-index is not set on the visual, then it is set to be above the currently registered visuals.
+ * @note If replacing a visual, then the depth-index of the visual being replaced is used for the visual.
*/
DALI_IMPORT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual );
/**
- * @brief Register a visual by Property Index, linking an Actor to visual when required.
+ * @brief Register a visual by Property Index with a depth index.
+ *
+ * @param[in] control The control
+ * @param[in] index The Property index of the visual, used to reference visual
+ * @param[in] visual The visual to register
+ * @param[in] depthIndex The visual's depth-index is set to this
*
- * In the case of the visual being an actor or control deeming visual not required then visual should be an empty handle.
- * If enabled is false then the visual is not set on stage until enabled by the derived class.
- * @see EnableVisual
+ * @note Derived class should not call visual.SetOnStage(actor). It is the responsibility of the base class to connect/disconnect registered visual to stage.
+ * Use below API with enabled set to false if derived class wishes to control when visual is staged.
+ *
+ * @see Visual::Base::GetDepthIndex()
+ * @see Visual::Base::SetDepthIndex()
+ */
+DALI_IMPORT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, int depthIndex );
+
+/**
+ * @brief Register a visual by Property Index with the option of enabling/disabling it.
*
* @param[in] control The control
* @param[in] index The Property index of the visual, used to reference visual
* @param[in] visual The visual to register
* @param[in] enabled false if derived class wants to control when visual is set on stage.
*
+ * @note If the depth-index is not set on the visual, then it is set to be above the currently registered visuals.
+ * @note If replacing a visual, then the depth-index of the visual being replaced is used for the visual.
+ *
+ * @see EnableVisual()
*/
DALI_IMPORT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled );
/**
+ * @brief Register a visual by Property Index with a depth index with the option of enabling/disabling it.
+ *
+ * @param[in] control The control
+ * @param[in] index The Property index of the visual, used to reference visual
+ * @param[in] visual The visual to register
+ * @param[in] enabled false if derived class wants to control when visual is set on stage.
+ * @param[in] depthIndex The visual's depth-index is set to this
+ *
+ * @see EnableVisual()
+ * @see Visual::Base::GetDepthIndex()
+ * @see Visual::Base::SetDepthIndex()
+ */
+DALI_IMPORT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex );
+
+/**
* @brief Erase the entry matching the given index from the list of registered visuals
*
* @param[in] control The control
DevelControl::RegisterVisual( *this, index, visual );
}
+void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, int depthIndex )
+{
+ DevelControl::RegisterVisual( *this, index, visual, depthIndex );
+}
+
void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled )
{
DevelControl::RegisterVisual( *this, index, visual, enabled );
}
+void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex )
+{
+ DevelControl::RegisterVisual( *this, index, visual, enabled, depthIndex );
+}
+
void ControlWrapper::UnregisterVisual( Property::Index index )
{
DevelControl::UnregisterVisual( *this, index );
/**
* @ref Dali::Toolkit::DevelControl::RegisterVisual()
*/
+ void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, int depthIndex );
+
+ /**
+ * @ref Dali::Toolkit::DevelControl::RegisterVisual()
+ */
void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled );
/**
+ * @ref Dali::Toolkit::DevelControl::RegisterVisual()
+ */
+ void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex );
+
+ /**
* @ref Dali::Toolkit::DevelControl::UnregisterVisual()
*/
void UnregisterVisual( Property::Index index );
* @brief The size of font in pixels.
* @details name "pixelSize", type float
*/
- PIXEL_SIZE
+ PIXEL_SIZE,
+
+ /**
+ * @brief The line count of text.
+ * @details name "lineCount", type int
+ * @note this property is read-only.
+ */
+ LINE_COUNT,
+
+ /**
+ * @brief The text to display when the TextEditor is empty and inactive.
+ * @details name "placeholderText", type string
+ */
+ PLACEHOLDER_TEXT,
+
+ /**
+ * @brief The placeholder-text color.
+ * @details name "placeholderTextColor", type vector4
+ */
+ PLACEHOLDER_TEXT_COLOR
};
} // namespace Property
* values FINISH_LOOP, IMMEDIATE, defualt FINISH_LOOP
*/
AUTO_SCROLL_STOP_MODE = OUTLINE + 4,
+
+ /*
+ * @brief The line count of text.
+ * @details name "lineCount", type int
+ * @node this property is read-only.
+ */
+ LINE_COUNT = OUTLINE + 5
};
} // namespace Property
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
GetImplementation( *this ).GetNaturalSize( naturalSize );
}
-void Visual::Base::SetDepthIndex( float index )
+void Visual::Base::SetDepthIndex( int index )
{
GetImplementation( *this ).SetDepthIndex( index );
}
-float Visual::Base::GetDepthIndex() const
+int Visual::Base::GetDepthIndex() const
{
return GetImplementation( *this ).GetDepthIndex();
}
*
* @param[in] index The depth index of this visual.
*/
- void SetDepthIndex( float index );
+ void SetDepthIndex( int index );
/**
* @brief Get the depth index of this visual
*
* @return The depth index of this visual.
*/
- float GetDepthIndex() const;
+ int GetDepthIndex() const;
/**
* @brief Create the property map representing this visual.
* @brief The origin of the visual within its control area.
* @details Name "origin", type Align::Type (Property::INTEGER) or Property::STRING.
* @see Toolkit::Align
+ * @note The default is Align::TOP_BEGIN.
*/
ORIGIN,
* @brief The anchor-point of the visual
* @details Name "anchorPoint", type Align::Type (Property::INTEGER) or Property::STRING.
* @see Toolkit::Align
+ * @note The default is Align::TOP_BEGIN.
*/
ANCHOR_POINT,
* 4) Unregister visual if empty map was provided. This is the method to remove a visual
*/
-void Button::CreateVisualsForComponent( Property::Index index, const Property::Value& value, const float visualDepth )
+void Button::CreateVisualsForComponent( Property::Index index, const Property::Value& value, const int visualDepth )
{
DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "CreateVisualsForComponent index(%d)\n", index );
Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
{
DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "CreateVisualsForComponent RegisterVisual index(%d) enabled(%s)\n",
index, DevelControl::IsVisualEnabled( *this, index )?"true":"false" );
- buttonVisual.SetDepthIndex( visualDepth );
- DevelControl::RegisterVisual( *this, index, buttonVisual, DevelControl::IsVisualEnabled( *this, index ) );
+ DevelControl::RegisterVisual( *this, index, buttonVisual, DevelControl::IsVisualEnabled( *this, index ), visualDepth );
}
else
{
#define DALI_TOOLKIT_INTERNAL_BUTTON_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
* @param[in] value the value to set on the component
* @param[in] visualDepth the depth of the visual if overlapping another
*/
- void CreateVisualsForComponent( Property::Index index ,const Property::Value& value, const float visualDepth );
+ void CreateVisualsForComponent( Property::Index index, const Property::Value& value, const int visualDepth );
/**
* @brief Get the Property map for the given Visual
#include <dali/integration-api/debug.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <cstring>
+#include <limits>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual )
{
- RegisterVisual( index, visual, true );
+ RegisterVisual( index, visual, VisualState::ENABLED, DepthIndexValue::NOT_SET );
+}
+
+void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, int depthIndex )
+{
+ RegisterVisual( index, visual, VisualState::ENABLED, DepthIndexValue::SET, depthIndex );
}
void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled )
{
+ RegisterVisual( index, visual, ( enabled ? VisualState::ENABLED : VisualState::DISABLED ), DepthIndexValue::NOT_SET );
+}
+
+void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex )
+{
+ RegisterVisual( index, visual, ( enabled ? VisualState::ENABLED : VisualState::DISABLED ), DepthIndexValue::SET, depthIndex );
+}
+
+void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, VisualState::Type enabled, DepthIndexValue::Type depthIndexValueSet, int depthIndex )
+{
bool visualReplaced ( false );
Actor self = mControlImpl.Self();
Toolkit::GetImplementation((*iter)->visual).SetOffStage( self );
}
+ // If we've not set the depth-index value and the new visual does not have a depth index applied to it, then use the previously set depth-index for this index
+ if( ( depthIndexValueSet == DepthIndexValue::NOT_SET ) &&
+ ( visual.GetDepthIndex() == 0 ) )
+ {
+ const int currentDepthIndex = (*iter)->visual.GetDepthIndex();
+ visual.SetDepthIndex( currentDepthIndex );
+ }
+
StopObservingVisual( (*iter)->visual );
StartObservingVisual( visual );
(*iter)->visual = visual;
+ (*iter)->enabled = ( enabled == VisualState::ENABLED ) ? true : false;
visualReplaced = true;
}
}
if( !visualReplaced ) // New registration entry
{
- mVisuals.PushBack( new RegisteredVisual( index, visual, enabled ) );
+ mVisuals.PushBack( new RegisteredVisual( index, visual, ( enabled == VisualState::ENABLED ? true : false ) ) );
// monitor when the visuals resources are ready
StartObservingVisual( visual );
+ // If we've not set the depth-index value, we have more than one visual and the visual does not have a depth index, then set it to be the highest
+ if( ( depthIndexValueSet == DepthIndexValue::NOT_SET ) &&
+ ( mVisuals.Size() > 1 ) &&
+ ( visual.GetDepthIndex() == 0 ) )
+ {
+ int maxDepthIndex = std::numeric_limits< int >::min();
+
+ RegisteredVisualContainer::ConstIterator iter;
+ const RegisteredVisualContainer::ConstIterator endIter = mVisuals.End();
+ for ( iter = mVisuals.Begin(); iter != endIter; iter++ )
+ {
+ const int visualDepthIndex = (*iter)->visual.GetDepthIndex();
+ if ( visualDepthIndex > maxDepthIndex )
+ {
+ maxDepthIndex = visualDepthIndex;
+ }
+ }
+
+ ++maxDepthIndex; // Add one to the current maximum depth index so that our added visual appears on top
+ visual.SetDepthIndex( maxDepthIndex );
+ }
}
- if( visual && self.OnStage() && enabled )
+ if( visual )
{
- Toolkit::GetImplementation(visual).SetOnStage( self );
+ // If the caller has set the depth-index, then set it here
+ if( depthIndexValueSet == DepthIndexValue::SET )
+ {
+ visual.SetDepthIndex( depthIndex );
+ }
+
+ // Put on stage if enabled and the control is already on the stage
+ if( ( enabled == VisualState::ENABLED ) && self.OnStage() )
+ {
+ Toolkit::GetImplementation(visual).SetOnStage( self );
+ }
}
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::RegisterVisual() Registered %s(%d), enabled:%s\n", visual.GetName().c_str(), index, enabled?"T":"F" );
Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( url, ImageDimensions() );
if( visual )
{
- controlImpl.mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual );
- visual.SetDepthIndex( DepthIndex::BACKGROUND );
+ controlImpl.mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND );
}
}
else if( value.Get( color ) )
/**
* @copydoc Dali::Toolkit::DevelControl::RegisterVisual()
*/
+ void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, int depthIndex );
+
+ /**
+ * @copydoc Dali::Toolkit::DevelControl::RegisterVisual()
+ */
void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled );
/**
+ * @copydoc Dali::Toolkit::DevelControl::RegisterVisual()
+ */
+ void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex );
+
+ /**
* @copydoc Dali::Toolkit::DevelControl::UnregisterVisual()
*/
void UnregisterVisual( Property::Index index );
*/
bool IsResourceReady() const;
+private:
+
+ /**
+ * Used as an alternative to boolean so that it is obvious whether a visual is enabled/disabled.
+ */
+ struct VisualState
+ {
+ enum Type
+ {
+ DISABLED = 0, ///< Visual disabled.
+ ENABLED = 1 ///< Visual enabled.
+ };
+ };
+
+ /**
+ * Used as an alternative to boolean so that it is obvious whether a visual's depth value has been set or not by the caller.
+ */
+ struct DepthIndexValue
+ {
+ enum Type
+ {
+ NOT_SET = 0, ///< Visual depth value not set by caller.
+ SET = 1 ///< Visual depth value set by caller.
+ };
+ };
+
+ /**
+ * @brief Adds the visual to the list of registered visuals.
+ * @param[in] index The Property index of the visual, used to reference visual
+ * @param[in] visual The visual to register
+ * @param[in] enabled false if derived class wants to control when visual is set on stage
+ * @param[in] depthIndexValueSet Set to true if the depthIndex has actually been set manually
+ * @param[in] depthIndex The visual's depth-index is set to this
+ */
+ void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, VisualState::Type enabled, DepthIndexValue::Type depthIndexValueSet, int depthIndex = 0 );
+
+public:
+
Control& mControlImpl;
DevelControl::State mState;
std::string mSubStateName;
mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
Internal::InitializeVisual( self, mVisualForChildren, mImageForChildren );
- DevelControl::RegisterVisual( *this, CHILD_VISUAL, mVisualForChildren );
- mVisualForChildren.SetDepthIndex( DepthIndex::CONTENT+1 );
+ DevelControl::RegisterVisual( *this, CHILD_VISUAL, mVisualForChildren, DepthIndex::CONTENT + 1 );
mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
TextureSet textureSet = TextureSet::New();
* 4) Unregister visual if empty map was provided. This is the method to remove a visual
*/
-void ProgressBar::CreateVisualsForComponent( Property::Index index, const Property::Value& value, const float visualDepth )
+void ProgressBar::CreateVisualsForComponent( Property::Index index, const Property::Value& value, const int visualDepth )
{
Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
Toolkit::Visual::Base progressVisual;
if ( progressVisual )
{
- progressVisual.SetDepthIndex( visualDepth );
if( index == Toolkit::ProgressBar::Property::INDETERMINATE_VISUAL )
{
- DevelControl::RegisterVisual( *this, index, progressVisual, mIndeterminate );
+ DevelControl::RegisterVisual( *this, index, progressVisual, mIndeterminate, visualDepth );
}
else
{
- DevelControl::RegisterVisual( *this, index, progressVisual, true );
+ DevelControl::RegisterVisual( *this, index, progressVisual, true, visualDepth );
}
}
else
#define DALI_TOOLKIT_INTERNAL_PROGRESS_BAR_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
/**
* Update progress bar label when progress value is changed
*/
- void CreateVisualsForComponent( Property::Index index, const Property::Value& value, const float visualDepth );
+ void CreateVisualsForComponent( Property::Index index, const Property::Value& value, const int visualDepth );
/**
* Update progress bar label when progress value is changed
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
-#include <dali/devel-api/common/set-wrapper.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/events/touch-data.h>
#include <dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.h>
using std::string;
-using std::set;
using namespace Dali;
namespace // Unnamed namespace
DALI_TYPE_REGISTRATION_END()
-bool FindById( const ItemContainer& items, ItemId id )
+const ItemIter FindItemById( ItemContainer& items, ItemId id )
{
- for( ConstItemIter iter = items.begin(); items.end() != iter; ++iter )
+ for( ItemIter iter = items.begin(); items.end() != iter; ++iter )
{
if( iter->first == id )
{
- return true;
+ return iter;
}
}
- return false;
+ return items.end();
}
+void InsertToItemContainer( ItemContainer& items, Item item )
+{
+ if( items.end() == FindItemById( items, item.first ) )
+ {
+ ItemIter iterToInsert = std::lower_bound( items.begin(), items.end(), item );
+ items.insert( iterToInsert, item );
+ }
+}
+
+
/**
* Helper to apply size constraint to mOvershootOverlay
* @param[in] overshootOverlay The overshootOverlay actor
// Move the items to the new layout positions...
- for (ConstItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
unsigned int itemId = iter->first;
Actor actor = iter->second;
{
if (mActiveLayout)
{
- for (ConstItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
Actor actor = iter->second;
actor.RemoveConstraints();
void ItemView::Refresh()
{
- for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter )
+ for (ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter )
{
ReleaseActor( iter->first, iter->second );
}
{
Actor actor;
- ConstItemPoolIter iter = mItemPool.find( itemId );
- if( iter != mItemPool.end() )
+ for ( ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter )
{
- actor = iter->second;
+ if( iter->first == itemId )
+ {
+ actor = iter->second;
+ break;
+ }
}
return actor;
{
unsigned int itemId( 0 );
- for ( ConstItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter )
+ for ( ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter )
{
if( iter->second == actor )
{
Vector3 layoutSize = Self().GetCurrentSize();
Actor displacedActor;
- ItemPoolIter afterDisplacedIter = mItemPool.end();
+ ItemIter afterDisplacedIter = mItemPool.end();
- ItemPoolIter foundIter = mItemPool.find( newItem.first );
+ ItemIter foundIter = FindItemById( mItemPool, newItem.first );
if( mItemPool.end() != foundIter )
{
SetupActor( newItem, layoutSize );
else
{
// Inserting before the existing item range?
- ItemPoolIter iter = mItemPool.begin();
+ ItemIter iter = mItemPool.begin();
if( iter != mItemPool.end() &&
iter->first > newItem.first )
{
displacedActor = iter->second;
- mItemPool.erase( iter++ ); // iter is still valid after the erase
+ iter = mItemPool.erase( iter ); // iter is still valid after the erase
afterDisplacedIter = iter;
}
if( displacedActor )
{
// Move the existing actors to make room
- for( ItemPoolIter iter = afterDisplacedIter; mItemPool.end() != iter; ++iter )
+ for( ItemIter iter = afterDisplacedIter; mItemPool.end() != iter; ++iter )
{
Actor temp = iter->second;
iter->second = displacedActor;
}
// Create last item
- ItemPool::reverse_iterator lastIter = mItemPool.rbegin();
+ ItemContainer::reverse_iterator lastIter = mItemPool.rbegin();
if ( lastIter != mItemPool.rend() )
{
ItemId lastId = lastIter->first;
Item lastItem( lastId + 1, displacedActor );
- mItemPool.insert( lastItem );
+ InsertToItemContainer( mItemPool, lastItem );
lastItem.second.RemoveConstraints();
mActiveLayout->ApplyConstraints( lastItem.second, lastItem.first, layoutSize, Self() );
Vector3 layoutSize = Self().GetCurrentSize();
// Insert from lowest id to highest
- std::set<Item> sortedItems;
- for( ConstItemIter iter = newItems.begin(); newItems.end() != iter; ++iter )
- {
- sortedItems.insert( *iter );
- }
+ ItemContainer sortedItems(newItems);
+ std::sort( sortedItems.begin(), sortedItems.end() );
- for( std::set<Item>::iterator iter = sortedItems.begin(); sortedItems.end() != iter; ++iter )
+ for( ItemIter iter = sortedItems.begin(); sortedItems.end() != iter; ++iter )
{
Self().Add( iter->second );
- ItemPoolIter foundIter = mItemPool.find( iter->first );
+ ItemIter foundIter = FindItemById( mItemPool, iter->first );
if( mItemPool.end() != foundIter )
{
Actor moveMe = foundIter->second;
foundIter->second = iter->second;
// Move the existing actors to make room
- for( ItemPoolIter iter = ++foundIter; mItemPool.end() != iter; ++iter )
+ for( ItemIter iter = ++foundIter; mItemPool.end() != iter; ++iter )
{
Actor temp = iter->second;
iter->second = moveMe;
// Create last item
ItemId lastId = mItemPool.rbegin()->first;
Item lastItem( lastId + 1, moveMe );
- mItemPool.insert( lastItem );
+ InsertToItemContainer( mItemPool, lastItem );
}
else
{
- mItemPool.insert( *iter );
+ InsertToItemContainer( mItemPool, *iter );
}
}
// Relayout everything
- for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
// If newly inserted
- if( FindById( newItems, iter->first ) )
+ if( std::binary_search( sortedItems.begin(), sortedItems.end(), *iter ) )
{
SetupActor( *iter, layoutSize );
}
bool actorsReordered( false );
// Remove from highest id to lowest
- set<ItemId> sortedItems;
- for( ConstItemIdIter iter = itemIds.begin(); itemIds.end() != iter; ++iter )
- {
- sortedItems.insert( *iter );
- }
+ ItemIdContainer sortedItems(itemIds);
+ std::sort( sortedItems.begin(), sortedItems.end() );
- for( set<ItemId>::reverse_iterator iter = sortedItems.rbegin(); sortedItems.rend() != iter; ++iter )
+ for( ItemIdContainer::reverse_iterator iter = sortedItems.rbegin(); sortedItems.rend() != iter; ++iter )
{
if( RemoveActor( *iter ) )
{
{
bool reordered( false );
- ItemPoolIter removeIter = mItemPool.find( itemId );
+ ItemIter removeIter = FindItemById( mItemPool, itemId );
if( removeIter != mItemPool.end() )
{
ReleaseActor(itemId, removeIter->second);
else
{
// Removing before the existing item range?
- ItemPoolIter iter = mItemPool.begin();
+ ItemIter iter = mItemPool.begin();
if( iter != mItemPool.end() &&
iter->first > itemId )
{
// In order to decrement the first visible item ID
- mItemPool.insert( Item(iter->first - 1, Actor()) );
+ InsertToItemContainer( mItemPool, Item(iter->first - 1, Actor()) );
removeIter = mItemPool.begin();
}
// ID 2 - ActorB ID 2 - ActorC (previously ID 3)
// ID 3 - ActorC ID 3 - ActorB (previously ID 4)
// ID 4 - ActorD
- for (ItemPoolIter iter = removeIter; iter != mItemPool.end(); ++iter)
+ for (ItemIter iter = removeIter; iter != mItemPool.end(); ++iter)
{
if( iter->first < mItemPool.rbegin()->first )
{
- iter->second = mItemPool[ iter->first + 1 ];
+ iter->second = ( iter + 1 )->second;
}
else
{
SetupActor( replacementItem, layoutSize );
Self().Add( replacementItem.second );
- const ItemPoolIter iter = mItemPool.find( replacementItem.first );
+ const ItemIter iter = FindItemById( mItemPool, replacementItem.first );
if( mItemPool.end() != iter )
{
ReleaseActor(iter->first, iter->second);
}
else
{
- mItemPool.insert( replacementItem );
+ InsertToItemContainer( mItemPool, replacementItem );
}
CalculateDomainSize( layoutSize );
void ItemView::RemoveActorsOutsideRange( ItemRange range )
{
// Remove unwanted actors from the ItemView & ItemPool
- for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); )
+ for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); )
{
unsigned int current = iter->first;
{
ReleaseActor(iter->first, iter->second);
- mItemPool.erase( iter++ ); // erase invalidates the return value of post-increment; iter remains valid
+ iter = mItemPool.erase( iter ); // iter is still valid after the erase
}
else
{
{
mAddingItems = true;
- if( mItemPool.end() == mItemPool.find( itemId ) )
+ if( mItemPool.end() == FindItemById( mItemPool, itemId ) )
{
Actor actor = mItemFactory.NewItem( itemId );
{
Item newItem( itemId, actor );
- mItemPool.insert( newItem );
+ InsertToItemContainer( mItemPool, newItem );
SetupActor( newItem, layoutSize );
Self().Add( actor );
{
Vector3 layoutSize = Self().GetCurrentSize();
- for (ConstItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
unsigned int id = iter->first;
Actor actor = iter->second;
if( parentOrigin != mItemsParentOrigin )
{
mItemsParentOrigin = parentOrigin;
- for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
iter->second.SetParentOrigin(parentOrigin);
}
if( anchorPoint != mItemsAnchorPoint )
{
mItemsAnchorPoint = anchorPoint;
- for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
iter->second.SetAnchorPoint(anchorPoint);
}
#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/object/property-notification.h>
-#include <dali/devel-api/common/map-wrapper.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/property-array.h>
private:
- typedef std::map<unsigned int, Actor> ItemPool;
- typedef ItemPool::iterator ItemPoolIter;
- typedef ItemPool::const_iterator ConstItemPoolIter;
-
Property::Array mlayoutArray;
- ItemPool mItemPool;
+ ItemContainer mItemPool;
ItemFactory& mItemFactory;
std::vector< ItemLayoutPtr > mLayouts; ///< Container of Dali::Toolkit::ItemLayout objects
Actor mOvershootOverlay; ///< The overlay actor for overshoot effect
Actor self( Self() );
mVisuals[0] = Toolkit::VisualFactory::Get().CreateVisual( mInputImage );
- DevelControl::RegisterVisual( *this, 0, mVisuals[0] ); // Will clean up previously registered visuals for this index.
- mVisuals[0].SetDepthIndex(0);
+ DevelControl::RegisterVisual( *this, 0, mVisuals[0], 0 ); // Will clean up previously registered visuals for this index.
// custom shader is not applied on the original image.
BlurImage( 0, inputImage);
GAUSSIAN_BLUR_RENDER_TARGET_PIXEL_FORMAT );
mVisuals[i] = Toolkit::VisualFactory::Get().CreateVisual( mBlurredImage[i - 1] );
- DevelControl::RegisterVisual( *this, i, mVisuals[i] ); // Will clean up existing visual with same index.
- mVisuals[i].SetDepthIndex( i );
+ DevelControl::RegisterVisual( *this, i, mVisuals[i], int( i ) ); // Will clean up existing visual with same index.
SetShaderEffect( mVisuals[i] );
}
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/text/rendering-backend.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "scrollBarShowDuration", FLOAT, SCROLL_BAR_SHOW_DURATION )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "scrollBarFadeDuration", FLOAT, SCROLL_BAR_FADE_DURATION )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "pixelSize", FLOAT, PIXEL_SIZE )
+DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextEditor, "lineCount", INTEGER, LINE_COUNT )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholderText", STRING, PLACEHOLDER_TEXT )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholderTextColor", VECTOR4, PLACEHOLDER_TEXT_COLOR )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
}
break;
}
+ case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT:
+ {
+ if( impl.mController )
+ {
+ const std::string& text = value.Get< std::string >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor::OnPropertySet %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() );
+
+ impl.mController->SetPlaceholderText( text );
+ }
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR:
+ {
+ if( impl.mController )
+ {
+ const Vector4& textColor = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
+
+ if( impl.mController->GetPlaceholderTextColor() != textColor )
+ {
+ impl.mController->SetPlaceholderTextColor( textColor );
+ impl.mRenderer.Reset();
+ }
+ }
+ break;
+ }
} // switch
} // texteditor
}
}
break;
}
+ case Toolkit::DevelTextEditor::Property::LINE_COUNT:
+ {
+ if( impl.mController )
+ {
+ float width = textEditor.GetProperty( Actor::Property::SIZE_WIDTH ).Get<float>();
+ value = impl.mController->GetLineCount( width );
+ }
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT:
+ {
+ if( impl.mController )
+ {
+ std::string text;
+ impl.mController->GetPlaceholderText( text );
+ value = text;
+ }
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetPlaceholderTextColor();
+ }
+ break;
+ }
} //switch
}
mScrollBar.SetScrollPropertySource(self, propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
+ // Set style name of ScrollBar for styling
+ mScrollBar.SetStyleName("TextEditorScrollBar");
+ Toolkit::Control scrollIndicator = Toolkit::Control::DownCast( mScrollBar.GetScrollIndicator() );
+ if( scrollIndicator )
+ {
+ // Set style name of ScrollBarIndicator for styling
+ scrollIndicator.SetStyleName("TextEditorScrollBarIndicator");
+ }
+
self.Add( mScrollBar );
}
else
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pixelSize", FLOAT, PIXEL_SIZE )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "ellipsis", BOOLEAN, ELLIPSIS )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopDelay", FLOAT, AUTO_SCROLL_LOOP_DELAY )
-DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollStopMode", STRING, AUTO_SCROLL_STOP_MODE )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollStopMode", STRING, AUTO_SCROLL_STOP_MODE )
+DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "lineCount", INTEGER, LINE_COUNT )
DALI_TYPE_REGISTRATION_END()
{
if( impl.mTextScroller )
{
- impl.mTextScroller->SetLoopCount( 0 ); // Causes the current animation to finish playing (0)
+ impl.mTextScroller->StopScrolling();
}
}
// If request is enable (true) then start autoscroll as not already running
}
break;
}
+ case Toolkit::DevelTextLabel::Property::LINE_COUNT:
+ {
+ if( impl.mController )
+ {
+ float width = label.GetProperty( Actor::Property::SIZE_WIDTH ).Get<float>();
+ value = impl.mController->GetLineCount( width );
+ }
+ break;
+ }
}
}
// If speed, loopCount or gap not set via property system then will need to create a TextScroller with defaults
mTextScroller = Text::TextScroller::New( *this );
}
- mTextScroller->SetParameters( mRenderableActor, controlSize, offScreenSize, direction, alignmentOffset );
+ mTextScroller->SetParameters( mRenderableActor, controlSize, offScreenSize, direction, alignmentOffset, mController->GetHorizontalAlignment() );
Actor self = Self();
self.Add( mTextScroller->GetScrollingText() );
if( visual )
{
- DevelControl::RegisterVisual( *this, Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER, visual );
- visual.SetDepthIndex( DepthIndex::CONTENT );
+ DevelControl::RegisterVisual( *this, Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER, visual, DepthIndex::CONTENT );
}
}
}
#define DALI_TOOLKIT_TEXT_LAYOUT_ALIGNMENT_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
VERTICAL_ALIGN_BOTTOM
};
+enum AlignmentCount
+{
+ HORIZONTAL_ALIGN_COUNT = HORIZONTAL_ALIGN_END + 1,
+ VERTICAL_ALIGN_COUNT = VERTICAL_ALIGN_BOTTOM + 1
+};
+
} // namespace Layout
} // namespace Text
EventData::EventData( DecoratorPtr decorator )
: mDecorator( decorator ),
mImfManager(),
+ mPlaceholderText(),
mPlaceholderTextActive(),
mPlaceholderTextInactive(),
mPlaceholderTextColor( 0.8f, 0.8f, 0.8f, 0.8f ),
DecoratorPtr mDecorator; ///< Pointer to the decorator.
ImfManager mImfManager; ///< The Input Method Framework Manager.
+ std::string mPlaceholderText; ///< The text to display when the TextField is empty.
std::string mPlaceholderTextActive; ///< The text to display when the TextField is empty with key-input focus.
std::string mPlaceholderTextInactive; ///< The text to display when the TextField is empty and inactive.
Vector4 mPlaceholderTextColor; ///< The in/active placeholder text color.
*/
bool IsPlaceholderAvailable() const
{
- return ( mEventData &&
- ( !mEventData->mPlaceholderTextInactive.empty() ||
- !mEventData->mPlaceholderTextActive.empty() )
- );
+ return ( mEventData && ( !mEventData->mPlaceholderText.empty() ||
+ !mEventData->mPlaceholderTextInactive.empty() ||
+ !mEventData->mPlaceholderTextActive.empty() ) );
}
bool IsShowingPlaceholderText() const
*/
bool IsFocusedPlaceholderAvailable() const
{
- return ( mEventData && !mEventData->mPlaceholderTextActive.empty() );
+ return ( mEventData && ( !mEventData->mPlaceholderTextActive.empty() ||
+ !mEventData->mPlaceholderText.empty() ) );
}
bool IsShowingRealText() const
}
}
+void Controller::SetPlaceholderText( const std::string& text )
+{
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mPlaceholderText = text;
+
+ // Update placeholder if there is no text
+ if( mImpl->IsShowingPlaceholderText() ||
+ ( 0u == mImpl->mModel->mLogicalModel->mText.Count() ) )
+ {
+ ShowPlaceholderText();
+ }
+ }
+}
+
+// This is overloading function for PLACEHOLDER_TEXT_FOCUSED in text-field
void Controller::SetPlaceholderText( PlaceholderType type, const std::string& text )
{
if( NULL != mImpl->mEventData )
}
}
+void Controller::GetPlaceholderText( std::string& text ) const
+{
+ if( NULL != mImpl->mEventData )
+ {
+ text = mImpl->mEventData->mPlaceholderText;
+ }
+}
+
+// This is overloading function for PLACEHOLDER_TEXT_FOCUSED in text-field
void Controller::GetPlaceholderText( PlaceholderType type, std::string& text ) const
{
if( NULL != mImpl->mEventData )
return layoutSize.height;
}
+int Controller::GetLineCount( float width )
+{
+ GetHeightForWidth( width );
+ int numberofLines = mImpl->mModel->GetNumberOfLines();
+ return numberofLines;
+}
+
const ModelInterface* const Controller::GetTextModel() const
{
return mImpl->mModel.Get();
const char* text( NULL );
size_t size( 0 );
- // TODO - Switch placeholder text styles when changing state
- if( ( EventData::INACTIVE != mImpl->mEventData->mState ) &&
- ( 0u != mImpl->mEventData->mPlaceholderTextActive.c_str() ) )
+ if( !mImpl->mEventData->mPlaceholderTextActive.empty() || !mImpl->mEventData->mPlaceholderTextInactive.empty() )
{
- text = mImpl->mEventData->mPlaceholderTextActive.c_str();
- size = mImpl->mEventData->mPlaceholderTextActive.size();
+ if( ( EventData::INACTIVE != mImpl->mEventData->mState ) &&
+ ( 0u != mImpl->mEventData->mPlaceholderTextActive.c_str() ) )
+ {
+ text = mImpl->mEventData->mPlaceholderTextActive.c_str();
+ size = mImpl->mEventData->mPlaceholderTextActive.size();
+ }
+ else
+ {
+ text = mImpl->mEventData->mPlaceholderTextInactive.c_str();
+ size = mImpl->mEventData->mPlaceholderTextInactive.size();
+ }
}
else
{
- text = mImpl->mEventData->mPlaceholderTextInactive.c_str();
- size = mImpl->mEventData->mPlaceholderTextInactive.size();
+ if( 0u != mImpl->mEventData->mPlaceholderText.c_str() )
+ {
+ text = mImpl->mEventData->mPlaceholderText.c_str();
+ size = mImpl->mEventData->mPlaceholderText.size();
+ }
}
mImpl->mTextUpdateInfo.mCharacterIndex = 0u;
/**
* @brief Replaces any placeholder text previously set.
*
+ * @param[in] text A string of UTF-8 characters.
+ */
+ void SetPlaceholderText( const std::string& text );
+
+ /**
+ * @brief Replaces any placeholder text previously set.
+ *
* @param[in] type Different placeholder-text can be shown when the control is active/inactive.
* @param[in] text A string of UTF-8 characters.
*/
/**
* @brief Retrieve any placeholder text previously set.
*
+ * @param[out] A string of UTF-8 characters.
+ */
+ void GetPlaceholderText( std::string& text ) const;
+
+ /**
+ * @brief Retrieve any placeholder text previously set.
+ *
* @param[in] type Different placeholder-text can be shown when the control is active/inactive.
* @param[out] A string of UTF-8 characters.
*/
float GetHeightForWidth( float width );
/**
+ * @brief Retrieves the text's number of lines for a given width.
+ * @param[in] width The width of the text's area.
+ * @ return The number of lines.
+ */
+ int GetLineCount( float width );
+
+ /**
* @brief Retrieves the text's model.
*
* @return A pointer to the text's model.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
uniform mediump float uDelta;\n
uniform mediump vec2 uTextureSize;
uniform mediump float uGap;\n
- uniform mediump float uRtl;\n
+ uniform mediump float uAlign;\n
\n
void main()\n
{\n
float smallTextPadding = max(uSize.x - uTextureSize.x, 0. );\n
float gap = max( uGap, smallTextPadding );\n
float delta = floor ( uDelta ) + 0.5;
- vTexCoord.x = ( delta + ( uRtl * ( uTextureSize.x - uSize.x ) ) + ( aPosition.x * uSize.x ) )/ ( uTextureSize.x + gap );\n
+ vTexCoord.x = ( delta + ( uAlign * ( uTextureSize.x - uSize.x ) ) + ( aPosition.x * uSize.x ) )/ ( uTextureSize.x + gap );\n
vTexCoord.y = ( 0.5 + floor( aPosition.y * uSize.y ) )/ ( uTextureSize.y ) ;\n
vRatio = uTextureSize.x / ( uTextureSize.x + gap );\n
gl_Position = uProjection * vertexPosition;
);
/**
+ * @brief How the text should be aligned when scrolling the text.
+ *
+ * 0.0f aligns the text to the left, 1.0f aligns the text to the right.
+ * The final alignment depends on three factors:
+ * 1) The alignment value of the text label (Use Text::Layout::HorizontalAlignment enumerations).
+ * 2) The text direction, i.e. whether it's LTR or RTL (0 = LTR, 1 = RTL).
+ * 3) Whether the text is greater than the size of the control ( 0 = Text width <= Control width, 1 = Text width > Control width ).
+ */
+const float ALIGNMENT_TABLE[ Text::Layout::HORIZONTAL_ALIGN_COUNT ][ 2 ][ 2 ] =
+{
+ // HORIZONTAL_ALIGN_BEGIN
+ {
+ { // LTR
+ 0.0f, // Text width <= Control width
+ 0.0f // Text width > Control width
+ },
+ { // RTL
+ 1.0f, // Text width <= Control width
+ 1.0f // Text width > Control width
+ }
+ },
+
+ // HORIZONTAL_ALIGN_CENTER
+ {
+ { // LTR
+ 0.5f, // Text width <= Control width
+ 0.0f // Text width > Control width
+ },
+ { // RTL
+ 0.5f, // Text width <= Control width
+ 1.0f // Text width > Control width
+ }
+ },
+
+ // HORIZONTAL_ALIGN_END
+ {
+ { // LTR
+ 1.0f, // Text width <= Control width
+ 0.0f // Text width > Control width
+ },
+ { // RTL
+ 0.0f, // Text width <= Control width
+ 1.0f // Text width > Control width
+ }
+ }
+};
+
+/**
* @brief Create and set up a camera for the render task to use
*
* @param[in] sizeOfTarget size of the source camera to look at
CreateGeometry( meshGeometry );
renderer = Renderer::New( meshGeometry, shader );
+ renderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true );
renderer.SetTextures( textureSet );
}
void TextScroller::SetLoopCount( int loopCount )
{
- if ( loopCount > 0 )
+ if ( loopCount >= 0 )
{
mLoopCount = loopCount;
}
- if ( mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING )
- {
- if ( loopCount == 0 ) // Request to stop looping
- {
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetLoopCount Single loop forced\n" );
- switch( mStopMode )
- {
- case DevelTextLabel::AutoScrollStopMode::IMMEDIATE:
- {
- mScrollAnimation.Stop();
- break;
- }
- case DevelTextLabel::AutoScrollStopMode::FINISH_LOOP:
- {
- mScrollAnimation.SetLoopCount( 1 ); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way
- break;
- }
- default:
- {
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n" );
- }
- }
- }
- }
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetLoopCount [%d] Status[%s]\n", mLoopCount, (loopCount)?"looping":"stop" );
}
mStopMode = stopMode;
}
+void TextScroller::StopScrolling()
+{
+ if ( mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING )
+ {
+ switch( mStopMode )
+ {
+ case DevelTextLabel::AutoScrollStopMode::IMMEDIATE:
+ {
+ mScrollAnimation.Stop();
+ CleanUp();
+ mScrollerInterface.ScrollingFinished();
+ break;
+ }
+ case DevelTextLabel::AutoScrollStopMode::FINISH_LOOP:
+ {
+ mScrollAnimation.SetLoopCount( 1 ); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way
+ break;
+ }
+ default:
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n" );
+ }
+ }
+ }
+}
+
DevelTextLabel::AutoScrollStopMode::Type TextScroller::GetStopMode() const
{
return mStopMode;
CleanUp();
}
-void TextScroller::SetParameters( Actor sourceActor, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, float alignmentOffset )
+void TextScroller::SetParameters( Actor sourceActor, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, float alignmentOffset, Layout::HorizontalAlignment horizontalAlignment )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters controlSize[%f,%f] offscreenSize[%f,%f] direction[%d] alignmentOffset[%f]\n",
controlSize.x, controlSize.y, offScreenSize.x, offScreenSize.y, direction, alignmentOffset );
CleanUp(); // If already scrolling then restart with new parameters
+ float animationProgress = 0.0f;
+ int remainedLoop = mLoopCount;
if ( mScrollAnimation )
{
+ if( mScrollAnimation.GetState() == Animation::PLAYING )
+ {
+ animationProgress = mScrollAnimation.GetCurrentProgress();
+
+ if( mLoopCount > 0 ) // If not a ininity loop, then calculate remained loop
+ {
+ remainedLoop = mLoopCount - ( mScrollAnimation.GetCurrentLoop() );
+ remainedLoop = ( remainedLoop <= 0 ? 1 : remainedLoop );
+ }
+ }
mScrollAnimation.Clear();
}
CreateRenderer( offscreenRenderTargetForText, renderer );
CreateRenderTask( sourceActor, mOffscreenCameraActor, offscreenRenderTargetForText, mRenderTask );
- // Reposition camera to match alignment of target, RTL text has direction=true
- if ( direction )
- {
- mOffscreenCameraActor.SetX( alignmentOffset + offScreenSize.width*0.5f );
- }
- else
+ float xPosition = 0.0f;
+ switch( horizontalAlignment )
{
- mOffscreenCameraActor.SetX( offScreenSize.width * 0.5f );
+ case Layout::HORIZONTAL_ALIGN_BEGIN:
+ {
+ // Reposition camera to match alignment of target, RTL text has direction=true
+ if ( direction )
+ {
+ xPosition = alignmentOffset + offScreenSize.width * 0.5f;
+ }
+ else
+ {
+ xPosition = offScreenSize.width * 0.5f;
+ }
+ break;
+ }
+
+ case Layout::HORIZONTAL_ALIGN_CENTER:
+ {
+ xPosition = controlSize.width * 0.5f;
+ break;
+ }
+
+ case Layout::HORIZONTAL_ALIGN_END:
+ {
+ // Reposition camera to match alignment of target, RTL text has direction=true
+ if ( direction )
+ {
+ xPosition = offScreenSize.width * 0.5f;
+ }
+ else
+ {
+ xPosition = alignmentOffset + offScreenSize.width * 0.5f;
+ }
+ break;
+ }
}
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters xPosition[%f]\n", xPosition );
+
+ mOffscreenCameraActor.SetX( xPosition );
mOffscreenCameraActor.SetY( offScreenSize.height * 0.5f );
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters mWrapGap[%f]\n", mWrapGap )
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters mWrapGap[%f]\n", mWrapGap );
+
+ const float align = ALIGNMENT_TABLE[ horizontalAlignment ][ direction ][ offScreenSize.width > controlSize.width ];
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters align[%f]\n", align );
mScrollingTextActor = Actor::New();
mScrollingTextActor.AddRenderer( renderer );
mScrollingTextActor.RegisterProperty( "uTextureSize", offScreenSize );
- mScrollingTextActor.RegisterProperty( "uRtl", ((direction)?1.0f:0.0f) );
+ mScrollingTextActor.RegisterProperty( "uAlign", align );
mScrollingTextActor.RegisterProperty( "uGap", mWrapGap );
mScrollingTextActor.SetSize( controlSize.width, std::min( offScreenSize.height, controlSize.height ) );
mScrollDeltaIndex = mScrollingTextActor.RegisterProperty( "uDelta", 0.0f );
scrollAmount = -scrollAmount; // reverse direction of scrollung
}
- StartScrolling( scrollAmount, scrollDuration, mLoopCount );
+ StartScrolling( scrollAmount, scrollDuration, remainedLoop );
+ mScrollAnimation.SetCurrentProgress(animationProgress);
}
void TextScroller::AutoScrollAnimationFinished( Dali::Animation& animation )
#define __DALI_TOOLKIT_TEXT_SCROLLER_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
#include <dali-toolkit/internal/text/text-definitions.h>
+#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
namespace Dali
{
* @param[in] alignmentOffset alignment of source text
*
*/
- void SetParameters( Actor sourceActor, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, float alignmentOffset );
+ void SetParameters( Actor sourceActor, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, float alignmentOffset, Layout::HorizontalAlignment horizontalAlignment );
/**
* @brief Set the gap distance to elapse before the text wraps around
void SetStopMode( DevelTextLabel::AutoScrollStopMode::Type stopMode );
/**
+ * @brief Stop the auto scrolling.
+ */
+ void StopScrolling();
+
+ /**
* @brief Get the mode of scrolling stop
* @return stopMode type when text scrolling is stoped.
*/
: mOffset( 0.0f,0.0f ),
mSize( 1.0f,1.0f ),
mOffsetSizeMode( 0.0f,0.0f,0.0f,0.0f ),
- mOrigin( Toolkit::Align::CENTER ),
- mAnchorPoint( Toolkit::Align::CENTER )
+ mOrigin( Toolkit::Align::TOP_BEGIN ),
+ mAnchorPoint( Toolkit::Align::TOP_BEGIN )
{
}
mOffset = Vector2( 0.0f,0.0f );
mSize = Vector2( 1.0f,1.0f );
mOffsetSizeMode = Vector4( 0.0f,0.0f,0.0f,0.0f );
- mOrigin = Toolkit::Align::CENTER;
- mAnchorPoint = Toolkit::Align::CENTER;
+ mOrigin = Toolkit::Align::TOP_BEGIN;
+ mAnchorPoint = Toolkit::Align::TOP_BEGIN;
UpdatePropertyMap( map );
}
#define DALI_TOOLKIT_INTERNAL_VISUAL_BASE_DATA_IMPL_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
Transform mTransform;
Vector4 mMixColor;
Size mControlSize;
- float mDepthIndex;
+ int mDepthIndex;
Property::Index mMixColorIndex;
Property::Index mOpacityIndex;
int mFlags;
naturalSize = Vector2::ZERO;
}
-void Visual::Base::SetDepthIndex( float index )
+void Visual::Base::SetDepthIndex( int index )
{
mImpl->mDepthIndex = index;
if( mImpl->mRenderer )
}
}
-float Visual::Base::GetDepthIndex() const
+int Visual::Base::GetDepthIndex() const
{
return mImpl->mDepthIndex;
}
#define DALI_TOOLKIT_INTERNAL_VISUAL_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
/**
* @copydoc Toolkit::Visual::Base::SetDepthIndex
*/
- void SetDepthIndex( float index );
+ void SetDepthIndex( int index );
/**
* @copydoc Toolkit::Visual::Base::GetDepthIndex
*/
- float GetDepthIndex() const;
+ int GetDepthIndex() const;
/**
* @copydoc Toolkit::Visual::Base::SetOnStage
Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( map );
if( visual )
{
- mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual );
- visual.SetDepthIndex( DepthIndex::BACKGROUND );
+ mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND );
// Trigger a size negotiation request that may be needed by the new visual to relayout its contents.
RelayoutRequest();
Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( image );
if( visual )
{
- mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual );
- visual.SetDepthIndex( DepthIndex::BACKGROUND );
+ mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND );
}
}
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 41;
+const unsigned int TOOLKIT_MICRO_VERSION = 42;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.41
+Version: 1.2.42
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT