Tizen 2.1 base
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / tizen / SmartZoom.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 SmartZoom_h
21 #define SmartZoom_h
22
23 #include <Ecore.h>
24 #include <Evas.h>
25 #include <WebCore/IntPoint.h>
26 #include <WebCore/IntRect.h>
27 #include <wtf/PassOwnPtr.h>
28
29 class EwkViewImpl;
30
31 class SmartZoom {
32 public:
33     static PassOwnPtr<SmartZoom> create(Evas_Object* viewWidget)
34     {
35         return adoptPtr(new SmartZoom(viewWidget));
36     }
37     ~SmartZoom();
38
39     void start(int x, int y);
40     void setZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
41     void stop();
42
43 private:
44     static const int s_numberOfCosineValue = 17;
45     static const float s_cosine[s_numberOfCosineValue];
46     static const int s_xMargin = 1;
47     static const int s_widthMargin = 4;
48
49     static Eina_Bool scaleAnimatorCallback(void*);
50
51 private:
52     SmartZoom(Evas_Object*);
53     bool process();
54
55     Evas_Object* m_viewWidget;
56     EwkViewImpl* m_viewImpl;
57     Ecore_Animator* m_scaleAnimator;
58     double m_baseScaleFactor;
59     double m_newScaleFactor;
60     double m_targetScaleFactor;
61     WebCore::IntPoint m_basisPoint;
62     WebCore::IntPoint m_baseScrollPosition;
63     int m_scaleIndex;
64     bool m_isStarted;
65 };
66
67 #endif // SmartZoom_h