Allow text-selection scroll indicator to have a different style
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scroll-bar / scroll-bar-impl.cpp
index f10dfb5..7612185 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -175,7 +175,7 @@ const char* INDICATOR_HEIGHT_POLICY_NAME[] = {"Variable", "Fixed"};
 }
 
 ScrollBar::ScrollBar(Toolkit::ScrollBar::Direction direction)
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
   mIndicatorShowAlpha(1.0f),
   mDirection(direction),
   mScrollableObject(WeakHandleBase()),
@@ -234,7 +234,8 @@ void ScrollBar::CreateDefaultIndicatorActor()
   Toolkit::ImageView indicator = Toolkit::ImageView::New( DEFAULT_INDICATOR_IMAGE_PATH );
   indicator.SetParentOrigin( ParentOrigin::TOP_LEFT );
   indicator.SetAnchorPoint( AnchorPoint::TOP_LEFT );
-
+  indicator.SetStyleName( "ScrollBarIndicator" );
+  indicator.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
   SetScrollIndicator(indicator);
 }
 
@@ -243,11 +244,17 @@ void ScrollBar::SetScrollIndicator( Actor indicator )
   // Don't allow empty handle
   if( indicator )
   {
+    // Remove current Indicator
+    if( mIndicator )
+    {
+      Self().Remove( mIndicator );
+    }
     mIndicator = indicator;
+
     mIndicatorFirstShow = true;
-    Self().Add(mIndicator);
+    Self().Add( mIndicator );
 
-    EnableGestureDetection(Gesture::Type(Gesture::Pan));
+    EnableGestureDetection( Gesture::Type( Gesture::Pan ) );
 
     PanGestureDetector detector( GetPanGestureDetector() );
     detector.DetachAll();
@@ -491,6 +498,8 @@ void ScrollBar::OnSizeSet( const Vector3& size )
   {
     mIndicator.SetSize(size.width, mIndicatorFixedHeight);
   }
+
+  Control::OnSizeSet( size );
 }
 
 void ScrollBar::SetScrollDirection( Toolkit::ScrollBar::Direction direction )