From: Paul Wisbey Date: Tue, 31 Mar 2015 16:38:22 +0000 (+0100) Subject: Replace TextView with TextLabel X-Git-Tag: dali_1.0.38~11^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F37601%2F2;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Replace TextView with TextLabel Change-Id: I302a122867fdb29481ea6b4433589e96c7d58bbe --- diff --git a/dali-toolkit/images/popup_bubble_bg.#.png b/dali-toolkit/images/popup_bubble_bg.#.png index 43106f3..202ecec 100644 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 index 0000000..462c9db Binary files /dev/null and b/dali-toolkit/images/popup_bubble_bg_ef.#.png differ diff --git a/dali-toolkit/internal/controls/buttons/button-impl.cpp b/dali-toolkit/internal/controls/buttons/button-impl.cpp index 3a0a7eb..0f7a0a5 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/button-impl.cpp @@ -26,6 +26,7 @@ #include // INTERNAL INCLUDES +#include 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 ) diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp index 08948de..1a5c3a4 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp @@ -23,6 +23,7 @@ #include // INTERNAL INCLUDES +#include 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; diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.cpp b/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.cpp index 1d65378..e8ce9e0 100644 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.cpp +++ b/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.cpp @@ -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() ) { diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.h b/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.h index e0a0a18..c8200ed 100644 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.h +++ b/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.h @@ -21,6 +21,7 @@ // INTERNAL INCLUDES #include #include +#include #include #include @@ -80,6 +81,9 @@ private: Toolkit::TableView mTitleLayout; Toolkit::TableView mTitleIconLayout; + Toolkit::TextLabel mTitle; + Toolkit::TextLabel mSubTitle; + }; } // namespace Internal diff --git a/dali-toolkit/internal/controls/slider/slider-impl.cpp b/dali-toolkit/internal/controls/slider/slider-impl.cpp index d5d1596..f635c13 100755 --- a/dali-toolkit/internal/controls/slider/slider-impl.cpp +++ b/dali-toolkit/internal/controls/slider/slider-impl.cpp @@ -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 ) diff --git a/dali-toolkit/internal/controls/slider/slider-impl.h b/dali-toolkit/internal/controls/slider/slider-impl.h index d99d48c..a8003c7 100755 --- a/dali-toolkit/internal/controls/slider/slider-impl.h +++ b/dali-toolkit/internal/controls/slider/slider-impl.h @@ -25,6 +25,7 @@ // INTERNAL INCLUDES #include #include +#include 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