From 2f705dd3525531584ee46d9a7fc9f23331909c10 Mon Sep 17 00:00:00 2001 From: Nick Holland Date: Wed, 15 Feb 2017 14:56:27 +0000 Subject: [PATCH] Allow text-selection scroll indicator to have a different style Change-Id: I3655d76cc1d0535d35365741f4e48f589dcd6168 --- .../utc-Dali-TextSelectionPopup.cpp | 25 +++++++++++++++++- .../controls/scroll-bar/scroll-bar-impl.cpp | 6 ----- .../text-selection-toolbar-impl.cpp | 7 +++++ .../480x800/dali-toolkit-default-theme.json | 25 ++++++++++++++++-- .../text_selection_scroll_indicator.9.png | Bin 0 -> 227 bytes 5 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 dali-toolkit/styles/images-common/text_selection_scroll_indicator.9.png diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp index 2cee1b52f3..b1d76da86f 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp @@ -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( Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR ); + DALI_TEST_CHECK( enabled ); + + DALI_TEST_CHECK( toolbar ); + END_TEST; +} diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp index e3564dfd06..7612185049 100755 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -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 ); diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp index 317dbf9210..0cb62af7ae 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp @@ -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 ); } diff --git a/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json b/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json index 6e1c7f1d3f..23af0f75a2 100644 --- a/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json +++ b/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json @@ -157,6 +157,20 @@ "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", @@ -172,8 +186,15 @@ "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 index 0000000000000000000000000000000000000000..5bf5b3fba1dfd6987857c4755e5bcffa879d956e GIT binary patch literal 227 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqY)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP~rznS_5x>EeSfEgWr;B5V#O2)c8#$Q*1zH|Pitc>j z!{ROAZMxTL%|WRnN0{Cm2$*pGiLL(y`>3??wwq2?p{kw%zESIpHXpq5%$X3R S-2V({H-o3EpUXO@geCxnTT)K| literal 0 HcmV?d00001 -- 2.34.1