X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fcontrol%2Fcontrol-data-impl.cpp;h=3f8c7d888f457cc74deeccd27402a35f1a89fd6a;hb=db57c8806f8336c6228645f3cd52abe353257d1d;hp=5e94e8f4a33aee4daf994133241fc462528fd81c;hpb=88164ac28facfc414392d99ff5d1cbcd4f9e9d2c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/control/control-data-impl.cpp b/dali-toolkit/internal/controls/control/control-data-impl.cpp index 5e94e8f..3f8c7d8 100755 --- 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) 2018 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. @@ -36,8 +36,6 @@ #include #include #include -#include -#include #include #include @@ -69,7 +67,6 @@ namespace #if defined(DEBUG_ENABLED) Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_CONTROL_VISUALS"); -Debug::Filter* gLogFilterLayout = Debug::Filter::New( Debug::NoLogging, false, "LOG_LAYOUT"); #endif @@ -320,7 +317,6 @@ Control::Impl::Impl( Control& controlImpl ) : mControlImpl( controlImpl ), mState( Toolkit::DevelControl::NORMAL ), mSubStateName(""), - mLayout( NULL ), mLeftFocusableActorId( -1 ), mRightFocusableActorId( -1 ), mUpFocusableActorId( -1 ), @@ -334,6 +330,7 @@ Control::Impl::Impl( Control& controlImpl ) mKeyInputFocusGainedSignal(), mKeyInputFocusLostSignal(), mResourceReadySignal(), + mVisualEventSignal(), mPinchGestureDetector(), mPanGestureDetector(), mTapGestureDetector(), @@ -342,8 +339,7 @@ Control::Impl::Impl( Control& controlImpl ) mInputMethodContext(), mFlags( Control::ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mIsKeyboardNavigationSupported( false ), - mIsKeyboardFocusGroup( false ), - mIsLayoutingRequired( false ) + mIsKeyboardFocusGroup( false ) { } @@ -626,15 +622,15 @@ 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 @@ -680,6 +676,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 @@ -1428,65 +1438,9 @@ bool Control::Impl::FilterKeyEvent( const KeyEvent& event ) return consumed; } -Toolkit::Internal::LayoutItemPtr Control::Impl::GetLayout() const -{ - return mLayout; -} - -void Control::Impl::SetLayout( Toolkit::Internal::LayoutItem& layout ) -{ - DALI_LOG_INFO( gLogFilterLayout, Debug::Verbose, "Control::SetLayout control:%s replacing existing layout:%s\n", - mControlImpl.Self().GetName().c_str(), - mLayout?"true":"false" ); - // Check if layout already has an owner. - auto control = Toolkit::Control::DownCast( layout.GetOwner() ); - if ( control ) - { - // If the owner is not this control then the owning control can no longer own it. - Dali::Toolkit::Control handle( mControlImpl.GetOwner() ); - if( control != handle ) - { - DALI_LOG_INFO( gLogFilterLayout, Debug::Verbose, "Control::SetLayout Layout already in use, %s will now have a BinLayout\n", - control.GetName().c_str() ); - Toolkit::BinLayout binLayout = Toolkit::BinLayout::New(); - // Previous owner of the layout gets a BinLayout instead of the layout. - DevelControl::SetLayout( control, binLayout ) ; - } - else - { - return; // layout is already set to this control. - } - } - - if( mLayout ) - { - mLayout->Unparent(); - mLayout.Reset(); - } - - mLayout = &layout; - - auto controlHandle = Toolkit::Control::DownCast( mControlImpl.Self() ); // Get a handle of this control implementation without copying internals. - mLayout->Initialize( controlHandle, controlHandle.GetTypeName() ); // LayoutGroup takes ownership of existing children -} - -void Control::Impl::RemoveLayout() -{ - DALI_LOG_INFO( gLogFilterLayout, Debug::Verbose, "Control::Impl::RemoveLayout\n"); - - Toolkit::BinLayout binLayout = Toolkit::BinLayout::New(); - - mControlImpl.mImpl->SetLayout( GetImplementation( binLayout ) ) ; -} - -void Control::Impl::SetLayoutingRequired( bool layoutingRequired ) -{ - mControlImpl.mImpl->mIsLayoutingRequired = layoutingRequired; -} - -bool Control::Impl::IsLayoutingRequired() +DevelControl::VisualEventSignalType& Control::Impl::VisualEventSignal() { - return mControlImpl.mImpl->mIsLayoutingRequired; + return mVisualEventSignal; } } // namespace Internal