Change FittingMode on Item view demos.
[platform/core/uifw/dali-demo.git] / examples / item-view / item-view-example.cpp
index 9b13be3..61dce2d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -21,6 +21,7 @@
 #include <dali/dali.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -866,7 +867,12 @@ public: // From ItemFactory
   virtual Actor NewItem(unsigned int itemId)
   {
     // Create an image view for this item
-    ImageView actor = ImageView::New( IMAGE_PATHS[ itemId % NUM_IMAGES ] );
+    Property::Map propertyMap;
+    propertyMap.Insert(Toolkit::Visual::Property::TYPE,  Visual::IMAGE);
+    propertyMap.Insert(ImageVisual::Property::URL, IMAGE_PATHS[ itemId % NUM_IMAGES ] );
+    propertyMap.Insert(DevelVisual::Property::FITTING_MODE, DevelVisual::FILL);
+    ImageView actor = ImageView::New();
+    actor.SetProperty( Toolkit::ImageView::Property::IMAGE, propertyMap );
     actor.SetZ( 0.0f );
     actor.SetPosition( INITIAL_OFFSCREEN_POSITION );
 
@@ -879,7 +885,7 @@ public: // From ItemFactory
     borderActor.SetColorMode( USE_PARENT_COLOR );
 
     Property::Map borderProperty;
-    borderProperty.Insert( Visual::Property::TYPE, Visual::BORDER );
+    borderProperty.Insert( Toolkit::Visual::Property::TYPE, Visual::BORDER );
     borderProperty.Insert( BorderVisual::Property::COLOR, Color::WHITE );
     borderProperty.Insert( BorderVisual::Property::SIZE, ITEM_BORDER_SIZE );
     borderProperty.Insert( BorderVisual::Property::ANTI_ALIASING, true );
@@ -903,7 +909,7 @@ public: // From ItemFactory
     checkbox.SetZ( 0.1f );
 
     Property::Map solidColorProperty;
-    solidColorProperty.Insert( Visual::Property::TYPE, Visual::COLOR );
+    solidColorProperty.Insert( Toolkit::Visual::Property::TYPE, Visual::COLOR );
     solidColorProperty.Insert( ColorVisual::Property::MIX_COLOR, Vector4(0.f, 0.f, 0.f, 0.6f) );
     checkbox.SetProperty( ImageView::Property::IMAGE, solidColorProperty );
 
@@ -994,18 +1000,10 @@ private:
   LongPressGestureDetector mLongPressDetector;
 };
 
-void RunTest(Application& app)
-{
-  ItemViewExample test(app);
-
-  app.MainLoop();
-}
-
 int DALI_EXPORT_API main(int argc, char **argv)
 {
   Application app = Application::New(&argc, &argv, DEMO_THEME_PATH);
-
-  RunTest(app);
-
+  ItemViewExample test(app);
+  app.MainLoop();
   return 0;
 }