- void SetTitle(const std::string& title)
- {
- if(!mTitleActor)
- {
- mTitleActor = TextView::New();
- // Add title to the tool bar.
- mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
- }
-
- Font font = Font::New();
- mTitleActor.SetText( title );
- mTitleActor.SetSize( font.MeasureText( title ) );
- mTitleActor.SetStyleToCurrentText(DemoHelper::GetDefaultTextStyle());
- }
-
- void ShowMenu()
- {
- Stage stage = Stage::GetCurrent();
- const float popupWidth = stage.GetSize().x * 0.75f;
-
- mMenu = Toolkit::Popup::New();
- mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
- mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
- mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu );
- stage.Add( mMenu );
-
- TableView tableView = TableView::New( 0, 0 );
- Vector2 tableSize = Vector2( popupWidth, MENU_OPTION_HEIGHT * 2 );
- tableView.SetSize( tableSize );
- mMenu.Add( tableView );
-
- Slider slider = Slider::New();
- slider.SetProperty( Slider::LOWER_BOUND_PROPERTY, 0.0f );
- slider.SetProperty( Slider::UPPER_BOUND_PROPERTY, 3.0f );
- slider.SetProperty( Slider::VALUE_PROPERTY, mDurationSeconds );
- slider.SetProperty( Slider::VALUE_PRECISION_PROPERTY, 2 );
- slider.SetProperty( Slider::SHOW_POPUP_PROPERTY, true );
- slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange );
- tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) );
- tableView.SetRelativeHeight( 0, 0.5f );
-
- TextStyle defaultTextStyle;
- defaultTextStyle.SetFontName(DEFAULT_TEXT_STYLE_FONT_FAMILY);
- defaultTextStyle.SetFontStyle(DEFAULT_TEXT_STYLE_FONT_STYLE);
- defaultTextStyle.SetFontPointSize(DEFAULT_TEXT_STYLE_POINT_SIZE);
- defaultTextStyle.SetWeight(DEFAULT_TEXT_STYLE_WEIGHT);
- defaultTextStyle.SetTextColor(DEFAULT_TEXT_STYLE_COLOR);
-
- TextView text = TextView::New( "Duration" );
- text.SetAnchorPoint( ParentOrigin::TOP_LEFT );
- text.SetParentOrigin( ParentOrigin::TOP_LEFT );
- text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft );
- text.SetStyleToCurrentText( defaultTextStyle );
- text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y );
- text.ApplyConstraint( Dali::Constraint::New<float>( Dali::Actor::Property::SizeWidth, Dali::ParentSource( Dali::Actor::Property::SizeWidth ), Dali::EqualToConstraint() ) );
- text.SetZ( -0.9f );
- slider.Add( text );
-
- Actor textContainer = Actor::New();
- mAlphaFunctionText = TextView::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] );
- mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER );
- mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER );
- mAlphaFunctionText.SetTextAlignment( Toolkit::Alignment::VerticalCenter );
- textContainer.Add( mAlphaFunctionText );
- tableView.AddChild( textContainer, TableView::CellPosition( 1, 0 ) );
- tableView.SetRelativeHeight( 0, 0.5f );
-
- mTapDetector = TapGestureDetector::New();
- mTapDetector.Attach(mAlphaFunctionText);
- mTapDetector.DetectedSignal().Connect( this, &ItemViewExample::ChangeAlphaFunctionOnTap );
-
- text = TextView::New( "Alpha Function" );
- text.SetAnchorPoint( ParentOrigin::TOP_LEFT );
- text.SetParentOrigin( ParentOrigin::TOP_LEFT );
- text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft );
- text.SetStyleToCurrentText( defaultTextStyle );
- text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y );
- text.ApplyConstraint( Dali::Constraint::New<float>( Dali::Actor::Property::SizeWidth, Dali::ParentSource( Dali::Actor::Property::SizeWidth ), Dali::EqualToConstraint() ) );
- textContainer.Add( text );
-
- mMenu.Show();
- mMenuShown = true;
- }
-
- bool SliderValueChange( Toolkit::Slider slider, float value )