Remove the dependency between ScrollBar & ItemView 48/19448/1
authorPaul Wisbey <p.wisbey@samsung.com>
Wed, 9 Apr 2014 15:46:49 +0000 (16:46 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Fri, 11 Apr 2014 14:36:24 +0000 (15:36 +0100)
[Issue#] N/A
[Problem]  ItemView only works with one type of scroll bar i.e. Toolkit::ScrollBar
[Cause]    Direct dependency from ItemView to ScrollBar
[Solution] Use the ScrollComponent interface instead. The idea is that custom
scroll components can be implemented and connected without changing ItemView

Change-Id: Ie059b6453f38b7a2baccd7ced135b1a49fc6ab88
Signed-off-by: Paul Wisbey <p.wisbey@samsung.com>
19 files changed:
dali-toolkit/dali-toolkit.h
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h
dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.h
dali-toolkit/internal/controls/scroll-component/scroll-bar-internal.h
dali-toolkit/internal/controls/scroll-component/scroll-component-impl.cpp [deleted file]
dali-toolkit/internal/controls/scroll-component/scroll-component-impl.h [deleted file]
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp
dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp
dali-toolkit/internal/controls/scrollable/scrollable-impl.h
dali-toolkit/internal/file.list
dali-toolkit/public-api/controls/scroll-bar/scroll-bar.cpp
dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h
dali-toolkit/public-api/controls/scrollable/scroll-component-impl.cpp [new file with mode: 0644]
dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h [new file with mode: 0644]
dali-toolkit/public-api/controls/scrollable/scroll-component.cpp [moved from dali-toolkit/internal/controls/scroll-component/scroll-component.cpp with 53% similarity]
dali-toolkit/public-api/controls/scrollable/scroll-component.h [moved from dali-toolkit/internal/controls/scroll-component/scroll-component.h with 74% similarity]
dali-toolkit/public-api/file.list

index b4f8455..7a7d089 100644 (file)
@@ -39,7 +39,8 @@
 #include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
 
 #include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
-#include <dali-toolkit/public-api/controls/scrollable/scroll-connector.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
 #include <dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h>
 #include <dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.h>
 #include <dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.h>
index f9473b9..7ae50af 100755 (executable)
@@ -126,8 +126,7 @@ TypeRegistration mType( typeid(Toolkit::ScrollBar), typeid(Toolkit::Control), Cr
 }
 
 ScrollBar::ScrollBar()
-: ControlImpl(true/*requires touch*/),
-  mScrollStart(0.0f)
+: mScrollStart(0.0f)
 {
 }
 
@@ -153,18 +152,22 @@ void ScrollBar::OnInitialize()
   EnableGestureDetection(Gesture::Type(Gesture::Pan));
 }
 
-void ScrollBar::SetScrollConnector( Toolkit::ScrollConnector connector )
+void ScrollBar::OnScrollConnectorSet( Toolkit::ScrollConnector oldConnector )
 {
-  if(mScrollConnector)
+  if( oldConnector )
   {
-    mScrollConnector.DomainChangedSignal().Disconnect(this, &ScrollBar::OnScrollDomainChanged);
+    oldConnector.DomainChangedSignal().Disconnect(this, &ScrollBar::OnScrollDomainChanged);
+
+    mScrollPositionObject.Reset();
   }
 
-  mScrollConnector = connector;
-  mScrollPositionObject = mScrollConnector.GetScrollPositionObject();
+  if( mScrollConnector )
+  {
+    mScrollPositionObject = mScrollConnector.GetScrollPositionObject();
 
-  ApplyConstraints();
-  mScrollConnector.DomainChangedSignal().Connect(this, &ScrollBar::OnScrollDomainChanged);
+    ApplyConstraints();
+    mScrollConnector.DomainChangedSignal().Connect(this, &ScrollBar::OnScrollDomainChanged);
+  }
 }
 
 void ScrollBar::SetBackgroundImage( Image image, const Vector4& border )
index 1da0474..c938c7e 100755 (executable)
@@ -18,7 +18,7 @@
 //
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
 #include <dali-toolkit/public-api/controls/scrollable/scroll-connector.h>
 #include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
 
@@ -39,7 +39,7 @@ typedef IntrusivePtr<ScrollBar> 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:
@@ -64,9 +64,9 @@ public:
   static Toolkit::ScrollBar New();
 
   /**
-   * @copydoc Toolkit::ScrollBar::SetScrollConnector()
+   * @copydoc Toolkit::ScrollComponentImpl::OnScrollConnectorSet()
    */
-  void SetScrollConnector( Toolkit::ScrollConnector connector );
+  void OnScrollConnectorSet( Toolkit::ScrollConnector connector );
 
   /**
    * @copydoc Toolkit::ScrollBar::SetBackgroundImage()
@@ -143,7 +143,6 @@ private:
 
 private:
 
-  Toolkit::ScrollConnector mScrollConnector;              ///< Connects scroll bar with the scrollable container.
   Constrainable mScrollPositionObject;                    ///< From mScrollConnector
 
   ImageActor mBackground;                                 ///< Background image of scroll bar.
index 22e92ff..3e3f20d 100755 (executable)
 //
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/scroll-component/scroll-component-impl.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
 #include <dali-toolkit/internal/controls/scrollable/scrollable-impl.h>
 #include <dali-toolkit/internal/controls/scroll-component/scroll-bar-internal.h>
-#include <dali-toolkit/public-api/controls/control-impl.h>
 
 namespace Dali
 {
@@ -36,7 +35,7 @@ namespace Internal
  * ScrollBarInternal is a UI component that can be added to the sides of the ScrollView
  * indicating the current scroll position within the domain.
  */
-class ScrollBarInternal : public ScrollComponent
+class ScrollBarInternal : public ScrollComponentImpl
 {
 
 public:
index ea98a94..47cf67c 100755 (executable)
@@ -18,7 +18,7 @@
 //
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/scroll-component/scroll-component.h>
+#include <dali-toolkit/public-api/controls/scrollable//scroll-component.h>
 #include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
 
 namespace Dali DALI_IMPORT_API
diff --git a/dali-toolkit/internal/controls/scroll-component/scroll-component-impl.cpp b/dali-toolkit/internal/controls/scroll-component/scroll-component-impl.cpp
deleted file mode 100644 (file)
index 729ee54..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// 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.
-//
-
-// CLASS HEADER
-#include <dali-toolkit/internal/controls/scroll-component/scroll-component-impl.h>
-#include <dali-toolkit/internal/controls/scroll-component/scroll-bar-internal.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace
-{
-BaseHandle Create()
-{
-  // empty handle as we cannot create ScrollComponent
-  return Toolkit::ScrollComponent::New();
-}
-
-TypeRegistration mType( typeid(Toolkit::ScrollComponent), typeid(Toolkit::Control), Create );
-
-}
-
-ScrollComponent::ScrollComponent()
-: ControlImpl(true/*requires touch*/)
-{
-
-}
-
-ScrollComponent::~ScrollComponent()
-{
-}
-
-Toolkit::ScrollComponent ScrollComponent::New(Toolkit::Scrollable& scrollable, Toolkit::Scrollable::ScrollComponentType type)
-{
-  Toolkit::ScrollComponent instance;
-
-  switch(type)
-  {
-    case Toolkit::Scrollable::VerticalScrollBar:
-    {
-      instance = static_cast<Toolkit::ScrollComponent>(Toolkit::ScrollBarInternal::New(scrollable, true));
-      break;
-    }
-    case Toolkit::Scrollable::HorizontalScrollBar:
-    {
-      instance = static_cast<Toolkit::ScrollComponent>(Toolkit::ScrollBarInternal::New(scrollable, false));
-      break;
-    }
-    default:
-    {
-      DALI_ASSERT_ALWAYS(true && "Unrecognized component type");
-    }
-  }
-
-  return instance;
-}
-
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/internal/controls/scroll-component/scroll-component-impl.h b/dali-toolkit/internal/controls/scroll-component/scroll-component-impl.h
deleted file mode 100644 (file)
index 2f93012..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_COMPONENTS_H__
-#define __DALI_TOOLKIT_INTERNAL_SCROLL_COMPONENTS_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.
-//
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/scroll-component/scroll-component.h>
-
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-class ScrollComponent;
-
-typedef IntrusivePtr<ScrollComponent> ScrollComponentPtr;
-
-
-/**
- * Base class for derived ScrollComponents
- * ScrollComponents such as ScrollBarInternal are derived from this class.
- * To instantiate these ScrollBarInternals and other derived components.
- */
-class ScrollComponent : public ControlImpl
-{
-public:
-
-  /**
-   * Create an initialized ScrollComponent
-   * @param[in] scrollable reference to ScrollView implementation
-   * @param[in] type the type of scroll component to create.
-   * @return A pointer to the created ScrollComponent.
-   */
-  static Toolkit::ScrollComponent New(Toolkit::Scrollable& scrollable, Toolkit::Scrollable::ScrollComponentType type);
-
-  /**
-   * Called when the scroll component is disconnected from a Scrollable container.
-   */
-  virtual void OnDisconnect()
-  {
-  }
-
-protected:
-
-  /**
-   * Construct a new ScrollComponent.
-   */
-  ScrollComponent();
-
-  /**
-   * A reference counted object may only be deleted by calling Unreference()
-   */
-  virtual ~ScrollComponent();
-
-private:
-
-  // Undefined
-  ScrollComponent(const ScrollComponent&);
-
-  // Undefined
-  ScrollComponent& operator=(const ScrollComponent& rhs);
-
-};
-
-} // namespace Internal
-
-// Helpers for public-api forwarding methods
-
-inline Toolkit::Internal::ScrollComponent& GetImpl(Toolkit::ScrollComponent& scrollComponent)
-{
-  DALI_ASSERT_ALWAYS(scrollComponent);
-
-  Dali::RefObject& handle = scrollComponent.GetImplementation();
-
-  return static_cast<Toolkit::Internal::ScrollComponent&>(handle);
-}
-
-inline const Toolkit::Internal::ScrollComponent& GetImpl(const Toolkit::ScrollComponent& scrollComponent)
-{
-  DALI_ASSERT_ALWAYS(scrollComponent);
-
-  const Dali::RefObject& handle = scrollComponent.GetImplementation();
-
-  return static_cast<const Toolkit::Internal::ScrollComponent&>(handle);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_INTERNAL_SCROLL_COMPONENTS_H__
index 289290c..5caa208 100644 (file)
@@ -23,7 +23,6 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/events/mouse-wheel-event.h>
 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
-#include <dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h>
 #include <dali-toolkit/internal/controls/scrollable/scroll-connector-impl.h>
 
 using namespace std;
@@ -1055,11 +1054,11 @@ void ItemView::OnChildAdd(Actor& child)
   if(!mAddingItems)
   {
     // We don't want to do this downcast check for any item added by ItemView itself.
-    Dali::Toolkit::ScrollBar scrollBar = Dali::Toolkit::ScrollBar::DownCast(child);
-    if(scrollBar)
+    Dali::Toolkit::ScrollComponent scrollComponent = Dali::Toolkit::ScrollComponent::DownCast(child);
+    if(scrollComponent)
     {
       // Set the scroll connector when scroll bar is being added
-      scrollBar.SetScrollConnector(mScrollConnector);
+      scrollComponent.SetScrollConnector(mScrollConnector);
     }
   }
 }
index 1acf2a6..82b647f 100644 (file)
 // INTERNAL INCLUDES
 #include <dali/public-api/events/mouse-wheel-event.h>
 
-#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h>
 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-constraints.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
+#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h>
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
-#include <dali-toolkit/internal/controls/scroll-component/scroll-component-impl.h>
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.h>
 
 // TODO: Change to two class system:
index b506dd4..d122835 100644 (file)
@@ -109,8 +109,8 @@ void Scrollable::EnableScrollComponent(Toolkit::Scrollable::ScrollComponentType
   {
     // Create ScrollComponent
     Toolkit::Scrollable scrollable = Toolkit::Scrollable::DownCast(Self());
-    Toolkit::ScrollComponent scrollComponent = ScrollComponent::New(scrollable, type);
-    Toolkit::Internal::ScrollComponent& component = static_cast<Toolkit::Internal::ScrollComponent&>(scrollComponent.GetImplementation());
+    Toolkit::ScrollComponent scrollComponent = NewScrollComponent(scrollable, type);
+    Toolkit::ScrollComponentImpl& component = static_cast<Toolkit::ScrollComponentImpl&>(scrollComponent.GetImplementation());
     ScrollComponentPtr componentPtr(&component);
 
     mComponents[type] = componentPtr;
@@ -131,9 +131,6 @@ void Scrollable::DisableScrollComponent(Toolkit::Scrollable::ScrollComponentType
   {
     ScrollComponentPtr component = pair->second;
 
-    // Disconnect the scroll component first.
-    component->OnDisconnect();
-
     // Destroy ScrollComponent.
     mComponents.erase( type );
   }
@@ -191,6 +188,31 @@ bool Scrollable::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface
   return connected;
 }
 
+Toolkit::ScrollComponent Scrollable::NewScrollComponent(Toolkit::Scrollable& scrollable, Toolkit::Scrollable::ScrollComponentType type)
+{
+  Toolkit::ScrollComponent instance;
+
+  switch(type)
+  {
+    case Toolkit::Scrollable::VerticalScrollBar:
+    {
+      instance = static_cast<Toolkit::ScrollComponent>(Toolkit::ScrollBarInternal::New(scrollable, true));
+      break;
+    }
+    case Toolkit::Scrollable::HorizontalScrollBar:
+    {
+      instance = static_cast<Toolkit::ScrollComponent>(Toolkit::ScrollBarInternal::New(scrollable, false));
+      break;
+    }
+    default:
+    {
+      DALI_ASSERT_ALWAYS(true && "Unrecognized component type");
+    }
+  }
+
+  return instance;
+}
+
 } // namespace Internal
 
 } // namespace Toolkit
index b784c02..72cc47a 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
-#include <dali-toolkit/internal/controls/scroll-component/scroll-component-impl.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
 
 namespace Dali
 {
@@ -181,6 +181,14 @@ private:
   // Undefined
   Scrollable& operator=(const Scrollable& rhs);
 
+  /**
+   * Helper to create an initialized ScrollComponent
+   * @param[in] scrollable reference to ScrollView implementation
+   * @param[in] type the type of scroll component to create.
+   * @return A pointer to the created ScrollComponent.
+   */
+  Toolkit::ScrollComponent NewScrollComponent(Toolkit::Scrollable& scrollable, Toolkit::Scrollable::ScrollComponentType type);
+
 protected:
 
   Property::Index mPropertyRelativePosition;///< Scroll Relative Position ("scroll-relative-position") [range from 0.0f - 1.0f in each axes]
index e190fe4..e0e8ebc 100644 (file)
@@ -34,9 +34,7 @@ toolkit_src_files = \
    $(toolkit_src_dir)/controls/popup/popup-style-impl.cpp \
    $(toolkit_src_dir)/controls/scroll-bar/scroll-bar-impl.cpp \
    $(toolkit_src_dir)/controls/scroll-component/scroll-bar-internal-impl.cpp \
-   $(toolkit_src_dir)/controls/scroll-component/scroll-component-impl.cpp \
    $(toolkit_src_dir)/controls/scroll-component/scroll-bar-internal.cpp \
-   $(toolkit_src_dir)/controls/scroll-component/scroll-component.cpp \
    $(toolkit_src_dir)/controls/scrollable/item-view/item-view-impl.cpp \
    $(toolkit_src_dir)/controls/scrollable/scrollable-impl.cpp \
    $(toolkit_src_dir)/controls/scrollable/scroll-connector-impl.cpp \
index 8f93e2c..b0279de 100755 (executable)
@@ -30,18 +30,18 @@ ScrollBar::ScrollBar()
 }
 
 ScrollBar::ScrollBar(Internal::ScrollBar& implementation)
-: Control( implementation )
+: ScrollComponent( implementation )
 {
 }
 
 ScrollBar::ScrollBar( Dali::Internal::CustomActor* internal )
-: Control( internal )
+: ScrollComponent( internal )
 {
   VerifyCustomActorPointer<Internal::ScrollBar>(internal);
 }
 
 ScrollBar::ScrollBar( const ScrollBar& scrollBar )
-: Control( scrollBar )
+: ScrollComponent( scrollBar )
 {
 }
 
@@ -68,11 +68,6 @@ ScrollBar::~ScrollBar()
 {
 }
 
-void ScrollBar::SetScrollConnector( ScrollConnector connector )
-{
-  GetImpl(*this).SetScrollConnector(connector);
-}
-
 void ScrollBar::SetBackgroundImage( Image image, const Vector4& border )
 {
   GetImpl(*this).SetBackgroundImage(image, border);
index 5adb04c..12aa98b 100755 (executable)
@@ -19,7 +19,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/dali.h>
-#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component.h>
 
 namespace Dali DALI_IMPORT_API
 {
@@ -41,7 +41,7 @@ class ScrollBar;
  * 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 Control
+class ScrollBar : public ScrollComponent
 {
 public:
 
@@ -89,15 +89,6 @@ public:
   static ScrollBar DownCast( BaseHandle handle );
 
   /**
-   * @brief Sets the scroll connector for the scroll bar.
-   *
-   * @pre The scroll bar actor has been initialised.
-   *
-   * @param[in] connector Scroll connector used to connect scrollable container with this ScrollBar
-   */
- void SetScrollConnector( ScrollConnector connector );
-
-  /**
    * @brief Sets the image for the background of scroll indicator.
    *
    * @pre The scroll bar actor has been initialised.
diff --git a/dali-toolkit/public-api/controls/scrollable/scroll-component-impl.cpp b/dali-toolkit/public-api/controls/scrollable/scroll-component-impl.cpp
new file mode 100644 (file)
index 0000000..654322d
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// 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.
+//
+
+// CLASS HEADER
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace // unnamed namespace
+{
+
+BaseHandle Create()
+{
+  // empty handle as we cannot create ScrollComponent
+  return BaseHandle();
+}
+
+TypeRegistration mType( typeid(Toolkit::ScrollComponent), typeid(Toolkit::Control), Create );
+
+} // unnamed namespace
+
+void ScrollComponentImpl::SetScrollConnector( Toolkit::ScrollConnector connector )
+{
+  if( mScrollConnector != connector )
+  {
+    Toolkit::ScrollConnector oldConnector = mScrollConnector;
+    mScrollConnector = connector;
+
+    // Notify derived classes
+    OnScrollConnectorSet( oldConnector );
+  }
+}
+
+Toolkit::ScrollConnector ScrollComponentImpl::GetScrollConnector() const
+{
+  return mScrollConnector;
+}
+
+ScrollComponentImpl::ScrollComponentImpl()
+: ControlImpl(true/*requires touch*/)
+{
+}
+
+ScrollComponentImpl::~ScrollComponentImpl()
+{
+}
+
+void ScrollComponentImpl::OnScrollConnectorSet( Toolkit::ScrollConnector connector )
+{
+  // Do nothing (override in derived classes)
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h b/dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h
new file mode 100644 (file)
index 0000000..1cb2354
--- /dev/null
@@ -0,0 +1,114 @@
+#ifndef __DALI_TOOLKIT_SCROLL_COMPONENT_IMPL_H__
+#define __DALI_TOOLKIT_SCROLL_COMPONENT_IMPL_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.
+//
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component.h>
+
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-connector.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+class ScrollComponentImpl;
+typedef IntrusivePtr<ScrollComponentImpl> ScrollComponentPtr;
+
+/**
+ * Base class for scroll component implementations.
+ * Scroll-components such as scroll bars, indicators etc. are connected to scrollable containers via ScrollConnector.
+ */
+class ScrollComponentImpl : public ControlImpl
+{
+public:
+
+  /**
+   * @brief Sets the scroll connector.
+   *
+   * @param[in] connector The scroll-connector used to connect with a scrollable container.
+   */
+  void SetScrollConnector( Toolkit::ScrollConnector connector );
+
+  /**
+   * @brief Retrieve the scroll connector.
+   *
+   * @return The scroll-connector used to connect with a scrollable container.
+   */
+  Toolkit::ScrollConnector GetScrollConnector() const;
+
+protected:
+
+  /**
+   * Construct a new ScrollComponentImpl.
+   */
+  ScrollComponentImpl();
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~ScrollComponentImpl();
+
+  /**
+   * @brief Called when a scroll component is connected to a scrollable UI control.
+   *
+   * @param[in] oldConnector The previous connector, or an empty handle.
+   */
+  virtual void OnScrollConnectorSet( Toolkit::ScrollConnector oldConnector );
+
+private:
+
+  // Undefined
+  ScrollComponentImpl(const ScrollComponentImpl&);
+
+  // Undefined
+  ScrollComponentImpl& operator=(const ScrollComponentImpl& rhs);
+
+protected:
+
+  Toolkit::ScrollConnector mScrollConnector;
+};
+
+// Helpers for public-api forwarding methods
+
+inline Toolkit::ScrollComponentImpl& GetImpl(Toolkit::ScrollComponent& scrollComponent)
+{
+  DALI_ASSERT_ALWAYS(scrollComponent);
+
+  Dali::RefObject& handle = scrollComponent.GetImplementation();
+
+  return static_cast<Toolkit::ScrollComponentImpl&>(handle);
+}
+
+inline const Toolkit::ScrollComponentImpl& GetImpl(const Toolkit::ScrollComponent& scrollComponent)
+{
+  DALI_ASSERT_ALWAYS(scrollComponent);
+
+  const Dali::RefObject& handle = scrollComponent.GetImplementation();
+
+  return static_cast<const Toolkit::ScrollComponentImpl&>(handle);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_SCROLL_COMPONENT_IMPL_H__
 // limitations under the License.
 //
 
-#include <dali-toolkit/internal/controls/scroll-component/scroll-component.h>
-#include <dali-toolkit/internal/controls/scroll-component/scroll-component-impl.h>
+// CLASS HEADER
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
 
 namespace Dali
 {
@@ -27,40 +30,50 @@ ScrollComponent::ScrollComponent()
 {
 }
 
-ScrollComponent::ScrollComponent(Internal::ScrollComponent& implementation)
-: Control(implementation)
+ScrollComponent::ScrollComponent( ScrollComponentImpl& implementation )
+: Control( implementation )
 {
 }
 
-ScrollComponent::ScrollComponent( Dali::Internal::CustomActor* internal )
-: Control( internal )
+ScrollComponent::ScrollComponent( Dali::Internal::CustomActor* actor )
+: Control( actor )
 {
-  VerifyCustomActorPointer<Internal::ScrollComponent>(internal);
+  VerifyCustomActorPointer<ScrollComponentImpl>( actor );
 }
 
-ScrollComponent::ScrollComponent( const ScrollComponent& scrollComponentNew )
-: Control(scrollComponentNew)
+ScrollComponent::ScrollComponent( const ScrollComponent& scrollComponent )
+: Control( scrollComponent )
 {
 }
 
-ScrollComponent& ScrollComponent::operator=( const ScrollComponent& scrollComponentNew )
+ScrollComponent& ScrollComponent::operator=( const ScrollComponent& scrollComponent )
 {
-  if( &scrollComponentNew != this )
+  if( &scrollComponent != this )
   {
-    Control::operator=( scrollComponentNew );
+    Control::operator=( scrollComponent );
   }
   return *this;
 }
 
 ScrollComponent ScrollComponent::DownCast( BaseHandle handle )
 {
-  return Control::DownCast<ScrollComponent, Internal::ScrollComponent>(handle);
+  return Control::DownCast<ScrollComponent, ScrollComponentImpl>(handle);
 }
 
 ScrollComponent::~ScrollComponent()
 {
 }
 
+void ScrollComponent::SetScrollConnector( ScrollConnector connector )
+{
+  GetImpl(*this).SetScrollConnector(connector);
+}
+
+ScrollConnector ScrollComponent::GetScrollConnector() const
+{
+  return GetImpl(*this).GetScrollConnector();
+}
+
 } // namespace Toolkit
 
 } // namespace Dali
@@ -27,15 +27,12 @@ namespace Dali DALI_IMPORT_API
 namespace Toolkit
 {
 
-namespace Internal DALI_INTERNAL
-{
-class ScrollComponent;
-}
+class ScrollComponentImpl;
+class ScrollConnector;
 
 /**
- * Base class for derived ScrollComponents
- * ScrollComponents such as ScrollBarInternal are derived from this class.
- * To instantiate these ScrollBarInternals and other derived components
+ * Base class for scroll component handles.
+ * Scroll-components such as scroll bars, indicators etc. are connected to scrollable containers via ScrollConnector.
  */
 class ScrollComponent : public Control
 {
@@ -71,13 +68,27 @@ public:
    */
   static ScrollComponent DownCast( BaseHandle handle );
 
+  /**
+   * @brief Sets the scroll connector.
+   *
+   * @param[in] connector The scroll-connector used to connect with scrollable container.
+   */
+  void SetScrollConnector( ScrollConnector connector );
+
+  /**
+   * @brief Retrieve the scroll connector.
+   *
+   * @return The scroll-connector used to connect with a scrollable container.
+   */
+  ScrollConnector GetScrollConnector() const;
+
 public: // Not intended for application developers
 
   /**
-   * Creates a handle using the Toolkit::Internal implementation.
-   * @param[in]  implementation  The Control implementation.
+   * Creates a handle using the implementation.
+   * @param[in]  implementation The Control implementation.
    */
-  ScrollComponent( Internal::ScrollComponent& implementation );
+  ScrollComponent( ScrollComponentImpl& implementation );
 
   /**
    * Allows the creation of this Control from an Internal::CustomActor pointer.
index 7942f20..638fdf2 100755 (executable)
@@ -36,6 +36,8 @@ public_api_src_files = \
   $(public_api_src_dir)/controls/scrollable/item-view/album-layout.cpp \
   $(public_api_src_dir)/controls/scrollable/scrollable.cpp \
   $(public_api_src_dir)/controls/scrollable/scroll-connector.cpp \
+  $(public_api_src_dir)/controls/scrollable/scroll-component-impl.cpp \
+  $(public_api_src_dir)/controls/scrollable/scroll-component.cpp \
   $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view.cpp \
   $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-constraints.cpp \
   $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-effect.cpp \
@@ -149,9 +151,9 @@ public_api_page_turn_view_header_files = \
 
 public_api_popup_header_files =
 
-public_api_scroll_component_header_files =
-
-public_api_scrollable_header_files =
+public_api_scrollable_header_files = \
+  $(public_api_src_dir)/controls/scrollable/scroll-component-impl.h \
+  $(public_api_src_dir)/controls/scrollable/scroll-component.h
 
 public_api_scroll_bar_header_files = \
   $(public_api_src_dir)/controls/scroll-bar/scroll-bar.h