Conversion to Apache 2.0 license
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / scroll-bar / scroll-bar-impl.h
index 909e4fe..fb6786c 100755 (executable)
@@ -1,21 +1,22 @@
 #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.
+ *
+ */
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
@@ -44,6 +45,14 @@ class ScrollBar : public ScrollComponentImpl
 
 public:
 
+  // Properties
+  enum
+  {
+    SCROLLBAR_PROPERTY_START_INDEX = ControlImpl::CONTROL_PROPERTY_END_INDEX + 1,
+    SCROLLBAR_PROPERTY_END_INDEX = SCROLLBAR_PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices
+  };
+
+  // Signals
   typedef Toolkit::ScrollBar::ScrollPositionNotifiedSignalType ScrollPositionNotifiedSignalType;
 
 public:
@@ -76,6 +85,11 @@ public:
   /**
    * @copydoc Toolkit::ScrollBar::SetIndicatorImage()
    */
+  void SetIndicatorImage( Image image );
+
+  /**
+   * @copydoc Toolkit::ScrollBar::SetIndicatorImage()
+   */
   void SetIndicatorImage( Image image, const Vector4& border );
 
   /**
@@ -89,6 +103,26 @@ public:
   void SetPositionNotifications( const std::vector<float>& 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::Show()
    */
   void Show();
@@ -106,7 +140,25 @@ public:
    return mScrollPositionNotifiedSignal;
  }
 
-private: // from ControlImpl
+ // 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
@@ -147,27 +199,39 @@ private:
    */
   bool OnPanGestureProcessTick();
 
+  /**
+   * Handle SetProperty for scroll indicator height policy.
+   * @param[in] propertyValue The new property value.
+   */
+  void OnIndicatorHeightPolicyPropertySet(Property::Value propertyValue);
+
 private:
 
-  Constrainable mScrollPositionObject;                    ///< From mScrollConnector
+  Constrainable mScrollPositionObject;                               ///< From mScrollConnector
+
+  ImageActor mBackground;                                            ///< Background image of scroll bar.
+  ImageActor mIndicator;                                             ///< Image of scroll indicator.
+  Animation mAnimation;                                              ///< Scroll indicator Show/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
 
-  bool mIsPanning;                                       ///< Whether the scroll bar is being panned.
-  float mCurrentScrollPosition;                          ///< The current scroll position updated by the pan gesture
+  Toolkit::ScrollBar::IndicatorHeightPolicy mIndicatorHeightPolicy;  ///< The height policy of scroll indicator (variable or fixed)
+  float mIndicatorFixedHeight;                                      ///< The fixed height of scroll indicator
 
-  Timer mTimer;                                           ///< The timer to process the pan gesture after the gesture is started.
+  Timer mTimer;                                                      ///< The timer to process the pan gesture after the gesture is started.
 
-  Property::Index mPropertyIndicatorPosition;             ///< Indicatore Position ("indicator-position")
+  Property::Index mPropertyIndicatorPosition;                        ///< Indicatore Position ("indicator-position")
 
-  PropertyNotification mPositionNotification;             ///< Stores the property notification used for scroll position changes
+  PropertyNotification mPositionNotification;                        ///< Stores the property notification used for scroll position changes
 
   ScrollPositionNotifiedSignalType mScrollPositionNotifiedSignal;
+
+  ActiveConstraint mIndicatorSizeConstraint;
+  ActiveConstraint mIndicatorPositionConstraint;
 };
 
 } // namespace Internal