1 | /* |
2 | * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * 1. Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. |
9 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. |
12 | * |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
23 | * THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ |
25 | |
26 | #ifndef WKBundlePageOverlay_h |
27 | #define WKBundlePageOverlay_h |
28 | |
29 | #include <WebKit/WKBase.h> |
30 | #include <WebKit/WKEvent.h> |
31 | #include <WebKit/WKGeometry.h> |
32 | |
33 | #ifndef __cplusplus |
34 | #include <stdbool.h> |
35 | #endif |
36 | |
37 | #include <stdint.h> |
38 | |
39 | #ifdef __cplusplus |
40 | extern "C" { |
41 | #endif |
42 | |
43 | // Page overlay client. |
44 | typedef void (*WKBundlePageOverlayWillMoveToPageCallback)(WKBundlePageOverlayRef pageOverlay, WKBundlePageRef page, const void* clientInfo); |
45 | typedef void (*WKBundlePageOverlayDidMoveToPageCallback)(WKBundlePageOverlayRef pageOverlay, WKBundlePageRef page, const void* clientInfo); |
46 | typedef void (*WKBundlePageOverlayDrawRectCallback)(WKBundlePageOverlayRef pageOverlay, void* graphicsContext, WKRect dirtyRect, const void* clientInfo); |
47 | typedef bool (*WKBundlePageOverlayMouseDownCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo); |
48 | typedef bool (*WKBundlePageOverlayMouseUpCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo); |
49 | typedef bool (*WKBundlePageOverlayMouseMovedCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, const void* clientInfo); |
50 | typedef bool (*WKBundlePageOverlayMouseDraggedCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo); |
51 | |
52 | typedef void* (*WKBundlePageOverlayActionContextForResultAtPointCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKBundleRangeHandleRef* rangeHandle, const void* clientInfo); |
53 | typedef void (*WKBundlePageOverlayDataDetectorsDidPresentUI)(WKBundlePageOverlayRef pageOverlay, const void* clientInfo); |
54 | typedef void (*WKBundlePageOverlayDataDetectorsDidChangeUI)(WKBundlePageOverlayRef pageOverlay, const void* clientInfo); |
55 | typedef void (*WKBundlePageOverlayDataDetectorsDidHideUI)(WKBundlePageOverlayRef pageOverlay, const void* clientInfo); |
56 | |
57 | typedef struct WKBundlePageOverlayClientBase { |
58 | int version; |
59 | const void * clientInfo; |
60 | } WKBundlePageOverlayClientBase; |
61 | |
62 | typedef struct WKBundlePageOverlayClientV0 { |
63 | WKBundlePageOverlayClientBase base; |
64 | |
65 | WKBundlePageOverlayWillMoveToPageCallback willMoveToPage; |
66 | WKBundlePageOverlayDidMoveToPageCallback didMoveToPage; |
67 | WKBundlePageOverlayDrawRectCallback drawRect; |
68 | WKBundlePageOverlayMouseDownCallback mouseDown; |
69 | WKBundlePageOverlayMouseUpCallback mouseUp; |
70 | WKBundlePageOverlayMouseMovedCallback mouseMoved; |
71 | WKBundlePageOverlayMouseDraggedCallback mouseDragged; |
72 | } WKBundlePageOverlayClientV0; |
73 | |
74 | typedef struct WKBundlePageOverlayClientV1 { |
75 | WKBundlePageOverlayClientBase base; |
76 | |
77 | WKBundlePageOverlayWillMoveToPageCallback willMoveToPage; |
78 | WKBundlePageOverlayDidMoveToPageCallback didMoveToPage; |
79 | WKBundlePageOverlayDrawRectCallback drawRect; |
80 | WKBundlePageOverlayMouseDownCallback mouseDown; |
81 | WKBundlePageOverlayMouseUpCallback mouseUp; |
82 | WKBundlePageOverlayMouseMovedCallback mouseMoved; |
83 | WKBundlePageOverlayMouseDraggedCallback mouseDragged; |
84 | |
85 | WKBundlePageOverlayActionContextForResultAtPointCallback actionContextForResultAtPoint; |
86 | WKBundlePageOverlayDataDetectorsDidPresentUI dataDetectorsDidPresentUI; |
87 | WKBundlePageOverlayDataDetectorsDidChangeUI dataDetectorsDidChangeUI; |
88 | WKBundlePageOverlayDataDetectorsDidHideUI dataDetectorsDidHideUI; |
89 | } WKBundlePageOverlayClientV1; |
90 | |
91 | typedef WKTypeRef (*WKAccessibilityAttributeValueCallback)(WKBundlePageOverlayRef pageOverlay, WKStringRef attribute, WKTypeRef parameter, const void* clientInfo); |
92 | typedef WKArrayRef (*WKAccessibilityAttributeNamesCallback)(WKBundlePageOverlayRef pageOverlay, bool parameterizedNames, const void* clientInfo); |
93 | |
94 | typedef struct WKBundlePageOverlayAccessibilityClientBase { |
95 | int version; |
96 | const void * clientInfo; |
97 | } WKBundlePageOverlayAccessibilityClientBase; |
98 | |
99 | typedef struct WKBundlePageOverlayAccessibilityClientV0 { |
100 | WKBundlePageOverlayAccessibilityClientBase base; |
101 | |
102 | // Version 0. |
103 | WKAccessibilityAttributeValueCallback copyAccessibilityAttributeValue; |
104 | WKAccessibilityAttributeNamesCallback copyAccessibilityAttributeNames; |
105 | } WKBundlePageOverlayAccessibilityClientV0; |
106 | |
107 | WK_EXPORT WKTypeID WKBundlePageOverlayGetTypeID(); |
108 | |
109 | WK_EXPORT WKBundlePageOverlayRef WKBundlePageOverlayCreate(WKBundlePageOverlayClientBase* client); |
110 | WK_EXPORT void WKBundlePageOverlaySetNeedsDisplay(WKBundlePageOverlayRef bundlePageOverlay, WKRect rect); |
111 | WK_EXPORT float WKBundlePageOverlayFractionFadedIn(WKBundlePageOverlayRef bundlePageOverlay); |
112 | WK_EXPORT void WKBundlePageOverlaySetAccessibilityClient(WKBundlePageOverlayRef bundlePageOverlay, WKBundlePageOverlayAccessibilityClientBase* client); |
113 | WK_EXPORT void WKBundlePageOverlayClear(WKBundlePageOverlayRef bundlePageOverlay); |
114 | |
115 | #ifdef __cplusplus |
116 | } |
117 | #endif |
118 | |
119 | #endif // WKBundlePageOverlay_h |
120 | |