const Dali::Toolkit::Alignment::Padding DEFAULT_PLAY_PADDING(12.0f, 12.0f, 12.0f, 12.0f);
const Dali::Toolkit::Alignment::Padding DEFAULT_MODE_SWITCH_PADDING(8.0f, 8.0f, 8.0f, 8.0f);
+void RequestThemeChange()
+{
+ // Provide the stylesheet
+ Dali::Toolkit::StyleManager styleManager = Dali::Toolkit::StyleManager::Get();
+ styleManager.RequestThemeChange( DALI_DEMO_THEME_PATH );
+}
+
float ScalePointSize(int pointSize)
{
Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi();
Dali::Stage stage = Dali::Stage::GetCurrent();
Dali::Layer toolBarLayer = Dali::Layer::New();
+ toolBarLayer.SetName( "TOOLBAR_LAYER" );
toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER );
toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER );
- toolBarLayer.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::SIZE, Dali::ParentSource( Dali::Actor::Property::SIZE ), Dali::SourceWidthFixedHeight( style.mToolBarHeight ) ) );
- toolBarLayer.SetSize( 0.0f, style.mToolBarHeight );
+ toolBarLayer.SetPreferredSize( Dali::Vector2( 0.0f, style.mToolBarHeight ) );
+ toolBarLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::WIDTH );
+ toolBarLayer.SetResizePolicy( Dali::FIXED, Dali::HEIGHT );
// Raise tool bar layer to the top.
toolBarLayer.RaiseToTop();
// Tool bar
Dali::Image image = Dali::ResourceImage::New( toolbarImagePath );
Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image );
+ toolBarBackground.SetName( "TOOLBAR_BACKGROUND" );
+ toolBarBackground.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
toolBar = Dali::Toolkit::ToolBar::New();
+ toolBar.SetName( "TOOLBAR" );
toolBar.SetBackground( toolBarBackground );
toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER );
toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER );
- toolBar.SetSize( 0.0f, style.mToolBarHeight );
- toolBar.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT );
+ toolBar.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
toolBarBackground.SetSortModifier(1.0f);
// Add the tool bar to the too bar layer.
{
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::Control::Property::STYLE_NAME, "toolbarlabel" );
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, ScalePointSize(DEFAULT_TEXT_STYLE_POINT_SIZE) );
+ label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+ label.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::HEIGHT );
label.SetColor( DEFAULT_TEXT_STYLE_COLOR );
toolBarLayer.Add( label );
}
// Create default View.
view = Dali::Toolkit::View::New();
+ view.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
// Add the view to the stage before setting the background.
stage.Add( view );
// Add tool bar layer to the view.
view.AddContentLayer( toolBarLayer );
-
-
// Create a content layer.
Dali::Layer contentLayer = Dali::Layer::New();
contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER );
contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER );
- contentLayer.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT );
+ contentLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
view.AddContentLayer( contentLayer );
contentLayer.LowerBelow( toolBarLayer );
return contentLayer;
}
+Dali::Toolkit::TextLabel CreateToolBarLabel( const std::string& text )
+{
+ Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New( text );
+ label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "toolbarlabel" );
+ label.SetDrawMode( Dali::DrawMode::OVERLAY );
+ label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+ label.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::HEIGHT );
+ label.SetColor( DEFAULT_TEXT_STYLE_COLOR );
+
+ return label;
+}
+
} // DemoHelper
#endif // __DALI_DEMO_HELPER_VIEW_H__