X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fsuper-blur-view%2Fsuper-blur-view-impl.cpp;h=1b15f2bc07864b327df073473cded3f839f2a9d3;hp=1a24e81c84f2a616a98693b78dd2b8b20336a953;hb=refs%2Ftags%2Fsubmit%2Ftizen%2F20150309.074330;hpb=b8d4bac83c801b93dc7b3298148864a4215e139f diff --git a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp index 1a24e81..1b15f2b 100644 --- a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp +++ b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp @@ -24,10 +24,11 @@ #include #include #include +#include #include #include -namespace //unnamed namespace +namespace //Unnamed namespace { using namespace Dali; @@ -81,13 +82,12 @@ namespace Dali namespace Toolkit { -const Property::Index SuperBlurView::PROPERTY_IMAGE( Internal::SuperBlurView::SUPER_BLUR_VIEW_PROPERTY_START_INDEX ); - namespace Internal { namespace { + const unsigned int DEFAULT_BLUR_LEVEL(5u); ///< The default blur level when creating SuperBlurView from the type registry BaseHandle Create() @@ -95,10 +95,12 @@ BaseHandle Create() return Toolkit::SuperBlurView::New( DEFAULT_BLUR_LEVEL ); } -// Type registration -TypeRegistration typeRegistration( typeid(Toolkit::SuperBlurView), typeid(Toolkit::Control), Create ); +// Setup properties, signals and actions using the type-registry. +DALI_TYPE_REGISTRATION_BEGIN( Toolkit::SuperBlurView, Toolkit::Control, Create ) + +DALI_PROPERTY_REGISTRATION( SuperBlurView, "image", MAP, IMAGE ) -PropertyRegistration property1( typeRegistration, "image", Toolkit::SuperBlurView::PROPERTY_IMAGE, Property::MAP, &SuperBlurView::SetProperty, &SuperBlurView::GetProperty ); +DALI_TYPE_REGISTRATION_END() } // unnamed namespace @@ -277,24 +279,20 @@ void SuperBlurView::SetProperty( BaseObject* object, Property::Index propertyInd { Toolkit::SuperBlurView superBlurView = Toolkit::SuperBlurView::DownCast( Dali::BaseHandle( object ) ); - if ( superBlurView ) + if( superBlurView ) { SuperBlurView& superBlurViewImpl( GetImpl( superBlurView ) ); - switch ( propertyIndex ) + if( propertyIndex == Toolkit::SuperBlurView::Property::IMAGE ) { - case Toolkit::SuperBlurView::PROPERTY_IMAGE: + Dali::Image image = Scripting::NewImage( value ); + if ( image ) + { + superBlurViewImpl.SetImage( image ); + } + else { - Dali::Image image = Scripting::NewImage( value ); - if ( image ) - { - superBlurViewImpl.SetImage( image ); - } - else - { - DALI_LOG_ERROR( "Cannot create image from property value\n" ); - } - break; + DALI_LOG_ERROR( "Cannot create image from property value\n" ); } } } @@ -306,22 +304,18 @@ Property::Value SuperBlurView::GetProperty( BaseObject* object, Property::Index Toolkit::SuperBlurView pushButton = Toolkit::SuperBlurView::DownCast( Dali::BaseHandle( object ) ); - if ( pushButton ) + if( pushButton ) { SuperBlurView& superBlurViewImpl( GetImpl( pushButton ) ); - switch ( propertyIndex ) + if( propertyIndex == Toolkit::SuperBlurView::Property::IMAGE ) { - case Toolkit::SuperBlurView::PROPERTY_IMAGE: + Property::Map map; + if( !superBlurViewImpl.mImageActors.empty() && superBlurViewImpl.mImageActors[0] ) { - Property::Map map; - if ( !superBlurViewImpl.mImageActors.empty() && superBlurViewImpl.mImageActors[0] ) - { - Scripting::CreatePropertyMap( superBlurViewImpl.mImageActors[0], map ); - } - value = Property::Value( map ); - break; + Scripting::CreatePropertyMap( superBlurViewImpl.mImageActors[0], map ); } + value = Property::Value( map ); } }