+
+ case Toolkit::ItemView::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;
+ }
+ }
+ }
+ }
+ }