From: Kimmo Hoikka Date: Thu, 28 Aug 2014 17:58:33 +0000 (-0700) Subject: Merge "Uses TextArray new type definition." into tizen X-Git-Tag: dali_1.0.8~12 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=9a93f27dd71b25d8a3fab4eab73e2d6daa90b179;hp=9289d2ffb47267b8f305e14e92be53f9094d1370 Merge "Uses TextArray new type definition." into tizen --- diff --git a/base/dali-toolkit/internal/builder/builder-impl.cpp b/base/dali-toolkit/internal/builder/builder-impl.cpp index 544c428..06e95e6 100644 --- a/base/dali-toolkit/internal/builder/builder-impl.cpp +++ b/base/dali-toolkit/internal/builder/builder-impl.cpp @@ -507,9 +507,7 @@ BaseHandle Builder::DoCreate( const TreeNode& root, const TreeNode& node, } } - ApplyProperties( root, node, handle, replacements ); - - if( actor) + if( actor ) { // add children of all the styles if( OptionalChild actors = IsChild( node, KEYNAME_ACTORS ) ) @@ -529,7 +527,10 @@ BaseHandle Builder::DoCreate( const TreeNode& root, const TreeNode& node, parent.Add( actor ); } } - + else + { + ApplyProperties( root, node, handle, replacements ); + } } else { diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.cpp index 1a3b893..c93d264 100755 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.cpp @@ -541,9 +541,19 @@ void ScrollViewTwistEffect::Apply(Actor child) } } +void ScrollViewTwistEffect::SetMaxSwingAngle(const Vector2& maxSwingAngle) +{ + mMaxSwingAngle = maxSwingAngle; +} + +Vector2 ScrollViewTwistEffect::GetMaxSwingAngle() const +{ + return mMaxSwingAngle; +} + void ScrollViewTwistEffect::SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function) { - if( mDropOffDistance.LengthSquared() > Math::MACHINE_EPSILON_1 && mDropOff.LengthSquared() > Math::MACHINE_EPSILON_1 ) + if( distance.LengthSquared() > Math::MACHINE_EPSILON_1 && dropOff.LengthSquared() > Math::MACHINE_EPSILON_1 ) { mFlags |= FlagDropOff; mDropOff = dropOff; @@ -558,6 +568,13 @@ void ScrollViewTwistEffect::SetSwingDropOff(const Vector2& dropOff, const Vector mFlags = mFlags & ~FlagDefaultDropOff; } +void ScrollViewTwistEffect::GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const +{ + dropOff = mDropOff; + distance = mDropOffDistance; + function = mDropOffFunction; +} + void ScrollViewTwistEffect::OnAttach(Toolkit::ScrollView& scrollView) { // Create effect-time property if not already created. diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.h b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.h index d98a086..5aca6a0 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.h +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.h @@ -99,13 +99,23 @@ public: /** * @copydoc Toolkit::ScrollViewEffect::SetMaxSwingAngle */ - void SetMaxSwingAngle(const Vector2& maxSwingAngle) { mMaxSwingAngle = maxSwingAngle; } + void SetMaxSwingAngle(const Vector2& maxSwingAngle); + + /** + * @copydoc Toolkit::ScrollViewEffect::GetMaxSwingAngle + */ + Vector2 GetMaxSwingAngle() const; /** * @copydoc Toolkit::ScrollViewEffect::SetSwingDropOff */ void SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function = NULL); + /** + * @copydoc Toolkit::ScrollViewEffect::GetSwingDropOff + */ + void GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const; + public: /** diff --git a/base/dali-toolkit/public-api/controls/control-impl.cpp b/base/dali-toolkit/public-api/controls/control-impl.cpp index 975152e..e45436f 100644 --- a/base/dali-toolkit/public-api/controls/control-impl.cpp +++ b/base/dali-toolkit/public-api/controls/control-impl.cpp @@ -76,6 +76,12 @@ TypeRegistration CONTROL_TYPE( typeid(Control), typeid(CustomActor), Create ); TypeAction ACTION_TYPE_1( CONTROL_TYPE, Toolkit::Control::ACTION_CONTROL_ACTIVATED, &Internal::Control::DoAction ); +SignalConnectorType SIGNAL_CONNECTOR_1( CONTROL_TYPE, Toolkit::Control::SIGNAL_KEY_EVENT, &Internal::Control::DoConnectSignal ); +SignalConnectorType SIGNAL_CONNECTOR_2( CONTROL_TYPE, Toolkit::Control::SIGNAL_TAPPED, &Internal::Control::DoConnectSignal ); +SignalConnectorType SIGNAL_CONNECTOR_3( CONTROL_TYPE, Toolkit::Control::SIGNAL_PANNED, &Internal::Control::DoConnectSignal ); +SignalConnectorType SIGNAL_CONNECTOR_4( CONTROL_TYPE, Toolkit::Control::SIGNAL_PINCHED, &Internal::Control::DoConnectSignal ); +SignalConnectorType SIGNAL_CONNECTOR_5( CONTROL_TYPE, Toolkit::Control::SIGNAL_LONG_PRESSED, &Internal::Control::DoConnectSignal ); + /** * Structure which holds information about the background of a control */ @@ -945,6 +951,50 @@ bool Control::DoAction(BaseObject* object, const std::string& actionName, const return ret; } +bool Control::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +{ + Dali::BaseHandle handle( object ); + + bool connected( false ); + Toolkit::Control control = Toolkit::Control::DownCast(handle); + if ( control ) + { + Control& controlImpl( control.GetImplementation() ); + connected = true; + + if ( Toolkit::Control::SIGNAL_KEY_EVENT == signalName ) + { + controlImpl.KeyEventSignal().Connect( tracker, functor ); + } + else if( Toolkit::Control::SIGNAL_TAPPED == signalName ) + { + controlImpl.EnableGestureDetection( Gesture::Tap ); + controlImpl.GetTapGestureDetector().DetectedSignal().Connect( tracker, functor ); + } + else if( Toolkit::Control::SIGNAL_PANNED == signalName ) + { + controlImpl.EnableGestureDetection( Gesture::Pan ); + controlImpl.GetPanGestureDetector().DetectedSignal().Connect( tracker, functor ); + } + else if( Toolkit::Control::SIGNAL_PINCHED == signalName ) + { + controlImpl.EnableGestureDetection( Gesture::Pinch ); + controlImpl.GetPinchGestureDetector().DetectedSignal().Connect( tracker, functor ); + } + else if( Toolkit::Control::SIGNAL_LONG_PRESSED == signalName ) + { + controlImpl.EnableGestureDetection( Gesture::LongPress ); + controlImpl.GetLongPressGestureDetector().DetectedSignal().Connect( tracker, functor ); + } + else + { + // signalName does not match any signal + connected = false; + } + } + return connected; +} + void Control::DoStyleChange( Toolkit::StyleManager styleManager, StyleChange change ) { if( change.themeChange ) @@ -1280,11 +1330,6 @@ void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* call mImpl->SignalDisconnected( slotObserver, callback ); } -std::size_t Control::GetConnectionCount() const -{ - return mImpl->GetConnectionCount(); -} - Control::Control( ControlBehaviour behaviourFlags ) : CustomActorImpl( behaviourFlags & REQUIRES_TOUCH_EVENTS ), mImpl(new Impl(*this)) diff --git a/base/dali-toolkit/public-api/controls/control-impl.h b/base/dali-toolkit/public-api/controls/control-impl.h index df822ef..fdcc05f 100644 --- a/base/dali-toolkit/public-api/controls/control-impl.h +++ b/base/dali-toolkit/public-api/controls/control-impl.h @@ -179,6 +179,17 @@ public: static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector& attributes); /** + * Connects a callback function with the object's signals. + * @param[in] object The object providing the signal. + * @param[in] tracker Used to disconnect the signal. + * @param[in] signalName The signal to connect to. + * @param[in] functor A newly allocated FunctorDelegate. + * @return True if the signal was connected. + * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. + */ + static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); + + /** * @brief If deriving classes wish to fine tune pinch gesture * detection then they can access the gesture detector through this * API and modify the detection. @@ -638,11 +649,6 @@ public: */ virtual void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback ); - /** - * @copydoc ConnectionTrackerInterface::GetConnectionCount - */ - virtual std::size_t GetConnectionCount() const; - protected: /** diff --git a/base/dali-toolkit/public-api/controls/control.cpp b/base/dali-toolkit/public-api/controls/control.cpp index 917a5b9..d01ad83 100644 --- a/base/dali-toolkit/public-api/controls/control.cpp +++ b/base/dali-toolkit/public-api/controls/control.cpp @@ -25,7 +25,12 @@ namespace Toolkit { const char* const Control::ACTION_CONTROL_ACTIVATED = "control-activated"; + const char* const Control::SIGNAL_KEY_EVENT = "key-event"; +const char* const Control::SIGNAL_TAPPED = "tapped"; +const char* const Control::SIGNAL_PANNED = "panned"; +const char* const Control::SIGNAL_PINCHED = "pinched"; +const char* const Control::SIGNAL_LONG_PRESSED = "long-pressed"; Control Control::New() { diff --git a/base/dali-toolkit/public-api/controls/control.h b/base/dali-toolkit/public-api/controls/control.h index 82ab066..951c2b6 100644 --- a/base/dali-toolkit/public-api/controls/control.h +++ b/base/dali-toolkit/public-api/controls/control.h @@ -58,6 +58,10 @@ public: /// @name Signals /** @{ */ static const char* const SIGNAL_KEY_EVENT; ///< name "key-event" + static const char* const SIGNAL_TAPPED; ///< name "tapped" + static const char* const SIGNAL_PANNED; ///< name "panned" + static const char* const SIGNAL_PINCHED; ///< name "pinched" + static const char* const SIGNAL_LONG_PRESSED; ///< name "long-pressed" /** @} */ /// @name Actions diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.cpp b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.cpp index 5ad2e57..0472917 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.cpp +++ b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.cpp @@ -85,11 +85,21 @@ void ScrollViewTwistEffect::SetMaxSwingAngle(const Vector2& maxSwingAngle) GetImpl(*this).SetMaxSwingAngle(maxSwingAngle); } +Vector2 ScrollViewTwistEffect::GetMaxSwingAngle() const +{ + return GetImpl( *this ).GetMaxSwingAngle(); +} + void ScrollViewTwistEffect::SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function) { GetImpl(*this).SetSwingDropOff(dropOff, distance, function); } +void ScrollViewTwistEffect::GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const +{ + GetImpl(*this).GetSwingDropOff(dropOff, distance, function); +} + } // namespace Toolkit } // namespace Dali diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h index 719fba2..a208fb0 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h +++ b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h @@ -130,6 +130,13 @@ public: void SetMaxSwingAngle(const Vector2& maxSwingAngle); /** + * @brief Retrieve the maximum swing angle when at zero drop off. + * + * @return The maximum swing angle for x and y axes + */ + Vector2 GetMaxSwingAngle() const; + + /** * @brief Set the drop off values to affect the amount of swing * angle applied to an actor the further it is from the scroll * position. @@ -146,6 +153,15 @@ public: */ void SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function = NULL); + /** + * @brief Get the drop off values that affect the amount of swing angle that is applied to an actor. + * + * @param[out] dropOff The current drop-off amount. + * @param[out] distance The current distance to apply drop-off in pixels. + * @param[out] function The current alpha function used to affect how the drop iff is applied over the distance. + */ + void GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const; + protected: /**