Commit 7214b931865d8768fb01d5db2299b77666a85f15
1 parent
ba477524
Added more TextLabels
Change-Id: I4d107d2611cb03b218ea03e9b7e2d26b9b403127
Showing
2 changed files
with
18 additions
and
15 deletions
demo/dali-table-view.cpp
| ... | ... | @@ -87,15 +87,7 @@ const Vector2 POSITION_SWING_3DEFFECT( 0.55f, 0.4f ); ///< Position |
| 87 | 87 | const Vector3 ANCHOR_3DEFFECT_STYLE0( -105.0f, 30.0f, -240.0f ); ///< Rotation Anchor position for 3D Effect (Style 0) |
| 88 | 88 | const Vector3 ANCHOR_3DEFFECT_STYLE1( 65.0f, -70.0f, -500.0f ); ///< Rotation Anchor position for 3D Effect (Style 1) |
| 89 | 89 | |
| 90 | -//const std::string DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNeue"); | |
| 91 | -//const std::string DEFAULT_TEXT_STYLE_FONT_STYLE("Regular"); | |
| 92 | -//const Dali::Vector4 DEFAULT_TEXT_STYLE_COLOR(0.7f, 0.7f, 0.7f, 1.0f); | |
| 93 | - | |
| 94 | -//const std::string TABLE_TEXT_STYLE_FONT_FAMILY("HelveticaNeue"); | |
| 95 | -//const std::string TABLE_TEXT_STYLE_FONT_STYLE("Regular"); | |
| 96 | -//const Dali::PointSize TABLE_TEXT_STYLE_POINT_SIZE( 8.0f ); | |
| 97 | -//const Dali::TextStyle::Weight TABLE_TEXT_STYLE_WEIGHT(Dali::TextStyle::LIGHT); | |
| 98 | -//const Dali::Vector4 TABLE_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f); | |
| 90 | +const Dali::Vector4 TABLE_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f); | |
| 99 | 91 | |
| 100 | 92 | Vector3 ScalePointSize(const Vector3& vec) |
| 101 | 93 | { |
| ... | ... | @@ -498,16 +490,14 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit |
| 498 | 490 | } |
| 499 | 491 | |
| 500 | 492 | TextLabel label = TextLabel::New(); |
| 501 | - label.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 502 | 493 | label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 494 | + label.SetSize( parentSize ); | |
| 503 | 495 | label.SetProperty( TextLabel::Property::MULTI_LINE, true ); |
| 504 | 496 | label.SetProperty( TextLabel::Property::TEXT, title ); |
| 505 | - label.SetColor( Color::BLACK ); | |
| 497 | + label.SetProperty( TextLabel::Property::ALIGNMENT, "CENTER" ); | |
| 498 | + label.SetColor( TABLE_TEXT_STYLE_COLOR ); | |
| 506 | 499 | tile.Add( label ); |
| 507 | 500 | |
| 508 | - // FIXME - This is a kludge because size negotiation is not finished | |
| 509 | - label.SetSize( parentSize ); | |
| 510 | - | |
| 511 | 501 | // Set the tile to be keyboard focusable |
| 512 | 502 | tile.SetKeyboardFocusable(true); |
| 513 | 503 | ... | ... |
shared/view.h
| ... | ... | @@ -45,6 +45,7 @@ const ViewStyle DEFAULT_VIEW_STYLE( 0.1f, 0.7f, 80.f, 4.f ); |
| 45 | 45 | |
| 46 | 46 | const char* DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNue"); |
| 47 | 47 | const char* DEFAULT_TEXT_STYLE_FONT_STYLE("Regular"); |
| 48 | +const float DEFAULT_TEXT_STYLE_POINT_SIZE( 16.0f ); | |
| 48 | 49 | const Dali::Vector4 DEFAULT_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f); |
| 49 | 50 | |
| 50 | 51 | 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, |
| 62 | 63 | const std::string& title, |
| 63 | 64 | const ViewStyle& style ) |
| 64 | 65 | { |
| 66 | + Dali::Stage stage = Dali::Stage::GetCurrent(); | |
| 67 | + | |
| 65 | 68 | Dali::Layer toolBarLayer = Dali::Layer::New(); |
| 66 | 69 | toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); |
| 67 | 70 | toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); |
| ... | ... | @@ -88,7 +91,17 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, |
| 88 | 91 | // Tool bar text. |
| 89 | 92 | if( !title.empty() ) |
| 90 | 93 | { |
| 91 | - // TODO | |
| 94 | + Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New(); | |
| 95 | + label.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT ); | |
| 96 | + label.SetSize( stage.GetSize().width, style.mToolBarHeight ); | |
| 97 | + label.SetDrawMode( Dali::DrawMode::OVERLAY ); | |
| 98 | + label.SetProperty( Dali::Toolkit::TextLabel::Property::TEXT, title ); | |
| 99 | + label.SetProperty( Dali::Toolkit::TextLabel::Property::ALIGNMENT, "CENTER" ); | |
| 100 | + label.SetProperty( Dali::Toolkit::TextLabel::Property::FONT_FAMILY, DEFAULT_TEXT_STYLE_FONT_FAMILY ); | |
| 101 | + label.SetProperty( Dali::Toolkit::TextLabel::Property::FONT_STYLE, DEFAULT_TEXT_STYLE_FONT_STYLE ); | |
| 102 | + label.SetProperty( Dali::Toolkit::TextLabel::Property::POINT_SIZE, DEFAULT_TEXT_STYLE_POINT_SIZE ); | |
| 103 | + label.SetColor( DEFAULT_TEXT_STYLE_COLOR ); | |
| 104 | + toolBarLayer.Add( label ); | |
| 92 | 105 | } |
| 93 | 106 | |
| 94 | 107 | return toolBarLayer; | ... | ... |