[WK2] Share Qt port's codes to find zoomable area with CoordinatedGraphics.
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / C / CoordinatedGraphics / WKView.h
1 /*
2  * Copyright (C) 2012 Samsung Electronics
3  * Copyright (C) 2013 Intel Corporation. All rights reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this program; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef WKView_h
22 #define WKView_h
23
24 #include <WebKit2/WKBase.h>
25 #include <WebKit2/WKGeometry.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 typedef void (*WKViewCallback)(WKViewRef view, const void* clientInfo);
32 typedef void (*WKViewViewNeedsDisplayCallback)(WKViewRef view, WKRect area, const void* clientInfo);
33 typedef void (*WKViewPageDidChangeContentsSizeCallback)(WKViewRef view, WKSize size, const void* clientInfo);
34 typedef void (*WKViewWebProcessCrashedCallback)(WKViewRef view, WKURLRef url, const void* clientInfo);
35 typedef void (*WKViewPageDidChangeContentsPositionCallback)(WKViewRef view, WKPoint position, const void* clientInfo);
36 typedef void (*WKViewPageDidRenderFrameCallback)(WKViewRef view, WKSize contentsSize, WKRect coveredRect, const void* clientInfo);
37 typedef void (*WKViewPageDidChangeViewportAttributesCallback)(WKViewRef view, WKViewportAttributesRef, const void* clientInfo);
38 typedef void (*WKViewPageDidChangeTooltipCallback)(WKViewRef view, WKStringRef newTooltip, const void* clientInfo);
39 typedef void (*WKViewDidFindZoomableAreaCallback)(WKViewRef view, WKPoint point, WKRect area, const void* clientInfo);
40
41 struct WKViewClient {
42     int                                              version;
43     const void*                                      clientInfo;
44
45     // Version 0
46     WKViewViewNeedsDisplayCallback                   viewNeedsDisplay;
47     WKViewPageDidChangeContentsSizeCallback          didChangeContentsSize;
48     WKViewWebProcessCrashedCallback                  webProcessCrashed;
49     WKViewCallback                                   webProcessDidRelaunch;
50     WKViewPageDidChangeContentsPositionCallback      didChangeContentsPosition;
51     WKViewPageDidRenderFrameCallback                 didRenderFrame;
52     WKViewCallback                                   didCompletePageTransition;
53     WKViewPageDidChangeViewportAttributesCallback    didChangeViewportAttributes;
54     WKViewPageDidChangeTooltipCallback               didChangeTooltip;
55     WKViewDidFindZoomableAreaCallback                didFindZoomableArea;
56 };
57 typedef struct WKViewClient WKViewClient;
58
59 enum { kWKViewClientCurrentVersion = 0 };
60
61 WK_EXPORT WKViewRef WKViewCreate(WKContextRef context, WKPageGroupRef pageGroup);
62
63 WK_EXPORT void WKViewInitialize(WKViewRef);
64
65 WK_EXPORT WKSize WKViewGetSize(WKViewRef);
66 WK_EXPORT void WKViewSetSize(WKViewRef, WKSize size);
67
68 WK_EXPORT void WKViewSetViewClient(WKViewRef, const WKViewClient*);
69
70 WK_EXPORT bool WKViewIsFocused(WKViewRef);
71 WK_EXPORT void WKViewSetIsFocused(WKViewRef, bool);
72
73 WK_EXPORT bool WKViewIsVisible(WKViewRef);
74 WK_EXPORT void WKViewSetIsVisible(WKViewRef, bool);
75
76 WK_EXPORT float WKViewGetContentScaleFactor(WKViewRef);
77 WK_EXPORT void WKViewSetContentScaleFactor(WKViewRef, float);
78
79 WK_EXPORT WKPoint WKViewGetContentPosition(WKViewRef);
80 WK_EXPORT void WKViewSetContentPosition(WKViewRef, WKPoint);
81
82 WK_EXPORT void WKViewSetUserViewportTranslation(WKViewRef, double tx, double ty);
83 WK_EXPORT WKPoint WKViewUserViewportToContents(WKViewRef, WKPoint);
84 WK_EXPORT WKPoint WKViewUserViewportToScene(WKViewRef, WKPoint);
85 WK_EXPORT WKPoint WKViewContentsToUserViewport(WKViewRef, WKPoint);
86
87 WK_EXPORT void WKViewPaintToCurrentGLContext(WKViewRef);
88
89 WK_EXPORT WKPageRef WKViewGetPage(WKViewRef);
90
91 WK_EXPORT void WKViewSetDrawsBackground(WKViewRef, bool);
92 WK_EXPORT bool WKViewGetDrawsBackground(WKViewRef);
93
94 WK_EXPORT void WKViewSetDrawsTransparentBackground(WKViewRef, bool);
95 WK_EXPORT bool WKViewGetDrawsTransparentBackground(WKViewRef);
96
97 WK_EXPORT void WKViewSuspendActiveDOMObjectsAndAnimations(WKViewRef);
98 WK_EXPORT void WKViewResumeActiveDOMObjectsAndAnimations(WKViewRef);
99
100 WK_EXPORT void WKViewSetShowsAsSource(WKViewRef, bool);
101 WK_EXPORT bool WKViewGetShowsAsSource(WKViewRef);
102
103 WK_EXPORT bool WKViewExitFullScreen(WKViewRef);
104
105 WK_EXPORT void WKViewSetOpacity(WKViewRef view, double opacity);
106 WK_EXPORT double WKViewOpacity(WKViewRef view);
107
108 WK_EXPORT void WKViewFindZoomableAreaForRect(WKViewRef, WKRect);
109
110 #ifdef __cplusplus
111 }
112 #endif
113
114 #endif /* WKView_h */