X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fscroll-bar%2Fscroll-bar-impl.h;h=6826c0ee4ba9b7b332a8216296551c111e242662;hb=52117490d94d8242addbe1608efe64364fdb308a;hp=1da04748be9abe7913f0710a3f8f99b316319511;hpb=818994dc0acac601b0b27c0b715259b504ef4ceb;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h index 1da0474..6826c0e 100755 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h @@ -1,24 +1,32 @@ #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_BAR_H__ #define __DALI_TOOLKIT_INTERNAL_SCROLL_BAR_H__ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include // INTERNAL INCLUDES -#include +#include #include #include @@ -39,11 +47,12 @@ typedef IntrusivePtr ScrollBarPtr; * ScrollBar is a UI component that can be added to the scrollable controls * indicating the current scroll position of the scrollable content. */ -class ScrollBar : public ControlImpl +class ScrollBar : public ScrollComponentImpl { public: + // Signals typedef Toolkit::ScrollBar::ScrollPositionNotifiedSignalType ScrollPositionNotifiedSignalType; public: @@ -64,19 +73,14 @@ public: static Toolkit::ScrollBar New(); /** - * @copydoc Toolkit::ScrollBar::SetScrollConnector() + * @copydoc Toolkit::ScrollComponentImpl::OnScrollConnectorSet() */ - void SetScrollConnector( Toolkit::ScrollConnector connector ); - - /** - * @copydoc Toolkit::ScrollBar::SetBackgroundImage() - */ - void SetBackgroundImage( Image image, const Vector4& border ); + void OnScrollConnectorSet( Toolkit::ScrollConnector connector ); /** * @copydoc Toolkit::ScrollBar::SetIndicatorImage() */ - void SetIndicatorImage( Image image, const Vector4& border ); + void SetIndicatorImage( Image image ); /** * @copydoc Toolkit::ScrollBar::GetScrollIndicator() @@ -89,6 +93,46 @@ public: void SetPositionNotifications( const std::vector& positions ); /** + * @copydoc Toolkit::ScrollBar::SetIndicatorHeightPolicy() + */ + void SetIndicatorHeightPolicy( Toolkit::ScrollBar::IndicatorHeightPolicy policy ); + + /** + * @copydoc Toolkit::ScrollBar::GetIndicatorHeightPolicy() + */ + Toolkit::ScrollBar::IndicatorHeightPolicy GetIndicatorHeightPolicy(); + + /** + * @copydoc Toolkit::ScrollBar::SetIndicatorFixedHeight() + */ + void SetIndicatorFixedHeight( float height ); + + /** + * @copydoc Toolkit::ScrollBar::GetIndicatorFixedHeight() + */ + float GetIndicatorFixedHeight(); + + /** + * @copydoc Toolkit::ScrollBar::SetIndicatorShowDuration() + */ + void SetIndicatorShowDuration( float durationSeconds ); + + /** + * @copydoc Toolkit::ScrollBar::GetIndicatorShowDuration() + */ + float GetIndicatorShowDuration(); + + /** + * @copydoc Toolkit::ScrollBar::SetIndicatorHideDuration() + */ + void SetIndicatorHideDuration( float durationSeconds ); + + /** + * @copydoc Toolkit::ScrollBar::GetIndicatorHideDuration() + */ + float GetIndicatorHideDuration(); + + /** * @copydoc Toolkit::ScrollBar::Show() */ void Show(); @@ -106,7 +150,36 @@ public: return mScrollPositionNotifiedSignal; } -private: // from ControlImpl + /** + * 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 ); + + // Properties + + /** + * Called when a property of an object of this type is set. + * @param[in] object The object whose property is set. + * @param[in] index The property index. + * @param[in] value The new property value. + */ + static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ); + + /** + * Called to retrieve a property of an object of this type. + * @param[in] object The object whose property is to be retrieved. + * @param[in] index The property index. + * @return The current value of the property. + */ + static Property::Value GetProperty( BaseObject* object, Property::Index index ); + +private: // from Control /** * @copydoc Toolkit::Control::OnInitialize @@ -118,6 +191,11 @@ private: // from ControlImpl */ virtual void OnPan( PanGesture gesture ); + /** + * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& size ) + */ + virtual void OnControlSizeSet( const Vector3& size ); + private: /** @@ -141,23 +219,47 @@ private: */ void OnScrollPositionNotified(PropertyNotification& source); + /** + * Process the pan gesture per predefined timeout until the gesture is finished. + * @return True if the timer should be kept running. + */ + bool OnPanGestureProcessTick(); + + /** + * Handle SetProperty for scroll indicator height policy. + * @param[in] propertyValue The new property value. + */ + void OnIndicatorHeightPolicyPropertySet(Property::Value propertyValue); + private: - Toolkit::ScrollConnector mScrollConnector; ///< Connects scroll bar with the scrollable container. - Constrainable mScrollPositionObject; ///< From mScrollConnector + Handle mScrollPositionObject; ///< From mScrollConnector + + ImageActor mIndicator; ///< Image of scroll indicator. + Animation mAnimation; ///< Scroll indicator Show/Hide Animation. + + float mIndicatorShowDuration; ///< The duration of scroll indicator show animation + float mIndicatorHideDuration; ///< The duration of scroll indicator hide animation - ImageActor mBackground; ///< Background image of scroll bar. - ImageActor mIndicator; ///< Image of scroll indicator. - Animation mAnimation; ///< Scroll indicator Show/Hide Animation. + float mScrollStart; ///< Scroll Start position (start of drag) + Vector3 mGestureDisplacement; ///< Gesture Displacement. - float mScrollStart; ///< Scroll Start position (start of drag) - Vector3 mGestureDisplacement; ///< Gesture Displacement. + bool mIsPanning; ///< Whether the scroll bar is being panned. + float mCurrentScrollPosition; ///< The current scroll position updated by the pan gesture - Property::Index mPropertyIndicatorPosition; ///< Indicatore Position ("indicator-position") + Toolkit::ScrollBar::IndicatorHeightPolicy mIndicatorHeightPolicy; ///< The height policy of scroll indicator (variable or fixed) + float mIndicatorFixedHeight; ///< The fixed height of scroll indicator - PropertyNotification mPositionNotification; ///< Stores the property notification used for scroll position changes + Timer mTimer; ///< The timer to process the pan gesture after the gesture is started. + + Property::Index mPropertyIndicatorPosition; ///< Indicatore Position ("indicator-position") + + PropertyNotification mPositionNotification; ///< Stores the property notification used for scroll position changes ScrollPositionNotifiedSignalType mScrollPositionNotifiedSignal; + + ActiveConstraint mIndicatorSizeConstraint; + ActiveConstraint mIndicatorPositionConstraint; }; } // namespace Internal