X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol-impl.cpp;h=df78b154ed574f288dd2f3ed795f6cbb7798a260;hp=47a12b1e213acb1a570e9a21d23d1711a6331204;hb=09fea2d3984ac0100f87f480335d674cbb9384a1;hpb=a05cf60f33b96c7baf3a749b2af24f187cf9ea85 diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index 47a12b1..df78b15 100755 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -30,18 +30,19 @@ #include // INTERNAL INCLUDES -#include +#include #include +#include #include #include +#include #include #include -#include #include +#include #include #include #include -#include #include namespace Dali @@ -61,6 +62,30 @@ Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_CO #endif /** + * @brief Replace the background visual if it's a color visual with the renderIfTransparent property set as required. + * @param[in] controlImpl The control implementation + * @param[in] renderIfTransaparent Whether we should render if the color is transparent + */ +void ChangeBackgroundColorVisual( Control& controlImpl, bool renderIfTransparent ) +{ + Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); + + Toolkit::Visual::Base backgroundVisual = controlDataImpl.GetVisual( Toolkit::Control::Property::BACKGROUND ); + if( backgroundVisual ) + { + Property::Map map; + backgroundVisual.CreatePropertyMap( map ); + Property::Value* typeValue = map.Find( Toolkit::Visual::Property::TYPE ); + if( typeValue && typeValue->Get< int >() == Toolkit::Visual::COLOR ) + { + // Only change it if it's a color visual + map[ Toolkit::DevelColorVisual::Property::RENDER_IF_TRANSPARENT ] = renderIfTransparent; + controlImpl.SetBackground( map ); + } + } +} + +/** * @brief Creates a clipping renderer if required. * (EG. If no renders exist and clipping is enabled). * @param[in] controlImpl The control implementation. @@ -72,13 +97,34 @@ void CreateClippingRenderer( Control& controlImpl ) int clippingMode = ClippingMode::DISABLED; if( self.GetProperty( Actor::Property::CLIPPING_MODE ).Get( clippingMode ) ) { - Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); - - if( ( clippingMode == ClippingMode::CLIP_CHILDREN ) && - controlDataImpl.mVisuals.Empty() && - ( self.GetRendererCount() == 0u ) ) + switch( clippingMode ) { - controlImpl.SetBackgroundColor( Color::TRANSPARENT ); + case ClippingMode::CLIP_CHILDREN: + { + if( self.GetRendererCount() == 0u ) + { + Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); + if( controlDataImpl.mVisuals.Empty() ) + { + controlImpl.SetBackgroundColor( Color::TRANSPARENT ); + } + else + { + // We have visuals, check if we've set the background and re-create it to + // render even if transparent (only if it's a color visual) + ChangeBackgroundColorVisual( controlImpl, true ); + } + } + break; + } + + case ClippingMode::DISABLED: + case ClippingMode::CLIP_TO_BOUNDING_BOX: + { + // If we have a background visual, check if it's a color visual and remove the render if transparent flag + ChangeBackgroundColorVisual( controlImpl, false ); + break; + } } } } @@ -168,6 +214,14 @@ void Control::SetBackgroundColor( const Vector4& color ) map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR; map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color; + int clippingMode = ClippingMode::DISABLED; + if( ( Self().GetProperty( Actor::Property::CLIPPING_MODE ).Get( clippingMode ) ) && + ( clippingMode == ClippingMode::CLIP_CHILDREN ) ) + { + // If clipping-mode is set to CLIP_CHILDREN, then force visual to add the render even if transparent + map[ Toolkit::DevelColorVisual::Property::RENDER_IF_TRANSPARENT ] = true; + } + SetBackground( map ); } @@ -411,13 +465,15 @@ bool Control::EmitKeyEventSignal( const KeyEvent& event ) bool consumed = false; + consumed = mImpl->FilterKeyEvent( event ); + // signals are allocated dynamically when someone connects - if ( !mImpl->mKeyEventSignal.Empty() ) + if ( !consumed && !mImpl->mKeyEventSignal.Empty() ) { consumed = mImpl->mKeyEventSignal.Emit( handle, event ); } - if (!consumed) + if ( !consumed ) { // Notification for derived classes consumed = OnKeyEvent(event);