Tizen 2.1 base
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / tizen / Zoom.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 program 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 program; 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 Zoom_h
21 #define Zoom_h
22
23 #include <Ecore.h>
24 #include <Evas.h>
25 #include <WebCore/IntPoint.h>
26 #include <wtf/PassOwnPtr.h>
27
28 class Zoom {
29 public:
30     static PassOwnPtr<Zoom> create(Evas_Object* viewWidget)
31     {
32         return adoptPtr(new Zoom(viewWidget));
33     }
34     ~Zoom();
35
36     void start(const WebCore::IntPoint& centerPoint, const WebCore::IntPoint& viewLocation);
37     void update(const double zoom, const WebCore::IntPoint& centerPoint);
38     void stop();
39
40 private:
41     static const int s_zoomCenterDistanceSquareThreshold = 1;
42     static const double s_scaleFactorThreshold;
43
44     static Eina_Bool zoomAnimatorCallback(void*);
45
46 private:
47     Zoom(Evas_Object* viewWidget);
48     void realStop();
49     void process();
50
51     Evas_Object* m_viewWidget;
52     bool m_isZooming;
53     bool m_isZoomInformationUpdated;
54     double m_baseScaleFactor;
55     double m_newScaleFactor;
56     double m_currentScaleFactor;
57     WebCore::IntPoint m_baseScrollPosition;
58     WebCore::IntPoint m_newScrollPosition;
59     WebCore::IntPoint m_basisPoint;
60     WebCore::IntPoint m_centerPoint;
61     WebCore::IntPoint m_viewLocation;
62     Ecore_Animator* m_zoomAnimator;
63 };
64
65 #endif // Zoom_h