Change-Id: I25a3d08a02cbff1a96be5951630bc5e054b24295
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
// 1. Create the backgrounds for the popup option both normal and pressed.
// Both containers will be added to a button.
Actor optionContainer = Actor::New();
// 1. Create the backgrounds for the popup option both normal and pressed.
// Both containers will be added to a button.
Actor optionContainer = Actor::New();
+ optionContainer.SetRelayoutEnabled( true );
+ optionContainer.SetResizePolicy( FIXED, ALL_DIMENSIONS );
optionContainer.SetDrawMode( DrawMode::OVERLAY );
optionContainer.SetDrawMode( DrawMode::OVERLAY );
- //optionContainer.SetParentOrigin( ParentOrigin::CENTER );
optionContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
ImageActor optionPressedContainer = Toolkit::CreateSolidColorActor( mBackgroundPressedColor );
optionContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
ImageActor optionPressedContainer = Toolkit::CreateSolidColorActor( mBackgroundPressedColor );
+ optionPressedContainer.SetResizePolicy( FIXED, ALL_DIMENSIONS );
optionPressedContainer.SetDrawMode( DrawMode::OVERLAY );
optionPressedContainer.SetDrawMode( DrawMode::OVERLAY );
- //optionPressedContainer.SetParentOrigin( ParentOrigin::CENTER );
optionPressedContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
// 2. Add text.
Toolkit::TextLabel captionTextLabel = Toolkit::TextLabel::New();
optionPressedContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
// 2. Add text.
Toolkit::TextLabel captionTextLabel = Toolkit::TextLabel::New();
+ captionTextLabel.SetResizePolicy( FIXED, ALL_DIMENSIONS );
captionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption );
captionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption );
- optionContainer.Add( captionTextLabel );
+ // optionContainer.Add( captionTextLabel ); Temporary removed.
Toolkit::TextLabel pressedCaptionTextLabel = Toolkit::TextLabel::New();
Toolkit::TextLabel pressedCaptionTextLabel = Toolkit::TextLabel::New();
+ pressedCaptionTextLabel.SetResizePolicy( FIXED, ALL_DIMENSIONS );
pressedCaptionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption );
pressedCaptionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption );
- optionPressedContainer.Add( pressedCaptionTextLabel );
+ // optionPressedContainer.Add( pressedCaptionTextLabel ); Temporary removed.
// Calculates the icon/text position.
float iconTextOffsetY = 0.0f;
// Calculates the icon/text position.
float iconTextOffsetY = 0.0f;
textSize.width = std::min( textSize.width, OPTION_MAX_WIDTH - 2.f * OPTION_MARGIN_WIDTH );
// Set the size to the text. Text will be ellipsized if exceeds the max width.
textSize.width = std::min( textSize.width, OPTION_MAX_WIDTH - 2.f * OPTION_MARGIN_WIDTH );
// Set the size to the text. Text will be ellipsized if exceeds the max width.
- captionTextLabel.SetSize( textSize );
- pressedCaptionTextLabel.SetSize( textSize );
+ captionTextLabel.SetPreferredSize( textSize.GetVectorXY() );
+ pressedCaptionTextLabel.SetPreferredSize( textSize.GetVectorXY() );
// 4. Calculate the size of option.
// 4. Calculate the size of option.
const Vector2 optionSize( std::min( OPTION_MAX_WIDTH, std::max( OPTION_MIN_WIDTH, std::max( textSize.width, OPTION_ICON_SIZE.width ) + 2.f * OPTION_MARGIN_WIDTH ) ),
DEFAULT_POPUP_MAX_SIZE.height - mNinePatchMargins.z - mNinePatchMargins.w );
const Vector2 optionSize( std::min( OPTION_MAX_WIDTH, std::max( OPTION_MIN_WIDTH, std::max( textSize.width, OPTION_ICON_SIZE.width ) + 2.f * OPTION_MARGIN_WIDTH ) ),
DEFAULT_POPUP_MAX_SIZE.height - mNinePatchMargins.z - mNinePatchMargins.w );
- optionContainer.SetSize( optionSize );
- optionPressedContainer.SetSize( optionSize );
+ optionContainer.SetPreferredSize( optionSize );
+ optionPressedContainer.SetPreferredSize( optionSize );
// 5. Create a option.
Toolkit::PushButton option = Toolkit::PushButton::New();
// 5. Create a option.
Toolkit::PushButton option = Toolkit::PushButton::New();
- //option.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed ); FIXME
- option.SetSize( optionSize );
+ option.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+ option.SetPreferredSize( optionSize );
option.SetAnchorPoint( AnchorPoint::TOP_LEFT );
option.SetX( mContentSize.width );
option.SetName( name );
option.SetAnchorPoint( AnchorPoint::TOP_LEFT );
option.SetX( mContentSize.width );
option.SetName( name );
const Size size( POPUP_DIVIDER_WIDTH, mContentSize.height );
ImageActor divider = Toolkit::CreateSolidColorActor( Color::WHITE );
const Size size( POPUP_DIVIDER_WIDTH, mContentSize.height );
ImageActor divider = Toolkit::CreateSolidColorActor( Color::WHITE );
- divider.SetSize (size);
+ divider.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+ divider.SetPreferredSize( size );
divider.SetParentOrigin( ParentOrigin::TOP_LEFT );
divider.SetAnchorPoint( AnchorPoint::TOP_LEFT );
divider.SetPosition( mContentSize.width - POPUP_DIVIDER_WIDTH, 0.0f );
divider.SetParentOrigin( ParentOrigin::TOP_LEFT );
divider.SetAnchorPoint( AnchorPoint::TOP_LEFT );
divider.SetPosition( mContentSize.width - POPUP_DIVIDER_WIDTH, 0.0f );
stencil.SetDrawMode( DrawMode::STENCIL );
stencil.SetVisible( true );
Actor scrollview = Actor::New(); //todo make a scrollview
stencil.SetDrawMode( DrawMode::STENCIL );
stencil.SetVisible( true );
Actor scrollview = Actor::New(); //todo make a scrollview
+ stencil.SetRelayoutEnabled( true );
- //todo Use Size negotiation
- //self.SetSize( size ); // control matches stencil size
- self.SetSize( mRequiredPopUpSize ); // control matches stencil size
- mStencilLayer.SetSize( size ); // matches stencil size
- stencil.SetSize( size );
- scrollview.SetSize( size );
- mButtons.SetSize( size );
+ self.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+ self.SetPreferredSize( mRequiredPopUpSize ); // control matches stencil size
+
+ mStencilLayer.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+ mStencilLayer.SetPreferredSize( size ); // matches stencil size
+
+ stencil.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ scrollview.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mButtons.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
mStencilLayer.SetAnchorPoint(AnchorPoint::TOP_LEFT);
scrollview.SetAnchorPoint(AnchorPoint::TOP_LEFT);
mStencilLayer.SetAnchorPoint(AnchorPoint::TOP_LEFT);
scrollview.SetAnchorPoint(AnchorPoint::TOP_LEFT);
mContentSize = Vector2::ZERO;
mButtons = Actor::New();
mContentSize = Vector2::ZERO;
mButtons = Actor::New();
+ mButtons.SetRelayoutEnabled( true );
// Add the options into the buttons container.
// Add the options into the buttons container.
FrameBufferImage frameBufferImage = FrameBufferImage::New( offscreenSize.width,
offscreenSize.height,
Pixel::RGBA8888 );
FrameBufferImage frameBufferImage = FrameBufferImage::New( offscreenSize.width,
offscreenSize.height,
Pixel::RGBA8888 );
- mImageActor.SetPreferredSize( offscreenSize );
- mImageActor.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+
+ mImageActor.SetSize( offscreenSize );
mImageActor.SetImage( frameBufferImage );
mRenderTask.SetTargetFrameBuffer( frameBufferImage );
mImageActor.SetImage( frameBufferImage );
mRenderTask.SetTargetFrameBuffer( frameBufferImage );
// Create a root actor and an image actor for offscreen rendering.
mOffscreenRootActor = Layer::New();
// Create a root actor and an image actor for offscreen rendering.
mOffscreenRootActor = Layer::New();
+ mOffscreenRootActor.SetRelayoutEnabled( false );
mOffscreenRootActor.SetColorMode( USE_OWN_COLOR );
mOffscreenRootActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );
mOffscreenRootActor.SetInheritScale( false );
mOffscreenRootActor.SetDepthTestDisabled( true );
mOffscreenRootActor.SetColorMode( USE_OWN_COLOR );
mOffscreenRootActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );
mOffscreenRootActor.SetInheritScale( false );
mOffscreenRootActor.SetDepthTestDisabled( true );
- mOffscreenRootActor.SetResizePolicy( FIXED, ALL_DIMENSIONS );
- mOffscreenRootActor.SetPreferredSize( offscreenSize );
+ mOffscreenRootActor.SetSize( offscreenSize );
mImageActor = ImageActor::New();
mImageActor = ImageActor::New();
+ mImageActor.SetRelayoutEnabled( false );
mImageActor.SetParentOrigin( ParentOrigin::CENTER );
mImageActor.SetBlendFunc( BlendingFactor::ONE, BlendingFactor::ONE_MINUS_SRC_ALPHA,
BlendingFactor::ONE, BlendingFactor::ONE );
mImageActor.SetScale( Vector3( 1.0f, -1.0f, 1.0f ) );
mImageActor.SetParentOrigin( ParentOrigin::CENTER );
mImageActor.SetBlendFunc( BlendingFactor::ONE, BlendingFactor::ONE_MINUS_SRC_ALPHA,
BlendingFactor::ONE, BlendingFactor::ONE );
mImageActor.SetScale( Vector3( 1.0f, -1.0f, 1.0f ) );
- mImageActor.SetPreferredSize( offscreenSize );
- mImageActor.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+ mImageActor.SetSize( offscreenSize );
// Creates a new camera actor.
mOffscreenCameraActor = CameraActor::New();
// Creates a new camera actor.
mOffscreenCameraActor = CameraActor::New();
{
mPrimaryCursor.SetPosition( mCursor[PRIMARY_CURSOR].x + scrollPosition.x,
mCursor[PRIMARY_CURSOR].y + scrollPosition.y );
{
mPrimaryCursor.SetPosition( mCursor[PRIMARY_CURSOR].x + scrollPosition.x,
mCursor[PRIMARY_CURSOR].y + scrollPosition.y );
- mPrimaryCursor.SetResizePolicy( FIXED, ALL_DIMENSIONS );
- mPrimaryCursor.SetPreferredSize( Vector2( 1.0f, mCursor[PRIMARY_CURSOR].height ) );
+ mPrimaryCursor.SetSize( Vector2( 1.0f, mCursor[PRIMARY_CURSOR].height ) );
}
if( mSecondaryCursor )
{
mSecondaryCursor.SetPosition( mCursor[SECONDARY_CURSOR].x + scrollPosition.x,
mCursor[SECONDARY_CURSOR].y + scrollPosition.y );
}
if( mSecondaryCursor )
{
mSecondaryCursor.SetPosition( mCursor[SECONDARY_CURSOR].x + scrollPosition.x,
mCursor[SECONDARY_CURSOR].y + scrollPosition.y );
- mSecondaryCursor.SetResizePolicy( FIXED, ALL_DIMENSIONS );
- mSecondaryCursor.SetPreferredSize( Vector2( 1.0f, mCursor[SECONDARY_CURSOR].height ) );
+ mSecondaryCursor.SetSize( Vector2( 1.0f, mCursor[SECONDARY_CURSOR].height ) );
}
// Show or hide the grab handle
}
// Show or hide the grab handle
void CreateCursor( ImageActor& cursor )
{
cursor = CreateSolidColorActor( Color::WHITE );
void CreateCursor( ImageActor& cursor )
{
cursor = CreateSolidColorActor( Color::WHITE );
- cursor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ cursor.SetParentOrigin( ParentOrigin::TOP_LEFT ); // Need to set the default parent origin as CreateSolidColorActor() sets a different one.
cursor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
cursor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
+ cursor.SetRelayoutEnabled( false );
}
// Add or Remove cursor(s) from parent
}
// Add or Remove cursor(s) from parent
mActiveLayer.SetName ( "ActiveLayerActor" );
#endif
mActiveLayer.SetName ( "ActiveLayerActor" );
#endif
- mActiveLayer.SetAnchorPoint( AnchorPoint::CENTER);
- mActiveLayer.SetParentOrigin( ParentOrigin::CENTER);
+ mActiveLayer.SetParentOrigin( ParentOrigin::CENTER );
mActiveLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
mActiveLayer.SetPositionInheritanceMode( USE_PARENT_POSITION );
mActiveLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
mActiveLayer.SetPositionInheritanceMode( USE_PARENT_POSITION );
#ifdef DECORATOR_DEBUG
mGrabHandle.SetName( "GrabHandleActor" );
#endif
#ifdef DECORATOR_DEBUG
mGrabHandle.SetName( "GrabHandleActor" );
#endif
- mGrabHandle.SetParentOrigin( ParentOrigin::TOP_LEFT );
mGrabHandle.SetAnchorPoint( AnchorPoint::TOP_CENTER );
mGrabHandle.SetDrawMode( DrawMode::OVERLAY );
// Area that Grab handle responds to, larger than actual handle so easier to move
mGrabHandle.SetAnchorPoint( AnchorPoint::TOP_CENTER );
mGrabHandle.SetDrawMode( DrawMode::OVERLAY );
// Area that Grab handle responds to, larger than actual handle so easier to move
-//#ifdef DECORATOR_DEBUG
-// mGrabArea = Toolkit::CreateSolidColorActor( Vector4(0.0f, 0.0f, 0.0f, 0.0f), true, Color::RED, 1 );
-// mGrabArea.SetName( "GrabArea" );
-//#else
- mGrabArea = Actor::New(); //todo Force use of Actor until SolidColorActor fixed in Size Negotiation
+#ifdef DECORATOR_DEBUG
+ mGrabArea = Toolkit::CreateSolidColorActor( Vector4(0.0f, 0.0f, 0.0f, 0.0f), true, Color::RED, 1 );
+ mGrabArea.SetName( "GrabArea" );
+#else
+ mGrabArea = Actor::New();
mGrabArea.SetRelayoutEnabled( true );
mGrabArea.SetRelayoutEnabled( true );
mGrabArea.SetParentOrigin( ParentOrigin::TOP_CENTER );
mGrabArea.SetParentOrigin( ParentOrigin::TOP_CENTER );
- mGrabArea.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
mGrabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
mGrabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
+ mGrabArea.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
mGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE );
mGrabHandle.Add( mGrabArea );
mGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE );
mGrabHandle.Add( mGrabArea );
#ifdef DECORATOR_DEBUG
primary.actor.SetName("SelectionHandleOne");
#endif
#ifdef DECORATOR_DEBUG
primary.actor.SetName("SelectionHandleOne");
#endif
- primary.actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
primary.actor.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); // Change to BOTTOM_RIGHT if Look'n'Feel requires handle above text.
primary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
primary.flipped = false;
primary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
primary.actor.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); // Change to BOTTOM_RIGHT if Look'n'Feel requires handle above text.
primary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
primary.flipped = false;
primary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
+ primary.grabArea.SetRelayoutEnabled( true );
#ifdef DECORATOR_DEBUG
primary.grabArea.SetName("SelectionHandleOneGrabArea");
#endif
#ifdef DECORATOR_DEBUG
primary.grabArea.SetName("SelectionHandleOneGrabArea");
#endif
#ifdef DECORATOR_DEBUG
secondary.actor.SetName("SelectionHandleTwo");
#endif
#ifdef DECORATOR_DEBUG
secondary.actor.SetName("SelectionHandleTwo");
#endif
- secondary.actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
secondary.actor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // Change to BOTTOM_LEFT if Look'n'Feel requires handle above text.
secondary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
secondary.flipped = false;
secondary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
secondary.actor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // Change to BOTTOM_LEFT if Look'n'Feel requires handle above text.
secondary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
secondary.flipped = false;
secondary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
+ secondary.grabArea.SetRelayoutEnabled( true );
#ifdef DECORATOR_DEBUG
secondary.grabArea.SetName("SelectionHandleTwoGrabArea");
#endif
#ifdef DECORATOR_DEBUG
secondary.grabArea.SetName("SelectionHandleTwoGrabArea");
#endif
#ifdef DECORATOR_DEBUG
mHighlightMeshActor.SetName( "HighlightMeshActor" );
#endif
#ifdef DECORATOR_DEBUG
mHighlightMeshActor.SetName( "HighlightMeshActor" );
#endif
- mHighlightMeshActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
for ( uint32_t i = 0; i < meshContainer.size(); ++i )
{
MeshActor actor = MeshActor::New( Mesh::New( meshContainer[ i ].mMeshData ) );
for ( uint32_t i = 0; i < meshContainer.size(); ++i )
{
MeshActor actor = MeshActor::New( Mesh::New( meshContainer[ i ].mMeshData ) );
- actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
// Check to see what pixel format the shader should be
actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
// Check to see what pixel format the shader should be
meshData.SetHasColor( false );
meshData.SetHasTextureCoords( true );
MeshActor actor = MeshActor::New( Mesh::New( meshData ) );
meshData.SetHasColor( false );
meshData.SetHasTextureCoords( true );
MeshActor actor = MeshActor::New( Mesh::New( meshData ) );
- actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
actor.SetShaderEffect( mBgraShader );
actor.SetFilterMode( FilterMode::LINEAR, FilterMode::LINEAR );
actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
actor.SetShaderEffect( mBgraShader );
actor.SetFilterMode( FilterMode::LINEAR, FilterMode::LINEAR );
newMeshData.SetHasTextureCoords( true );
MeshActor subActor = MeshActor::New( Mesh::New( newMeshData ) );
newMeshData.SetHasTextureCoords( true );
MeshActor subActor = MeshActor::New( Mesh::New( newMeshData ) );
- subActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
subActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
subActor.SetColor( shadowColor );
subActor.SetShaderEffect( mBasicShadowShader );
subActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
subActor.SetColor( shadowColor );
subActor.SetShaderEffect( mBasicShadowShader );
AtlasRenderer::~AtlasRenderer()
{
delete mImpl;
AtlasRenderer::~AtlasRenderer()
{
delete mImpl;
-}
\ No newline at end of file
imageData.Update();
image = ImageActor::New( imageData );
imageData.Update();
image = ImageActor::New( imageData );
- image.SetAnchorPoint( AnchorPoint::CENTER );
image.SetParentOrigin( ParentOrigin::CENTER );
if( border )
image.SetParentOrigin( ParentOrigin::CENTER );
if( border )