X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Fbutton-impl.cpp;h=925daf117778978a0c6a9fbc55587ed10e24ca4f;hp=af8cd5c4db36dddc4d1dd58e630524d9bdbfa38d;hb=9217ec0c1d483607ed6c8f08a1d9c238657ba5d6;hpb=ba15ee43a942f27e564c4d5e442066db440b7c3f diff --git a/dali-toolkit/internal/controls/buttons/button-impl.cpp b/dali-toolkit/internal/controls/buttons/button-impl.cpp index af8cd5c..925daf1 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/button-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,10 @@ // INTERNAL INCLUDES #include #include -#include +#include +#include +#include + /** * Button states and contents @@ -109,7 +112,7 @@ const unsigned int NEXT_AUTOREPEATING_DELAY( 0.05f ); } // unnamed namespace Button::Button() -: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ), +: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mAutoRepeatingTimer(), mUnselectedColor( Color::WHITE ), // The natural colors of the specified images will be used by default. mSelectedColor( Color::WHITE ), @@ -537,6 +540,7 @@ void Button::SetColor( const Vector4& color, Button::PaintState selectedState ) { Actor* contentActor = NULL; // Using a pointer as SetupContent assigns the new Actor to this. bool imageFileExists = false; + Property::Index visualIndex = Toolkit::Button::Property::SELECTED_STATE_IMAGE; if ( selectedState == SelectedState || selectedState == DisabledSelectedState ) { @@ -549,6 +553,7 @@ void Button::SetColor( const Vector4& color, Button::PaintState selectedState ) mUnselectedColor = color; contentActor = &mUnselectedContent; imageFileExists = !GetUnselectedImageFilename().empty(); + visualIndex = Toolkit::Button::Property::UNSELECTED_STATE_IMAGE; } if ( contentActor ) @@ -562,15 +567,16 @@ void Button::SetColor( const Vector4& color, Button::PaintState selectedState ) { // If there is no existing content, create a new actor to use for flat color. Actor placementActor = Actor::New(); - Toolkit::RendererFactory rendererFactory = Toolkit::RendererFactory::Get(); - Toolkit::ControlRenderer colorRenderer; + Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get(); + Toolkit::Visual::Base visual; Property::Map map; - map["rendererType"] = "color"; - map["mixColor"] = color; + map[ Toolkit::DevelVisual::Property::TYPE ] = Toolkit::Visual::COLOR; + map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color; + + visual = visualFactory.CreateVisual( map ); - colorRenderer = rendererFactory.CreateControlRenderer( map ); - colorRenderer.SetOnStage( placementActor ); + RegisterVisual( visualIndex, visual ); SetupContent( *contentActor, placementActor ); // contentActor->SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );