fixed bug (TapGesture improvement)
[platform/framework/native/uifw.git] / src / ui / inc / FUiCtrl_Gallery.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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 #ifndef _FUI_CTRL_INTERNAL_GALLERY_H_
18 #define _FUI_CTRL_INTERNAL_GALLERY_H_
19
20
21 #include "FUi_Control.h"
22 #include "FUi_ITouchFlickGestureEventListener.h"
23 #include "FUi_ITouchTapGestureEventListener.h"
24 #include "FUi_ITouchPinchGestureEventListener.h"
25 #include "FUiCtrl_GalleryTypes.h"
26
27
28 namespace Tizen { namespace Base {
29
30 class String;
31
32 }} // Tizen::Base
33
34 namespace Tizen { namespace Graphics {
35
36 class Color;
37
38 }} // Tizen::Graphics
39
40 namespace Tizen { namespace Ui {
41 class _TouchFlickGestureDetector;
42 class _TouchTapGestureDetector;
43 class _TouchPinchGestureDetector;
44 class _AccessibilityElement;
45 }} // Tizen::Ui
46
47 namespace Tizen { namespace Ui { namespace Effects {
48 class Effect;
49 }}}
50
51 namespace Tizen { namespace Ui { namespace Controls {
52
53 class _GalleryBitmap;
54 class _GalleryRenderer;
55 class _GalleryPresenter;
56 class _GalleryViewEvent;
57 class _IGalleryCoreEventListener;
58 class _IGalleryRendererNotiListener;
59 class _GalleryItemProviderAdaptorImpl;
60
61 class _Gallery
62         : public Tizen::Ui::_Control
63         , virtual public Tizen::Ui::_ITouchFlickGestureEventListener
64         , virtual public Tizen::Ui::_ITouchTapGestureEventListener
65         , virtual public Tizen::Ui::_ITouchPinchGestureEventListener
66         , virtual public Tizen::Ui::_IUiEventListener
67         , virtual public Tizen::Ui::_ITouchGestureEventListener
68         , virtual public Tizen::Ui::_IUiEventPreviewer
69         , virtual public Tizen::Base::Runtime::IEventListener
70 {
71 public:
72         virtual ~_Gallery(void);
73         static _Gallery* CreateGalleryN(_GalleryItemProviderAdaptorImpl* pGalleryItemProviderAdaptor);
74
75         // presenter access
76         result SetTextOfEmptyGallery(const Tizen::Base::String& text);
77         Tizen::Base::String GetTextOfEmptyGallery(void) const;
78         result SetBitmapOfEmptyGallery(const _GalleryBitmap* pBitmap);
79         result SetCoreEventListener(const _IGalleryCoreEventListener& coreEventListener);
80         result RemoveCoreEventListener(const _IGalleryCoreEventListener& coreEventListener);
81         result SetZoomingEnabled(bool enable);
82         bool IsZoomingEnabled(void) const;
83         result SetSlideShowType(_GallerySlideShowType slideShowType);
84         _GallerySlideShowType GetSlideShowType(void) const;
85         result SetSlideShowAnimationDuration(int duration);
86         int GetSlideShowAnimationDuration(void) const;
87         result SetSlideShowViewDuration(int duration);
88         int GetSlideShowViewDuration(void) const;
89         result StartSlideShow(bool repeat);
90         result StopSlideShow(void);
91         bool IsSlideShowStarted(void) const;
92
93         // model access
94         result SetCurrentItemIndex(int itemIndex);
95         int GetCurrentItemIndex(void) const;
96         int GetItemCount(void) const;
97         result RequestToLoadItem(int itemIndex);
98         result RequestToUnloadItem(int itemIndex);
99         result RequestToUnloadAllItems(void);
100         result RequestToUpdateItem(int itemIndex);
101         result RequestToUpdateAllItems(void);
102
103         // gesture
104         virtual bool OnFlickGestureDetected(_TouchFlickGestureDetector& gesture);
105         virtual bool OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture);
106         virtual bool OnTapGestureDetected(_TouchTapGestureDetector& gesture);
107         virtual bool OnTapGestureCanceled(_TouchTapGestureDetector& gesture);
108         virtual bool OnPinchGestureStarted(_TouchPinchGestureDetector& gesture);
109         virtual bool OnPinchGestureChanged(_TouchPinchGestureDetector& gesture);
110         virtual bool OnPinchGestureFinished(_TouchPinchGestureDetector& gesture);
111         virtual bool OnPinchGestureCanceled(_TouchPinchGestureDetector& gesture);
112
113         // Touch Event Callbacks
114         virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
115         virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
116         virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
117         virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
118
119         // Windowing Event Callbacks
120         virtual void OnDraw(void);
121         virtual void OnBoundsChanged(void);
122
123         // Font Callback
124         virtual void OnFontInfoRequested(unsigned long& style, int& size);
125         virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
126
127         void SetEffect(Tizen::Ui::Effects::Effect* pEffect);
128         Tizen::Ui::Effects::Effect* GetEffect(void);
129
130         virtual result OnAttachedToMainTree(void);
131
132         void ResizeGalleryAccessibilityElement(void);
133
134 private:
135         _Gallery(void);
136         result Construct(_GalleryItemProviderAdaptorImpl* pGalleryItemProviderAdaptor);
137
138         // Copy constructor
139         _Gallery(const _Gallery& rhs);
140         _Gallery& operator=(const _Gallery& rhs);
141
142         void SetRenderer(_GalleryRenderer& galleryRenderer)
143         {
144                 __pRenderer = &galleryRenderer;
145         }
146
147         _GalleryRenderer& GetRenderer(void)
148         {
149                 return *__pRenderer;
150         }
151
152         void SetPresenter(_GalleryPresenter& galleryPresenter)
153         {
154                 __pPresenter = &galleryPresenter;
155         }
156
157         _GalleryPresenter& GetPresenter(void) const
158         {
159                 return *__pPresenter;
160         }
161
162         void InitializeAccessibilityElement(void);
163         void AddGalleryAccessibilityElement(void);
164         void RemoveGalleryAccessibilityElements(void);
165
166 private:
167         _GalleryRenderer* __pRenderer;
168         _GalleryPresenter* __pPresenter;
169
170         _TouchFlickGestureDetector __flickGesture;
171         _TouchTapGestureDetector __oneTapGesture;
172         _TouchTapGestureDetector __twoTapGesture;
173         _TouchPinchGestureDetector __pinchGesture;
174
175         bool __modelInitialized;
176
177         Tizen::Ui::_AccessibilityElement* __pGalleryImageElement;
178 }; // _Gallery
179
180 }}}
181 #endif //_FUI_CTRL_INTERNAL_GALLERY_H_