1/*
2 * Copyright (C) 2012 Igalia S.L.
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 library 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 library; 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#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) && !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__)
21#error "Only <webkit2/webkit2.h> can be included directly."
22#endif
23
24#ifndef WebKitHitTestResult_h
25#define WebKitHitTestResult_h
26
27#include <glib-object.h>
28#include <webkit2/WebKitDefines.h>
29
30G_BEGIN_DECLS
31
32#define WEBKIT_TYPE_HIT_TEST_RESULT (webkit_hit_test_result_get_type())
33#define WEBKIT_HIT_TEST_RESULT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_HIT_TEST_RESULT, WebKitHitTestResult))
34#define WEBKIT_IS_HIT_TEST_RESULT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_HIT_TEST_RESULT))
35#define WEBKIT_HIT_TEST_RESULT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_HIT_TEST_RESULT, WebKitHitTestResultClass))
36#define WEBKIT_IS_HIT_TEST_RESULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_HIT_TEST_RESULT))
37#define WEBKIT_HIT_TEST_RESULT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_HIT_TEST_RESULT, WebKitHitTestResultClass))
38
39typedef struct _WebKitHitTestResult WebKitHitTestResult;
40typedef struct _WebKitHitTestResultClass WebKitHitTestResultClass;
41typedef struct _WebKitHitTestResultPrivate WebKitHitTestResultPrivate;
42
43/**
44 * WebKitHitTestResultContext:
45 * @WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT: anywhere in the document.
46 * @WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK: a hyperlink element.
47 * @WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE: an image element.
48 * @WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA: a video or audio element.
49 * @WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE: an editable element
50 * @WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR: a scrollbar element.
51 * @WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION: a selected element. Since 2.8
52 *
53 * Enum values with flags representing the context of a #WebKitHitTestResult.
54 */
55typedef enum
56{
57 WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT = 1 << 1,
58 WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK = 1 << 2,
59 WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE = 1 << 3,
60 WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA = 1 << 4,
61 WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE = 1 << 5,
62 WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR = 1 << 6,
63 WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION = 1 << 7
64} WebKitHitTestResultContext;
65
66struct _WebKitHitTestResult {
67 GObject parent;
68
69 WebKitHitTestResultPrivate *priv;
70};
71
72struct _WebKitHitTestResultClass {
73 GObjectClass parent_class;
74
75 void (*_webkit_reserved0) (void);
76 void (*_webkit_reserved1) (void);
77 void (*_webkit_reserved2) (void);
78 void (*_webkit_reserved3) (void);
79};
80
81WEBKIT_API GType
82webkit_hit_test_result_get_type (void);
83
84WEBKIT_API guint
85webkit_hit_test_result_get_context (WebKitHitTestResult *hit_test_result);
86
87WEBKIT_API gboolean
88webkit_hit_test_result_context_is_link (WebKitHitTestResult *hit_test_result);
89
90WEBKIT_API gboolean
91webkit_hit_test_result_context_is_image (WebKitHitTestResult *hit_test_result);
92
93WEBKIT_API gboolean
94webkit_hit_test_result_context_is_media (WebKitHitTestResult *hit_test_result);
95
96WEBKIT_API gboolean
97webkit_hit_test_result_context_is_editable (WebKitHitTestResult *hit_test_result);
98
99WEBKIT_API gboolean
100webkit_hit_test_result_context_is_selection (WebKitHitTestResult *hit_test_result);
101
102WEBKIT_API const gchar *
103webkit_hit_test_result_get_link_uri (WebKitHitTestResult *hit_test_result);
104
105WEBKIT_API const gchar *
106webkit_hit_test_result_get_link_title (WebKitHitTestResult *hit_test_result);
107
108WEBKIT_API const gchar *
109webkit_hit_test_result_get_link_label (WebKitHitTestResult *hit_test_result);
110
111WEBKIT_API const gchar *
112webkit_hit_test_result_get_image_uri (WebKitHitTestResult *hit_test_result);
113
114WEBKIT_API const gchar *
115webkit_hit_test_result_get_media_uri (WebKitHitTestResult *hit_test_result);
116
117WEBKIT_API gboolean
118webkit_hit_test_result_context_is_scrollbar (WebKitHitTestResult *hit_test_result);
119
120G_END_DECLS
121
122#endif
123