Replace TextView with TextLabel 01/37601/2
authorPaul Wisbey <p.wisbey@samsung.com>
Tue, 31 Mar 2015 16:38:22 +0000 (17:38 +0100)
committerPaul Wisbey <p.wisbey@samsung.com>
Wed, 1 Apr 2015 11:37:26 +0000 (04:37 -0700)
Change-Id: I302a122867fdb29481ea6b4433589e96c7d58bbe

dali-toolkit/images/popup_bubble_bg.#.png
dali-toolkit/images/popup_bubble_bg_ef.#.png [new file with mode: 0644]
dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.cpp
dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.h
dali-toolkit/internal/controls/slider/slider-impl.cpp
dali-toolkit/internal/controls/slider/slider-impl.h

index 43106f3..202ecec 100644 (file)
Binary files a/dali-toolkit/images/popup_bubble_bg.#.png and b/dali-toolkit/images/popup_bubble_bg.#.png differ
diff --git a/dali-toolkit/images/popup_bubble_bg_ef.#.png b/dali-toolkit/images/popup_bubble_bg_ef.#.png
new file mode 100644 (file)
index 0000000..462c9db
Binary files /dev/null and b/dali-toolkit/images/popup_bubble_bg_ef.#.png differ
index 3a0a7eb..0f7a0a5 100644 (file)
@@ -26,6 +26,7 @@
 #include <dali/public-api/scripting/scripting.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 
 namespace Dali
 {
@@ -210,6 +211,8 @@ float Button::GetAnimationTime() const
 
 void Button::SetLabel( const std::string& label )
 {
+  Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( label );
+  SetLabel( textLabel );
 }
 
 void Button::SetLabel( Actor label )
index 08948de..1a5c3a4 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali/public-api/object/type-registry.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 
 namespace Dali
 {
@@ -1071,6 +1072,23 @@ Vector3 PushButton::GetNaturalSize()
         size.height = std::max( size.height, imageSize.height );
       }
     }
+
+    // If label, test against it's size
+    Toolkit::TextLabel textLabel = Toolkit::TextLabel::DownCast( GetLabel() );
+    if( textLabel )
+    {
+      Vector3 textLabelSize = textLabel.GetNaturalSize();
+
+      if( widthIsZero )
+      {
+        size.width = std::max( size.width, textLabelSize.width + TEXT_PADDING * 2.0f );
+      }
+
+      if( heightIsZero )
+      {
+        size.height = std::max( size.height, textLabelSize.height + TEXT_PADDING * 2.0f );
+      }
+    }
   }
 
   return size;
index 1d65378..e8ce9e0 100644 (file)
@@ -55,6 +55,9 @@ NavigationTitleBar::NavigationTitleBar(NavigationControl& naviControl,
   // title icon layout: the top row, the bottom row and the left column are all for margins
   mTitleIconLayout= Toolkit::TableView::New( 3,2 );
   SetFixedSizes();
+
+  mTitle = Toolkit::TextLabel::New();
+  mSubTitle = Toolkit::TextLabel::New();
 }
 
 void NavigationTitleBar::Update( Toolkit::Page page )
@@ -105,6 +108,21 @@ void NavigationTitleBar::Update( Toolkit::Page page )
     mLayout.AddChild(mButtonLayout, Toolkit::TableView::CellPosition(0,2));
   }
 
+  // add title and subtitle(if exist)
+  mTitle.SetProperty( Toolkit::TextLabel::Property::TEXT, page.GetTitle() );
+  if( page.GetSubTitle().empty() )  //display title
+  {
+    mTitleLayout.SetFixedHeight( 1,mCurrentStyle->titleHeightWithoutSubtitle - mCurrentStyle->subtitleHeight );
+    mTitleLayout.AddChild( mTitle, Toolkit::TableView::CellPosition(1,0,2,1) );
+  }
+  else //display title and subtitle
+  {
+    mTitleLayout.SetFixedHeight( 1, mCurrentStyle->titleHeightWithSubtitle );
+    mTitleLayout.AddChild( mTitle, Toolkit::TableView::CellPosition(1,0) );
+    mSubTitle.SetProperty( Toolkit::TextLabel::Property::TEXT, page.GetSubTitle() );
+    mTitleLayout.AddChild( mSubTitle, Toolkit::TableView::CellPosition(2,0) );
+  }
+
   // insert title icon to the left of the title(if exist)
   if( page.GetTitleIcon() )
   {
index e0a0a18..c8200ed 100644 (file)
@@ -21,6 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/navigation-frame/page.h>
 #include <dali-toolkit/public-api/controls/table-view/table-view.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 #include <dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h>
 #include <dali-toolkit/internal/controls/navigation-frame/navigation-bar.h>
 
@@ -80,6 +81,9 @@ private:
   Toolkit::TableView mTitleLayout;
   Toolkit::TableView mTitleIconLayout;
 
+  Toolkit::TextLabel  mTitle;
+  Toolkit::TextLabel  mSubTitle;
+
 };
 
 } // namespace Internal
index d5d1596..f635c13 100755 (executable)
@@ -348,7 +348,14 @@ void Slider::DisplayValue( float value, bool raiseSignals )
     }
   }
 
-  // TODO
+  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 )
@@ -516,9 +523,14 @@ 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.SetZ( VALUE_DISPLAY_TEXT_Z );
+  return textLabel;
+}
 
 ImageActor Slider::CreatePopup()
 {
@@ -559,10 +571,19 @@ 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.SetDrawMode( DrawMode::OVERLAY );
+    mHandle.Add( mHandleValueTextLabel );
+  }
 }
 
 void Slider::DestroyHandleValueDisplay()
 {
+  UnparentAndReset(mHandleValueTextLabel);
 }
 
 void Slider::SetPopupTextColor( const Vector4& color )
@@ -988,6 +1009,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 )
index d99d48c..a8003c7 100755 (executable)
@@ -25,6 +25,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/public-api/controls/slider/slider.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 
 namespace Dali
 {
@@ -433,7 +434,7 @@ private:
    *
    * @return The textview created for the popup
    */
-  //Toolkit::TextView CreatePopupText();
+  Toolkit::TextLabel CreatePopupText();
 
   /**
    * Create the value display for the slider
@@ -686,6 +687,8 @@ private:
   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
   Vector2 mHandleLastTouchPoint;            ///< The last touch point for the handle
   Timer mValueTimer;                        ///< Timer used to hide value view