CreatePopup();
}
-void TextSelectionPopup::OnRelayout( const Vector2& size, ActorSizeContainer& container )
+void TextSelectionPopup::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
}
mNinePatchMargins.w = ninePatchImageSize.height - ( childRect.y + childRect.height ) - 1u;
}
- SetBackground ( mBackgroundImage );
- SetBackgroundColor ( mBackgroundColor );
+ SetBackgroundImage( mBackgroundImage );
+ SetBackgroundColor( mBackgroundColor );
}
void TextSelectionPopup::AddOption( Actor& parent, const std::string& name, const std::string& caption, const Image iconImage, bool finalOption, bool showIcons )
// 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.SetParentOrigin( ParentOrigin::CENTER );
optionContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
ImageActor optionPressedContainer = Toolkit::CreateSolidColorActor( mBackgroundPressedColor );
+ optionPressedContainer.SetResizePolicy( FIXED, ALL_DIMENSIONS );
optionPressedContainer.SetDrawMode( DrawMode::OVERLAY );
- //optionPressedContainer.SetParentOrigin( ParentOrigin::CENTER );
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 );
- optionContainer.Add( captionTextLabel );
+ // optionContainer.Add( captionTextLabel ); Temporary removed.
Toolkit::TextLabel pressedCaptionTextLabel = Toolkit::TextLabel::New();
+ pressedCaptionTextLabel.SetResizePolicy( FIXED, ALL_DIMENSIONS );
pressedCaptionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption );
- optionPressedContainer.Add( pressedCaptionTextLabel );
+ // optionPressedContainer.Add( pressedCaptionTextLabel ); Temporary removed.
// 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.
- captionTextLabel.SetSize( textSize );
- pressedCaptionTextLabel.SetSize( textSize );
+ captionTextLabel.SetSize( textSize.GetVectorXY() );
+ pressedCaptionTextLabel.SetSize( textSize.GetVectorXY() );
// 4. Calculate the size of option.
// 5. Create a option.
Toolkit::PushButton option = Toolkit::PushButton::New();
- option.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed );
+ option.SetResizePolicy( FIXED, ALL_DIMENSIONS );
option.SetSize( optionSize );
option.SetAnchorPoint( AnchorPoint::TOP_LEFT );
option.SetX( mContentSize.width );
const Size size( POPUP_DIVIDER_WIDTH, mContentSize.height );
ImageActor divider = Toolkit::CreateSolidColorActor( Color::WHITE );
- divider.SetSize (size);
+ divider.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+ divider.SetSize( size );
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.SetRelayoutEnabled( true );
- //todo Use Size negotiation
- //self.SetSize( size ); // control matches stencil size
+ self.SetResizePolicy( FIXED, ALL_DIMENSIONS );
self.SetSize( mRequiredPopUpSize ); // control matches stencil size
+
+ mStencilLayer.SetResizePolicy( FIXED, ALL_DIMENSIONS );
mStencilLayer.SetSize( size ); // matches stencil size
- stencil.SetSize( size );
- scrollview.SetSize( size );
- mButtons.SetSize( 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);
mContentSize = Vector2::ZERO;
mButtons = Actor::New();
+ mButtons.SetRelayoutEnabled( true );
// Add the options into the buttons container.