From c38b9091faab34444644f626356abbdb875548d8 Mon Sep 17 00:00:00 2001 From: Paul Wisbey Date: Tue, 31 Mar 2015 17:38:22 +0100 Subject: [PATCH] Replace TextView with TextLabel Change-Id: I302a122867fdb29481ea6b4433589e96c7d58bbe --- dali-toolkit/images/popup_bubble_bg.#.png | Bin 3190 -> 1129 bytes dali-toolkit/images/popup_bubble_bg_ef.#.png | Bin 0 -> 3195 bytes .../internal/controls/buttons/button-impl.cpp | 3 ++ .../internal/controls/buttons/push-button-impl.cpp | 18 +++++++++ .../navigation-frame/navigation-title-bar.cpp | 18 +++++++++ .../navigation-frame/navigation-title-bar.h | 4 ++ .../internal/controls/slider/slider-impl.cpp | 44 +++++++++++++++++++-- .../internal/controls/slider/slider-impl.h | 5 ++- 8 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 dali-toolkit/images/popup_bubble_bg_ef.#.png diff --git a/dali-toolkit/images/popup_bubble_bg.#.png b/dali-toolkit/images/popup_bubble_bg.#.png index 43106f342aa5e6a6b1db8802b824ae094ad3265f..202ececa14cb64c960e802bd708fe445dccd461a 100644 GIT binary patch literal 1129 zcmah|O=#0l9M5p54E3ObOhF#mMa4FGZId){Rl2;?73~~d#|B=^lD9Q%$&1OG?dHS} zMDZee5xgiUiYTZIM8tzTDMLjBPkJ55U`!9Pfy|GWwVfV@{z>va^85Y2|ChSE4sLAO z-okO*#(XC#vNavO>({dHy$kzxvZa+8{j`S+(ux^iE^Ctk4Dzlygp1g;$Bs|qc8*&! z=#=_tf8nrZ5jSo|n0VFo8JpwU4^(~A8pae1;33D$@L!(4;DKXj_&%v17JMC-ozC$9 z_l$Rytnpz>wfO`4L3>qW3S3N0P<2PVP^)J6WxX2PN7n)mmLYUF!`GbZFLVQ)1QrfyL@E*w!Gk-2K~71Z3W5M*@cx z#T-Gz8g;Qp^C-i!KXKc!HA#Vnn1;Emf}oLrFfA)dlorJ#loXUy<%W(`xhW*+qMpqn zLxRvqrcYH;&jNKMbe4ZBWcx5icf$<_1#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p{Ui4P`?ZJ24cOCDe z-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy000JJOGiWi{{a60|De66lYamJ z010qNS#tmY3ljhU3ljkVnw%H_000McNliru-vbQ`9vjF9zl8t*0jNntK~!ko?VHhV z!Y~X)?@b~!?Nj#u-!@G^>OGJmtLh%&Caz$%RDp_$bK+d%I)x$vFC!@c=;<@T*XZoe z50G?cd-(NSE@xQ6n_B<|U;qYS0DlHx0KTymV_iwd0{U4?ilMG7MliNI_U=@u7XY%l z?*X+eQMT)nvy@WrY9T49GkO}XI7{gX$&P!kVu&6A?9FaQHE00VFwpln_}%;Zx0N?GL zX+nzuOq#=WAU6fI47k%51$b-k7X>LZ0au8s;IcZO2Su>9@79pDeKswEy75}oEJF<_ z4~n3kz^el6ZvGadbMC;IHfu=!(zlYpI+0aDPS;@F=p_$=+d|gOF;9acvi47x9as%F zB7z!H6x`B=A~TbWsB9^i*C&-7?RWoFn4UI#r7i4uoH76dFaW38;a%GHSAlsc^kCQT Y7iA}>Qvn-Dv;Y7A07*qoM6N<$f>rwJv;Y7A 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 0000000000000000000000000000000000000000..462c9dbb95baef4e0073c8f7b584cd3a02857552 GIT binary patch literal 3195 zcmV->421KEP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu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@=#FAfG2%XfRFZl_18T%EXEzK3NEYP^PmjYc5e+? z+kewCs0XiA?J`tAc~A!R2Hq85_wctEo$~Uh*KgJ!IWo z^E4-=;%fYop#GN>U%!7VKmnOS5+RZGFVIjJ0If9@OJZP8U // 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 -- 2.7.4