2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FWebCtrl_Web.h
20 * @brief The file contains the declaration of _Web class.
22 * The file contains the declaration of _Web class.
24 #ifndef _FWEB_CTRL_INTERNAL_WEB_H_
25 #define _FWEB_CTRL_INTERNAL_WEB_H_
27 #include <unique_ptr.h>
29 #include <FBaseColIListT.h>
30 #include <FUi_Control.h>
31 #include <FUi_ITouchFlickGestureEventListener.h>
32 #include <FUi_ITouchLongPressGestureEventListener.h>
33 #include <FUi_ITouchPinchGestureEventListener.h>
34 #include <FUi_ITouchTapGestureEventListener.h>
35 #include <FUiAnim_IVisualElementCaptureProvider.h>
37 namespace Tizen { namespace Ui
39 class _AccessibilityElement;
43 namespace Tizen { namespace Ui { namespace Animations
46 }}} // Tizen::Ui::Animations
48 namespace Tizen { namespace Graphics
56 namespace Tizen { namespace Web { namespace Controls
59 class _WebSettingImpl;
60 class _TapGestureState;
61 class _PanningGestureState;
62 class _FlickGestureState;
63 class _PinchGestureState;
64 class _WebAccessibilityListener;
65 class _WebAccessibilityFocusHandler;
71 WEB_GESTURE_TYPE_PANNING,
72 WEB_GESTURE_TYPE_FLICK,
73 WEB_GESTURE_TYPE_PINCH
79 WEB_EDGE_LEFT = 1 << 1,
80 WEB_EDGE_RIGHT = 1 << 2,
81 WEB_EDGE_TOP = 1 << 3,
82 WEB_EDGE_BOTTOM = 1 << 4,
86 : public Tizen::Ui::_Control
87 , public Tizen::Ui::_ITouchFlickGestureEventListener
88 , public Tizen::Ui::_ITouchLongPressGestureEventListener
89 , public Tizen::Ui::_ITouchPinchGestureEventListener
90 , public Tizen::Ui::_ITouchTapGestureEventListener
91 , public Tizen::Ui::Animations::_IVisualElementCaptureProvider
92 , virtual public Tizen::Base::Runtime::IEventListener
93 , virtual public Tizen::Ui::_IUiEventListener
94 , virtual public Tizen::Ui::_IUiEventPreviewer
95 , virtual public Tizen::Ui::_ITouchGestureEventListener
102 static _Web* CreateWebN(void);
104 result InitializeWebNativeNode(void);
106 Evas_Object* GetWebNativeNode(void);
108 void ChangeGesture(_WebGestureType type);
110 Tizen::Graphics::Point GetAbsoluteCoordinate(Tizen::Graphics::Point relativePoint);
111 Tizen::Graphics::FloatPoint GetAbsoluteCoordinate(Tizen::Graphics::FloatPoint relativePoint);
113 Tizen::Graphics::Point GetRelativeCoordinate(Tizen::Graphics::Point absolutePoint);
114 Tizen::Graphics::FloatPoint GetRelativeCoordinate(Tizen::Graphics::FloatPoint absolutePoint);
116 WebSetting* GetSetting(void) const;
118 _EflWebkit* GetEflWebkit(void) const;
120 Tizen::Graphics::FloatPoint GetTouchPosition(void) const;
122 void SetEdgeReachedEvent(_WebEdgeType type);
124 void SetFullScreenEntered(bool isFullScreenEntered);
126 void SetFocusEnd(bool focus);
128 bool IsFocusEnd(void) const;
130 bool CanOutOfEdgeLeft(float scrollDistanceX, int pageDistance);
131 bool CanOutOfEdgeRight(float scrollDistanceX, int pageDistance);
132 bool CanOutOfEdgeTop(float scrollDistanceY, int pageDistance);
133 bool CanOutOfEdgeBottom(float scrollDistanceY, int pageDistance);
134 bool CanConsumeTouchMoved(float scrollDistanceX, float scrollDistanceY);
135 virtual result OnAttaching(const _Control* pParent);
136 virtual result OnBoundsChanging(const Tizen::Graphics::Rectangle& bounds);
137 virtual void OnBoundsChanged(void);
138 virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
140 virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
141 virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
142 virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
143 virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
145 virtual bool OnPinchGestureStarted(Tizen::Ui::_TouchPinchGestureDetector& gesture);
146 virtual bool OnPinchGestureChanged(Tizen::Ui::_TouchPinchGestureDetector& gesture);
147 virtual bool OnPinchGestureFinished(Tizen::Ui::_TouchPinchGestureDetector& gesture);
148 virtual bool OnPinchGestureCanceled(Tizen::Ui::_TouchPinchGestureDetector& gesture);
150 virtual bool OnFlickGestureDetected(Tizen::Ui::_TouchFlickGestureDetector& gesture);
151 virtual bool OnFlickGestureCanceled(Tizen::Ui::_TouchFlickGestureDetector& gesture);
153 virtual bool OnLongPressGestureDetected(Tizen::Ui::_TouchLongPressGestureDetector& gesture);
154 virtual bool OnLongPressGestureCanceled(Tizen::Ui::_TouchLongPressGestureDetector& gesture);
156 virtual bool OnTapGestureDetected(Tizen::Ui::_TouchTapGestureDetector& gesture);
157 virtual bool OnTapGestureCanceled(Tizen::Ui::_TouchTapGestureDetector& gesture);
159 virtual Tizen::Graphics::Canvas* OnCanvasRequestedN(const Tizen::Graphics::FloatRectangle& size);
160 virtual Tizen::Graphics::Bitmap* OnCapturedBitmapRequestedN(void);
161 virtual bool OnCaptureAcquire(Tizen::Graphics::BufferInfo& output);
162 virtual void OnCaptureReleased(void) {};
164 virtual bool OnKeyPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_KeyInfo& keyInfo);
165 virtual bool OnKeyReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_KeyInfo& keyInfo);
166 virtual void OnDrawFocus(void);
167 virtual bool OnFocusLost(const Tizen::Ui::_Control& source);
170 _Web(const _Web& value);
172 _Web& operator =(const _Web& value);
174 result CreateWebkitEvasObject(void);
176 result InitializeGestureStates(void);
177 result AddGestureListeners(void);
178 void RemoveGestureListener(void);
180 void SendTouchEventForJavaScript(const Tizen::Ui::_TouchInfo& touchInfo);
181 void SendTouchEventForJavaScriptWithTouchInfo(const Tizen::Ui::_TouchInfo& touchInfo);
183 Ewk_Touch_Event_Type GetEwkTouchEvent(Tizen::Ui::_TouchStatus touchStatus);
184 Evas_Touch_Point_State GetEvasTouchState(Tizen::Ui::TouchStatus touchStatus);
187 Tizen::Ui::_ITouchEventListener* __pGestureHandler;
189 std::unique_ptr<_EflWebkit> __pEflWebkit;
191 std::unique_ptr<WebSetting> __pWebSetting;
193 std::unique_ptr<Tizen::Ui::_TouchFlickGestureDetector> __pGestureFlick;
195 std::unique_ptr<Tizen::Ui::_TouchLongPressGestureDetector> __pGestureLongPress;
197 std::unique_ptr<Tizen::Ui::_TouchPinchGestureDetector> __pGesturePinch;
199 std::unique_ptr<Tizen::Ui::_TouchTapGestureDetector> __pGestureDoubleTap;
201 std::unique_ptr<Tizen::Base::Collection::IListT<Tizen::Ui::_TouchInfo*> > __pTouchEventInfoList;
203 std::unique_ptr<_TapGestureState> __pTapGestureHandler;
205 std::unique_ptr<_PanningGestureState> __pPanningGestureHandler;
207 std::unique_ptr<_FlickGestureState> __pFlickGestureHandler;
209 std::unique_ptr<_PinchGestureState> __pPinchGestureHandler;
211 std::unique_ptr<_WebAccessibilityListener> __pWebAccessibilityListener;
213 std::unique_ptr<_WebAccessibilityFocusHandler> __pWebAccessibilityFocusHandler;
215 _WebGestureType __gestureType;
221 Tizen::Ui::_AccessibilityElement* __pTextElement;
223 Tizen::Graphics::FloatPoint __previousTouchedPosition;
225 bool __isFullScreenEntered;
232 }}} // Tizen::Web::Controls
233 #endif // _FWEB_CTRL_INTERNAL_WEB_H_