*/
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/tool-bar/tool-bar.h>
+
namespace DemoHelper
{
const char* DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNue");
const char* DEFAULT_TEXT_STYLE_FONT_STYLE("Regular");
const float DEFAULT_TEXT_STYLE_POINT_SIZE( 8.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);
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();
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::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
toolBar = Dali::Toolkit::ToolBar::New();
toolBar.SetName( "TOOLBAR" );
- toolBar.SetBackground( toolBarBackground );
+ Dali::Property::Map background;
+ background["url"] = toolbarImagePath;
+ toolBar.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, background );
toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER );
toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER );
toolBar.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
- toolBarBackground.SetSortModifier(1.0f);
- // Add the tool bar to the too bar layer.
+ // Add the tool bar to the tool bar layer.
toolBarLayer.Add( toolBar );
// Tool bar text.
{
Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New();
label.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT );
- 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::HORIZONTAL_ALIGNMENT, "CENTER" );
label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
label.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT );
- label.SetColor( DEFAULT_TEXT_STYLE_COLOR );
// Add title to the tool bar.
const float padding( style.mToolBarPadding );
}
Dali::Layer CreateView( Dali::Application& application,
- Dali::Toolkit::View& view,
+ Dali::Toolkit::Control& view,
Dali::Toolkit::ToolBar& toolBar,
const std::string& backgroundImagePath,
const std::string& toolbarImagePath,
Dali::Stage stage = Dali::Stage::GetCurrent();
// Create default View.
- view = Dali::Toolkit::View::New();
+ view = Dali::Toolkit::Control::New();
+ view.SetAnchorPoint( Dali::AnchorPoint::CENTER );
+ view.SetParentOrigin( Dali::ParentOrigin::CENTER );
view.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
// Add the view to the stage before setting the background.
// Set background image, loading it at screen resolution:
if ( !backgroundImagePath.empty() )
{
- Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath, Dali::ImageDimensions( stage.GetSize().x, stage.GetSize().y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR );
- Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage );
- view.SetBackground( backgroundImageActor );
+ Dali::Property::Map map;
+ map[Dali::Toolkit::Visual::Property::TYPE] = Dali::Toolkit::Visual::IMAGE;
+ map[Dali::Toolkit::ImageVisual::Property::URL] = backgroundImagePath;
+ map[Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH] = stage.GetSize().x;
+ map[Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = stage.GetSize().y;
+ map[Dali::Toolkit::ImageVisual::Property::FITTING_MODE] = Dali::FittingMode::SCALE_TO_FILL;
+ map[Dali::Toolkit::ImageVisual::Property::SAMPLING_MODE] = Dali::SamplingMode::BOX_THEN_LINEAR;
+ map[Dali::Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING] = true;
+ view.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
}
// FIXME
Dali::Layer toolBarLayer = CreateToolbar( toolBar, toolbarImagePath, title, style );
// Add tool bar layer to the view.
- view.AddContentLayer( toolBarLayer );
+ view.Add( toolBarLayer );
// Create a content layer.
Dali::Layer contentLayer = Dali::Layer::New();
contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER );
contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER );
contentLayer.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
- view.AddContentLayer( contentLayer );
+ view.Add( contentLayer );
contentLayer.LowerBelow( toolBarLayer );
return contentLayer;
{
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::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT );
- label.SetColor( DEFAULT_TEXT_STYLE_COLOR );
return label;
}