[dali_1.0.40] Merge branch 'tizen'
[platform/core/uifw/dali-demo.git] / examples / item-view / item-view-example.cpp
index 448735c..6a0a6e2 100644 (file)
@@ -103,9 +103,9 @@ const unsigned int IMAGE_WIDTH = 256;
 const unsigned int IMAGE_HEIGHT = 256;
 const unsigned int NUM_IMAGE_PER_ROW_IN_ATLAS = 8;
 
-AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunctions::Linear,
-                                    AlphaFunctions::EaseIn,
-                                    AlphaFunctions::EaseOut };
+AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunction(AlphaFunction::LINEAR),
+                                    AlphaFunction(AlphaFunction::EASE_IN),
+                                    AlphaFunction(AlphaFunction::EASE_OUT) };
 
 const unsigned int NUM_ALPHA_FUNCTIONS = sizeof(ALPHA_FUNCTIONS) / sizeof(AlphaFunction);
 
@@ -253,7 +253,7 @@ public:
                                              TOOLBAR_IMAGE,
                                              "" );
 
-    mView.OrientationAnimationStartedSignal().Connect( this, &ItemViewExample::OnOrientationChanged );
+    app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &ItemViewExample::OnOrientationChanged );
 
     // Create an edit mode button. (left of toolbar)
     Toolkit::PushButton editButton = Toolkit::PushButton::New();
@@ -314,7 +314,6 @@ public:
     // Create the item view actor
     mImageAtlas = CreateImageAtlas();
     mItemView = ItemView::New(*this);
-    mItemView.SetRelayoutEnabled( false );
     mItemView.SetParentOrigin(ParentOrigin::CENTER);
     mItemView.SetAnchorPoint(AnchorPoint::CENTER);
 
@@ -415,7 +414,7 @@ public:
    * Orientation changed signal callback
    * @param orientation
    */
-  void OnOrientationChanged( View view, Animation& animation, const Orientation& orientation )
+  void OnOrientationChanged( Orientation orientation )
   {
     const unsigned int angle = orientation.GetDegrees();
 
@@ -894,7 +893,7 @@ public: // From ItemFactory
     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( SIZE_FIXED_OFFSET_FROM_PARENT, ALL_DIMENSIONS );
+    borderActor.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
     borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE );
     actor.Add(borderActor);
     actor.SetKeyboardFocusable( true );
@@ -905,7 +904,6 @@ public: // From ItemFactory
     // 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 );
@@ -922,7 +920,6 @@ public: // From ItemFactory
     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 );
@@ -988,7 +985,7 @@ private:
     mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu );
 
     TableView tableView = TableView::New( 0, 0 );
-    tableView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+    tableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     mMenu.Add( tableView );
 
     Slider slider = Slider::New();
@@ -997,21 +994,20 @@ private:
     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.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange );
     tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) );
 
     TextLabel text = TextLabel::New( "Duration" );
     text.SetAnchorPoint( ParentOrigin::TOP_LEFT );
     text.SetParentOrigin( ParentOrigin::TOP_LEFT );
-    text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
-    text.SetResizePolicy( FIXED, HEIGHT );
+    text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+    text.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
     text.SetSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) );
     slider.Add( text );
 
     Actor textContainer = Actor::New();
-    textContainer.SetRelayoutEnabled( true );
-    textContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+    textContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     mAlphaFunctionText = TextLabel::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] );
     mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER );
     mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER );
@@ -1025,11 +1021,10 @@ private:
     text = TextLabel::New( "Alpha Function" );
     text.SetAnchorPoint( ParentOrigin::TOP_LEFT );
     text.SetParentOrigin( ParentOrigin::TOP_LEFT );
-    text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+    text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
     text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y );
     textContainer.Add( text );
 
-    mMenu.MarkDirtyForRelayout();
     mMenu.Show();
     mMenuShown = true;
   }
@@ -1110,7 +1105,7 @@ private:
   Mode mMode;
   bool mMenuShown;
 
-  Toolkit::View mView;
+  Toolkit::Control mView;
   unsigned int mOrientation;
 
   Toolkit::ToolBar mToolBar;