Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUiCtrl_Scroll.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FUiCtrl_Scroll.h
20  * @brief               This is the header file for the _Scroll class.
21  *
22  * This header file contains the declarations of the %_Scroll class.
23  */
24
25 #ifndef _FUICTRL_INTERNAL_SCROLL_H_
26 #define _FUICTRL_INTERNAL_SCROLL_H_
27
28 #include "FUi_Control.h"
29
30 namespace Tizen { namespace Ui { namespace Controls
31 {
32
33 class _ScrollPresenter;
34 class _IScrollEventListener;
35
36 enum _ScrollDirection
37 {
38         SCROLL_DIRECTION_VERTICAL = 0,
39         SCROLL_DIRECTION_HORIZONTAL
40 };
41
42 class _Scroll
43         : public Tizen::Ui::_Control
44         , virtual public Tizen::Base::Runtime::IEventListener
45         , virtual public _IUiEventListener
46         , virtual public _IUiEventPreviewer
47 {
48 public:
49         virtual ~_Scroll(void);
50         static _Scroll* CreateScrollN(Tizen::Ui::_Control& parentCtrl,
51                                                                                 _ScrollDirection scrollDir,
52                                                                                 bool enableFadeEffect,
53                                                                                 bool enableJumpToTop,
54                                                                                 bool enableHandler,
55                                                                                 bool visibility,
56                                                                                 int viewRange,
57                                                                                 int scrollRange,
58                                                                                 int scrollPosition);
59
60         result SetScrollDirection(_ScrollDirection scrollDir);
61         _ScrollDirection GetScrollDirection(void) const;
62         result SetScrollRange(int viewRange, int scrollRange);
63         void GetScrollRange(int* pViewRange, int* pScrollRange) const;
64         result SetScrollPosition(int scrollPosition);
65         int GetScrollPosition(void) const;
66
67         void EnableFadeEffect(bool enable);
68         bool IsEnabledFadeEffect(void) const;
69         bool IsOnFadeEffect(void) const;
70         void EnableScrollingEffect(bool enable);
71         bool IsEnabledScrollingEffect(void) const;
72         void EnableOverScrollingEffect(bool enable);
73         bool IsEnabledOverScrollingEffect(void) const;
74         void SetParentUsingViewport(bool useViewport);
75         bool IsParentUsingViewport(void) const;
76         result SetScrollVisibility(bool visibility);
77         bool GetScrollVisibility(void) const;
78         void CancelFadeEffect(void);
79         result SetScrollingEffectVisibility(bool visibility);
80
81
82         result EnableJumpToTop(bool enable);
83         bool IsEnabledJumpToTop(void) const;
84
85         result EnableHandler(bool enable);
86         bool IsEnabledHandler(void) const;
87
88         void AddScrollEventListener(const Tizen::Ui::Controls::_IScrollEventListener& listener);
89         void RemoveScrollEventListener(const Tizen::Ui::Controls::_IScrollEventListener& listener);
90
91         void OnParentBoundsChanged(void);
92
93         virtual void OnDraw(void);
94         virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
95         virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
96         virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
97         virtual Tizen::Ui::Animations::HitTestResult HitTest(const Tizen::Graphics::FloatPoint& point);
98
99 private:
100         _Scroll(const _Scroll& rhs);
101         _Scroll& operator =(const _Scroll& rhs);
102
103         _Scroll(void);
104         result Construct(Tizen::Ui::_Control& parentCtrl,
105                                                                 _ScrollDirection scrollDir,
106                                                                 bool enableFadeEffect,
107                                                                 bool enableJumpToTop,
108                                                                 bool enableHandler,
109                                                                 bool visibility,
110                                                                 int viewRange,
111                                                                 int scrollRange,
112                                                                 int scrollPosition);
113
114         void SetPresenter(_ScrollPresenter& scrollPresenter);
115         _ScrollPresenter& GetPresenter(void) const;
116
117
118 private:
119         _ScrollPresenter* __pPresenter;
120
121 };
122
123 }}} // Tizen::Ui::Controls
124
125 #endif //_FUICTRL_INTERNAL_SCROLL_H_