[SRUK] Initial copy from Tizen 2.2 version
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scroll-component / scroll-component-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_COMPONENTS_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_COMPONENTS_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/control-impl.h>
22 #include <dali-toolkit/public-api/controls/scroll-component/scroll-component.h>
23 #include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
24
25 namespace Dali
26 {
27
28 namespace Toolkit
29 {
30
31 namespace Internal
32 {
33
34 class ScrollComponent;
35
36 typedef IntrusivePtr<ScrollComponent> ScrollComponentPtr;
37
38
39 /**
40  * Base class for derived ScrollComponents
41  * ScrollComponents such as ScrollBar are derived from this class.
42  * To instantiate these ScrollBars and other derived components.
43  */
44 class ScrollComponent : public ControlImpl
45 {
46 public:
47
48   /**
49    * Create an initialized ScrollComponent
50    * @param[in] scrollable reference to ScrollView implementation
51    * @param[in] type the type of scroll component to create.
52    * @return A pointer to the created ScrollComponent.
53    */
54   static Toolkit::ScrollComponent New(Toolkit::Scrollable& scrollable, Toolkit::Scrollable::ScrollComponentType type);
55
56   /**
57    * Called when the scroll component is disconnected from a Scrollable container.
58    */
59   virtual void OnDisconnect()
60   {
61   }
62
63 protected:
64
65   /**
66    * Construct a new ScrollComponent.
67    */
68   ScrollComponent();
69
70   /**
71    * A reference counted object may only be deleted by calling Unreference()
72    */
73   virtual ~ScrollComponent();
74
75 private:
76
77   // Undefined
78   ScrollComponent(const ScrollComponent&);
79
80   // Undefined
81   ScrollComponent& operator=(const ScrollComponent& rhs);
82
83 };
84
85 } // namespace Internal
86
87 // Helpers for public-api forwarding methods
88
89 inline Toolkit::Internal::ScrollComponent& GetImpl(Toolkit::ScrollComponent& scrollComponent)
90 {
91   DALI_ASSERT_ALWAYS(scrollComponent);
92
93   Dali::RefObject& handle = scrollComponent.GetImplementation();
94
95   return static_cast<Toolkit::Internal::ScrollComponent&>(handle);
96 }
97
98 inline const Toolkit::Internal::ScrollComponent& GetImpl(const Toolkit::ScrollComponent& scrollComponent)
99 {
100   DALI_ASSERT_ALWAYS(scrollComponent);
101
102   const Dali::RefObject& handle = scrollComponent.GetImplementation();
103
104   return static_cast<const Toolkit::Internal::ScrollComponent&>(handle);
105 }
106
107 } // namespace Toolkit
108
109 } // namespace Dali
110
111 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_COMPONENTS_H__