+void TableView::SetHeightOrWidthProperty(TableView& tableViewImpl,
+ void(TableView::*funcFixed)(unsigned int, float),
+ void(TableView::*funcRelative)(unsigned int, float),
+ const Property::Value& value )
+{
+ if( Property::MAP == value.GetType() )
+ {
+ Property::Map map = value.Get<Property::Map>();
+ unsigned int rowIndex;
+ for( Property::Map::const_iterator iter = map.begin(); iter != map.end(); iter++)
+ {
+ if( istringstream(iter->first) >> rowIndex // the key is a number
+ && Property::MAP == (iter->second).GetType())
+ {
+ Property::Value item = iter->second;
+ if( item.HasKey( "policy" ) && item.HasKey( "value" ) )
+ {
+ Toolkit::TableView::LayoutPolicy policy = Scripting::GetEnumeration< Toolkit::TableView::LayoutPolicy >( item.GetValue("policy").Get<string>(), LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT );
+ if( policy == Toolkit::TableView::Fixed )
+ {
+ (tableViewImpl.*funcFixed)( rowIndex, item.GetValue("value").Get<float>() );
+ }
+ else if( policy == Toolkit::TableView::Relative )
+ {
+ (tableViewImpl.*funcRelative)( rowIndex, item.GetValue("value").Get<float>() );
+ }
+ }
+ }
+ }
+ }
+}
+
+Property::Value TableView::GetRowHeightsPropertyValue()
+{
+ Property::Map map;
+ GetMapPropertyValue( mFixedHeights, mRelativeHeights, map);
+ return Property::Value(map);
+}
+
+Property::Value TableView::GetColumnWidthsPropertyValue()
+{
+ Property::Map map;
+ GetMapPropertyValue( mFixedWidths, mRelativeWidths, map);
+ return Property::Value(map);
+}
+
+void TableView::GetMapPropertyValue( const std::vector<float>& fixedSize, const std::vector<float>& relativeSize, Property::Map& map )
+{
+ string fixedPolicy( Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::Fixed, LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ) );
+ string relativePolicy( Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::Relative, LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ) );
+ Property::StringValuePair fixedPolicyPair( "policy", fixedPolicy );
+ Property::StringValuePair relativePolicyPair( "policy", relativePolicy );
+
+ size_t count = fixedSize.size();
+ for( size_t index = 0; index < count; index++ )
+ {
+ if( ! EqualsZero( fixedSize[index] ) )
+ {
+ Property::StringValuePair valuePair( "value", fixedSize[index] );
+ Property::Map item;
+ item.push_back( fixedPolicyPair );
+ item.push_back( valuePair );
+
+ map.push_back( Property::StringValuePair( static_cast<std::ostringstream*>( &(std::ostringstream() << index ) )->str(), item ) );
+ }
+ else if( ! EqualsZero( relativeSize[index] ) )
+ {
+ Property::StringValuePair valuePair( "value", relativeSize[index] );
+ Property::Map item;
+ item.push_back( relativePolicyPair );
+ item.push_back( valuePair );
+
+ map.push_back( Property::StringValuePair( static_cast<std::ostringstream*>( &(std::ostringstream() << index ) )->str(), item ) );
+ }
+ }
+}
+