Allow text-selection scroll indicator to have a different style 25/114925/8
authorNick Holland <nick.holland@partner.samsung.com>
Wed, 15 Feb 2017 14:56:27 +0000 (14:56 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Thu, 16 Feb 2017 15:47:09 +0000 (15:47 +0000)
Change-Id: I3655d76cc1d0535d35365741f4e48f589dcd6168

automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp
dali-toolkit/styles/480x800/dali-toolkit-default-theme.json
dali-toolkit/styles/images-common/text_selection_scroll_indicator.9.png [new file with mode: 0644]

index 2cee1b52f3fc319099dd7195d93e3d7ed8dbc168..b1d76da86f9e57c152c012742dde1334ec492140 100644 (file)
@@ -111,7 +111,6 @@ int UtcDaliToolkitTextSelectionPopupDownCastP(void)
 
 int UtcDaliToolkitTextSelectionToolBarP(void)
 {
-
   // Creates Toolbar, adds 2 options and a divider then resizes divider
   ToolkitTestApplication application;
 
@@ -140,3 +139,27 @@ int UtcDaliToolkitTextSelectionToolBarP(void)
   DALI_TEST_CHECK( toolbar );
   END_TEST;
 }
+
+int UtcDaliToolkitTextSelectionToolBarScrollBarP(void)
+{
+  // Creates Toolbar, adds 2 options and a divider then resizes divider
+  ToolkitTestApplication application;
+
+  TextSelectionToolbar toolbar = TextSelectionToolbar::New();
+
+  toolbar.SetProperty( Toolkit::TextSelectionToolbar::Property::MAX_SIZE, Size( 100.0f, 60.0f) );
+
+  Toolkit::PushButton option = Toolkit::PushButton::New();
+  option.SetName( "test-option" );
+  option.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+  toolbar.AddOption( option );
+
+  // Add a scroll-bar
+  toolbar.SetProperty( Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR, true );
+
+  bool enabled = toolbar.GetProperty<bool>( Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR );
+  DALI_TEST_CHECK( enabled );
+
+  DALI_TEST_CHECK( toolbar );
+  END_TEST;
+}
index e3564dfd068eb239122387275ea1afeb79d8afa2..7612185049596fd714a250d277d3ec2c0409f430 100755 (executable)
@@ -251,12 +251,6 @@ void ScrollBar::SetScrollIndicator( Actor indicator )
     }
     mIndicator = indicator;
 
-    Toolkit::Control control = Toolkit::Control::DownCast( mIndicator );
-    if( control )
-    {
-      control.SetStyleName( "ScrollBarIndicator" );
-    }
-
     mIndicatorFirstShow = true;
     Self().Add( mIndicator );
 
index 317dbf92106003cd8b7309e04d980cbedc243dd5..0cb62af7ae31e01559536dca1353785c3307e0bb 100644 (file)
@@ -252,13 +252,20 @@ void TextSelectionToolbar::SetUpScrollBar( bool enable )
   {
     if( ! mScrollBar )
     {
+      Toolkit::ImageView indicator = Toolkit::ImageView::New();
+      indicator.SetParentOrigin( ParentOrigin::TOP_LEFT );
+      indicator.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+      indicator.SetStyleName( "TextSelectionScrollIndicator" );
+
       mScrollBar = Toolkit::ScrollBar::New( Toolkit::ScrollBar::Horizontal );
       mScrollBar.SetName( "Text popup scroll bar" );
+      mScrollBar.SetStyleName( "TextSelectionScrollBar" );
       mScrollBar.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
       mScrollBar.SetAnchorPoint( AnchorPoint::TOP_LEFT );
       mScrollBar.SetPosition( mScrollBarPadding.x, -mScrollBarPadding.y );
       mScrollBar.SetResizePolicy( Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::WIDTH );
       mScrollBar.SetOrientation( Quaternion( Radian( 1.5f * Math::PI ), Vector3::ZAXIS ) );
+      mScrollBar.SetScrollIndicator( indicator );
       mScrollBar.GetPanGestureDetector().DetachAll();
       mScrollView.Add( mScrollBar );
     }
index 6e1c7f1d3f625718ec94c6c508404c4ff8e07359..23af0f75a27a2be0e2bdb4ebb403493adbbee02b 100644 (file)
         "overshootSize":[480.0,42.0]
       }
     },
+    "TextSelectionScrollBar":
+    {
+      "indicatorShowDuration":0.25,
+      "indicatorHideDuration":0.25
+    },
+    "TextSelectionScrollIndicator":
+    {
+      "image":
+      {
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}text_selection_scroll_indicator.9.png"
+      },
+      "color":[0.0,0.72,0.9,0.7]
+    },
     "ScrollView":
     {
       "overshootEffectColor":"B018",
     "ScrollBar":
     {
       "indicatorShowDuration":0.25,
-      "indicatorHideDuration":0.25,
-      "color":[0.0,0.72,0.9,0.7]
+      "indicatorHideDuration":0.25
+    },
+    "ScrollBarIndicator":
+    {
+      "image":
+      {
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}popup_scroll.9.png"
+      }
     },
     "TextEditor":
     {
diff --git a/dali-toolkit/styles/images-common/text_selection_scroll_indicator.9.png b/dali-toolkit/styles/images-common/text_selection_scroll_indicator.9.png
new file mode 100644 (file)
index 0000000..5bf5b3f
Binary files /dev/null and b/dali-toolkit/styles/images-common/text_selection_scroll_indicator.9.png differ