+void Button::SetLabelPadding( const Padding& padding)
+{
+ DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::SetLabelPadding padding(%f,%f,%f,%f)\n", padding.left, padding.right, padding.bottom, padding.top );
+ mLabelPadding = Padding( padding.left, padding.right, padding.bottom, padding.top );
+ RelayoutRequest();
+}
+
+Padding Button::GetLabelPadding()
+{
+ return mLabelPadding;
+}
+
+void Button::SetForegroundPadding( const Padding& padding)
+{
+ DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::SetForegroundPadding padding(%f,%f,%f,%f)\n", padding.left, padding.right, padding.bottom, padding.top );
+ mForegroundPadding = Padding( padding.left, padding.right, padding.bottom, padding.top );
+ RelayoutRequest();
+}
+
+Padding Button::GetForegroundPadding()
+{
+ return mForegroundPadding;
+}
+
+////////////////////////////////////////////////////////////////////////
+// Legacy functions from Tizen 2.4 and 3.0
+
+// Legacy code needed whilst Color can be set by direct Property setting ( deprecated ) instead of setting a Visual
+void Button::SetColor( const Vector4& color, Property::Index visualIndex )
+{
+ if ( visualIndex == Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL )
+ {
+ mSelectedColor = color;
+ }
+ else
+ {
+ mUnselectedColor = color;
+ }
+
+ Property::Map map;
+ map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR;
+ map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
+
+ CreateVisualsForComponent( visualIndex, map, DepthIndex::BACKGROUND );
+}
+
+const Vector4 Button::GetUnselectedColor() const
+{
+ return mUnselectedColor;
+}
+
+const Vector4 Button::GetSelectedColor() const
+{
+ return mSelectedColor;
+}
+
+void Button::SetAnimationTime( float animationTime )
+{
+ // Used by deprecated API
+ mAnimationTime = animationTime;
+}
+
+float Button::GetAnimationTime() const
+{
+ // Used by deprecated API
+ return mAnimationTime;
+}
+
+void Button::SetLabel( Actor label )
+{
+ if ( label )
+ {
+ Property::Value value ="";
+ value = label.GetProperty(Toolkit::TextLabel::Property::TEXT);
+
+ SetLabelText( value.Get<std::string>() );
+ }
+}
+
+void Button::SetUnselectedImage( const std::string& filename )
+{
+ SetBackgroundImage( filename );
+}
+
+void Button::SetBackgroundImage( const std::string& filename )
+{
+ if( !filename.empty() )
+ {
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
+ }
+ else
+ {
+ DevelControl::UnregisterVisual( *this, Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL );
+ }
+}
+
+void Button::SetSelectedImage( const std::string& filename )
+{
+ SetSelectedBackgroundImage( filename );
+}
+
+void Button::SetSelectedBackgroundImage( const std::string& filename )
+{
+ if( !filename.empty() )
+ {
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
+ }
+ else
+ {
+ DevelControl::UnregisterVisual( *this, Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL );
+ }
+}
+
+void Button::SetDisabledBackgroundImage( const std::string& filename )
+{
+ if( !filename.empty() )
+ {
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
+ }
+}
+
+void Button::SetDisabledImage( const std::string& filename )
+{
+ if( !filename.empty() )
+ {
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_VISUAL, filename, DepthIndex::CONTENT );
+ }
+}
+
+void Button::SetDisabledSelectedImage( const std::string& filename )
+{
+ if( !filename.empty() )
+ {
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::DISABLED_SELECTED_VISUAL, filename, DepthIndex::CONTENT );
+ }
+}
+
+// Used by Deprecated Properties which don't use the Visual Property maps for setting and getting
+std::string Button::GetUrlForImageVisual( const Property::Index index ) const
+{
+ Toolkit::Visual::Base visual = DevelControl::GetVisual( *this, index );
+ std::string result;
+
+ if ( visual )
+ {
+ Dali::Property::Map retreivedMap;
+ visual.CreatePropertyMap( retreivedMap );
+ Property::Value* value = retreivedMap.Find( Toolkit::ImageVisual::Property::URL, Property::STRING );
+ if ( value )
+ {
+ result = value->Get<std::string>();
+ }
+ }
+
+ return result;
+}
+
+// Below functions DEPRECATED_1_0.50 - Return empty Actors
+
+namespace
+{
+std::string GetUrlFromImage( Image& image )
+{
+ ResourceImage resourceImage = ResourceImage::DownCast( image );
+
+ std::string imageUrl;
+
+ if ( resourceImage )
+ {
+ imageUrl = resourceImage.GetUrl();
+ }
+ return imageUrl;
+}
+
+} // namespace
+
+
+void Button::SetButtonImage( Image image )
+{
+ DALI_LOG_WARNING("Button::SetButtonImage @DEPRECATED_1_0.50\n");
+ SetUnselectedImage( GetUrlFromImage( image ) );
+ mSetButtonImage = image;
+}
+
+void Button::SetSelectedImage( Image image )
+{
+ DALI_LOG_WARNING("Button::SetSelectedImage @DEPRECATED_1_0.50\n");
+ SetSelectedImage( GetUrlFromImage( image ) );
+ mSetSelectedImage = image;
+}
+
+Actor Button::GetButtonImage() const
+{
+ // When deprecated ImageView API removed then this button API can be removed too.
+ DALI_LOG_WARNING("Button::GetButtonImage @DEPRECATED_1_0.50\n");
+
+ Actor imageView;
+
+ if ( mSetButtonImage )
+ {
+ imageView = Toolkit::ImageView::New( mSetButtonImage );
+ }
+ else
+ {
+ ResourceImage image = ResourceImage::New( GetUrlForImageVisual( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL ) );
+ imageView = Toolkit::ImageView::New( image );
+ }
+
+ return imageView;
+}
+
+Actor Button::GetSelectedImage() const
+{
+ // When deprecated ImageView API removed then this button API can be removed too.
+ DALI_LOG_WARNING("Button::GetSelectedImage @DEPRECATED_1_0.50\n");
+
+ Actor imageView;
+
+ if ( mSetSelectedImage )
+ {
+ imageView = Toolkit::ImageView::New( mSetSelectedImage );
+ }
+ else
+ {
+ ResourceImage image = ResourceImage::New( GetUrlForImageVisual( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL ) );
+ imageView = Toolkit::ImageView::New( image );
+ }
+ return imageView;
+}
+