+Property::Array ItemView::GetLayoutArray()
+{
+ return mlayoutArray;
+}
+
+void ItemView::SetLayoutArray(const Property::Array& layouts)
+{
+ mlayoutArray = layouts;
+ const int layoutCount = GetLayoutCount();
+ if(layoutCount > 0)
+ {
+ for(int index = layoutCount - 1; index >= 0; --index)
+ {
+ RemoveLayout(index);
+ if(index == 0) break;
+ }
+ }
+
+ for(unsigned int arrayIdx = 0, arrayCount = layouts.Count(); arrayIdx < arrayCount; ++arrayIdx)
+ {
+ const Property::Value& element = layouts.GetElementAt(arrayIdx);
+
+ const Property::Map* layout = element.GetMap();
+ if(layout != NULL)
+ {
+ for(unsigned int mapIdx = 0, mapCount = (*layout).Count(); mapIdx < mapCount; ++mapIdx)
+ {
+ KeyValuePair propertyPair((*layout).GetKeyValue(mapIdx));
+
+ if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
+ {
+ int layoutType = propertyPair.second.Get<int>();
+ if(layoutType <= DefaultItemLayout::SPIRAL && layoutType >= DefaultItemLayout::DEPTH)
+ {
+ //DEPTH, GRID, LIST, SPIRAL
+ switch(DefaultItemLayout::Type(layoutType))
+ {
+ case DefaultItemLayout::DEPTH:
+ {
+ Internal::DepthLayoutPtr depthLayout = Internal::DepthLayout::New();
+ (*depthLayout).SetLayoutProperties(*layout);
+ (*depthLayout).SetDepthLayoutProperties(*layout);
+ AddLayout(*depthLayout);
+ break;
+ }
+ case DefaultItemLayout::GRID:
+ {
+ Internal::GridLayoutPtr gridLayout = Internal::GridLayout::New();
+ (*gridLayout).SetLayoutProperties(*layout);
+ (*gridLayout).SetGridLayoutProperties(*layout);
+ AddLayout(*gridLayout);
+ break;
+ }
+ case DefaultItemLayout::LIST:
+ {
+ Internal::GridLayoutPtr listLayout = Internal::GridLayout::New();
+ listLayout->SetNumberOfColumns(1);
+ (*listLayout).SetLayoutProperties(*layout);
+ (*listLayout).SetGridLayoutProperties(*layout);
+ AddLayout(*listLayout);
+ break;
+ }
+ case DefaultItemLayout::SPIRAL:
+ {
+ Internal::SpiralLayoutPtr spiralLayout = Internal::SpiralLayout::New();
+ (*spiralLayout).SetLayoutProperties(*layout);
+ (*spiralLayout).SetSpiralLayoutProperties(*layout);
+ AddLayout(*spiralLayout);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+Property::Value ItemView::GetProperty(BaseObject* object, Property::Index index)
+{
+ Property::Value value;
+
+ Toolkit::ItemView itemView = Toolkit::ItemView::DownCast(Dali::BaseHandle(object));
+
+ if(itemView)
+ {
+ ItemView& itemViewImpl(GetImpl(itemView));
+ switch(index)
+ {
+ case Toolkit::ItemView::Property::MINIMUM_SWIPE_SPEED:
+ {
+ value = itemViewImpl.GetMinimumSwipeSpeed();
+ break;
+ }
+
+ case Toolkit::ItemView::Property::MINIMUM_SWIPE_DISTANCE:
+ {
+ value = itemViewImpl.GetMinimumSwipeDistance();
+ break;
+ }
+
+ case Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP:
+ {
+ value = itemViewImpl.GetWheelScrollDistanceStep();
+ break;
+ }
+
+ case Toolkit::ItemView::Property::SNAP_TO_ITEM_ENABLED:
+ {
+ value = itemViewImpl.GetAnchoring();
+ break;
+ }
+
+ case Toolkit::ItemView::Property::REFRESH_INTERVAL:
+ {
+ value = itemViewImpl.GetRefreshInterval();
+ break;
+ }
+
+ case Toolkit::ItemView::Property::LAYOUT:
+ {
+ Property::Array layouts = itemViewImpl.GetLayoutArray();
+ value = layouts;
+ break;
+ }
+ }
+ }
+
+ return value;
+}
+
+bool ItemView::DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes)
+{
+ Dali::BaseHandle handle(object);
+
+ Toolkit::ItemView itemView = Toolkit::ItemView::DownCast(handle);
+
+ DALI_ASSERT_ALWAYS(itemView);
+
+ if(0 == strcmp(actionName.c_str(), ACTION_STOP_SCROLLING))
+ {
+ GetImpl(itemView).DoStopScrolling();
+ }
+ else if(0 == strcmp(actionName.c_str(), ACTION_ENABLE_REFRESH))
+ {
+ GetImpl(itemView).SetRefreshNotificationEnabled(true);
+ }
+ else if(0 == strcmp(actionName.c_str(), ACTION_DISABLE_REFRESH))
+ {
+ GetImpl(itemView).SetRefreshNotificationEnabled(false);
+ }
+
+ return true;
+}
+
+void ItemView::DoStopScrolling()
+{
+ if(mScrollAnimation)
+ {
+ mScrollAnimation.Stop();
+ mScrollAnimation.Reset();
+ }
+}
+
+void ItemView::SetRefreshNotificationEnabled(bool enabled)
+{
+ mRefreshNotificationEnabled = enabled;