cd30e48aca29e190921c6243723ea102b0787970
[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
40 struct WKViewClient {
41     int                                              version;
42     const void*                                      clientInfo;
43
44     // Version 0
45     WKViewViewNeedsDisplayCallback                   viewNeedsDisplay;
46     WKViewPageDidChangeContentsSizeCallback          didChangeContentsSize;
47     WKViewWebProcessCrashedCallback                  webProcessCrashed;
48     WKViewCallback                                   webProcessDidRelaunch;
49     WKViewPageDidChangeContentsPositionCallback      didChangeContentsPosition;
50     WKViewPageDidRenderFrameCallback                 didRenderFrame;
51     WKViewCallback                                   didCompletePageTransition;
52     WKViewPageDidChangeViewportAttributesCallback    didChangeViewportAttributes;
53     WKViewPageDidChangeTooltipCallback               didChangeTooltip;
54 };
55 typedef struct WKViewClient WKViewClient;
56
57 enum { kWKViewClientCurrentVersion = 0 };
58
59 WK_EXPORT WKViewRef WKViewCreate(WKContextRef context, WKPageGroupRef pageGroup);
60
61 WK_EXPORT void WKViewInitialize(WKViewRef);
62
63 WK_EXPORT WKSize WKViewGetSize(WKViewRef);
64 WK_EXPORT void WKViewSetSize(WKViewRef, WKSize size);
65
66 WK_EXPORT void WKViewSetViewClient(WKViewRef, const WKViewClient*);
67
68 WK_EXPORT bool WKViewIsFocused(WKViewRef);
69 WK_EXPORT void WKViewSetIsFocused(WKViewRef, bool);
70
71 WK_EXPORT bool WKViewIsVisible(WKViewRef);
72 WK_EXPORT void WKViewSetIsVisible(WKViewRef, bool);
73
74 WK_EXPORT float WKViewGetContentScaleFactor(WKViewRef);
75 WK_EXPORT void WKViewSetContentScaleFactor(WKViewRef, float);
76
77 WK_EXPORT WKPoint WKViewGetContentPosition(WKViewRef);
78 WK_EXPORT void WKViewSetContentPosition(WKViewRef, WKPoint);
79
80 WK_EXPORT void WKViewSetUserViewportTranslation(WKViewRef, double tx, double ty);
81 WK_EXPORT WKPoint WKViewUserViewportToContents(WKViewRef, WKPoint);
82 WK_EXPORT WKPoint WKViewUserViewportToScene(WKViewRef, WKPoint);
83 WK_EXPORT WKPoint WKViewContentsToUserViewport(WKViewRef, WKPoint);
84
85 WK_EXPORT void WKViewPaintToCurrentGLContext(WKViewRef);
86
87 WK_EXPORT WKPageRef WKViewGetPage(WKViewRef);
88
89 WK_EXPORT void WKViewSetDrawsBackground(WKViewRef, bool);
90 WK_EXPORT bool WKViewGetDrawsBackground(WKViewRef);
91
92 WK_EXPORT void WKViewSetDrawsTransparentBackground(WKViewRef, bool);
93 WK_EXPORT bool WKViewGetDrawsTransparentBackground(WKViewRef);
94
95 WK_EXPORT void WKViewSuspendActiveDOMObjectsAndAnimations(WKViewRef);
96 WK_EXPORT void WKViewResumeActiveDOMObjectsAndAnimations(WKViewRef);
97
98 WK_EXPORT void WKViewSetShowsAsSource(WKViewRef, bool);
99 WK_EXPORT bool WKViewGetShowsAsSource(WKViewRef);
100
101 WK_EXPORT bool WKViewExitFullScreen(WKViewRef);
102
103 WK_EXPORT void WKViewSetOpacity(WKViewRef view, double opacity);
104 WK_EXPORT double WKViewOpacity(WKViewRef view);
105
106 #ifdef __cplusplus
107 }
108 #endif
109
110 #endif /* WKView_h */