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