projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor TextLabel to use text visual
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
controls
/
slider
/
slider-impl.cpp
diff --git
a/dali-toolkit/internal/controls/slider/slider-impl.cpp
b/dali-toolkit/internal/controls/slider/slider-impl.cpp
index
de7e5c6
..
275995d
100755
(executable)
--- a/
dali-toolkit/internal/controls/slider/slider-impl.cpp
+++ b/
dali-toolkit/internal/controls/slider/slider-impl.cpp
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 201
4
Samsung Electronics Co., Ltd.
+ * Copyright (c) 201
7
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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-25,7
+25,7
@@
#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
-#include <dali
/public-api/images/resource-image
.h>
+#include <dali
-toolkit/public-api/visuals/image-visual-properties
.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
@@
-134,7
+134,7
@@
Dali::Toolkit::Slider Slider::New()
}
Slider::Slider()
}
Slider::Slider()
-: Control( ControlBehaviour(
REQUIRES_STYLE_CHANGE_SIGNALS
) ),
+: Control( ControlBehaviour(
CONTROL_BEHAVIOUR_DEFAULT
) ),
mState( NORMAL ),
mPopupVisual(""),
mPopupArrowVisual(""),
mState( NORMAL ),
mPopupVisual(""),
mPopupArrowVisual(""),
@@
-205,10
+205,6
@@
void Slider::OnInitialize()
self.TouchSignal().Connect( this, &Slider::OnTouch );
}
self.TouchSignal().Connect( this, &Slider::OnTouch );
}
-void Slider::OnSizeSet( const Vector3& size )
-{
-}
-
void Slider::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
SetHitRegion( Vector2( size.x, GetHitRegion().y ) );
void Slider::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
SetHitRegion( Vector2( size.x, GetHitRegion().y ) );
@@
-317,9
+313,9
@@
Slider::Domain Slider::CalcDomain( const Vector2& currentSize )
void Slider::DisplayValue( float value, bool raiseSignals )
{
void Slider::DisplayValue( float value, bool raiseSignals )
{
- float clamp
l
edValue = Clamp( value, GetLowerBound(), GetUpperBound() );
+ float clampedValue = Clamp( value, GetLowerBound(), GetUpperBound() );
- float percent = MapValuePercentage( clamp
l
edValue );
+ float percent = MapValuePercentage( clampedValue );
float x = mDomain.from.x + percent * ( mDomain.to.x - mDomain.from.x );
float x = mDomain.from.x + percent * ( mDomain.to.x - mDomain.from.x );
@@
-335,7
+331,7
@@
void Slider::DisplayValue( float value, bool raiseSignals )
if( raiseSignals )
{
Toolkit::Slider self = Toolkit::Slider::DownCast( Self() );
if( raiseSignals )
{
Toolkit::Slider self = Toolkit::Slider::DownCast( Self() );
- mValueChangedSignal.Emit( self, clamp
l
edValue );
+ mValueChangedSignal.Emit( self, clampedValue );
int markIndex;
if( MarkReached( percent, markIndex ) )
int markIndex;
if( MarkReached( percent, markIndex ) )
@@
-348,9
+344,13
@@
void Slider::DisplayValue( float value, bool raiseSignals )
{
std::stringstream ss;
ss.precision( GetValuePrecision() );
{
std::stringstream ss;
ss.precision( GetValuePrecision() );
- ss << std::fixed << clamp
l
edValue;
+ ss << std::fixed << clampedValue;
- mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, ss.str() );
+ std::string label = mHandleValueTextLabel.GetProperty<std::string>( Toolkit::TextLabel::Property::TEXT );
+ if( label.compare(ss.str()) )
+ {
+ mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, ss.str() );
+ }
}
}
}
}
@@
-520,8
+520,9
@@
void Slider::CreatePopupImage( const std::string& filename )
{
if( mPopup && ( filename.size() > 0 ) )
{
{
if( mPopup && ( filename.size() > 0 ) )
{
- Image image = ResourceImage::New( filename );
- mPopup.SetImage( image );
+ Property::Map map;
+ map[Toolkit::ImageVisual::Property::URL] = filename;
+ mPopup.SetProperty( Toolkit::ImageView::Property::IMAGE, map );
}
}
}
}
@@
-557,8
+558,9
@@
void Slider::CreatePopupArrowImage( const std::string& filename )
{
if( mPopupArrow && ( filename.size() > 0 ) )
{
{
if( mPopupArrow && ( filename.size() > 0 ) )
{
- Image image = ResourceImage::New( filename );
- mPopupArrow.SetImage( image );
+ Property::Map map;
+ map[Toolkit::ImageVisual::Property::URL] = filename;
+ mPopupArrow.SetProperty( Toolkit::ImageView::Property::IMAGE, map );
}
}
}
}
@@
-1376,8
+1378,15
@@
Property::Value Slider::GetProperty( BaseObject* object, Property::Index propert
case Toolkit::Slider::Property::MARKS:
{
case Toolkit::Slider::Property::MARKS:
{
- // TODO: Need to be able to return a PropertyArray
- // value = sliderImpl.GetMarks();
+ Property::Value value1( Property::ARRAY );
+ Property::Array* markArray = value1.GetArray();
+
+ if( markArray )
+ {
+ *markArray = sliderImpl.GetMarks();
+ }
+
+ value = value1;
break;
}
break;
}