(Programming Guide) ItemView 41/40441/3
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 3 Jun 2015 20:05:41 +0000 (21:05 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 4 Jun 2015 09:45:30 +0000 (10:45 +0100)
Change-Id: If9480c78a19bf9b5f47e56f1dba8d77eac373781

build/tizen/docs/dali_doxygen.css
docs/content/images/item-view/depth.png [new file with mode: 0644]
docs/content/images/item-view/grid.png [new file with mode: 0644]
docs/content/images/item-view/spiral.png [new file with mode: 0644]
docs/content/main.md
docs/content/programming-guide/item-view.h [deleted file]
docs/content/shared-javascript-and-cpp-documentation/item-view.md [new file with mode: 0644]

index 4b68ddf..223b8ef 100644 (file)
@@ -1,7 +1,8 @@
 .image
 {
    text-align: left;
-   margin-left: 50px;
+   margin-left: 20px;
+   margin-right: 20px;
 }
 
 div.image img {
diff --git a/docs/content/images/item-view/depth.png b/docs/content/images/item-view/depth.png
new file mode 100644 (file)
index 0000000..86c879d
Binary files /dev/null and b/docs/content/images/item-view/depth.png differ
diff --git a/docs/content/images/item-view/grid.png b/docs/content/images/item-view/grid.png
new file mode 100644 (file)
index 0000000..398da01
Binary files /dev/null and b/docs/content/images/item-view/grid.png differ
diff --git a/docs/content/images/item-view/spiral.png b/docs/content/images/item-view/spiral.png
new file mode 100644 (file)
index 0000000..1825a11
Binary files /dev/null and b/docs/content/images/item-view/spiral.png differ
index 27937d2..c34c256 100644 (file)
@@ -56,7 +56,7 @@
  + Buttons
  + TableView
  + [Scroll View](@ref scroll-view)
- + ItemView
+ + [ItemView](@ref item-view)
 
 ### RenderTasks
 
diff --git a/docs/content/programming-guide/item-view.h b/docs/content/programming-guide/item-view.h
deleted file mode 100644 (file)
index 43cd656..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/*! \page item-view Item View
- * Your text here
- *
- * References to Dali::Toolkit::ItemView will work...
- *
- */
-
diff --git a/docs/content/shared-javascript-and-cpp-documentation/item-view.md b/docs/content/shared-javascript-and-cpp-documentation/item-view.md
new file mode 100644 (file)
index 0000000..1313253
--- /dev/null
@@ -0,0 +1,73 @@
+<!--
+/**-->
+
+# Item View {#item-view}
+
+An Item view is a scrollable container that contains several items.
+It can have several layouts.
+There are a few built-in layouts that the application writer can use:
+
+|GRID                    |SPIRAL                    |DEPTH                    |
+|:----------------------:|:------------------------:|:-----------------------:|
+|![ ](item-view/grid.png)|![ ](item-view/spiral.png)|![ ](item-view/depth.png)|
+
+The application writer can also create their own custom layout by inheriting from Dali::Toolkit::ItemLayout.
+
+## Item Factory
+
+To create an item-view, the application writer has to provide an item-factory.
+An ItemFactory provides methods to create items and how many items there are among other things.
+
+~~~{.cpp}
+class MyFactory : public Dali::Toolkit::ItemFactory
+{
+public:
+  virtual unsigned int GetNumberOfItems()
+  {
+    // Should return the number of items
+    return MY_ITEM_COUNT;
+  }
+
+  virtual Actor NewItem( unsigned int itemId )
+  {
+    // We should create the actor here that represents our item based on the itemId given.
+
+    // Here we'll create an ImageActor which uses the the itemId to parse the image in a particular directory.
+    std::ostringstream imageName;
+    imageName << "my-image-folder/" << itemId << ".png"; // If item was 10, then this would result in my-image-folder/10.png
+    Dali::ResourceImage image = Dali::ResourceImage::New( imageName.str() );
+
+    // Create an Image Actor from the image and return
+    return Dali::ImageActor::New( image );
+  }
+};
+~~~
+These overridden methods in our factory will be called by the Item View.
+
+## Creating an ItemView
+
+~~~{.cpp}
+MyFactory factory; // Should store this as a member variable
+Dali::Toolkit::ItemView itemView = Dali::Toolkit::ItemView::New( factory ); // Pass in our factory
+itemView.SetParentOrigin( ParentOrigin::CENTER );
+itemView.SetAnchorPoint( AnchorPoint::CENTER );
+
+// Now create a layout
+Dali::Toolkit::ItemLayoutPtr spiralLayout = Dali::Toolkit::DefaultItemLayout::New( Dali::Toolkit::DefaultItemLayout::SPIRAL );
+
+// ... and add the layout to the item view
+itemView.AddLayout( spiralLayout );
+
+// More layouts can be created and added to the item-view
+
+// Activate the layout
+itemView.ActivateLayout(
+  0,                                   // The layout ID matches the order in which layouts are added
+  Dali::Stage::GetCurrent().GetSize(), // Use the stage's size as our item-view size
+  0 );                                 // We want the item-view to appear straight away
+
+// And add to the stage
+Dali::Stage::GetCurrent().Add( itemView );
+~~~
+
+*/
\ No newline at end of file