diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 1b7711c..150f945 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -87,15 +87,7 @@ const Vector2 POSITION_SWING_3DEFFECT( 0.55f, 0.4f ); ///< Position const Vector3 ANCHOR_3DEFFECT_STYLE0( -105.0f, 30.0f, -240.0f ); ///< Rotation Anchor position for 3D Effect (Style 0) const Vector3 ANCHOR_3DEFFECT_STYLE1( 65.0f, -70.0f, -500.0f ); ///< Rotation Anchor position for 3D Effect (Style 1) -//const std::string DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNeue"); -//const std::string DEFAULT_TEXT_STYLE_FONT_STYLE("Regular"); -//const Dali::Vector4 DEFAULT_TEXT_STYLE_COLOR(0.7f, 0.7f, 0.7f, 1.0f); - -//const std::string TABLE_TEXT_STYLE_FONT_FAMILY("HelveticaNeue"); -//const std::string TABLE_TEXT_STYLE_FONT_STYLE("Regular"); -//const Dali::PointSize TABLE_TEXT_STYLE_POINT_SIZE( 8.0f ); -//const Dali::TextStyle::Weight TABLE_TEXT_STYLE_WEIGHT(Dali::TextStyle::LIGHT); -//const Dali::Vector4 TABLE_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f); +const Dali::Vector4 TABLE_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f); Vector3 ScalePointSize(const Vector3& vec) { @@ -498,16 +490,14 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit } TextLabel label = TextLabel::New(); - label.SetParentOrigin( ParentOrigin::TOP_LEFT ); label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + label.SetSize( parentSize ); label.SetProperty( TextLabel::Property::MULTI_LINE, true ); label.SetProperty( TextLabel::Property::TEXT, title ); - label.SetColor( Color::BLACK ); + label.SetProperty( TextLabel::Property::ALIGNMENT, "CENTER" ); + label.SetColor( TABLE_TEXT_STYLE_COLOR ); tile.Add( label ); - // FIXME - This is a kludge because size negotiation is not finished - label.SetSize( parentSize ); - // Set the tile to be keyboard focusable tile.SetKeyboardFocusable(true); diff --git a/shared/view.h b/shared/view.h index 123fdef..64e97fa 100644 --- a/shared/view.h +++ b/shared/view.h @@ -45,6 +45,7 @@ const ViewStyle DEFAULT_VIEW_STYLE( 0.1f, 0.7f, 80.f, 4.f ); const char* DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNue"); const char* DEFAULT_TEXT_STYLE_FONT_STYLE("Regular"); +const float DEFAULT_TEXT_STYLE_POINT_SIZE( 16.0f ); const Dali::Vector4 DEFAULT_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f); const Dali::Toolkit::Alignment::Padding DEFAULT_PLAY_PADDING(12.0f, 12.0f, 12.0f, 12.0f); @@ -62,6 +63,8 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, const std::string& title, const ViewStyle& style ) { + Dali::Stage stage = Dali::Stage::GetCurrent(); + Dali::Layer toolBarLayer = Dali::Layer::New(); toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); @@ -88,7 +91,17 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, // Tool bar text. if( !title.empty() ) { - // TODO + Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New(); + label.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT ); + label.SetSize( stage.GetSize().width, style.mToolBarHeight ); + label.SetDrawMode( Dali::DrawMode::OVERLAY ); + label.SetProperty( Dali::Toolkit::TextLabel::Property::TEXT, title ); + label.SetProperty( Dali::Toolkit::TextLabel::Property::ALIGNMENT, "CENTER" ); + label.SetProperty( Dali::Toolkit::TextLabel::Property::FONT_FAMILY, DEFAULT_TEXT_STYLE_FONT_FAMILY ); + label.SetProperty( Dali::Toolkit::TextLabel::Property::FONT_STYLE, DEFAULT_TEXT_STYLE_FONT_STYLE ); + label.SetProperty( Dali::Toolkit::TextLabel::Property::POINT_SIZE, DEFAULT_TEXT_STYLE_POINT_SIZE ); + label.SetColor( DEFAULT_TEXT_STYLE_COLOR ); + toolBarLayer.Add( label ); } return toolBarLayer;