void KeyboardFocusManager::CreateDefaultFocusIndicatorActor() { // Create a focus indicator actor shared by all the keyboard focusable actors Image borderImage = ResourceImage::New(FOCUS_BORDER_IMAGE_PATH); ImageActor focusIndicator = ImageActor::New(borderImage); focusIndicator.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION_PLUS_LOCAL_POSITION ); focusIndicator.SetStyle( ImageActor::STYLE_NINE_PATCH ); focusIndicator.SetNinePatchBorder(FOCUS_BORDER_IMAGE_BORDER); focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f)); // Apply size constraint to the focus indicator focusIndicator.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); SetFocusIndicatorActor(focusIndicator); }
void View::SetBackground( ImageActor backgroundImage ) { // Create background layer if doesn't exist. if( !mBackgroundLayer ) { mBackgroundLayer = Layer::New(); mBackgroundLayer.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); mBackgroundLayer.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); // Add background layer to custom actor. Self().Add( mBackgroundLayer ); // Drop the background layer DALI_ASSERT_ALWAYS( mBackgroundLayer.OnStage() ); // We need to be on-stage to drop the layer mBackgroundLayer.LowerToBottom(); } else { // It removes the old background if( 0 < mBackgroundLayer.GetChildCount() ) { mBackgroundLayer.Remove( mBackgroundLayer.GetChildAt(0) ); } } backgroundImage.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); Constraint constraint = Constraint::New<Vector3>( Actor::SCALE, LocalSource( Actor::SIZE ), ParentSource( Actor::SIZE ), ScaleToFillXYKeepAspectRatioConstraint() ); backgroundImage.ApplyConstraint( constraint ); mBackgroundLayer.Add( backgroundImage ); }