2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
17 #ifndef _FUI_CTRL_INTERNAL_GALLERY_VIEW_EVENT_HANDLER_H_
18 #define _FUI_CTRL_INTERNAL_GALLERY_VIEW_EVENT_HANDLER_H_
20 #include <FBaseObject.h>
21 #include <FGrpPoint.h>
22 #include "FUiCtrl_GalleryTypes.h"
23 #include "FUiCtrl_IGalleryRendererNotiListener.h"
25 namespace Tizen { namespace Graphics {
31 namespace Tizen { namespace Ui { namespace Controls {
35 FLICK_DIRECTION_NONE = 0,
40 class _GalleryImageReader;
42 class _GalleryPresenter;
43 class _GalleryViewEventInfo;
44 class _IGalleryRenderer;
46 class _GalleryViewEventHandler
47 : public Tizen::Base::Object
48 , public _IGalleryRendererNotiListener
49 , virtual public Tizen::Base::Runtime::IEventListener
52 _GalleryViewEventHandler(_GalleryPresenter& galleryPresenter, _IGalleryRenderer& galleryRenderer, _GalleryImageReader& galleryModel);
53 virtual ~_GalleryViewEventHandler(void);
55 result Construct(void);
57 bool OnTouchPressed(_GalleryViewEventInfo& eventInfo);
58 bool OnTouchDoublePressed(_GalleryViewEventInfo& eventInfo);
59 bool OnTouchReleased(_GalleryViewEventInfo& eventInfo);
60 bool OnTouchPinchZoom(_GalleryViewEventInfo& eventInfo);
61 bool OnTouchMoved(_GalleryViewEventInfo& eventInfo);
62 bool OnTouchFlicked(_GalleryViewEventInfo& eventInfo);
65 virtual void OnTransitionCancel(void);
66 virtual void OnTransitionCompleted(void);
67 virtual void OnCanvasAnimationCancel(void);
68 virtual void OnCanvasAnimationCompleted(void);
69 virtual void OnCanvasAnimationStarted(void);
71 void SetZoomFlag(bool zoomMode);
72 bool IsZoomFlag(void) const;
73 result SetVisibleCanvas(void);
74 result AlignCanvas(bool animation = true);
75 bool CorrectCanvasPosition(Tizen::Graphics::Rectangle& canvasBounds, const Tizen::Graphics::Rectangle& imageBounds);
78 _GalleryViewEventHandler(const _GalleryViewEventHandler& rhs);
79 _GalleryViewEventHandler& operator=(const _GalleryViewEventHandler& rhs);
81 result RefreshView(void);
83 result SetInvisibleCanvas(void);
85 result FlickToTheRight(void);
86 result FlickToTheLeft(void);
88 result ZoomCanvas(int distance, const Tizen::Graphics::Point& center, bool zoomIn, _GalleryAnimationTiming* pAnimation = null);
89 result PinchZoomCanvas(int area, const Tizen::Graphics::Point& center, bool zoomIn);
90 result MoveCanvas(const Tizen::Graphics::Dimension& distance, _GalleryAnimationTiming* pAnimation = null);
92 void SetRollbackCanvas(void);
93 int CalculateRound(float value);
94 result SetCurrentItemIndex(int index);
95 result CallChangeItemIndex(void);
98 _GalleryPresenter& __galleryPresenter;
99 _IGalleryRenderer& __galleryRenderer;
100 _GalleryImageReader& __galleryImageReader;
101 Tizen::Graphics::Point __previousPosition;
102 Tizen::Graphics::Point __startPinchCenterPosition;
103 FlickDirection __flickingDirection;
104 int __pinchInitialArea;
108 bool __zoomAnimationComplete;
110 unsigned long __touchPointId;
111 int __currentItemIndex;
112 }; // _GalleryViewEventHandler
114 }}} // Tizen::Ui::Controls
116 #endif // _FUI_CTRL_INTERNAL_GALLERY_VIEW_EVENT_HANDLER_H_