Change-Id: Ieb9843466d112205bf360649502e23f38ab8313f
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
using namespace Dali;
namespace
{
using namespace Dali;
namespace
{
-const char* DEFAULT_INDICATOR_IMAGE_PATH = DALI_IMAGE_DIR "popup_scroll.png";
-const Vector4 DEFAULT_INDICATOR_NINE_PATCH_BORDER(4.0f, 9.0f, 7.0f, 11.0f);
+const char* DEFAULT_INDICATOR_IMAGE_PATH = DALI_IMAGE_DIR "popup_scroll.9.png";
const float MINIMUM_INDICATOR_HEIGHT(20.0f); // The minimum indicator height for the nine patch border
const float DEFAULT_SLIDER_DEPTH(1.0f);
const float DEFAULT_INDICATOR_SHOW_DURATION(0.5f);
const float MINIMUM_INDICATOR_HEIGHT(20.0f); // The minimum indicator height for the nine patch border
const float DEFAULT_SLIDER_DEPTH(1.0f);
const float DEFAULT_INDICATOR_SHOW_DURATION(0.5f);
void ScrollBar::CreateDefaultIndicatorActor()
{
void ScrollBar::CreateDefaultIndicatorActor()
{
- Image indicatorImage = ResourceImage::New( DEFAULT_INDICATOR_IMAGE_PATH );
- ImageActor indicator = ImageActor::New( indicatorImage );
- indicator.SetNinePatchBorder( DEFAULT_INDICATOR_NINE_PATCH_BORDER );
- indicator.SetStyle( ImageActor::STYLE_NINE_PATCH );
+ Toolkit::ImageView indicator = Toolkit::ImageView::New( DEFAULT_INDICATOR_IMAGE_PATH );
indicator.SetParentOrigin( ParentOrigin::TOP_LEFT );
indicator.SetAnchorPoint( AnchorPoint::TOP_LEFT );
indicator.SetParentOrigin( ParentOrigin::TOP_LEFT );
indicator.SetAnchorPoint( AnchorPoint::TOP_LEFT );
// EXTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/timer.h>
// EXTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/timer.h>
-#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/common/dali-vector.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
DALI_TYPE_REGISTRATION_END()
DALI_TYPE_REGISTRATION_END()
-const float BACKING_Z = -0.1f;
-const float PROGRESS_Z = 0.1f;
-const float HANDLE_Z = 1.0f;
-const float VALUE_TEXT_INCREMENT = 0.01f;
-const float HANDLE_VALUE_DISPLAY_TEXT_Z = HANDLE_Z + VALUE_TEXT_INCREMENT;
-const float VALUE_DISPLAY_TEXT_Z = VALUE_TEXT_INCREMENT + VALUE_TEXT_INCREMENT; // Put above HANDLE_VALUE_DISPLAY_TEXT_Z (parented to handle)
-
const float MARK_SNAP_TOLERANCE = 0.05f; // 5% of slider width
const int VALUE_VIEW_SHOW_DURATION = 1000; // millisec
const float MARK_SNAP_TOLERANCE = 0.05f; // 5% of slider width
const int VALUE_VIEW_SHOW_DURATION = 1000; // millisec
Slider::Slider()
: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mState( NORMAL ),
Slider::Slider()
: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mState( NORMAL ),
+ mPopupImageName(""),
+ mPopupArrowImageName(""),
+ mBackingImageName(""),
+ mHandleImageName(""),
+ mProgressImageName(""),
mDisableColor( 0.0f, 0.0f, 0.0f, 0.0f ),
mPopupTextColor( 0.0f, 0.0f, 0.0f, 0.0f ),
mHitRegion( 0.0f, 0.0f ),
mDisableColor( 0.0f, 0.0f, 0.0f, 0.0f ),
mPopupTextColor( 0.0f, 0.0f, 0.0f, 0.0f ),
mHitRegion( 0.0f, 0.0f ),
float x = mDomain.from.x + percent * ( mDomain.to.x - mDomain.from.x );
float x = mDomain.from.x + percent * ( mDomain.to.x - mDomain.from.x );
- mHandle.SetPosition( x, 0.0f, HANDLE_Z );
// Progress bar
if( mProgress )
// Progress bar
if( mProgress )
-ImageActor Slider::CreateBacking()
+Toolkit::ImageView Slider::CreateBacking()
- ImageActor backing = ImageActor::New();
+ Toolkit::ImageView backing = Toolkit::ImageView::New();
backing.SetParentOrigin( ParentOrigin::CENTER );
backing.SetAnchorPoint( AnchorPoint::CENTER );
backing.SetParentOrigin( ParentOrigin::CENTER );
backing.SetAnchorPoint( AnchorPoint::CENTER );
- backing.SetZ( BACKING_Z );
{
if( mBacking && ( imageName.size() > 0 ) )
{
{
if( mBacking && ( imageName.size() > 0 ) )
{
- Image image = ResourceImage::New( imageName );
- mBacking.SetImage( image );
+ mBacking.SetImage( imageName );
+ mBackingImageName = imageName;
}
}
std::string Slider::GetBackingImageName()
{
}
}
std::string Slider::GetBackingImageName()
{
- if( mBacking )
- {
- return ResourceImage::DownCast( mBacking.GetImage() ).GetUrl();
- }
-
- return std::string( "" );
+ return mBackingImageName;
-ImageActor Slider::CreateProgress()
+Toolkit::ImageView Slider::CreateProgress()
- ImageActor progress = ImageActor::New();
+ Toolkit::ImageView progress = Toolkit::ImageView::New();
progress.SetParentOrigin( ParentOrigin::CENTER_LEFT );
progress.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
progress.SetParentOrigin( ParentOrigin::CENTER_LEFT );
progress.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
- progress.SetZ( PROGRESS_Z );
{
if( mProgress && ( imageName.size() > 0 ) )
{
{
if( mProgress && ( imageName.size() > 0 ) )
{
- Image image = ResourceImage::New( imageName );
- mProgress.SetImage( image );
+ mProgress.SetImage( imageName );
+ mProgressImageName = imageName;
}
}
std::string Slider::GetProgressImageName()
{
}
}
std::string Slider::GetProgressImageName()
{
- if( mProgress )
- {
- return ResourceImage::DownCast( mProgress.GetImage()).GetUrl();
- }
-
- return std::string( "" );
+ return mProgressImageName;
}
void Slider::SetPopupImageName( const std::string& imageName )
}
void Slider::SetPopupImageName( const std::string& imageName )
-ImageActor Slider::CreateHandle()
+Toolkit::ImageView Slider::CreateHandle()
- ImageActor handle = ImageActor::New();
+ Toolkit::ImageView handle = Toolkit::ImageView::New();
handle.SetParentOrigin( ParentOrigin::CENTER_LEFT );
handle.SetAnchorPoint( AnchorPoint::CENTER );
handle.SetParentOrigin( ParentOrigin::CENTER_LEFT );
handle.SetAnchorPoint( AnchorPoint::CENTER );
- handle.SetZ( HANDLE_Z );
-ImageActor Slider::CreatePopupArrow()
+Toolkit::ImageView Slider::CreatePopupArrow()
- ImageActor arrow = ImageActor::New();
+ Toolkit::ImageView arrow = Toolkit::ImageView::New();
arrow.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
arrow.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
arrow.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
arrow.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
- arrow.SetZ( HANDLE_Z );
textLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
textLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, DEFAULT_POPUP_TEXT_COLOR );
textLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
textLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, DEFAULT_POPUP_TEXT_COLOR );
- textLabel.SetZ( VALUE_DISPLAY_TEXT_Z );
textLabel.SetPadding( Padding( POPUP_TEXT_PADDING, POPUP_TEXT_PADDING, 0.0f, 0.0f ) );
return textLabel;
}
textLabel.SetPadding( Padding( POPUP_TEXT_PADDING, POPUP_TEXT_PADDING, 0.0f, 0.0f ) );
return textLabel;
}
-ImageActor Slider::CreatePopup()
+Toolkit::ImageView Slider::CreatePopup()
- ImageActor popup = ImageActor::New();
+ Toolkit::ImageView popup = Toolkit::ImageView::New();
popup.SetParentOrigin( ParentOrigin::TOP_CENTER );
popup.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
popup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::WIDTH );
popup.SetParentOrigin( ParentOrigin::TOP_CENTER );
popup.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
popup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::WIDTH );
{
if( mHandle && ( imageName.size() > 0 ) )
{
{
if( mHandle && ( imageName.size() > 0 ) )
{
- Image image = ResourceImage::New( imageName );
- mHandle.SetImage( image );
+ mHandle.SetImage( imageName );
+ mHandleImageName = imageName;
}
}
std::string Slider::GetHandleImageName()
{
}
}
std::string Slider::GetHandleImageName()
{
- if( mHandle )
- {
- return ResourceImage::DownCast( mHandle.GetImage() ).GetUrl();
- }
-
- return std::string( "" );
+ return mHandleImageName;
}
void Slider::ResizeHandleRegion( const Vector2& region )
}
void Slider::ResizeHandleRegion( const Vector2& region )
// Handle
mHandle = CreateHandle();
// Handle
mHandle = CreateHandle();
- mBacking.Add( mHandle );
+ mProgress.Add( mHandle );
}
void Slider::SetHitRegion( const Vector2& size )
}
void Slider::SetHitRegion( const Vector2& size )
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/slider/slider.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/slider/slider.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
*
* @return The backing actor
*/
*
* @return The backing actor
*/
- ImageActor CreateBacking();
+ Toolkit::ImageView CreateBacking();
/**
* Create the progress backing for the slider
*
* @return The backing actor
*/
/**
* Create the progress backing for the slider
*
* @return The backing actor
*/
- ImageActor CreateProgress();
+ Toolkit::ImageView CreateProgress();
/**
* Create the handle for the slider
*
* @return The created image handle
*/
/**
* Create the handle for the slider
*
* @return The created image handle
*/
- ImageActor CreateHandle();
+ Toolkit::ImageView CreateHandle();
/**
* Create the popup arrow
*
* @return The created image handle
*/
/**
* Create the popup arrow
*
* @return The created image handle
*/
- ImageActor CreatePopupArrow();
+ Toolkit::ImageView CreatePopupArrow();
/**
* Create the popup
*
* @return The created image handle
*/
/**
* Create the popup
*
* @return The created image handle
*/
- ImageActor CreatePopup();
+ Toolkit::ImageView CreatePopup();
/**
* Create the textview for the popup
/**
* Create the textview for the popup
Domain mDomain; ///< Current domain of the handle
Actor mHitArea; ///< The input handler
Domain mDomain; ///< Current domain of the handle
Actor mHitArea; ///< The input handler
- ImageActor mBacking; ///< Backing image
- ImageActor mHandle; ///< Slider handle
- ImageActor mProgress; ///< Progress backing
Actor mValueDisplay; ///< Display of the value
Actor mValueDisplay; ///< Display of the value
- ImageActor mPopup; ///< Popup backing
- ImageActor mPopupArrow; ///< Popup arrow backing
-
- Toolkit::TextLabel mValueTextLabel; //< The text value in popup
- Toolkit::TextLabel mHandleValueTextLabel; ///< The text value on handle
+ Toolkit::ImageView mBacking; ///< Backing image
+ Toolkit::ImageView mHandle; ///< Slider handle
+ Toolkit::ImageView mProgress; ///< Progress backing
+ Toolkit::ImageView mPopup; ///< Popup backing
+ Toolkit::ImageView mPopupArrow; ///< Popup arrow backing
+
+ Toolkit::TextLabel mValueTextLabel; //< The text value in popup
+ Toolkit::TextLabel mHandleValueTextLabel; ///< The text value on handle
Vector2 mHandleLastTouchPoint; ///< The last touch point for the handle
Timer mValueTimer; ///< Timer used to hide value view
Vector2 mHandleLastTouchPoint; ///< The last touch point for the handle
Timer mValueTimer; ///< Timer used to hide value view
std::string mPopupImageName; ///< Image name for popup image
std::string mPopupArrowImageName; ///< Image name for popup arrow
std::string mPopupImageName; ///< Image name for popup image
std::string mPopupArrowImageName; ///< Image name for popup arrow
+ std::string mBackingImageName; ///< Image name for backing image
+ std::string mHandleImageName; ///< Image name for handle image
+ std::string mProgressImageName; ///< Image name for progress image
Vector4 mDisableColor; ///< The color to tint the slider when disabled
Vector4 mPopupTextColor; ///< The color of the popup text
Vector4 mDisableColor; ///< The color to tint the slider when disabled
Vector4 mPopupTextColor; ///< The color of the popup text