Merge "Programming guide of DebugRenderer" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 19 Nov 2015 15:02:30 +0000 (07:02 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 19 Nov 2015 15:02:30 +0000 (07:02 -0800)
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h
dali-toolkit/internal/controls/slider/slider-impl.cpp
dali-toolkit/internal/controls/slider/slider-impl.h
dali-toolkit/styles/images-common/popup_scroll.9.png [new file with mode: 0644]
dali-toolkit/styles/images-common/popup_scroll.png [deleted file]

index ff3dbb1..8d3aa64 100755 (executable)
 
 // 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
 {
 
-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);
@@ -204,10 +204,7 @@ void ScrollBar::SetScrollPropertySource( Handle handle, Property::Index property
 
 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 );
 
index 1f9691d..ff9e07d 100755 (executable)
@@ -20,7 +20,6 @@
 
 // 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>
index ca94e91..cbbd166 100755 (executable)
@@ -29,6 +29,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
 
 using namespace Dali;
 
@@ -78,13 +79,6 @@ DALI_SIGNAL_REGISTRATION(   Toolkit, Slider, "mark",
 
 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
@@ -149,6 +143,11 @@ Dali::Toolkit::Slider Slider::New()
 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 ),
@@ -322,7 +321,7 @@ void Slider::DisplayValue( float value, bool raiseSignals )
 
   float x = mDomain.from.x + percent * ( mDomain.to.x - mDomain.from.x );
 
-  mHandle.SetPosition( x, 0.0f, HANDLE_Z );
+  mHandle.SetX( x );
 
   // Progress bar
   if( mProgress )
@@ -383,12 +382,11 @@ Actor Slider::CreateHitRegion()
   return hitRegion;
 }
 
-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.SetZ( BACKING_Z );
 
   return backing;
 }
@@ -397,27 +395,21 @@ void Slider::SetBackingImageName( const std::string& imageName )
 {
   if( mBacking && ( imageName.size() > 0 ) )
   {
-    Image image = ResourceImage::New( imageName );
-    mBacking.SetImage( image );
+    mBacking.SetImage( imageName );
+    mBackingImageName = imageName;
   }
 }
 
 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.SetZ( PROGRESS_Z );
 
   return progress;
 }
@@ -426,19 +418,14 @@ void Slider::SetProgressImageName( const std::string& imageName )
 {
   if( mProgress && ( imageName.size() > 0 ) )
   {
-    Image image = ResourceImage::New( imageName );
-    mProgress.SetImage( image );
+    mProgress.SetImage( imageName );
+    mProgressImageName = imageName;
   }
 }
 
 std::string Slider::GetProgressImageName()
 {
-  if( mProgress )
-  {
-    return ResourceImage::DownCast( mProgress.GetImage()).GetUrl();
-  }
-
-  return std::string( "" );
+  return mProgressImageName;
 }
 
 void Slider::SetPopupImageName( const std::string& imageName )
@@ -487,22 +474,20 @@ void Slider::ResizeProgressRegion( const Vector2& region )
   }
 }
 
-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.SetZ( HANDLE_Z );
 
   return handle;
 }
 
-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.SetZ( HANDLE_Z );
 
   return arrow;
 }
@@ -516,14 +501,13 @@ Toolkit::TextLabel Slider::CreatePopupText()
   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;
 }
 
-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 );
@@ -538,19 +522,14 @@ void Slider::SetHandleImageName( const std::string& imageName )
 {
   if( mHandle && ( imageName.size() > 0 ) )
   {
-    Image image = ResourceImage::New( imageName );
-    mHandle.SetImage( image );
+    mHandle.SetImage( imageName );
+    mHandleImageName = imageName;
   }
 }
 
 std::string Slider::GetHandleImageName()
 {
-  if( mHandle )
-  {
-    return ResourceImage::DownCast( mHandle.GetImage() ).GetUrl();
-  }
-
-  return std::string( "" );
+  return mHandleImageName;
 }
 
 void Slider::ResizeHandleRegion( const Vector2& region )
@@ -666,7 +645,7 @@ void Slider::CreateChildren()
 
   // Handle
   mHandle = CreateHandle();
-  mBacking.Add( mHandle );
+  mProgress.Add( mHandle );
 }
 
 void Slider::SetHitRegion( const Vector2& size )
index ea652fd..9e25fcc 100755 (executable)
@@ -27,6 +27,7 @@
 #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>
 
 namespace Dali
 {
@@ -400,35 +401,35 @@ private:
    *
    * @return The backing actor
    */
-  ImageActor CreateBacking();
+  Toolkit::ImageView CreateBacking();
 
   /**
    * 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
    */
-  ImageActor CreateHandle();
+  Toolkit::ImageView CreateHandle();
 
   /**
    * Create the popup arrow
    *
    * @return The created image handle
    */
-  ImageActor CreatePopupArrow();
+  Toolkit::ImageView CreatePopupArrow();
 
   /**
    * Create the popup
    *
    * @return The created image handle
    */
-  ImageActor CreatePopup();
+  Toolkit::ImageView CreatePopup();
 
   /**
    * Create the textview for the popup
@@ -681,15 +682,15 @@ private:
   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
-  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
 
@@ -705,6 +706,9 @@ private:
 
   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
diff --git a/dali-toolkit/styles/images-common/popup_scroll.9.png b/dali-toolkit/styles/images-common/popup_scroll.9.png
new file mode 100644 (file)
index 0000000..2ffc3a7
Binary files /dev/null and b/dali-toolkit/styles/images-common/popup_scroll.9.png differ
diff --git a/dali-toolkit/styles/images-common/popup_scroll.png b/dali-toolkit/styles/images-common/popup_scroll.png
deleted file mode 100755 (executable)
index 1dc8fc0..0000000
Binary files a/dali-toolkit/styles/images-common/popup_scroll.png and /dev/null differ