#include <dali/public-api/scripting/scripting.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
namespace Dali
{
void Button::SetLabel( const std::string& label )
{
+ Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( label );
+ SetLabel( textLabel );
}
void Button::SetLabel( Actor label )
#include <dali/public-api/object/type-registry.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
namespace Dali
{
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;
// 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 )
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() )
{
// 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>
Toolkit::TableView mTitleLayout;
Toolkit::TableView mTitleIconLayout;
+ Toolkit::TextLabel mTitle;
+ Toolkit::TextLabel mSubTitle;
+
};
} // namespace Internal
}
}
- // 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 )
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()
{
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 )
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 )
// 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
{
*
* @return The textview created for the popup
*/
- //Toolkit::TextView CreatePopupText();
+ Toolkit::TextLabel CreatePopupText();
/**
* Create the value display for the slider
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