- Layer mFrameLayer = Layer::New();
- mFrameLayer.SetParentOrigin( ParentOrigin::CENTER );
- Stage::GetCurrent().Add(mFrameLayer);
-
- Image image = Image::New( DEFAULT_FRAME_IMAGE_PATH );
- ImageActor frame = ImageActor::New( image );
- frame.SetDrawMode(DrawMode::OVERLAY);
- frame.SetStyle( ImageActor::STYLE_NINE_PATCH );
-
- frame.SetNinePatchBorder( Vector4::ONE * IMAGE_BORDER_INDENT );
- mFrameLayer.Add(frame);
-
- // Apply position constraint to the frame
- Constraint constraint = Constraint::New<Vector3>( Actor::POSITION,
- Source( self, Actor::WORLD_POSITION ),
- EqualToConstraint() );
- frame.ApplyConstraint(constraint);
-
- // Apply scale constraint to the frame
- constraint = Constraint::New<Vector3>( Actor::SCALE,
- Source( self, Actor::SCALE ),
- EqualToConstraint() );
- frame.ApplyConstraint(constraint);
-
- Source(self, Actor::SCALE),
-
- // Apply size constraint to the the frame
- constraint = Constraint::New<Vector3>(Actor::SIZE,
- Source(self, Actor::SIZE),
- ImageBorderSizeConstraint());
- frame.ApplyConstraint(constraint);
+ mFrame = Actor::New( );
+ mFrame.SetInheritPosition(false);
+ mFrame.SetInheritScale(true);
+ mFrame.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
+ Vector3 sizeOffset(IMAGE_BORDER_INDENT*2.f - 2.f, IMAGE_BORDER_INDENT*2.f - 2.f, 0.0f);
+ mFrame.SetSizeModeFactor( sizeOffset );
+
+ //TODO Set the renderer onto the control self when Actor::RemoveRenderer is supported
+ Toolkit::RendererFactory rendererFactory = Toolkit::RendererFactory::Get();
+ Toolkit::ControlRenderer borderRenderer = rendererFactory.GetControlRenderer(IMAGE_BORDER_INDENT, Color::WHITE);
+ borderRenderer.SetOnStage( mFrame );
+
+ Constraint constraint = Constraint::New<Vector3>( mFrame, Actor::Property::POSITION, EqualToConstraint() );
+ constraint.AddSource( ParentSource( Actor::Property::WORLD_POSITION ) );
+ constraint.Apply();
+
+ self.Add(mFrame);