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