X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fcontrol%2Fcontrol-data-impl.cpp;h=eb6285a4fa9fc81efe257857391bb93caa2d327a;hp=43f3161e836f8d84dcafd8b2e984765d9dbfcefd;hb=1061baa5912952ac998c34584b1e2e5e030e0e5f;hpb=ca4209fb071e5c353a7e528098a2e497765118d8 diff --git a/dali-toolkit/internal/controls/control/control-data-impl.cpp b/dali-toolkit/internal/controls/control/control-data-impl.cpp old mode 100644 new mode 100755 index 43f3161..eb6285a --- a/dali-toolkit/internal/controls/control/control-data-impl.cpp +++ b/dali-toolkit/internal/controls/control/control-data-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -19,7 +19,7 @@ #include "control-data-impl.h" // EXTERNAL INCLUDES -#include +#include #include #include #include @@ -31,13 +31,13 @@ // INTERNAL INCLUDES #include -#include -#include #include #include -#include +#include #include #include +#include +#include namespace Dali { @@ -298,18 +298,20 @@ void SetVisualsOffStage( const RegisteredVisualContainer& container, Actor paren // Properties registered without macro to use specific member variables. const PropertyRegistration Control::Impl::PROPERTY_1( typeRegistration, "styleName", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); -const PropertyRegistration Control::Impl::PROPERTY_2( typeRegistration, "backgroundColor", Toolkit::Control::Property::BACKGROUND_COLOR, Property::VECTOR4, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); -const PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "backgroundImage", Toolkit::Control::Property::BACKGROUND_IMAGE, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_2( typeRegistration, "reservedProperty01", Toolkit::Control::Property::RESERVED_PROPERTY_01, Property::VECTOR4, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "reservedProperty02", Toolkit::Control::Property::RESERVED_PROPERTY_02, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); const PropertyRegistration Control::Impl::PROPERTY_4( typeRegistration, "keyInputFocus", Toolkit::Control::Property::KEY_INPUT_FOCUS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); const PropertyRegistration Control::Impl::PROPERTY_5( typeRegistration, "background", Toolkit::Control::Property::BACKGROUND, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); -const PropertyRegistration Control::Impl::PROPERTY_6( typeRegistration, "tooltip", Toolkit::DevelControl::Property::TOOLTIP, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); -const PropertyRegistration Control::Impl::PROPERTY_7( typeRegistration, "state", Toolkit::DevelControl::Property::STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); -const PropertyRegistration Control::Impl::PROPERTY_8( typeRegistration, "subState", Toolkit::DevelControl::Property::SUB_STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); -const PropertyRegistration Control::Impl::PROPERTY_9( typeRegistration, "leftFocusableActorId", Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); -const PropertyRegistration Control::Impl::PROPERTY_10( typeRegistration, "rightFocusableActorId", Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID,Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); -const PropertyRegistration Control::Impl::PROPERTY_11( typeRegistration, "upFocusableActorId", Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); -const PropertyRegistration Control::Impl::PROPERTY_12( typeRegistration, "downFocusableActorId", Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); - +const PropertyRegistration Control::Impl::PROPERTY_6( typeRegistration, "margin", Toolkit::Control::Property::MARGIN, Property::EXTENTS, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_7( typeRegistration, "padding", Toolkit::Control::Property::PADDING, Property::EXTENTS, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_8( typeRegistration, "tooltip", Toolkit::DevelControl::Property::TOOLTIP, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_9( typeRegistration, "state", Toolkit::DevelControl::Property::STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_10( typeRegistration, "subState", Toolkit::DevelControl::Property::SUB_STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_11( typeRegistration, "leftFocusableActorId", Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_12( typeRegistration, "rightFocusableActorId", Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID,Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_13( typeRegistration, "upFocusableActorId", Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_14( typeRegistration, "downFocusableActorId", Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_15( typeRegistration, "shadow", Toolkit::DevelControl::Property::SHADOW, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); Control::Impl::Impl( Control& controlImpl ) @@ -323,16 +325,23 @@ Control::Impl::Impl( Control& controlImpl ) mStyleName(""), mBackgroundColor(Color::TRANSPARENT), mStartingPinchScale( NULL ), + mMargin( 0, 0, 0, 0 ), + mPadding( 0, 0, 0, 0 ), mKeyEventSignal(), + mKeyInputFocusGainedSignal(), + mKeyInputFocusLostSignal(), + mResourceReadySignal(), + mVisualEventSignal(), mPinchGestureDetector(), mPanGestureDetector(), mTapGestureDetector(), mLongPressGestureDetector(), + mTooltip( NULL ), + mInputMethodContext(), mFlags( Control::ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mIsKeyboardNavigationSupported( false ), mIsKeyboardFocusGroup( false ) { - } Control::Impl::~Impl() @@ -465,27 +474,18 @@ void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base // ( If the control has been type registered ) if( visual.GetName().empty() ) { - try - { - std::string visualName = self.GetPropertyName( index ); - if( !visualName.empty() ) - { - DALI_LOG_INFO( gLogFilter, Debug::Concise, "Setting visual name for property %d to %s\n", - index, visualName.c_str() ); - visual.SetName( visualName ); - } - } - catch( Dali::DaliException e ) + // returns empty string if index is not found as long as index is not -1 + std::string visualName = self.GetPropertyName( index ); + if( !visualName.empty() ) { - DALI_LOG_WARNING( "Attempting to register visual without a registered property, index: %d\n", index ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "Setting visual name for property %d to %s\n", + index, visualName.c_str() ); + visual.SetName( visualName ); } } if( !visualReplaced ) // New registration entry { - // monitor when the visual resources are ready - StartObservingVisual( visual ); - // If we've not set the depth-index value, we have more than one visual and the visual does not have a depth index, then set it to be the highest if( ( depthIndexValueSet == DepthIndexValue::NOT_SET ) && ( mVisuals.Size() > 0 ) && @@ -522,12 +522,17 @@ void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base ( visualReplaced && enabled ) ) ; mVisuals.PushBack( newRegisteredVisual ); + Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual ); // Put on stage if enabled and the control is already on the stage - // Visual must be set on stage for the renderer to be created and the ResourceReady triggered. if( ( enabled == VisualState::ENABLED ) && self.OnStage() ) { - Toolkit::GetImplementation(visual).SetOnStage( self ); + visualImpl.SetOnStage( self ); + } + else if( visualImpl.IsResourceReady() ) // When not being staged, check if visual already 'ResourceReady' before it was Registered. ( Resource may have been loaded already ) + { + ResourceReady( visualImpl ); } + } DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::RegisterVisual() Registered %s(%d), enabled:%s\n", visual.GetName().c_str(), index, enabled?"true":"false" ); @@ -535,17 +540,26 @@ void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base void Control::Impl::UnregisterVisual( Property::Index index ) { - RegisteredVisualContainer::Iterator iter; - if ( FindVisual( index, mVisuals, iter ) ) - { - // stop observing visual - StopObservingVisual( (*iter)->visual ); + RegisteredVisualContainer::Iterator iter; + if ( FindVisual( index, mVisuals, iter ) ) + { + // stop observing visual + StopObservingVisual( (*iter)->visual ); - Actor self( mControlImpl.Self() ); - Toolkit::GetImplementation((*iter)->visual).SetOffStage( self ); - (*iter)->visual.Reset(); - mVisuals.Erase( iter ); - } + Actor self( mControlImpl.Self() ); + Toolkit::GetImplementation((*iter)->visual).SetOffStage( self ); + (*iter)->visual.Reset(); + mVisuals.Erase( iter ); + } + + if( FindVisual( index, mRemoveVisuals, iter ) ) + { + Actor self( mControlImpl.Self() ); + Toolkit::GetImplementation( (*iter)->visual ).SetOffStage( self ); + (*iter)->pending = false; + (*iter)->visual.Reset(); + mRemoveVisuals.Erase( iter ); + } } Toolkit::Visual::Base Control::Impl::GetVisual( Property::Index index ) const @@ -561,7 +575,7 @@ Toolkit::Visual::Base Control::Impl::GetVisual( Property::Index index ) const void Control::Impl::EnableVisual( Property::Index index, bool enable ) { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Visual (%d)\n", index); + DALI_LOG_INFO( gLogFilter, Debug::General, "Control::EnableVisual(%d, %s)\n", index, enable?"T":"F"); RegisteredVisualContainer::Iterator iter; if ( FindVisual( index, mVisuals, iter ) ) @@ -588,6 +602,10 @@ void Control::Impl::EnableVisual( Property::Index index, bool enable ) } } } + else + { + DALI_LOG_WARNING( "Control::EnableVisual(%d, %s) FAILED - NO SUCH VISUAL\n", index, enable?"T":"F" ); + } } bool Control::Impl::IsVisualEnabled( Property::Index index ) const @@ -605,21 +623,21 @@ void Control::Impl::StopObservingVisual( Toolkit::Visual::Base& visual ) Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual ); // Stop observing the visual - visualImpl.RemoveResourceObserver( *this ); + visualImpl.RemoveEventObserver( *this ); } void Control::Impl::StartObservingVisual( Toolkit::Visual::Base& visual) { Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual ); - // start observing the visual for resource ready - visualImpl.AddResourceObserver( *this ); + // start observing the visual for events + visualImpl.AddEventObserver( *this ); } // Called by a Visual when it's resource is ready void Control::Impl::ResourceReady( Visual::Base& object) { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "ResourceReady replacements pending[%d]\n", mRemoveVisuals.Count() ); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::Impl::ResourceReady() replacements pending[%d]\n", mRemoveVisuals.Count() ); Actor self = mControlImpl.Self(); @@ -645,8 +663,11 @@ void Control::Impl::ResourceReady( Visual::Base& object) } } - // A visual is ready so control may need relayouting - mControlImpl.RelayoutRequest(); + // A visual is ready so control may need relayouting if staged + if ( self.OnStage() ) + { + mControlImpl.RelayoutRequest(); + } // Emit signal if all enabled visuals registered by the control are ready. if( IsResourceReady() ) @@ -656,6 +677,20 @@ void Control::Impl::ResourceReady( Visual::Base& object) } } +void Control::Impl::NotifyVisualEvent( Visual::Base& object, Property::Index signalId ) +{ + for( auto registeredIter = mVisuals.Begin(), end = mVisuals.End(); registeredIter != end; ++registeredIter ) + { + Internal::Visual::Base& registeredVisualImpl = Toolkit::GetImplementation( (*registeredIter)->visual ); + if( &object == ®isteredVisualImpl ) + { + Dali::Toolkit::Control handle( mControlImpl.GetOwner() ); + mVisualEventSignal.Emit( handle, (*registeredIter)->index, signalId ); + break; + } + } +} + bool Control::Impl::IsResourceReady() const { // Iterate through and check all the enabled visuals are ready @@ -674,83 +709,114 @@ bool Control::Impl::IsResourceReady() const return true; } +Toolkit::Visual::ResourceStatus Control::Impl::GetVisualResourceStatus( Property::Index index ) const +{ + RegisteredVisualContainer::Iterator iter; + if ( FindVisual( index, mVisuals, iter ) ) + { + const Toolkit::Visual::Base visual = (*iter)->visual; + const Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual ); + return visualImpl.GetResourceStatus( ); + } + + return Toolkit::Visual::ResourceStatus::PREPARING; +} + -Dali::Animation Control::Impl::CreateTransition( const Toolkit::TransitionData& handle ) + +void Control::Impl::AddTransitions( Dali::Animation& animation, + const Toolkit::TransitionData& handle, + bool createAnimation ) { - Dali::Animation transition; + // Setup a Transition from TransitionData. const Internal::TransitionData& transitionData = Toolkit::GetImplementation( handle ); - - if( transitionData.Count() > 0 ) + TransitionData::Iterator end = transitionData.End(); + for( TransitionData::Iterator iter = transitionData.Begin() ; + iter != end; ++iter ) { - // Setup a Transition from TransitionData. - TransitionData::Iterator end = transitionData.End(); - for( TransitionData::Iterator iter = transitionData.Begin() ; - iter != end; ++iter ) - { - TransitionData::Animator* animator = (*iter); + TransitionData::Animator* animator = (*iter); - Toolkit::Visual::Base visual = GetVisualByName( mVisuals, animator->objectName ); + Toolkit::Visual::Base visual = GetVisualByName( mVisuals, animator->objectName ); - if( visual ) - { + if( visual ) + { #if defined(DEBUG_ENABLED) - Dali::TypeInfo typeInfo; - ControlWrapper* controlWrapperImpl = dynamic_cast(&mControlImpl); - if( controlWrapperImpl ) - { - typeInfo = controlWrapperImpl->GetTypeInfo(); - } + Dali::TypeInfo typeInfo; + ControlWrapper* controlWrapperImpl = dynamic_cast(&mControlImpl); + if( controlWrapperImpl ) + { + typeInfo = controlWrapperImpl->GetTypeInfo(); + } - DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Found %s visual for %s\n", - visual.GetName().c_str(), typeInfo?typeInfo.GetName().c_str():"Unknown" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Found %s visual for %s\n", + visual.GetName().c_str(), typeInfo?typeInfo.GetName().c_str():"Unknown" ); #endif - Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual ); - visualImpl.AnimateProperty( transition, *animator ); - } - else + Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual ); + visualImpl.AnimateProperty( animation, *animator ); + } + else + { + DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Could not find visual. Trying actors"); + // Otherwise, try any actor children of control (Including the control) + Actor child = mControlImpl.Self().FindChildByName( animator->objectName ); + if( child ) { - DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Could not find visual. Trying actors"); - // Otherwise, try any actor children of control (Including the control) - Actor child = mControlImpl.Self().FindChildByName( animator->objectName ); - if( child ) + Property::Index propertyIndex = DevelHandle::GetPropertyIndex( child, animator->propertyKey ); + if( propertyIndex != Property::INVALID_INDEX ) { - Property::Index propertyIndex = DevelHandle::GetPropertyIndex( child, animator->propertyKey ); - if( propertyIndex != Property::INVALID_INDEX ) + if( animator->animate == false ) + { + if( animator->targetValue.GetType() != Property::NONE ) + { + child.SetProperty( propertyIndex, animator->targetValue ); + } + } + else // animate the property { - if( animator->animate == false ) + if( animator->initialValue.GetType() != Property::NONE ) { - if( animator->targetValue.GetType() != Property::NONE ) - { - child.SetProperty( propertyIndex, animator->targetValue ); - } + child.SetProperty( propertyIndex, animator->initialValue ); } - else // animate the property + + if( createAnimation && !animation ) { - if( animator->initialValue.GetType() != Property::NONE ) - { - child.SetProperty( propertyIndex, animator->initialValue ); - } - - if( ! transition ) - { - transition = Dali::Animation::New( 0.1f ); - } - - transition.AnimateTo( Property( child, propertyIndex ), - animator->targetValue, - animator->alphaFunction, - TimePeriod( animator->timePeriodDelay, - animator->timePeriodDuration ) ); + animation = Dali::Animation::New( 0.1f ); } + + animation.AnimateTo( Property( child, propertyIndex ), + animator->targetValue, + animator->alphaFunction, + TimePeriod( animator->timePeriodDelay, + animator->timePeriodDuration ) ); } } } } } +} + +Dali::Animation Control::Impl::CreateTransition( const Toolkit::TransitionData& transitionData ) +{ + Dali::Animation transition; + if( transitionData.Count() > 0 ) + { + AddTransitions( transition, transitionData, true ); + } return transition; } + + +void Control::Impl::DoAction( Dali::Property::Index visualIndex, Dali::Property::Index actionId, const Dali::Property::Value attributes ) +{ + RegisteredVisualContainer::Iterator iter; + if ( FindVisual( visualIndex, mVisuals, iter ) ) + { + Toolkit::GetImplementation((*iter)->visual).DoAction( actionId, attributes ); + } +} + void Control::Impl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) { Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) ); @@ -844,29 +910,6 @@ void Control::Impl::SetProperty( BaseObject* object, Property::Index index, cons } break; - case Toolkit::Control::Property::BACKGROUND_COLOR: - { - DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" ); - controlImpl.SetBackgroundColor( value.Get< Vector4 >() ); - break; - } - - case Toolkit::Control::Property::BACKGROUND_IMAGE: - { - DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" ); - Image image = Scripting::NewImage( value ); - if ( image ) - { - controlImpl.SetBackgroundImage( image ); - } - else - { - // An empty image means the background is no longer required - controlImpl.ClearBackground(); - } - break; - } - case Toolkit::Control::Property::KEY_INPUT_FOCUS: { if ( value.Get< bool >() ) @@ -910,6 +953,26 @@ void Control::Impl::SetProperty( BaseObject* object, Property::Index index, cons break; } + case Toolkit::Control::Property::MARGIN: + { + Extents margin; + if( value.Get( margin ) ) + { + controlImpl.mImpl->SetMargin( margin ); + } + break; + } + + case Toolkit::Control::Property::PADDING: + { + Extents padding; + if( value.Get( padding ) ) + { + controlImpl.mImpl->SetPadding( padding ); + } + break; + } + case Toolkit::DevelControl::Property::TOOLTIP: { TooltipPtr& tooltipPtr = controlImpl.mImpl->mTooltip; @@ -918,7 +981,24 @@ void Control::Impl::SetProperty( BaseObject* object, Property::Index index, cons tooltipPtr = Tooltip::New( control ); } tooltipPtr->SetProperties( value ); + break; + } + + case Toolkit::DevelControl::Property::SHADOW: + { + const Property::Map* map = value.GetMap(); + if( map && !map->Empty() ) + { + controlImpl.mImpl->SetShadow( *map ); + } + else + { + // The shadow is an empty property map, so we should clear the shadow + controlImpl.mImpl->ClearShadow(); + } + break; } + } } } @@ -977,42 +1057,34 @@ Property::Value Control::Impl::GetProperty( BaseObject* object, Property::Index break; } - case Toolkit::Control::Property::BACKGROUND_COLOR: + case Toolkit::Control::Property::KEY_INPUT_FOCUS: { - DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" ); - value = controlImpl.GetBackgroundColor(); + value = controlImpl.HasKeyInputFocus(); break; } - case Toolkit::Control::Property::BACKGROUND_IMAGE: + case Toolkit::Control::Property::BACKGROUND: { - DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" ); Property::Map map; Toolkit::Visual::Base visual = controlImpl.mImpl->GetVisual( Toolkit::Control::Property::BACKGROUND ); if( visual ) { visual.CreatePropertyMap( map ); } + value = map; break; } - case Toolkit::Control::Property::KEY_INPUT_FOCUS: + case Toolkit::Control::Property::MARGIN: { - value = controlImpl.HasKeyInputFocus(); + value = controlImpl.mImpl->GetMargin(); break; } - case Toolkit::Control::Property::BACKGROUND: + case Toolkit::Control::Property::PADDING: { - Property::Map map; - Toolkit::Visual::Base visual = controlImpl.mImpl->GetVisual( Toolkit::Control::Property::BACKGROUND ); - if( visual ) - { - visual.CreatePropertyMap( map ); - } - - value = map; + value = controlImpl.mImpl->GetPadding(); break; } @@ -1027,6 +1099,18 @@ Property::Value Control::Impl::GetProperty( BaseObject* object, Property::Index break; } + case Toolkit::DevelControl::Property::SHADOW: + { + Property::Map map; + Toolkit::Visual::Base visual = controlImpl.mImpl->GetVisual( Toolkit::DevelControl::Property::SHADOW ); + if( visual ) + { + visual.CreatePropertyMap( map ); + } + + value = map; + break; + } } } @@ -1298,6 +1382,74 @@ void Control::Impl::OnStageDisconnection() mRemoveVisuals.Clear(); } +void Control::Impl::SetMargin( Extents margin ) +{ + mControlImpl.mImpl->mMargin = margin; + + // Trigger a size negotiation request that may be needed when setting a margin. + mControlImpl.RelayoutRequest(); +} + +Extents Control::Impl::GetMargin() const +{ + return mControlImpl.mImpl->mMargin; +} + +void Control::Impl::SetPadding( Extents padding ) +{ + mControlImpl.mImpl->mPadding = padding; + + // Trigger a size negotiation request that may be needed when setting a padding. + mControlImpl.RelayoutRequest(); +} + +Extents Control::Impl::GetPadding() const +{ + return mControlImpl.mImpl->mPadding; +} + +void Control::Impl::SetInputMethodContext( InputMethodContext& inputMethodContext ) +{ + mInputMethodContext = inputMethodContext; +} + +bool Control::Impl::FilterKeyEvent( const KeyEvent& event ) +{ + bool consumed ( false ); + + if ( mInputMethodContext ) + { + consumed = mInputMethodContext.FilterEventKey( event ); + } + return consumed; +} + +DevelControl::VisualEventSignalType& Control::Impl::VisualEventSignal() +{ + return mVisualEventSignal; +} + +void Control::Impl::SetShadow( const Property::Map& map ) +{ + Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( map ); + visual.SetName("shadow"); + + if( visual ) + { + mControlImpl.mImpl->RegisterVisual( Toolkit::DevelControl::Property::SHADOW, visual, DepthIndex::BACKGROUND_EFFECT ); + + mControlImpl.RelayoutRequest(); + } +} + +void Control::Impl::ClearShadow() +{ + mControlImpl.mImpl->UnregisterVisual( Toolkit::DevelControl::Property::SHADOW ); + + // Trigger a size negotiation request that may be needed when unregistering a visual. + mControlImpl.RelayoutRequest(); +} + } // namespace Internal } // namespace Toolkit