+ Dali::BaseHandle handle( object );
+
+ bool connected( true );
+ Toolkit::ItemView itemView = Toolkit::ItemView::DownCast( handle );
+
+ if( 0 == strcmp( signalName.c_str(), LAYOUT_ACTIVATED_SIGNAL ) )
+ {
+ itemView.LayoutActivatedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
+void ItemView::SetProperty( BaseObject* object, Property::Index index, const 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:
+ {
+ itemViewImpl.SetMinimumSwipeSpeed( value.Get<float>() );
+ break;
+ }
+ case Toolkit::ItemView::Property::MINIMUM_SWIPE_DISTANCE:
+ {
+ itemViewImpl.SetMinimumSwipeDistance( value.Get<float>() );
+ break;
+ }
+ case Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP:
+ {
+ itemViewImpl.SetWheelScrollDistanceStep( value.Get<float>() );
+ break;
+ }
+ case Toolkit::ItemView::Property::SNAP_TO_ITEM_ENABLED:
+ {
+ itemViewImpl.SetAnchoring( value.Get<bool>() );
+ break;
+ }
+ case Toolkit::ItemView::Property::REFRESH_INTERVAL:
+ {
+ itemViewImpl.SetRefreshInterval( value.Get<float>() );
+ break;
+ }
+ case Toolkit::DevelItemView::Property::LAYOUT:
+ {
+ // Get a Property::Array from the property if possible.
+ Property::Array layoutArray;
+ if( value.Get( layoutArray ) )
+ {
+ itemViewImpl.SetLayoutArray( layoutArray );
+ }
+ break;
+ }
+ }
+ }
+}
+
+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 );
+
+ 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::DevelItemView::Property::LAYOUT:
+ {
+ Property::Array layouts= itemViewImpl.GetLayoutArray();
+ value = layouts;
+ break;
+ }
+
+ }
+ }