X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fslider%2Fslider-impl.cpp;h=4c1b2fa331da9cf58cd28a26f03333feb4d8e5db;hp=af6284681b608b3e846cbaef8b69722eb109df22;hb=4b347781c8761d2909b235ded2e98d272fa9ac16;hpb=eea53605c5acb244aebb72d75bdd9b3a68a9678a diff --git a/dali-toolkit/internal/controls/slider/slider-impl.cpp b/dali-toolkit/internal/controls/slider/slider-impl.cpp index af62846..4c1b2fa 100755 --- a/dali-toolkit/internal/controls/slider/slider-impl.cpp +++ b/dali-toolkit/internal/controls/slider/slider-impl.cpp @@ -19,7 +19,9 @@ #include // EXTERNAL INCLUDES +#include // for strcmp #include +#include #include #include #include @@ -347,6 +349,15 @@ void Slider::DisplayValue( float value, bool raiseSignals ) mMarkSignal.Emit( self, markIndex ); } } + + if( mHandleValueTextLabel ) + { + std::stringstream ss; + ss.precision( GetValuePrecision() ); + ss << std::fixed << clampledValue; + + mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, ss.str() ); + } } void Slider::SetMarks( const MarkList& marks ) @@ -389,6 +400,7 @@ Actor Slider::CreateHitRegion() ImageActor Slider::CreateBacking() { ImageActor backing = ImageActor::New(); + backing.SetRelayoutEnabled( false ); backing.SetParentOrigin( ParentOrigin::CENTER ); backing.SetAnchorPoint( AnchorPoint::CENTER ); backing.SetZ( BACKING_Z ); @@ -418,6 +430,7 @@ std::string Slider::GetBackingImageName() ImageActor Slider::CreateProgress() { ImageActor progress = ImageActor::New(); + progress.SetRelayoutEnabled( false ); progress.SetParentOrigin( ParentOrigin::CENTER_LEFT ); progress.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); progress.SetZ( PROGRESS_Z ); @@ -493,6 +506,7 @@ void Slider::ResizeProgressRegion( const Vector2& region ) ImageActor Slider::CreateHandle() { ImageActor handle = ImageActor::New(); + handle.SetRelayoutEnabled( false ); handle.SetParentOrigin( ParentOrigin::CENTER_LEFT ); handle.SetAnchorPoint( AnchorPoint::CENTER ); handle.SetZ( HANDLE_Z ); @@ -503,6 +517,7 @@ ImageActor Slider::CreateHandle() ImageActor Slider::CreatePopupArrow() { ImageActor arrow = ImageActor::New(); + arrow.SetRelayoutEnabled( false ); arrow.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); arrow.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); arrow.SetZ( HANDLE_Z ); @@ -510,16 +525,27 @@ ImageActor Slider::CreatePopupArrow() return arrow; } -//Toolkit::TextView Slider::CreatePopupText() -//{ -//} +Toolkit::TextLabel Slider::CreatePopupText() +{ + Toolkit::TextLabel textLabel = Toolkit::TextLabel::New(); + textLabel.SetParentOrigin( ParentOrigin::CENTER ); + textLabel.SetAnchorPoint( AnchorPoint::CENTER ); + textLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); + textLabel.SetZ( VALUE_DISPLAY_TEXT_Z ); + return textLabel; +} ImageActor Slider::CreatePopup() { ImageActor popup = ImageActor::New(); + popup.SetRelayoutEnabled( false ); popup.SetParentOrigin( ParentOrigin::TOP_CENTER ); popup.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + mValueTextLabel = CreatePopupText(); + popup.Add( mValueTextLabel ); + return popup; } @@ -552,10 +578,21 @@ void Slider::ResizeHandleRegion( const Vector2& region ) void Slider::CreateHandleValueDisplay() { + if( mHandle && !mHandleValueTextLabel ) + { + mHandleValueTextLabel = Toolkit::TextLabel::New(); + mHandleValueTextLabel.SetParentOrigin( ParentOrigin::CENTER ); + mHandleValueTextLabel.SetAnchorPoint( AnchorPoint::CENTER ); + mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); + mHandleValueTextLabel.SetDrawMode( DrawMode::OVERLAY ); + mHandle.Add( mHandleValueTextLabel ); + } } void Slider::DestroyHandleValueDisplay() { + UnparentAndReset(mHandleValueTextLabel); } void Slider::SetPopupTextColor( const Vector4& color ) @@ -981,6 +1018,21 @@ bool Slider::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tr void Slider::DisplayPopup( float value ) { + // Value displayDoConnectSignal + if( mValueTextLabel ) + { + std::stringstream ss; + ss.precision( GetValuePrecision() ); + ss << std::fixed << value; + mValueTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, ss.str() ); + + if( mValueDisplay ) + { + mValueDisplay.SetVisible( true ); + + mValueTimer.SetInterval( VALUE_VIEW_SHOW_DURATION ); + } + } } void Slider::SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )