<label>Image Scaling Modes</label>
</ui-application>
<ui-application appid="buttons.example" exec="/usr/apps/com.samsung.dali-demo/bin/buttons.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
- <label>Radio Buttons</label>
+ <label>Buttons</label>
</ui-application>
<ui-application appid="text-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
<label>Text View</label>
<ui-application appid="atlas.example" exec="/usr/apps/com.samsung.dali-demo/bin/atlas.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
<label>Atlas</label>
</ui-application>
+ <ui-application appid="size-negotiation.example" exec="/usr/apps/com.samsung.dali-demo/bin/size-negotiation.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+ <label>Size Negotiation</label>
+ </ui-application>
</manifest>
demo.AddExample(Example("refraction-effect.example", "Refraction"));
demo.AddExample(Example("scroll-view.example", "Scroll View"));
demo.AddExample(Example("shadow-bone-lighting.example", "Lights and shadows"));
- demo.AddExample(Example("builder.example", "Script Based UI"));
+// demo.AddExample(Example("builder.example", "Script Based UI"));
demo.AddExample(Example("image-scaling-irregular-grid.example", "Image Scaling Modes"));
demo.AddExample(Example("text-view.example", "Text View"));
demo.AddExample(Example("animated-shapes.example", "Animated Shapes"));
demo.AddExample(Example("path-animation.example", "Path Animation"));
+ demo.AddExample(Example("size-negotiation.example", "Size Negotiation"));
+
+ demo.SortAlphabetically( true );
+
app.MainLoop();
return 0;
const int EXAMPLES_PER_ROW = 3;
const int ROWS_PER_PAGE = 3;
const int EXAMPLES_PER_PAGE = EXAMPLES_PER_ROW * ROWS_PER_PAGE;
-const float LOGO_MARGIN_RATIO = 0.5f / 0.9f;
+const float LOGO_MARGIN_RATIO = 0.1f / 0.3f;
const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f;
const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f ); ///< ScrollView's relative size to its parent
-const Vector3 TABLE_RELATIVE_SIZE(0.9f, 0.9f, 0.8f ); ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights.
+const Vector3 TABLE_RELATIVE_SIZE(0.95f, 0.9f, 0.8f ); ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights.
const float STENCIL_RELATIVE_SIZE = 1.0f;
const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap Duration for Effects
const unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs
const float BACKGROUND_Z = -1.0f;
-const float BACKGROUND_SIZE_SCALE = 1.0f;
const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f );
const float BUBBLE_MIN_Z = -1.0;
{
Image image = ResourceImage::New( imagePath );
ImageActor background = ImageActor::New( image );
-
+ background.SetName( "BACKGROUND" );
background.SetAnchorPoint( AnchorPoint::CENTER );
background.SetParentOrigin( ParentOrigin::CENTER );
background.SetZ( -1.0f );
+ background.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
return background;
}
const float IMAGE_BORDER_BOTTOM = IMAGE_BORDER_LEFT;
/**
- * Constraint to return a position for a bubble based on the scroll value and vertical wrapping.
+ * Constraint to return a position for a bubble based on the scroll value and vertical wrapping
*/
struct AnimateBubbleConstraint
{
Vector3 operator()( const Vector3& current, const PropertyInput& scrollProperty, const PropertyInput& parentSize )
{
Vector3 pos( current );
+ const float parentHeight = parentSize.GetVector3().height;
- // Wrap bubbles verically.
- if( pos.y + mShapeSize * 0.5f < -parentSize.GetVector3().y * 0.5f )
+ // Wrap bubbles vertically
+ if( pos.y + mShapeSize * 0.5f < -parentHeight * 0.5f )
{
- pos.y += parentSize.GetVector3().y + mShapeSize;
+ pos.y = parentHeight * 0.5f + mShapeSize * 0.5f;
}
- // Bubbles X position moves parallax to horizontal
- // panning by a scale factor unique to each bubble.
+ // Bubbles X position moves parallax to horizontal panning by a scale factor unique to each bubble
pos.x = mInitialX + ( scrollProperty.GetVector3().x * mScale );
return pos;
}
mRootActor(),
mRotateAnimation(),
mBackground(),
- mLogo(),
mPressedAnimation(),
mScrollViewLayer(),
mScrollView(),
const Vector2 stageSize = Stage::GetCurrent().GetSize();
// Background
- mBackground = CreateBackground( mBackgroundImagePath );
- // set same size as parent actor
- mBackground.SetSize( stageSize );
- Stage::GetCurrent().Add( mBackground );
+ Actor background = CreateBackground( mBackgroundImagePath );
+ Stage::GetCurrent().Add( background );
// Render entire content as overlays, as is all on same 2D plane.
mRootActor = TableView::New( 4, 1 );
mRootActor.SetAnchorPoint( AnchorPoint::CENTER );
mRootActor.SetParentOrigin( ParentOrigin::CENTER );
+ mRootActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
Stage::GetCurrent().Add( mRootActor );
// Toolbar at top
DemoHelper::GetDefaultTextStyle());
mRootActor.AddChild( toolBarLayer, TableView::CellPosition( 0, 0 ) );
- const float toolbarHeight = DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight;
- mRootActor.SetFixedHeight( 0, toolbarHeight );
+ mRootActor.SetFitHeight( 0 );
// Add logo
- mLogo = CreateLogo( LOGO_PATH );
+ Dali::ImageActor logo = CreateLogo( LOGO_PATH );
+ logo.SetName( "LOGO_IMAGE" );
+ logo.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
const float paddingHeight = ( ( 1.f-TABLE_RELATIVE_SIZE.y ) * stageSize.y );
const float logoMargin = paddingHeight * LOGO_MARGIN_RATIO;
- const float logoHeight = mLogo.GetImage().GetHeight() + logoMargin;
- mRootActor.SetFixedHeight( 1, logoHeight );
// Show version in a popup when log is tapped
mLogoTapDetector = TapGestureDetector::New();
- mLogoTapDetector.Attach( mLogo );
+ mLogoTapDetector.Attach( logo );
mLogoTapDetector.DetectedSignal().Connect( this, &DaliTableView::OnLogoTapped );
const float bottomMargin = paddingHeight * BOTTOM_PADDING_RATIO;
- mButtonsPageRelativeSize = Vector3( TABLE_RELATIVE_SIZE.x, 1.f - ( toolbarHeight + logoHeight + bottomMargin) / stageSize.height, TABLE_RELATIVE_SIZE.z );
- mRootActor.SetFixedHeight( 2, mButtonsPageRelativeSize.y * stageSize.height );
Alignment alignment = Alignment::New();
- alignment.Add(mLogo);
+ alignment.SetName( "LOGO_ALIGNMENT" );
+ alignment.Add( logo );
+ alignment.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ alignment.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
+ Actor alignmentActor = alignment;
+ alignmentActor.SetPadding( Padding( 0.0f, 0.0f, logoMargin, logoMargin ));
mRootActor.AddChild( alignment, TableView::CellPosition( 1, 0 ) );
+ mRootActor.SetFitHeight( 1 );
// scrollview occupying the majority of the screen
mScrollView = ScrollView::New();
+ mScrollView.SetRelayoutEnabled( true );
mScrollView.SetAnchorPoint( AnchorPoint::CENTER );
mScrollView.SetParentOrigin( ParentOrigin::CENTER );
- // Note: Currently, changing mScrollView to use SizeMode RELATIVE_TO_PARENT
- // will cause scroll ends to appear in the wrong position.
- mScrollView.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::SIZE, Dali::ParentSource( Dali::Actor::Property::SIZE ), Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) );
+ mScrollView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ const float buttonsPageMargin = ( 1.0f - TABLE_RELATIVE_SIZE.x ) * 0.5f * stageSize.width;
+ mScrollView.SetPadding( Padding( buttonsPageMargin, buttonsPageMargin, 0.0f, 0.0f ) );
+
mScrollView.SetAxisAutoLock( true );
mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete );
mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart );
mScrollViewLayer.SetAnchorPoint( AnchorPoint::CENTER );
mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER );
mScrollViewLayer.SetDrawMode( DrawMode::OVERLAY );
+ mScrollViewLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
+ // Create solid background colour.
+ ImageActor backgroundColourActor = Dali::Toolkit::CreateSolidColorActor( BACKGROUND_COLOR );
+ backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER );
+ backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER );
+ backgroundColourActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ backgroundColourActor.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ backgroundColourActor.SetSizeModeFactor( Vector3( 1.0f, 1.5f, 1.0f ) );
+ backgroundColourActor.SetZ( BACKGROUND_Z );
+ mScrollViewLayer.Add( backgroundColourActor );
// Populate background and bubbles - needs to be scrollViewLayer so scroll ends show
- SetupBackground( mScrollView, mScrollViewLayer, stageSize );
+ Actor bubbleContainer = Actor::New();
+ bubbleContainer.SetRelayoutEnabled( true );
+ bubbleContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER );
+ bubbleContainer.SetParentOrigin( ParentOrigin::CENTER );
+ mScrollViewLayer.Add( bubbleContainer );
+
+ SetupBackground( bubbleContainer );
+
+ Alignment buttonsAlignment = Alignment::New();
+ buttonsAlignment.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ buttonsAlignment.Add( mScrollViewLayer );
mScrollViewLayer.Add( mScrollView );
- mRootActor.AddChild( mScrollViewLayer, TableView::CellPosition( 2, 0 ) );
+
+ mRootActor.AddChild( buttonsAlignment, TableView::CellPosition( 2, 0 ) );
+
+ mRootActor.SetFixedHeight( 3, bottomMargin );
// Add scroll view effect and setup constraints on pages
ApplyScrollViewEffect();
winHandle.ShowIndicator( Dali::Window::INVISIBLE );
- //
+ // Background animation
mAnimationTimer = Timer::New( BACKGROUND_ANIMATION_DURATION );
mAnimationTimer.TickSignal().Connect( this, &DaliTableView::PauseBackgroundAnimation );
mAnimationTimer.Start();
{
Actor page = *pageIter;
- unsigned int numChildren = page.GetChildCount();
- Actor pageActor = page;
- for( unsigned int i=0; i<numChildren; ++i)
+ for( unsigned int i = 0, numChildren = page.GetChildCount(); i < numChildren; ++i)
{
// Remove old effect's manual constraints.
- Actor child = pageActor.GetChildAt(i);
+ Actor child = page.GetChildAt(i);
if( child )
{
ApplyCubeEffectToActor( child );
}
}
}
+
+void DaliTableView::OnButtonsPageRelayout( const Dali::Actor& actor )
+{
+
+}
+
void DaliTableView::Populate()
{
const Vector2 stageSize = Stage::GetCurrent().GetSize();
for( int t = 0; t < mTotalPages; t++ )
{
// Create Table. (contains up to 9 Examples)
- Actor page = Actor::New();
-
- // Add tableView to container.
- mScrollView.Add( page );
-
+ TableView page = TableView::New( 3, 3 );
page.SetAnchorPoint( AnchorPoint::CENTER );
page.SetParentOrigin( ParentOrigin::CENTER );
- page.SetSizeMode( SIZE_EQUAL_TO_PARENT );
-
- // add cells to table
- const float margin = 4.0f;
+ page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mScrollView.Add( page );
// Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi.
- const Size tileSize((stageSize.x * mButtonsPageRelativeSize.x / EXAMPLES_PER_ROW) - margin, (stageSize.y * mButtonsPageRelativeSize.y / ROWS_PER_PAGE) - margin );
+ const float margin = 2.0f;
+ const float tileParentMultiplier = 1.0f / EXAMPLES_PER_ROW;
for(int row = 0; row < ROWS_PER_PAGE; row++)
{
{
const Example& example = ( *iter );
- Actor tile = CreateTile( example.name, example.title, tileSize, true );
+ Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), true );
FocusManager focusManager = FocusManager::Get();
focusManager.SetFocusOrder( tile, ++exampleCount );
focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_LABEL,
focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_HINT,
"You can run this example" );
- Vector3 position( margin * 0.5f + (tileSize.x + margin) * column - stageSize.width * mButtonsPageRelativeSize.x * 0.5f,
- margin * 0.5f + (tileSize.y + margin) * row - stageSize.height * mButtonsPageRelativeSize.y * 0.5f,
- 0.0f);
- tile.SetPosition( position + Vector3( tileSize.x, tileSize.y, 0.0f ) * 0.5f );
- tile.SetSize( tileSize );
- page.Add( tile );
+ tile.SetPadding( Padding( margin, margin, margin, margin ) );
+
+ page.AddChild( tile, TableView::CellPosition( row, column ) );
iter++;
}
// Set tableview position
- Vector3 pagePos( stageSize.x * mButtonsPageRelativeSize.x * t, 0.0f, 0.0f );
+ Vector3 pagePos( stageSize.width * TABLE_RELATIVE_SIZE.x * t, 0.0f, 0.0f );
page.SetPosition( pagePos );
mPages.push_back( page );
}
// Update Ruler info.
- mScrollRulerX = new FixedRuler( stageSize.width * mButtonsPageRelativeSize.x );
+ mScrollRulerX = new FixedRuler( stageSize.width * TABLE_RELATIVE_SIZE.x );
mScrollRulerY = new DefaultRuler();
- mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * mButtonsPageRelativeSize.x, true ) );
+ mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * TABLE_RELATIVE_SIZE.x, true ) );
mScrollRulerY->Disable();
mScrollView.SetRulerX( mScrollRulerX );
mScrollView.SetRulerY( mScrollRulerY );
mRotateAnimation.Play();
}
-Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Size& parentSize, bool addBackground )
+Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground )
{
- Actor tile = Actor::New();
- tile.SetName( name );
- tile.SetAnchorPoint( AnchorPoint::CENTER );
- tile.SetParentOrigin( ParentOrigin::CENTER );
+ Actor content = Actor::New();
+ content.SetName( name );
+ content.SetAnchorPoint( AnchorPoint::CENTER );
+ content.SetParentOrigin( ParentOrigin::CENTER );
+ content.SetRelayoutEnabled( true );
+ content.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ content.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ content.SetSizeModeFactor( sizeMultiplier );
// create background image
if( addBackground )
image.SetAnchorPoint( AnchorPoint::CENTER );
image.SetParentOrigin( ParentOrigin::CENTER );
// make the image 100% of tile
- image.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
// move image back to get text appear in front
image.SetZ( -1 );
image.SetStyle( ImageActor::STYLE_NINE_PATCH );
image.SetNinePatchBorder( Vector4( IMAGE_BORDER_LEFT, IMAGE_BORDER_TOP, IMAGE_BORDER_RIGHT, IMAGE_BORDER_BOTTOM ) );
- tile.Add( image );
+ content.Add( image );
// Add stencil
ImageActor stencil = NewStencilImage();
- stencil.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ stencil.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
image.Add( stencil );
}
text.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
text.SetLineJustification( Toolkit::TextView::Center );
text.SetTextAlignment( Toolkit::Alignment::Type( Alignment::HorizontalCenter | Alignment::VerticalCenter ) );
- text.SetColor( Color::WHITE );
text.SetZ( 1 );
// make the text 90% of tile
- text.SetSize( 0.9f * parentSize.width, 0.9f * parentSize.height );
+ text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ text.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ text.SetSizeModeFactor( Vector3( 0.9f, 0.9f, 0.0f ) );
text.SetStyleToCurrentText( GetTableTextStyle() );
text.SetSnapshotModeEnabled( false );
- tile.Add( text );
+ content.Add( text );
// Set the tile to be keyboard focusable
- tile.SetKeyboardFocusable(true);
+ content.SetKeyboardFocusable(true);
// connect to the touch events
- tile.TouchedSignal().Connect( this, &DaliTableView::OnTilePressed );
- tile.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered );
+ content.TouchedSignal().Connect( this, &DaliTableView::OnTilePressed );
+ content.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered );
- return tile;
+ return content;
}
ImageActor DaliTableView::NewStencilImage()
// move focus to 1st item of new page
FocusManager focusManager = FocusManager::Get();
focusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) );
-
- ApplyCubeEffectToActors();
}
bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event )
}
}
-void DaliTableView::SetupBackground( Actor bubbleContainer, Actor backgroundLayer, const Vector2& size )
+void DaliTableView::SetupBackground( Actor bubbleContainer )
{
// Create distance field shape.
BufferImage distanceField;
Size imageSize( 512, 512 );
CreateShapeImage( CIRCLE, imageSize, distanceField );
- // Create solid background colour.
- ImageActor backgroundColourActor = Dali::Toolkit::CreateSolidColorActor( BACKGROUND_COLOR );
- backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER );
- backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER );
- backgroundColourActor.SetSize( size * BACKGROUND_SIZE_SCALE );
- backgroundColourActor.SetZ( BACKGROUND_Z );
- backgroundColourActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );
- backgroundLayer.Add( backgroundColourActor );
-
// Add bubbles to the bubbleContainer.
// Note: The bubbleContainer is parented externally to this function.
- AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField, size );
+ AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField );
+}
+
+void DaliTableView::InitialiseBackgroundActors( Actor actor )
+{
+ // Delete current animations
+ mBackgroundAnimations.clear();
+
+ // Create new animations
+ const Vector3 size = actor.GetTargetSize();
+
+ for( unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i )
+ {
+ Actor child = actor.GetChildAt( i );
+
+ const Vector3 childSize = child.GetTargetSize();
+
+ // Calculate a random position
+ Vector3 childPos( Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ),
+ Random::Range( -size.y * 0.5f - childSize.height, size.y * 0.5f + childSize.height ),
+ Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) );
+
+ child.SetPosition( childPos );
+
+ // Define bubble horizontal parallax and vertical wrapping
+ Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::POSITION,
+ Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ),
+ Dali::ParentSource( Dali::Actor::Property::SIZE ),
+ AnimateBubbleConstraint( childPos, Random::Range( -0.85f, 0.25f ), childSize.height ) );
+ child.ApplyConstraint( animConstraint );
+
+ // Kickoff animation
+ Animation animation = Animation::New( Random::Range( 40.0f, 80.0f ) );
+ animation.MoveBy( child, Vector3( 0.0f, -1.0f, 0.0f ), AlphaFunctions::Linear );
+ animation.SetLooping( true );
+ animation.Play();
+ mBackgroundAnimations.push_back( animation );
+ }
}
-void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField, const Dali::Vector2& size )
+void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField )
{
for( int i = 0; i < count; ++i )
{
float randSize = Random::Range( 10.0f, 400.0f );
float hue = Random::Range( 0.3f, 1.0f );
- Vector4 randColour( hue, hue*0.5, 0.0f, Random::Range( 0.3f, 0.6f ));
+ Vector4 randColour( hue, hue * 0.5, 0.0f, Random::Range( 0.3f, 0.6f ));
ImageActor dfActor = ImageActor::New( distanceField );
- mBackgroundActors.push_back( dfActor );
+ dfActor.SetRelayoutEnabled( false );
dfActor.SetSize( Vector2( randSize, randSize ) );
dfActor.SetParentOrigin( ParentOrigin::CENTER );
effect.SetOutlineParams( Vector2( 0.55f, 0.00f ) );
effect.SetSmoothingEdge( 0.5f );
layer.Add( dfActor );
-
- // Setup animation
- Vector3 actorPos(
- Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ),
- Random::Range( -size.y * 0.5f - randSize, size.y * 0.5f + randSize ),
- Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) );
- dfActor.SetPosition( actorPos );
-
- // Define bubble horizontal parallax and vertical wrapping
- Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::POSITION,
- Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ),
- Dali::ParentSource( Dali::Actor::Property::SIZE ),
- AnimateBubbleConstraint( actorPos, Random::Range( -0.85f, 0.25f ), randSize ) );
- dfActor.ApplyConstraint( animConstraint );
-
- // Kickoff animation
- Animation animation = Animation::New( Random::Range( 40.0f, 200.0f ) );
- KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.0f, actorPos );
- Vector3 toPos( actorPos );
- toPos.y -= ( size.y + randSize );
- keyframes.Add( 1.0f, toPos );
- animation.AnimateBetween( Property( dfActor, Actor::Property::POSITION ), keyframes );
- animation.SetLooping( true );
- animation.Play();
- mBackgroundAnimations.push_back( animation );
}
+
+ // Positioning will occur when the layer is relaid out
+ layer.OnRelayoutSignal().Connect( this, &DaliTableView::InitialiseBackgroundActors );
}
void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut )
ImageActor logo = ImageActor::New( image );
logo.SetAnchorPoint( AnchorPoint::CENTER );
- logo.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
+ logo.SetParentOrigin( ParentOrigin::CENTER );
return logo;
}
stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")";
mVersionPopup = Dali::Toolkit::Popup::New();
- mVersionPopup.SetTitle( stream.str() );
mVersionPopup.SetParentOrigin( ParentOrigin::CENTER );
mVersionPopup.SetAnchorPoint( AnchorPoint::CENTER );
+ mVersionPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ mVersionPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mVersionPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
+ mVersionPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
+ mVersionPopup.SetTitle( stream.str() );
mVersionPopup.HideTail();
mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup );
mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden );
- Dali::Stage::GetCurrent().Add( mVersionPopup );
+ mVersionPopup.MarkDirtyForRelayout();
}
mVersionPopup.Show();
*
* @return The Actor for the created tile.
*/
- Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Size& parentSize, bool addBackground );
+ Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground );
/**
* Create a stencil image
* Create a depth field background
*
* @param[in] bubbleLayer Add the graphics to this layer
- * @param[in] backgroundLayer Add the background to this layer
*/
- void SetupBackground( Dali::Actor bubbleLayer, Dali::Actor backgroundLayer, const Dali::Vector2& size );
+ void SetupBackground( Dali::Actor bubbleLayer );
/**
* Create background actors for the given layer
* @param[in] layer The layer to add the actors to
* @param[in] count The number of actors to generate
* @param[in] distanceField The distance field bitmap to use
- * @param[in] size The size of the actor
*/
- void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage distanceField, const Dali::Vector2& size );
+ void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage distanceField );
/**
* Create a bitmap with the specified shape and also output a distance field
*/
void PopupHidden();
+ /*
+ * @brief Callback called when the buttons page actor is relaid out
+ *
+ * @param[in] actor The page actor
+ */
+ void OnButtonsPageRelayout( const Dali::Actor& actor );
+
+ /**
+ * @brief Callback called to set up background actors
+ *
+ * @param[in] actor The actor raising the callback
+ */
+ void InitialiseBackgroundActors( Dali::Actor actor );
+
private:
Dali::Application& mApplication; ///< Application instance.
Dali::Toolkit::TableView mRootActor; ///< All content (excluding background is anchored to this Actor)
Dali::Animation mRotateAnimation; ///< Animation to rotate and resize mRootActor.
Dali::ImageActor mBackground; ///< Background's static image.
- Dali::ImageActor mLogo; ///< Logo's static image.
Dali::Animation mPressedAnimation; ///< Button press scaling animation.
Dali::Layer mScrollViewLayer; ///< ScrollView resides on a separate layer.
Dali::Toolkit::ScrollView mScrollView; ///< ScrollView container (for all Examples)
bool mSortAlphabetically:1; ///< Sort examples alphabetically.
bool mBackgroundAnimsPlaying:1; ///< Are background animations playing
bool mVersionPopupShown:1; ///< Whehter the version popup is shown or not
+
};
#endif // __DALI_DEMO_H__
//Create a view
mView = Dali::Toolkit::View::New();
+ mView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
stage.Add( mView );
//Set background image for the view
mLevelContainer = Actor::New();
mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER );
mLevelContainer.SetParentOrigin( ParentOrigin::CENTER );
- mLevelContainer.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ mLevelContainer.SetRelayoutEnabled( true );
+ mLevelContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
mContentLayer.Add( mLevelContainer );
mBrickCount = 0;
ImageActor brick = ImageActor::New(img);
brick.SetParentOrigin(ParentOrigin::TOP_LEFT);
brick.SetAnchorPoint(AnchorPoint::CENTER);
+ brick.SetRelayoutEnabled( false );
brick.SetSize( brickSize );
brick.SetPosition( Vector3( position ) );
ImageActor actor = ImageActor::New(img);
actor.SetParentOrigin(ParentOrigin::TOP_LEFT);
actor.SetAnchorPoint(AnchorPoint::CENTER);
+ actor.SetRelayoutEnabled( false );
return actor;
}
mFiles.clear();
mItemView = ItemView::New(*this);
+ mItemView.SetRelayoutEnabled( false );
stage.Add( mItemView );
mItemView.SetParentOrigin(ParentOrigin::CENTER);
mItemView.SetAnchorPoint(AnchorPoint::CENTER);
Actor MenuItem(const std::string& text)
{
TextView t = TextView::New();
+ t.SetResizePolicy( FILL_TO_PARENT, WIDTH );
t.SetMarkupProcessingEnabled(true);
int size = static_cast<int>(DemoHelper::ScalePointSize(6));
builder.AddActors( layer );
+ // Force relayout on layer
+ layer.RelayoutRequestTree();
}
radioGroup2Background.SetAnchorPoint( AnchorPoint::TOP_LEFT );
radioGroup2Background.SetParentOrigin( ParentOrigin::TOP_LEFT );
radioGroup2Background.SetPosition( DP(MARGIN_SIZE), DP(yPos) );
- radioGroup2Background.SetSize( DP(348), DP(GROUP2_HEIGHT) );
+ radioGroup2Background.SetRelayoutEnabled( true );
+ radioGroup2Background.SetPreferredSize( Vector2( DP(348), DP(GROUP2_HEIGHT) ) );
mContentLayer.Add( radioGroup2Background );
Actor radioButtonsGroup2 = Actor::New();
radioButtonsGroup2.SetParentOrigin( ParentOrigin::TOP_LEFT );
radioButtonsGroup2.SetAnchorPoint( AnchorPoint::TOP_LEFT );
radioButtonsGroup2.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
- radioButtonsGroup2.SetSize( DP(100), DP(160) );
+ radioButtonsGroup2.SetRelayoutEnabled( true );
+ radioButtonsGroup2.SetPreferredSize( Vector2( DP(100), DP(160) ) );
radioGroup2Background.Add( radioButtonsGroup2 );
// Radio 1
{
ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_1 ) );
- imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
+ imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
mRadioButtonImage1 = Dali::Toolkit::RadioButton::New( imageActor );
mRadioButtonImage1.SetParentOrigin( ParentOrigin::TOP_LEFT );
mRadioButtonImage1.SetAnchorPoint( AnchorPoint::TOP_LEFT );
radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING;
ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_2 ) );
- imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
+ imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( imageActor );
mRadioButtonImage2.SetParentOrigin( ParentOrigin::TOP_LEFT );
radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING;
ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_3 ) );
- imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
+ imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( imageActor );
mRadioButtonImage3.SetParentOrigin( ParentOrigin::TOP_LEFT );
mUpdateButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
mUpdateButton.SetAnchorPoint( AnchorPoint::TOP_CENTER );
mUpdateButton.SetPosition( 0, DP(MARGIN_SIZE) );
- mUpdateButton.SetLabel("Select");
- mUpdateButton.SetSize( DP(100), DP(BUTTON_HEIGHT) );
+ mUpdateButton.SetLabel( "Select" );
+ mUpdateButton.SetPreferredSize( Vector2( DP(100), DP(BUTTON_HEIGHT) ) );
mUpdateButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
mUpdateButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) );
mImage.SetParentOrigin( ParentOrigin::TOP_RIGHT );
mImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mImage.SetPosition( DP(MARGIN_SIZE), 0 );
- mImage.SetSize( DP(218), DP(218) );
+ mImage.SetPreferredSize( Vector2( DP(218), DP(218) ) );
radioButtonsGroup2.Add( mImage );
// The enable/disable radio group
radioGroup1Background.SetAnchorPoint( AnchorPoint::TOP_LEFT );
radioGroup1Background.SetParentOrigin( ParentOrigin::TOP_LEFT );
radioGroup1Background.SetPosition( DP(MARGIN_SIZE), DP(yPos) );
- radioGroup1Background.SetSize( DP(348), DP(GROUP1_HEIGHT) );
+ radioGroup1Background.SetRelayoutEnabled( true );
+ radioGroup1Background.SetPreferredSize( Vector2( DP(348), DP(GROUP1_HEIGHT) ) );
mContentLayer.Add( radioGroup1Background );
// Radio group
// First radio button
{
Toolkit::TableView tableView = Toolkit::TableView::New( 1, 2 );
- tableView.SetSize( DP(260), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
+ tableView.SetPreferredSize( Vector2( DP(260), 0.0f ) );
+ tableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
Toolkit::TextView textView = Toolkit::TextView::New( "Select enabled" );
- Toolkit::Alignment alignment = Toolkit::Alignment::New( Toolkit::Alignment::HorizontalLeft );
- alignment.Add( textView );
- tableView.AddChild( alignment, Toolkit::TableView::CellPosition( 0, 0 ) );
+ tableView.AddChild( textView, Toolkit::TableView::CellPosition( 0, 0 ) );
ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) );
- imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
+ imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
+ imageActor.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+ imageActor.SetPadding( Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) );
tableView.AddChild( imageActor, Toolkit::TableView::CellPosition( 0, 1 ) );
- tableView.SetFixedWidth( 1, DP(RADIO_LABEL_THUMBNAIL_SIZE) );
Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( tableView );
radioButton.SetName( "radio-select-enable" );
checkBoxBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT );
checkBoxBackground.SetParentOrigin( ParentOrigin::TOP_LEFT );
checkBoxBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) );
- checkBoxBackground.SetSize( DP(430), DP(GROUP3_HEIGHT) );
+ checkBoxBackground.SetRelayoutEnabled( true );
+ checkBoxBackground.SetPreferredSize( Vector2( DP(430), DP(GROUP3_HEIGHT) ) );
mContentLayer.Add( checkBoxBackground );
Dali::Image unselected = Dali::ResourceImage::New( CHECKBOX_UNSELECTED_IMAGE );
toggleBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT );
toggleBackground.SetParentOrigin( ParentOrigin::TOP_LEFT );
toggleBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) );
- toggleBackground.SetSize( DP(150 + MARGIN_SIZE * 2), DP(GROUP4_HEIGHT) );
+ toggleBackground.SetRelayoutEnabled( true );
+ toggleBackground.SetPreferredSize( Vector2( DP(150 + MARGIN_SIZE * 2), DP(GROUP4_HEIGHT) ) );
mContentLayer.Add( toggleBackground );
Toolkit::PushButton toggleButton = Toolkit::PushButton::New();
toggleButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
toggleButton.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
toggleButton.SetLabel( "Unselected" );
- toggleButton.SetSize( DP(150), DP(BUTTON_HEIGHT) );
+ toggleButton.SetPreferredSize( Vector2( DP(150), DP(BUTTON_HEIGHT) ) );
toggleButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
toggleButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) );
// create and setup the scroll view...
mScrollView = ScrollView::New();
+ mScrollView.SetRelayoutEnabled( false );
mScrollView.SetSize(stageSize);
// attach Wobble Effect to ScrollView
mScrollView.SetParentOrigin(ParentOrigin::CENTER);
// Scale ScrollView to fit parent (mContentLayer)
- mScrollView.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ mScrollView.SetRelayoutEnabled( true );
+ mScrollView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
// Add the scroll view to the content layer
mContentLayer.Add(mScrollView);
Cluster clusterActor = Cluster::New(style);
clusterActor.SetParentOrigin(ParentOrigin::CENTER);
clusterActor.SetAnchorPoint(AnchorPoint::CENTER);
+ clusterActor.SetRelayoutEnabled( false );
Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
float minStageDimension = std::min(stageSize.x, stageSize.y);
backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ShrinkToFit );
Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH );
ImageActor image = ImageActor::New(bg);
+ image.SetRelayoutEnabled( false );
clusterActor.SetBackgroundImage(image);
// Add actors (pictures) as the children of the cluster
shadowActor.SetPosition(Vector3(0.0f, 0.0f, -1.0f));
// Apply size-relative mode to auto-size the image shadow
+ shadowActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
shadowActor.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
shadowActor.SetSizeModeFactor( ShadowProperty::SIZE_SCALE );
actor.Add( shadowActor );
ImageActor imageActor = ImageActor::New( image );
imageActor.SetParentOrigin( ParentOrigin::CENTER );
imageActor.SetAnchorPoint( AnchorPoint::CENTER );
- imageActor.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ imageActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
actor.Add( imageActor );
// Add a border image child actor (with a fixed size offset from parent).
borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH );
borderActor.SetNinePatchBorder( CLUSTER_IMAGE_BORDER_ABSOLUTE );
borderActor.SetPosition( Vector3( 0.0f, 0.0f, 1.0f ) );
+ borderActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT );
borderActor.SetSizeModeFactor( Vector3( CLUSTER_IMAGE_BORDER_INDENT - 1.0f, CLUSTER_IMAGE_BORDER_INDENT - 1.0f, 0.0f ) * 2.0f );
actor.Add( borderActor );
mScrollView.Add(pageView);
pageView.SetParentOrigin(ParentOrigin::CENTER);
pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f));
- pageView.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ pageView.SetRelayoutEnabled( true );
+ pageView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
// Create cluster actors, add them to scroll view, and set the shear effect with the given center point.
Cluster cluster = CreateClusterActor(clusterType, style);
mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) );
mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION );
mCurrentImage.ApplyConstraint( mImageConstraint );
+ mCurrentImage.SetRelayoutEnabled( false );
mParent.Add( mCurrentImage );
mCurrentEffect = mCubeWaveEffect;
mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION);
mNextImage.ApplyConstraint( mImageConstraint );
+ mNextImage.SetRelayoutEnabled( false );
mCurrentEffect.SetTargetImage(mNextImage);
if( image.GetLoadingState() == ResourceLoadingSucceeded )
{
// coordinates in a frame defined by a parent actor:
Actor gridActor = Actor::New();
- gridActor.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ gridActor.SetRelayoutEnabled( true );
+ gridActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
gridActor.SetParentOrigin( ParentOrigin::CENTER );
gridActor.SetAnchorPoint( AnchorPoint::CENTER );
mDeleteButton.SetDrawMode( DrawMode::OVERLAY );
mDeleteButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
mDeleteButton.SetButtonImage( ResourceImage::New( DELETE_IMAGE ) );
- mDeleteButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f );
+ mDeleteButton.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+ mDeleteButton.SetPreferredSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked);
mDeleteButton.SetLeaveRequired( true );
mDeleteButton.SetVisible( false );
mInsertButton.SetDrawMode( DrawMode::OVERLAY );
mInsertButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
mInsertButton.SetButtonImage( ResourceImage::New( INSERT_IMAGE ) );
- mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f );
+ mInsertButton.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+ mInsertButton.SetPreferredSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked);
mInsertButton.SetLeaveRequired( true );
mInsertButton.SetVisible( false );
mReplaceButton.SetDrawMode( DrawMode::OVERLAY );
mReplaceButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
mReplaceButton.SetButtonImage( ResourceImage::New( REPLACE_IMAGE ) );
- mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f );
+ mReplaceButton.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+ mReplaceButton.SetPreferredSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked);
mReplaceButton.SetLeaveRequired( true );
mReplaceButton.SetVisible( false );
// Create the item view actor
mImageAtlas = CreateImageAtlas();
mItemView = ItemView::New(*this);
+ mItemView.SetRelayoutEnabled( false );
mItemView.SetParentOrigin(ParentOrigin::CENTER);
mItemView.SetAnchorPoint(AnchorPoint::CENTER);
borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH );
borderActor.SetNinePatchBorder( Vector4( ITEM_IMAGE_BORDER_LEFT, ITEM_IMAGE_BORDER_TOP, ITEM_IMAGE_BORDER_RIGHT, ITEM_IMAGE_BORDER_BOTTOM ) );
borderActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); // darken with parent image-actor
+ borderActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT );
borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE );
actor.Add(borderActor);
// Add a checkbox child actor; invisible until edit-mode is enabled
ImageActor checkbox = ImageActor::New( mWhiteImage );
+ checkbox.SetRelayoutEnabled( false );
checkbox.SetName( "CheckBox" );
checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) );
checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT );
actor.Add( checkbox );
ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) );
+ tick.SetRelayoutEnabled( false );
tick.SetColorMode( USE_OWN_COLOR );
tick.SetName( "Tick" );
tick.SetParentOrigin( ParentOrigin::TOP_RIGHT );
mMenu = Toolkit::Popup::New();
mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
+ mMenu.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+ mMenu.SetPreferredSize( Vector2( popupWidth, MENU_OPTION_HEIGHT * 2 ) );
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 );
+ tableView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
mMenu.Add( tableView );
Slider slider = Slider::New();
slider.SetProperty( Slider::Property::VALUE, mDurationSeconds );
slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 );
slider.SetProperty( Slider::Property::SHOW_POPUP, true );
+ slider.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
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);
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::SIZE_WIDTH, Dali::ParentSource( Dali::Actor::Property::SIZE_WIDTH ), Dali::EqualToConstraint() ) );
+ text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ text.SetResizePolicy( FIXED, HEIGHT );
+ text.SetPreferredSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) );
text.SetZ( -0.9f );
slider.Add( text );
Actor textContainer = Actor::New();
+ textContainer.SetRelayoutEnabled( true );
+ textContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
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);
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::SIZE_WIDTH, Dali::ParentSource( Dali::Actor::Property::SIZE_WIDTH ), Dali::EqualToConstraint() ) );
+ text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ text.SetResizePolicy( FIXED, HEIGHT );
+ text.SetPreferredSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) );
textContainer.Add( text );
+ mMenu.MarkDirtyForRelayout();
mMenu.Show();
mMenuShown = true;
}
mContentLayer.Add( createGroupBackground );
int buttonXDP = DP(MARGIN_SIZE);
- int buttonWidthDP = (createGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2;
+ int buttonWidthDP = (createGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2;
{
Toolkit::PushButton button = Toolkit::PushButton::New();
mContentLayer.Add( timingGroupBackground );
buttonXDP = DP(MARGIN_SIZE);
- buttonWidthDP = (timingGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2;
+ buttonWidthDP = (timingGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2;
{
Toolkit::PushButton button = Toolkit::PushButton::New();
mContentLayer.Add( enableGroupBackground );
buttonXDP = DP(MARGIN_SIZE);
- buttonWidthDP = (enableGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2;
+ buttonWidthDP = (enableGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2;
{
Toolkit::PushButton button = Toolkit::PushButton::New();
mContentLayer.Add( vsyncGroupBackground );
buttonXDP = DP(MARGIN_SIZE);
- buttonWidthDP = vsyncGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 2;
+ buttonWidthDP = vsyncGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 2;
{
Toolkit::PushButton button = Toolkit::PushButton::New();
// Create magnifier (controlled by human touch)
Layer overlay = Layer::New();
+ overlay.SetRelayoutEnabled( false );
overlay.SetSensitive(false);
overlay.SetParentOrigin( ParentOrigin::CENTER );
overlay.SetSize(mStageSize);
Stage::GetCurrent().Add(overlay);
mMagnifier = Toolkit::Magnifier::New();
+ mMagnifier.SetRelayoutEnabled( false );
mMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
// Create bouncing magnifier automatically bounces around screen.
mBouncingMagnifier = Toolkit::Magnifier::New();
+ mBouncingMagnifier.SetRelayoutEnabled( false );
mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
mBouncingMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
*/
virtual Actor NewPage( unsigned int pageId )
{
+ ImageActor page;
+
if( pageId == 0 )
{
- return ImageActor::New( ResourceImage::New( BOOK_COVER_PORTRAIT ) );
+ page = ImageActor::New( ResourceImage::New( BOOK_COVER_PORTRAIT ) );
}
else
{
- return ImageActor::New( ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) );
+ page = ImageActor::New( ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) );
}
+
+ page.SetRelayoutEnabled( false );
+
+ return page;
}
};
pageBack = ImageActor::New( ResourceImage::New( PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ] ) );
}
pageFront.Add(pageBack);
+
+ pageFront.SetRelayoutEnabled( false );
+ pageBack.SetRelayoutEnabled( false );
+
return pageFront;
}
};
// Create default View.
mView = View::New();
+ mView.SetRelayoutEnabled( false );
stage.Add( mView );
Dali::Window winHandle = app.GetWindow();
mView.OrientationAnimationStartedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted );
mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize );
+ mPageTurnPortraitView.SetRelayoutEnabled( false );
mPageTurnPortraitView.SetSpineShadowParameter( Vector2(70.f, 30.f) );
mPageTurnPortraitView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn );
mPageTurnPortraitView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn );
mPageTurnPortraitView.SetPositionInheritanceMode( USE_PARENT_POSITION );
mPageTurnLandscapeView = PageTurnLandscapeView::New( mLandscapePageFactory, Vector2(stageSize.y*0.5f, stageSize.x) );
+ mPageTurnLandscapeView.SetRelayoutEnabled( false );
mPageTurnLandscapeView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn );
mPageTurnLandscapeView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn );
mPageTurnLandscapeView.PagePanStartedSignal().Connect( this, &PageTurnController::OnPageStartedPan );
textActor.SetSize(size.y,size.y,0.0f);
Slider slider = Slider::New();
+ slider.SetRelayoutEnabled( false );
slider.SetAnchorPoint( AnchorPoint::CENTER_LEFT);
slider.SetParentOrigin( ParentOrigin::CENTER_RIGHT);
slider.SetProperty(Slider::Property::LOWER_BOUND, -1.0f );
//TextInput
Dali::Layer controlsLayer = Dali::Layer::New();
+ controlsLayer.SetRelayoutEnabled( false );
controlsLayer.SetSize( stage.GetSize().x, stage.GetSize().y*0.3f, 0.0 );
controlsLayer.SetPosition( 0.0f, stage.GetSize().y*0.8f, 0.0f );
controlsLayer.SetAnchorPoint( AnchorPoint::TOP_LEFT);
if( !mControlPoint[index] )
{
mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f));
+ mControlPoint[index].SetRelayoutEnabled( false );
mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT);
mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER );
mControlPoint[index].SetSize( 20.0f, 20.0f );
if( !mControlPoint[index])
{
mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f));
+ mControlPoint[index].SetRelayoutEnabled( false );
mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT);
mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER );
mControlPoint[index].SetSize( 20.0f, 20.0f );
ImageAttributes attributes;
Image img = ResourceImage::New(ACTOR_IMAGE, attributes );
mActor = ImageActor::New( img );
+ mActor.SetRelayoutEnabled( false );
mActor.SetAnchorPoint( AnchorPoint::CENTER );
mActor.SetSize( 100, 50, 1 );
stage.Add( mActor );
Vector2 stageSize = stage.GetSize();
mScrollView = ScrollView::New();
+ mScrollView.SetRelayoutEnabled( false );
mScrollView.SetAnchorPoint(AnchorPoint::CENTER);
mScrollView.SetParentOrigin(ParentOrigin::CENTER);
mContentLayer.Add( mScrollView );
Actor CreatePage()
{
Actor page = Actor::New();
- page.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ page.SetRelayoutEnabled( true );
+ page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
page.SetParentOrigin( ParentOrigin::CENTER );
page.SetAnchorPoint( AnchorPoint::CENTER );
void ApplyEffectToPage(Actor page)
{
page.RemoveConstraints();
- page.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ page.SetRelayoutEnabled( true );
+ page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
switch( mEffectMode )
{
attributes.SetFilterMode( ImageAttributes::BoxThenLinear );
Image img = ResourceImage::New(filename, attributes);
ImageActor actor = ImageActor::New(img);
+ actor.SetRelayoutEnabled( false );
actor.SetName( filename );
actor.SetParentOrigin(ParentOrigin::CENTER);
actor.SetAnchorPoint(AnchorPoint::CENTER);
mShadowView.SetName("Container");
mShadowView.SetParentOrigin(ParentOrigin::CENTER);
mShadowView.SetAnchorPoint(AnchorPoint::CENTER);
- mShadowView.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ mShadowView.SetRelayoutEnabled( true );
+ mShadowView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f);
mContents.Add(mShadowView);
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "shared/view.h"
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+// Define this so that it is interchangeable
+// "DP" stands for Device independent Pixels
+#define DP(x) DemoHelper::ScalePointSize(x)
+
+struct ButtonItem
+{
+ const char* name;
+ const char* text;
+};
+
+
+namespace
+{
+
+const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "background-gradient.jpg";
+const char* const TOOLBAR_IMAGE = DALI_IMAGE_DIR "top-bar.png";
+
+const char* const TOOLBAR_TITLE = "Size Negotiation";
+const int TOOLBAR_HEIGHT = 62;
+
+const char* MENU_ICON_IMAGE = DALI_IMAGE_DIR "icon-cluster-none.png";
+
+const char* const PUSHBUTTON_BUTTON_IMAGE = DALI_IMAGE_DIR "button-up.9.png";
+const char* const PUSHBUTTON_PRESS_IMAGE = DALI_IMAGE_DIR "button-down.9.png";
+
+const char* const POPUPS_MENU_ID = "POPUPS_MENU";
+const char* const TABLEVIEW_MENU_ID = "TABLEVIEW_MENU";
+
+const char* const POPUP_BUTTON_EMPTY_ID = "POPUP_BUTTON_EMPTY";
+const char* const POPUP_BUTTON_TITLE_ID = "POPUP_BUTTON_TITLE";
+const char* const POPUP_BUTTON_BUTTONS_1_ID = "POPUP_BUTTON_BUTTONS_1";
+const char* const POPUP_BUTTON_BUTTONS_2_ID = "POPUP_BUTTON_BUTTONS_2";
+const char* const POPUP_BUTTON_TITLE_BUTTONS_ID = "POPUP_BUTTON_TITLE_BUTTONS";
+const char* const POPUP_BUTTON_CONTENT_TEXT_ID = "POPUP_BUTTON_CONTENT_TEXT";
+const char* const POPUP_BUTTON_CONTENT_IMAGE_ID = "POPUP_BUTTON_CONTENT_IMAGE";
+const char* const POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID = "POPUP_BUTTON_CONTENT_IMAGE_SCALE";
+const char* const POPUP_BUTTON_CONTENT_IMAGE_FIT_ID = "POPUP_BUTTON_CONTENT_IMAGE_FIT";
+const char* const POPUP_BUTTON_CONTENT_IMAGE_FILL_ID = "POPUP_BUTTON_CONTENT_IMAGE_FILL";
+const char* const POPUP_BUTTON_TITLE_CONTENT_TEXT_ID = "POPUP_BUTTON_TITLE_CONTENT_TEXT";
+const char* const POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID = "POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS";
+const char* const POPUP_BUTTON_COMPLEX_ID = "POPUP_BUTTON_COMPLEX";
+
+const char* const TABLEVIEW_BUTTON_EMPTY_ID = "TABLEVIEW_BUTTON_EMPTY";
+const char* const TABLEVIEW_BUTTON_1CELL_ID = "TABLEVIEW_BUTTON_1CELL";
+const char* const TABLEVIEW_BUTTON_3CELL_ID = "TABLEVIEW_BUTTON_3CELL";
+const char* const TABLEVIEW_BUTTON_3X3CELL_ID = "TABLEVIEW_BUTTON_3X3CELL";
+const char* const TABLEVIEW_BUTTON_FIXED1_ID = "TABLEVIEW_BUTTON_FIXED1";
+const char* const TABLEVIEW_BUTTON_FIXED2_ID = "TABLEVIEW_BUTTON_FIXED2";
+const char* const TABLEVIEW_BUTTON_FIT1_ID = "TABLEVIEW_BUTTON_FIT1";
+const char* const TABLEVIEW_BUTTON_FIT2_ID = "TABLEVIEW_BUTTON_FIT2";
+const char* const TABLEVIEW_BUTTON_NATURAL1_ID = "TABLEVIEW_BUTTON_NATURAL1";
+const char* const TABLEVIEW_BUTTON_NATURAL2_ID = "TABLEVIEW_BUTTON_NATURAL2";
+const char* const TABLEVIEW_BUTTON_NATURAL3_ID = "TABLEVIEW_BUTTON_NATURAL3";
+
+const char* const OKAY_BUTTON_ID = "OKAY_BUTTON";
+const char* const CANCEL_BUTTON_ID = "CANCEL_BUTTON";
+
+const char* const CONTENT_TEXT = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
+const char* const IMAGE1 = DALI_IMAGE_DIR "gallery-medium-5.jpg";
+const char* const IMAGE2 = DALI_IMAGE_DIR "background-magnifier.jpg";
+const char* const CHECKBOX_UNCHECKED_IMAGE = DALI_IMAGE_DIR "checkbox-unselected.png";
+const char* const CHECKBOX_CHECKED_IMAGE = DALI_IMAGE_DIR "checkbox-selected.png";
+
+const ButtonItem MENU_ITEMS[] = {
+ { POPUPS_MENU_ID, "Popups" },
+ { TABLEVIEW_MENU_ID, "TableView" }
+};
+
+const unsigned int MENU_ITEMS_COUNT = sizeof( MENU_ITEMS ) / sizeof( MENU_ITEMS[0] );
+
+const ButtonItem POPUP_BUTTON_ITEMS[] = {
+ { POPUP_BUTTON_COMPLEX_ID, "Complex" },
+ { POPUP_BUTTON_EMPTY_ID, "Empty" },
+ { POPUP_BUTTON_TITLE_ID, "Title" },
+ { POPUP_BUTTON_BUTTONS_1_ID, "1 Button" },
+ { POPUP_BUTTON_BUTTONS_2_ID, "2 Buttons" },
+ { POPUP_BUTTON_TITLE_BUTTONS_ID, "Title & Buttons" },
+ { POPUP_BUTTON_CONTENT_TEXT_ID, "Text" },
+ { POPUP_BUTTON_CONTENT_IMAGE_ID, "Image" },
+ { POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID, "Image Scale" },
+ { POPUP_BUTTON_CONTENT_IMAGE_FIT_ID, "Image Fit" },
+ { POPUP_BUTTON_CONTENT_IMAGE_FILL_ID, "Image Fill" },
+ { POPUP_BUTTON_TITLE_CONTENT_TEXT_ID, "Title Text" },
+ { POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID, "Title, text, buttons" }
+
+};
+
+const int POPUP_BUTTON_ITEMS_COUNT = sizeof( POPUP_BUTTON_ITEMS ) / sizeof( POPUP_BUTTON_ITEMS[0] );
+
+const ButtonItem TABLEVIEW_BUTTON_ITEMS[] = {
+ { TABLEVIEW_BUTTON_EMPTY_ID, "Empty" },
+ { TABLEVIEW_BUTTON_1CELL_ID, "1 Cell" },
+ { TABLEVIEW_BUTTON_3CELL_ID, "3 Cell" },
+ { TABLEVIEW_BUTTON_3X3CELL_ID, "3x3 Cells" },
+ { TABLEVIEW_BUTTON_FIXED1_ID, "Fixed 1" },
+ { TABLEVIEW_BUTTON_FIXED2_ID, "Fixed 2" },
+ { TABLEVIEW_BUTTON_FIT1_ID, "Fit Top Bottom" },
+ { TABLEVIEW_BUTTON_FIT2_ID, "Fit Middle" },
+ { TABLEVIEW_BUTTON_NATURAL1_ID, "Natural 1" },
+ { TABLEVIEW_BUTTON_NATURAL2_ID, "Natural 2" },
+ { TABLEVIEW_BUTTON_NATURAL3_ID, "Natural 3" },
+};
+
+const unsigned int TABLEVIEW_BUTTON_ITEMS_COUNT = sizeof( TABLEVIEW_BUTTON_ITEMS ) / sizeof( TABLEVIEW_BUTTON_ITEMS[0] );
+
+} // namespace
+
+
+
+/**
+ * This example shows the usage of size negotiation.
+ */
+class SizeNegotiationController: public ConnectionTracker, public Toolkit::ItemFactory
+{
+public:
+
+ SizeNegotiationController( Application& application )
+ : mApplication( application ),
+ mMenuShown( false ),
+ mDemoState( POPUP )
+ {
+ // Connect to the Application's Init signal
+ mApplication.InitSignal().Connect( this, &SizeNegotiationController::Create );
+ }
+
+ ~SizeNegotiationController()
+ {
+ // Nothing to do here
+ }
+
+ void Create( Application& application )
+ {
+ // The Init signal is received once (only) during the Application lifetime
+
+ Stage stage = Stage::GetCurrent();
+
+ // Respond to key events
+ stage.KeyEventSignal().Connect(this, &SizeNegotiationController::OnKeyEvent);
+
+ // Creates a default view with a default tool bar.
+ // The view is added to the stage.
+ mContentLayer = DemoHelper::CreateView( application,
+ mView,
+ mToolBar,
+ BACKGROUND_IMAGE,
+ TOOLBAR_IMAGE,
+ std::string("") );
+
+ mTitleActor = Dali::Toolkit::TextView::New();
+ mTitleActor.SetName( "CUSTOM_TOOLBAR_TITLE" );
+
+ SetTitle();
+
+ // Create menu button
+ Toolkit::PushButton viewButton = Toolkit::PushButton::New();
+ viewButton.SetBackgroundImage( ResourceImage::New( MENU_ICON_IMAGE ) );
+ viewButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnMenu );
+ mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
+
+ // Add title to the tool bar.
+ const float padding( DemoHelper::DEFAULT_VIEW_STYLE.mToolBarPadding );
+ mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::Padding( padding, padding, padding, padding ) );
+
+ mItemView = Toolkit::ItemView::New( *this );
+ mItemView.SetParentOrigin( ParentOrigin::CENTER );
+ mItemView.SetAnchorPoint( AnchorPoint::CENTER );
+ mItemView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
+ // Use a grid layout for tests
+ Toolkit::GridLayoutPtr gridLayout = Toolkit::GridLayout::New();
+ gridLayout->SetNumberOfColumns( 2 );
+ gridLayout->SetTopMargin( DP(TOOLBAR_HEIGHT) + DP(20.0f) );
+ gridLayout->SetBottomMargin( DP(100.0f) );
+ gridLayout->SetRowSpacing( DP(20.0f) );
+ mItemView.AddLayout( *gridLayout );
+
+ Vector2 stageSize = stage.GetSize();
+ float layoutWidth = Toolkit::IsHorizontal( gridLayout->GetOrientation() ) ? stageSize.height : stageSize.width;
+ float gridItemSize = ( layoutWidth / gridLayout->GetNumberOfColumns() ) * 0.5f;
+ gridLayout->SetScrollSpeedFactor( gridLayout->GetNumberOfColumns() / gridItemSize * 0.5f );
+
+ mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f );
+
+ mContentLayer.Add( mItemView );
+ }
+
+ void SetTitle()
+ {
+ std::string subTitle = "";
+
+ switch( mDemoState )
+ {
+ case POPUP:
+ {
+ subTitle = "Popups";
+ break;
+ }
+
+ case TABLEVIEW:
+ {
+ subTitle = "TableView";
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+
+ mTitleActor.SetText( std::string( TOOLBAR_TITLE ) + ": " + subTitle );
+ mTitleActor.SetStyleToCurrentText( DemoHelper::GetDefaultTextStyle() );
+ }
+
+ bool OnMenu( Toolkit::Button button )
+ {
+ ShowMenu();
+ return true;
+ }
+
+ void ShowMenu()
+ {
+ Stage stage = Stage::GetCurrent();
+ const float popupWidth = stage.GetSize().x * 0.5f;
+
+ mMenu = Toolkit::Popup::New();
+ mMenu.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ mMenu.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mMenu.HideTail();
+ mMenu.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::HideMenu );
+ mMenu.SetPreferredSize( Vector2( popupWidth, 0.0f ) );
+ mMenu.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
+
+ Toolkit::TableView tableView = Toolkit::TableView::New( 0, 0 );
+ tableView.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ tableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+ mMenu.Add( tableView );
+
+ for( unsigned int i = 0; i < MENU_ITEMS_COUNT; ++i )
+ {
+ Toolkit::PushButton menuButton = Toolkit::PushButton::New();
+ menuButton.SetName( MENU_ITEMS[ i ].name );
+ menuButton.SetLabel( MENU_ITEMS[ i ].text );
+ menuButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnMenuSelect );
+
+ tableView.Add( menuButton );
+ tableView.SetFitHeight( i );
+ }
+
+ // Show the menu
+ mMenu.Show();
+ mMenuShown = true;
+ }
+
+ void HideMenu()
+ {
+ if( mMenu )
+ {
+ mMenu.Hide();
+ mMenu.Reset();
+ }
+
+ mMenuShown = false;
+ }
+
+ bool OnMenuSelect( Toolkit::Button button )
+ {
+ bool refresh = false;
+
+ if( button.GetName() == POPUPS_MENU_ID )
+ {
+ if( mDemoState != POPUP )
+ {
+ refresh = true;
+ mDemoState = POPUP;
+ }
+ }
+ else if( button.GetName() == TABLEVIEW_MENU_ID )
+ {
+ if( mDemoState != TABLEVIEW )
+ {
+ refresh = true;
+ mDemoState = TABLEVIEW;
+ }
+ }
+
+ if( refresh )
+ {
+ SetTitle();
+
+ mItemView.Refresh();
+ }
+
+ HideMenu();
+ return true;
+ }
+
+ Toolkit::Popup CreatePopup()
+ {
+ Stage stage = Stage::GetCurrent();
+ const float POPUP_WIDTH_DP = stage.GetSize().width * 0.75f;
+
+ Toolkit::Popup popup = Toolkit::Popup::New();
+ popup.SetName( "POPUP" );
+ popup.SetParentOrigin( ParentOrigin::CENTER );
+ popup.SetAnchorPoint( AnchorPoint::CENTER );
+ popup.SetPreferredSize( Vector2( POPUP_WIDTH_DP, 0.0f ) );
+ popup.HideTail();
+
+ popup.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::OnPopupOutsideTouched );
+
+ return popup;
+ }
+
+ bool OnButtonClicked( Toolkit::Button button )
+ {
+ if( button.GetName() == POPUP_BUTTON_EMPTY_ID )
+ {
+ mPopup = CreatePopup();
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_TITLE_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetTitle( "Popup!" );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_BUTTONS_1_ID )
+ {
+ mPopup = CreatePopup();
+
+ Toolkit::PushButton okayButton = Toolkit::PushButton::New();
+ okayButton.SetName( OKAY_BUTTON_ID );
+ okayButton.SetLabel( "OK!" );
+ okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
+ okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+
+ okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
+
+ mPopup.AddButton( okayButton );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_BUTTONS_2_ID )
+ {
+ mPopup = CreatePopup();
+
+ Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
+ cancelButton.SetName( CANCEL_BUTTON_ID );
+ cancelButton.SetLabel( "Cancel" );
+ cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
+ cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+
+ cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
+
+ mPopup.AddButton( cancelButton );
+
+ Toolkit::PushButton okayButton = Toolkit::PushButton::New();
+ okayButton.SetName( OKAY_BUTTON_ID );
+ okayButton.SetLabel( "OK!" );
+ okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
+ okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+
+ okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
+
+ mPopup.AddButton( okayButton );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_TITLE_BUTTONS_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetTitle( "Popup!" );
+
+ Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
+ cancelButton.SetName( CANCEL_BUTTON_ID );
+ cancelButton.SetLabel( "Cancel" );
+ cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
+ cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+
+ cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
+
+ mPopup.AddButton( cancelButton );
+
+ Toolkit::PushButton okayButton = Toolkit::PushButton::New();
+ okayButton.SetName( OKAY_BUTTON_ID );
+ okayButton.SetLabel( "OK!" );
+ okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
+ okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+
+ okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
+
+ mPopup.AddButton( okayButton );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_CONTENT_TEXT_ID )
+ {
+ mPopup = CreatePopup();
+
+ Toolkit::TextView text = Toolkit::TextView::New();
+ text.SetName( "POPUP_CONTENT_TEXT" );
+ text.SetText( CONTENT_TEXT );
+ text.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
+ text.SetWidthExceedPolicy( Toolkit::TextView::Split );
+ text.SetLineJustification( Toolkit::TextView::Center );
+ text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ text.SetDimensionDependency( HEIGHT, WIDTH );
+ text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
+
+ mPopup.Add( text );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_ID )
+ {
+ mPopup = CreatePopup();
+
+ ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
+ image.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ image.SetDimensionDependency( HEIGHT, WIDTH );
+ image.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
+
+ mPopup.Add( image );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID )
+ {
+ mPopup = CreatePopup();
+
+ mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+ ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
+ image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
+ mPopup.Add( image );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID )
+ {
+ mPopup = CreatePopup();
+
+ mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+ ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
+ image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ image.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO );
+
+ mPopup.Add( image );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID )
+ {
+ mPopup = CreatePopup();
+
+ mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+ ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
+ image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ image.SetSizeScalePolicy( FILL_WITH_ASPECT_RATIO );
+
+ mPopup.Add( image );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetTitle( "Popup!" );
+
+ Toolkit::TextView text = Toolkit::TextView::New();
+ text.SetName( "POPUP_CONTENT_TEXT" );
+ text.SetText( CONTENT_TEXT );
+ text.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
+ text.SetWidthExceedPolicy( Toolkit::TextView::Split );
+ text.SetLineJustification( Toolkit::TextView::Center );
+ text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ text.SetDimensionDependency( HEIGHT, WIDTH );
+ text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
+
+ mPopup.Add( text );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetTitle( "Popup!" );
+
+ Toolkit::TextView text = Toolkit::TextView::New();
+ text.SetName( "POPUP_CONTENT_TEXT" );
+ text.SetText( CONTENT_TEXT );
+ text.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
+ text.SetWidthExceedPolicy( Toolkit::TextView::Split );
+ text.SetLineJustification( Toolkit::TextView::Left );
+ text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ text.SetDimensionDependency( HEIGHT, WIDTH );
+ text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) );
+
+ mPopup.Add( text );
+
+ Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
+ cancelButton.SetName( CANCEL_BUTTON_ID );
+ cancelButton.SetLabel( "Cancel" );
+ cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
+ cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+
+ cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
+
+ mPopup.AddButton( cancelButton );
+
+ Toolkit::PushButton okayButton = Toolkit::PushButton::New();
+ okayButton.SetName( OKAY_BUTTON_ID );
+ okayButton.SetLabel( "OK!" );
+ okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
+ okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+
+ okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
+
+ mPopup.AddButton( okayButton );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetTitle( "Warning" );
+
+ // Content
+ Toolkit::TableView content = Toolkit::TableView::New( 2, 2 );
+ content.SetName( "COMPLEX_TABLEVIEW" );
+ content.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ content.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+ content.SetFitHeight( 0 );
+ content.SetFitHeight( 1 );
+ content.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 0.0f ) );
+
+ // Text
+ {
+ Toolkit::TextView text = Toolkit::TextView::New();
+ text.SetText( "Do you really want to quit?" );
+ text.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
+ text.SetWidthExceedPolicy( Toolkit::TextView::Split );
+ text.SetLineJustification( Toolkit::TextView::Left );
+ text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ text.SetDimensionDependency( HEIGHT, WIDTH );
+
+ content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) );
+ }
+
+ // Image
+ {
+ ImageActor image = ImageActor::New( ResourceImage::New( IMAGE1 ) );
+ image.SetName( "COMPLEX_IMAGE" );
+ image.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ image.SetDimensionDependency( HEIGHT, WIDTH );
+ image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) );
+ content.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) );
+ }
+
+ // Text 2
+ {
+ Toolkit::TableView root = Toolkit::TableView::New( 1, 2 );
+ root.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ root.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+ root.SetFitHeight( 0 );
+ root.SetFitWidth( 0 );
+ root.SetPadding( Padding( 0.0f, 0.0f, 0.0f, 20.0f ) );
+
+ Dali::Image unchecked = Dali::ResourceImage::New( CHECKBOX_UNCHECKED_IMAGE );
+ Dali::Image checked = Dali::ResourceImage::New( CHECKBOX_CHECKED_IMAGE );
+ Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New();
+ checkBox.SetBackgroundImage( unchecked );
+ checkBox.SetSelectedImage( checked );
+ checkBox.SetPreferredSize( Vector2( 48, 48 ) );
+ checkBox.SetResizePolicy( FIXED, ALL_DIMENSIONS );
+
+ root.AddChild( checkBox, Toolkit::TableView::CellPosition( 0, 0 ) );
+
+ Toolkit::TextView text = Toolkit::TextView::New();
+ text.SetText( "Don't show again" );
+ text.SetLineJustification( Toolkit::TextView::Left );
+ Actor textActor = text;
+ textActor.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 10.0f ) );
+
+ root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) );
+
+ content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0, 0, 2 ) ); // Column span 2
+ }
+
+ mPopup.Add( content );
+
+ // Buttons
+ Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
+ cancelButton.SetName( CANCEL_BUTTON_ID );
+ cancelButton.SetLabel( "Cancel" );
+ cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
+ cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+
+ cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
+
+ mPopup.AddButton( cancelButton );
+
+ Toolkit::PushButton okayButton = Toolkit::PushButton::New();
+ okayButton.SetName( OKAY_BUTTON_ID );
+ okayButton.SetLabel( "OK!" );
+ okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
+ okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+
+ okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
+
+ mPopup.AddButton( okayButton );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == TABLEVIEW_BUTTON_EMPTY_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+
+ Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
+ table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
+ mPopup.Add( table );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+
+ Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
+ table.SetName( "TABLEVIEW_BUTTON_1CELL_ID" );
+ table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.Add( backing );
+
+ mPopup.Add( table );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == TABLEVIEW_BUTTON_3CELL_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+
+ Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
+ table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.Add( backing );
+ }
+
+ mPopup.Add( table );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == TABLEVIEW_BUTTON_3X3CELL_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+
+ Toolkit::TableView table = Toolkit::TableView::New( 3, 3 );
+ table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
+ // Column 0
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 0 ) );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 0 ) );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 0 ) );
+ }
+
+ // Column 1
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 1 ) );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 1 ) );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 1.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 1 ) );
+ }
+
+ // Column 2
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 2 ) );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.5f, 0.5f, 0.5f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 2 ) );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.5f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 2 ) );
+ }
+
+ mPopup.Add( table );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == TABLEVIEW_BUTTON_FIXED1_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+
+ Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
+ table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.SetFixedHeight( 0, 50.0f );
+
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ TextActor text = TextActor::New( "Fixed" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ TextActor text = TextActor::New( "Fill" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ TextActor text = TextActor::New( "Fill" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+ table.Add( backing );
+ }
+
+ mPopup.Add( table );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == TABLEVIEW_BUTTON_FIXED2_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+
+ Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
+ table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.SetFixedHeight( 0, 50.0f );
+ table.SetFixedHeight( 2, 50.0f );
+
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ TextActor text = TextActor::New( "Fixed" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ TextActor text = TextActor::New( "Fill" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ TextActor text = TextActor::New( "Fixed" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+ table.Add( backing );
+ }
+
+ mPopup.Add( table );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == TABLEVIEW_BUTTON_FIT1_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+
+ Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
+ table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.SetFitHeight( 0 );
+ table.SetFitHeight( 2 );
+
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ backing.SetResizePolicy( FIXED, HEIGHT );
+ backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
+
+ TextActor text = TextActor::New( "Fit" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
+ TextActor text = TextActor::New( "Fill" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ backing.SetResizePolicy( FIXED, HEIGHT );
+ backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
+
+ TextActor text = TextActor::New( "Fit" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+
+ mPopup.Add( table );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == TABLEVIEW_BUTTON_FIT2_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+
+ Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
+ table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ table.SetFitHeight( 1 );
+
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
+ TextActor text = TextActor::New( "Fill" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ backing.SetResizePolicy( FIXED, HEIGHT );
+ backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
+
+ TextActor text = TextActor::New( "Fit" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
+ TextActor text = TextActor::New( "Fill" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+
+ mPopup.Add( table );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL1_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
+ mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
+
+ Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
+ table.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+ table.SetFitHeight( 0 );
+ table.SetFitHeight( 1 );
+ table.SetFitHeight( 2 );
+
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ backing.SetResizePolicy( FIXED, HEIGHT );
+ backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
+
+ TextActor text = TextActor::New( "Fit" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ backing.SetResizePolicy( FIXED, HEIGHT );
+ backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
+
+ TextActor text = TextActor::New( "Fit" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ backing.SetResizePolicy( FIXED, HEIGHT );
+ backing.SetPreferredSize( Vector2( 0.0f, 300.0f ) );
+
+ TextActor text = TextActor::New( "Fit" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+
+ mPopup.Add( table );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL2_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
+ mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
+
+ Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
+ table.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+ table.SetFitHeight( 0 );
+ table.SetFitHeight( 1 );
+
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ backing.SetResizePolicy( FIXED, HEIGHT );
+ backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
+
+ TextActor text = TextActor::New( "Fit" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ backing.SetResizePolicy( FIXED, HEIGHT );
+ backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
+
+ TextActor text = TextActor::New( "Fit" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+
+ mPopup.Add( table );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL3_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
+ mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
+
+ Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
+ table.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+ table.SetFixedHeight( 0, 20.0f );
+ table.SetFitHeight( 1 );
+
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+
+ TextActor text = TextActor::New( "Fixed" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+ {
+ Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ backing.SetResizePolicy( FIXED, HEIGHT );
+ backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
+
+ TextActor text = TextActor::New( "Fit" );
+ text.SetAnchorPoint( AnchorPoint::CENTER );
+ text.SetParentOrigin( ParentOrigin::CENTER );
+ backing.Add( text );
+
+ table.Add( backing );
+ }
+
+ mPopup.Add( table );
+
+ // The popup is not yet on the stage so needs to be flaged as dirty
+ mPopup.MarkDirtyForRelayout();
+
+ mPopup.Show();
+ }
+ else if( button.GetName() == OKAY_BUTTON_ID || button.GetName() == CANCEL_BUTTON_ID )
+ {
+ if( mPopup )
+ {
+ mPopup.Hide();
+ }
+ }
+
+ return true;
+ }
+
+ void OnPopupOutsideTouched()
+ {
+ if( mPopup )
+ {
+ mPopup.Hide();
+ }
+ }
+
+ void OnKeyEvent( const KeyEvent& event )
+ {
+ if( event.state == KeyEvent::Down )
+ {
+ if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
+ {
+ // Exit application when click back or escape.
+ mApplication.Quit();
+ }
+ }
+ }
+
+public: // From ItemFactory
+
+ /**
+ * @brief Return the number of items to display in the item view
+ *
+ * @return Return the number of items to display
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ switch( mDemoState )
+ {
+ case POPUP:
+ {
+ return POPUP_BUTTON_ITEMS_COUNT;
+ }
+
+ case TABLEVIEW:
+ {
+ return TABLEVIEW_BUTTON_ITEMS_COUNT;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+
+ return 0;
+ }
+
+ /**
+ * @brief Create a new item to populate the item view with
+ *
+ * @param[in] itemId The index of the item to create
+ * @return Return the created actor for the given ID
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ const ButtonItem* buttonDataArray = NULL;
+ switch( mDemoState )
+ {
+ case POPUP:
+ {
+ buttonDataArray = POPUP_BUTTON_ITEMS;
+ break;
+ }
+
+ case TABLEVIEW:
+ {
+ buttonDataArray = TABLEVIEW_BUTTON_ITEMS;
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+
+ if( buttonDataArray )
+ {
+ Toolkit::PushButton popupButton = Toolkit::PushButton::New();
+ popupButton.SetName( buttonDataArray[ itemId ].name );
+ popupButton.SetLabel( buttonDataArray[ itemId ].text );
+ popupButton.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
+
+ popupButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
+ popupButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+
+ popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
+
+ return popupButton;
+ }
+
+ return Actor();
+ }
+
+private:
+
+ enum DemoState
+ {
+ POPUP,
+ TABLEVIEW
+ };
+
+ Application& mApplication;
+ Toolkit::View mView; ///< The View instance.
+ Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
+ Layer mContentLayer; ///< Content layer
+
+ Toolkit::TextView mTitleActor; ///< Title text
+
+ Toolkit::Popup mMenu; ///< The navigation menu
+ bool mMenuShown; ///< If the navigation menu is currently being displayed or not
+
+ Toolkit::Popup mPopup;
+
+ Toolkit::ItemView mItemView; ///< ItemView to hold test images
+
+ DemoState mDemoState;
+};
+
+void RunTest( Application& application )
+{
+ SizeNegotiationController test( application );
+
+ application.MainLoop();
+}
+
+// Entry point for Linux & SLP applications
+//
+int main( int argc, char **argv )
+{
+ Application application = Application::New( &argc, &argv );
+
+ RunTest( application );
+
+ return 0;
+}
{ "HelveticaNue", "Regular", 12.0f, Dali::TextStyle::REGULAR, Vector4( 0.5f, 1.0f, 1.0f, 1.0f ), "Hola", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 90.0f, { 2, 0, 4, 2 } },
{ "HelveticaNue", "Regular", 18.0f, Dali::TextStyle::BOLD, Vector4( 0.5f, 1.0f, 0.5f, 1.0f ), "Bonjour", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 2, 2, 2, 4 } },
{ "HelveticaNue", "Regular", 12.0f, Dali::TextStyle::REGULAR, Vector4( 1.0f, 1.0f, 0.5f, 1.0f ), "Ciao", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 2, 7, 2, 3 } },
- { "HelveticaNue", "Regular", 26.0f, Dali::TextStyle::EXTRABLACK, Vector4( 0.5f, 0.0f, 0.0f, 1.0f ), "Hello", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 4, 2, 1, 6 } },
+ { "HelveticaNue", "Regular", 23.0f, Dali::TextStyle::EXTRABLACK, Vector4( 0.5f, 0.0f, 0.0f, 1.0f ), "안녕하세요", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 20.0f, 0.0f, { 4, 3, 1, 6 } },
{ "HelveticaNue", "Regular", 8.0f, Dali::TextStyle::DEMIBOLD, Vector4( 0.0f, 0.5f, 0.0f, 1.0f ), "Top of the morning to you", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 90.0f, { 4, 10, 8, 2 } },
- { "HelveticaNue", "Regular", 13.0f, Dali::TextStyle::DEMIBOLD, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), "हैलो", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 6, 1, 1, 3 } },
+ { "HelveticaNue", "Regular", 13.0f, Dali::TextStyle::DEMIBOLD, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), "हैलो", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 6, 1, 1, 3 } },
{ "HelveticaNue", "Regular", 8.0f, Dali::TextStyle::DEMIBOLD, Vector4( 1.0f, 1.0f, 0.0f, 1.0f ), "สวัสดี", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 90.0f, { 6, 5, 2, 1 } },
{ "HelveticaNue", "Regular", 18.0f, Dali::TextStyle::REGULAR, Vector4( 0.0f, 1.0f, 1.0f, 1.0f ), "你好", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalBottom, 10.0f, 0.0f, { 6, 6, 1, 3 } },
{ "HelveticaNue", "Regular", 34.0f, Dali::TextStyle::REGULAR, Vector4( 0.0f, 0.0f, 1.0f, 1.0f ), "G'day", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 7, 0, 2, 10 } },
{ "HelveticaNue", "Regular", 16.0f, Dali::TextStyle::EXTRABLACK, Vector4( 0.0f, 0.5f, 1.0f, 1.0f ), "مرحبا", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 9, 1, 2, 4 } },
- { "HelveticaNue", "Regular", 10.0f, Dali::TextStyle::EXTRABLACK, Vector4( 1.0f, 0.0f, 0.0f, 1.0f ), "こんにちは", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 10, 0, 2, 6 } },
+ { "HelveticaNue", "Regular", 10.0f, Dali::TextStyle::EXTRABLACK, Vector4( 1.0f, 0.0f, 0.0f, 1.0f ), "こんにちは", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 10, 0, 2, 6 } },
{ "HelveticaNue", "Regular", 14.0f, Dali::TextStyle::REGULAR, Vector4( 0.0f, 1.0f, 0.0f, 1.0f ), "aloha", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 10, 6, 2, 4 } }
};
textContainer.SetParentOrigin( ParentOrigin::TOP_LEFT );
textContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
textContainer.SetPosition( 0, TOOLBAR_HEIGHT );
- textContainer.SetSize( stage.GetSize().width, stage.GetSize().height - TOOLBAR_HEIGHT );
+ textContainer.SetPreferredSize( Vector2( stage.GetSize().width, stage.GetSize().height - TOOLBAR_HEIGHT ) );
mContentLayer.Add( textContainer );
Toolkit::TextView textView = Toolkit::TextView::New( tableString.text );
textView.SetStyleToCurrentText( textStyle );
textView.SetOrientation( Dali::Degree( tableString.orientation ), Vector3( 0.0f, 0.0f, 1.0f ) );
+ textView.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
Toolkit::Alignment alignmentContainer = Toolkit::Alignment::New( tableString.horizontalAlignment, tableString.verticalAlignment );
- alignmentContainer.SetPadding( Toolkit::Alignment::Padding( tableString.padding, tableString.padding, tableString.padding, tableString.padding ) );
- alignmentContainer.SetScaling( Toolkit::Alignment::ScaleToFill );
+ Actor alignmentContainerActor = alignmentContainer;
+ alignmentContainerActor.SetPadding( Padding( tableString.padding, tableString.padding, tableString.padding, tableString.padding ) );
+ alignmentContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
alignmentContainer.Add( textView );
textContainer.AddChild( alignmentContainer, Toolkit::TableView::CellPosition( tableString.cellPosition.row, tableString.cellPosition.column, tableString.cellPosition.rowSpan, tableString.cellPosition.columnSpan ) );
{
"type": "ImageActor",
"name": "On",
+ "relayout-enabled": false,
"position": [
374,
215,
"size": [
144,
144,
- 1
+ 1
],
"sizeAspectRatio": false,
"color": [
{
"type": "ImageActor",
"name": "Off",
+ "relayout-enabled": false,
"position": [
129,
215,
"size": [
144,
144,
- 1
+ 1
],
"sizeAspectRatio": false,
"color": [
{
"type": "ImageActor",
"name": "Right",
+ "relayout-enabled": false,
"position": [
418.5,
214.5,
"size": [
85,
161,
- 1
+ 1
],
"sizeAspectRatio": false,
"visible": true,
{
"type": "ImageActor",
"name": "Left",
+ "relayout-enabled": false,
"position": [
331,
214.5,
"size": [
88,
161,
- 1
+ 1
],
"sizeAspectRatio": false,
"visible": true,
{
"type": "ImageActor",
"name": "Middle",
+ "relayout-enabled": false,
"position": [
375.5,
214.5,
"size": [
1,
161,
- 1
+ 1
],
"sizeAspectRatio": false,
"color": [
{
"type": "ImageActor",
"name": "Jelly",
+ "relayout-enabled": false,
"position": [
374,
215,
"size": [
144,
144,
- 1
+ 1
],
"sizeAspectRatio": false,
"color": [
{
"type": "Control",
"name": "Left Black",
+ "relayout-enabled": false,
"position": [
144.5,
218.5,
"size": [
275,
243,
- 1
+ 1
],
"sizeAspectRatio": false,
"background-color": [
{
"type": "Control",
"name": "Right Black",
+ "relayout-enabled": false,
"position": [
629.5,
218.5,
"size": [
335,
243,
- 1
+ 1
],
"sizeAspectRatio": false,
"background-color": [
{
"type": "ImageActor",
"name": "JellyOff",
+ "relayout-enabled": false,
"position": [
121,
-117,
"size": [
144,
144,
- 1
+ 1
],
"sizeAspectRatio": false,
"color": [
{
"type": "Control",
"name": "Control On",
+ "relayout-enabled": false,
"position": [
371.26116838487997,
217.33333333333331,
"size": [
196,
184,
- 1
+ 1
],
"sizeAspectRatio": false,
"scale": [
{
"type": "Control",
"name": "Control Off",
+ "relayout-enabled": false,
"position": [
123.5,
-117,
"size": [
193,
182,
- 1
+ 1
],
"sizeAspectRatio": false,
"color": [
"stage": [
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
+ "relayout-enabled": true,
"actors": [],
"name": "Control 8",
"position": [
},
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [],
"name": "Container 2",
"position": [
},
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [],
"name": "Container 4",
"position": [
},
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [],
"name": "Container 5",
"position": [
},
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [],
"name": "Container 7",
"position": [
},
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [],
"name": "Container 8",
"position": [
},
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [],
"name": "Container 10",
"position": [
},
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [],
"name": "Control 4",
"position": [
},
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
},
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [],
"name": "Container 11",
"position": [
},
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [],
"name": "Container 15",
"position": [
},
{
"type": "Control",
+ "relayout-enabled": false,
"actors": [],
"name": "Container 16",
"position": [
"image": {
"filename": "{DALI_IMAGE_DIR}gallery-large-21.jpg"
},
+ "relayout-enabled": false,
"position": [0, 200, 0],
"size": [200, 200, 1],
"signals": [{
// A container with a yellow background
{
"type": "Control",
+ "relayout-enabled": false,
"parent-origin": "CENTER",
"anchor-point": "BOTTOM_CENTER",
"background-color": [1, 1, 0, 1],
// A container with an image
{
"type": "Control",
+ "relayout-enabled": false,
"parent-origin": "CENTER",
"anchor-point": "TOP_CENTER",
"size": [400, 150, 1],
// A container with the same image blended in with a blue background
{
"type": "Control",
+ "relayout-enabled": false,
"parent-origin": "BOTTOM_CENTER",
"anchor-point": "BOTTOM_CENTER",
"size": [400, 150, 1],
const Dali::TextStyle& textStyle )
{
Dali::Layer toolBarLayer = Dali::Layer::New();
+ toolBarLayer.SetName( "TOOLBAR_LAYER" );
toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER );
toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER );
- toolBarLayer.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::SIZE, Dali::ParentSource( Dali::Actor::Property::SIZE ), Dali::SourceWidthFixedHeight( style.mToolBarHeight ) ) );
- toolBarLayer.SetSize( 0.0f, style.mToolBarHeight );
+ toolBarLayer.SetPreferredSize( Dali::Vector2( 0.0f, style.mToolBarHeight ) );
+ toolBarLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::WIDTH );
+ toolBarLayer.SetResizePolicy( Dali::FIXED, Dali::HEIGHT );
// Raise tool bar layer to the top.
toolBarLayer.RaiseToTop();
// Tool bar
Dali::Image image = Dali::ResourceImage::New( toolbarImagePath );
Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image );
+ toolBarBackground.SetName( "TOOLBAR_BACKGROUND" );
+ toolBarBackground.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
toolBar = Dali::Toolkit::ToolBar::New();
+ toolBar.SetName( "TOOLBAR" );
toolBar.SetBackground( toolBarBackground );
toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER );
toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER );
- toolBar.SetSize( 0.0f, style.mToolBarHeight );
- toolBar.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT );
+ toolBar.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
toolBarBackground.SetSortModifier(1.0f);
// Add the tool bar to the too bar layer.
if( !title.empty() )
{
Dali::Toolkit::TextView titleActor = Dali::Toolkit::TextView::New();
- titleActor.SetName( "ToolbarTitle" );
+ titleActor.SetName( "TOOLBAR_TITLE" );
titleActor.SetText( title );
titleActor.SetSize( font.MeasureText( title ) );
titleActor.SetStyleToCurrentText(textStyle);
// Create default View.
view = Dali::Toolkit::View::New();
+ view.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
// Add the view to the stage before setting the background.
stage.Add( view );
// Add tool bar layer to the view.
view.AddContentLayer( toolBarLayer );
-
-
// Create a content layer.
Dali::Layer contentLayer = Dali::Layer::New();
contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER );
contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER );
- contentLayer.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT );
+ contentLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
view.AddContentLayer( contentLayer );
contentLayer.LowerBelow( toolBarLayer );