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