Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / scrollable / scroll-component-impl.h
1 #ifndef __DALI_TOOLKIT_SCROLL_COMPONENT_IMPL_H__
2 #define __DALI_TOOLKIT_SCROLL_COMPONENT_IMPL_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 // INTERNAL INCLUDES
21 #include <dali-toolkit/public-api/controls/scrollable/scroll-component.h>
22
23 #include <dali-toolkit/public-api/controls/control-impl.h>
24 #include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
25 #include <dali-toolkit/public-api/controls/scrollable/scroll-connector.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 class ScrollComponentImpl;
34 typedef IntrusivePtr<ScrollComponentImpl> ScrollComponentPtr;
35
36 /**
37  * Base class for scroll component implementations.
38  * Scroll-components such as scroll bars, indicators etc. are connected to scrollable containers via ScrollConnector.
39  */
40 class ScrollComponentImpl : public ControlImpl
41 {
42 public:
43
44   /**
45    * @brief Sets the scroll connector.
46    *
47    * @param[in] connector The scroll-connector used to connect with a scrollable container.
48    */
49   void SetScrollConnector( Toolkit::ScrollConnector connector );
50
51   /**
52    * @brief Retrieve the scroll connector.
53    *
54    * @return The scroll-connector used to connect with a scrollable container.
55    */
56   Toolkit::ScrollConnector GetScrollConnector() const;
57
58   /**
59    * Called when the scroll component is disconnected from a scrollable container.
60    */
61   virtual void OnDisconnect() {}
62
63 protected:
64
65   /**
66    * Construct a new ScrollComponentImpl.
67    */
68   ScrollComponentImpl();
69
70   /**
71    * A reference counted object may only be deleted by calling Unreference()
72    */
73   virtual ~ScrollComponentImpl();
74
75   /**
76    * @brief Called when a scroll component is connected to a scrollable UI control.
77    *
78    * @param[in] oldConnector The previous connector, or an empty handle.
79    */
80   virtual void OnScrollConnectorSet( Toolkit::ScrollConnector oldConnector );
81
82 private:
83
84   // Undefined
85   ScrollComponentImpl(const ScrollComponentImpl&);
86
87   // Undefined
88   ScrollComponentImpl& operator=(const ScrollComponentImpl& rhs);
89
90 protected:
91
92   Toolkit::ScrollConnector mScrollConnector;
93 };
94
95 // Helpers for public-api forwarding methods
96
97 inline Toolkit::ScrollComponentImpl& GetImpl(Toolkit::ScrollComponent& scrollComponent)
98 {
99   DALI_ASSERT_ALWAYS(scrollComponent);
100
101   Dali::RefObject& handle = scrollComponent.GetImplementation();
102
103   return static_cast<Toolkit::ScrollComponentImpl&>(handle);
104 }
105
106 inline const Toolkit::ScrollComponentImpl& GetImpl(const Toolkit::ScrollComponent& scrollComponent)
107 {
108   DALI_ASSERT_ALWAYS(scrollComponent);
109
110   const Dali::RefObject& handle = scrollComponent.GetImplementation();
111
112   return static_cast<const Toolkit::ScrollComponentImpl&>(handle);
113 }
114
115 } // namespace Toolkit
116
117 } // namespace Dali
118
119 #endif // __DALI_TOOLKIT_SCROLL_COMPONENT_IMPL_H__