Tizen 2.1 base
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / tizen / Pan.h
1 /*
2  * Copyright (C) 2012 Samsung Electronics
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef Pan_h
21 #define Pan_h
22
23 #include <Ecore.h>
24 #include <Eina.h>
25 #include <Evas.h>
26 #include <WebCore/IntPoint.h>
27 #include <wtf/OwnPtr.h>
28 #include <wtf/PassOwnPtr.h>
29
30 #if ENABLE(TIZEN_GESTURE_FEATURE)
31 #include "SmoothAlgorithm.h"
32 #endif
33
34 class EwkViewImpl;
35
36 class Pan {
37 public:
38     static PassOwnPtr<Pan> create(Evas_Object* ewkView)
39     {
40         return adoptPtr(new Pan(ewkView));
41     }
42     ~Pan();
43
44     void start(const WebCore::IntPoint&);
45     void update(const WebCore::IntPoint&);
46     void stop();
47
48 private:
49     static Eina_Bool panAnimatorCallback(void*);
50 #if ENABLE(TIZEN_GESTURE_FEATURE)
51     static void onMouseDown(void* data, Evas*, Evas_Object*, void* eventInfo);
52     static void onMouseMove(void* data, Evas*, Evas_Object*, void* eventInfo);
53
54     void mouseDown(Evas_Event_Mouse_Down*);
55     void mouseMove(Evas_Event_Mouse_Move*);
56 #endif
57
58 private:
59     Pan(Evas_Object*);
60     void process();
61
62     Evas_Object* m_ewkView;
63     EwkViewImpl* m_viewImpl;
64     Ecore_Animator* m_panAnimator;
65     WebCore::IntPoint m_lastPoint;
66     WebCore::IntPoint m_currentPoint;
67 #if ENABLE(TIZEN_GESTURE_FEATURE)
68     OwnPtr<SmoothAlgorithm> m_smoothAlgorithm;
69 #endif
70 };
71
72 #endif // Pan_h