[Tizen][dev] Fix TV build
[platform/framework/web/chromium-efl.git] / tizen_src / impl / browser / motion / MotionUI.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 MotionUI_h
21 #define MotionUI_h
22
23 #include <Ecore.h>
24 #include <Ecore_Evas.h>
25 #ifndef TIZEN_LEGACY_V_2_2_1
26 #include <sensor/sensor.h>
27 #else
28 #include <sensors.h>
29 #endif
30
31
32 class MotionUI {
33  public:
34   static MotionUI& motionUI();
35   ~MotionUI();
36
37   void setTiltToZoom(Evas_Object*, bool, unsigned int);
38
39   void initializeTiltToZoom(Evas_Object*, const Evas_Coord_Point*);
40   void stopTiltToZoom();
41   bool isTiltToZoomStarted();
42
43   void updateTiltPosition(Evas_Coord_Point* position);
44   void scaleInitialize(double scale);
45   double syncScale(double scale, bool isTiltMode);
46
47  private:
48   static Eina_Bool initializeSensor(void*);
49   static void tiltCallback(unsigned long long, int, int, void*);
50   MotionUI();
51
52   void startSensor();
53   void stopSensor();
54
55   void tiltToZoom();
56
57   static unsigned int s_tiltToZoomStartAngle;
58
59   Eina_Hash* m_tiltViewHash;
60
61   sensor_h m_sensorHandle;
62   Ecore_Timer* m_sensorTimer;
63
64   Evas_Object* m_ewkView;
65   Evas_Coord_Point m_tiltPosition;
66   bool m_isTiltToZoomStarted;
67   int m_tiltAngle;
68
69   //Sync for pinch zoom
70   double m_syncScale;
71   double m_lastTiltScale;
72   double m_lastPinchScale;
73   double tiltBaseScaleFactor;
74   double tiltScaleFactorUnit;
75 };
76
77 #endif // MotionUI_h