File: WebKitInputMethodContext.h.in

package info (click to toggle)
webkit2gtk 2.48.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 429,764 kB
  • sloc: cpp: 3,697,587; javascript: 194,444; ansic: 169,997; python: 46,499; asm: 19,295; ruby: 18,528; perl: 16,602; xml: 4,650; yacc: 2,360; sh: 2,098; java: 1,993; lex: 1,327; pascal: 366; makefile: 298
file content (254 lines) | stat: -rw-r--r-- 11,499 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/*
 * Copyright (C) 2012 Igalia S.L.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

@API_SINGLE_HEADER_CHECK@

#ifndef WebKitInputMethodContext_h
#define WebKitInputMethodContext_h

#include <glib-object.h>
#include <@API_INCLUDE_PREFIX@/WebKitDefines.h>

#if PLATFORM(GTK)
#include <gdk/gdk.h>
#elif PLATFORM(WPE)
#include <wpe/WebKitColor.h>
#include <wpe/wpe.h>
#endif

G_BEGIN_DECLS

#define WEBKIT_TYPE_INPUT_METHOD_UNDERLINE          (webkit_input_method_underline_get_type())
#define WEBKIT_TYPE_INPUT_METHOD_CONTEXT            (webkit_input_method_context_get_type())
#if !ENABLE(2022_GLIB_API)
#define WEBKIT_INPUT_METHOD_CONTEXT(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_INPUT_METHOD_CONTEXT, WebKitInputMethodContext))
#define WEBKIT_INPUT_METHOD_CONTEXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_INPUT_METHOD_CONTEXT, WebKitInputMethodContextClass))
#define WEBKIT_IS_INPUT_METHOD_CONTEXT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_INPUT_METHOD_CONTEXT))
#define WEBKIT_IS_INPUT_METHOD_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_INPUT_METHOD_CONTEXT))
#define WEBKIT_INPUT_METHOD_CONTEXT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_INPUT_METHOD_CONTEXT, WebKitInputMethodContextClass))
#endif

WEBKIT_DECLARE_DERIVABLE_TYPE (WebKitInputMethodContext, webkit_input_method_context, WEBKIT, INPUT_METHOD_CONTEXT, GObject)

/**
 * WebKitInputPurpose:
 * @WEBKIT_INPUT_PURPOSE_FREE_FORM: Editable element expects any characters
 * @WEBKIT_INPUT_PURPOSE_DIGITS: Editable element expects digits
 * @WEBKIT_INPUT_PURPOSE_NUMBER: Editable element expects a number
 * @WEBKIT_INPUT_PURPOSE_PHONE: Editable element expects a telephone
 * @WEBKIT_INPUT_PURPOSE_URL: Editable element expects a URL
 * @WEBKIT_INPUT_PURPOSE_EMAIL: Editable element expects an email
 * @WEBKIT_INPUT_PURPOSE_PASSWORD: Editable element expects a password
 *
 * Enum values used to describe the primary purpose of the active editable element.
 *
 * Since: 2.28
 */
typedef enum {
    WEBKIT_INPUT_PURPOSE_FREE_FORM,
    WEBKIT_INPUT_PURPOSE_DIGITS,
    WEBKIT_INPUT_PURPOSE_NUMBER,
    WEBKIT_INPUT_PURPOSE_PHONE,
    WEBKIT_INPUT_PURPOSE_URL,
    WEBKIT_INPUT_PURPOSE_EMAIL,
    WEBKIT_INPUT_PURPOSE_PASSWORD
} WebKitInputPurpose;

/**
 * WebKitInputHints:
 * @WEBKIT_INPUT_HINT_NONE: No special behavior suggested
 * @WEBKIT_INPUT_HINT_SPELLCHECK: Suggest spell checking
 * @WEBKIT_INPUT_HINT_LOWERCASE: Suggest to not autocapitlize
 * @WEBKIT_INPUT_HINT_UPPERCASE_CHARS: Suggest to capitalize all text
 * @WEBKIT_INPUT_HINT_UPPERCASE_WORDS: Suggest to capitalize the first character of each word
 * @WEBKIT_INPUT_HINT_UPPERCASE_SENTENCES: Suggest to capitalize the first word of each sentence
 * @WEBKIT_INPUT_HINT_INHIBIT_OSK: Suggest to not show an onscreen keyboard
 *
 * Enum values used to describe hints that might be taken into account by input methods.
 *
 * Since: 2.28
 */
typedef enum {
    WEBKIT_INPUT_HINT_NONE                = 0,
    WEBKIT_INPUT_HINT_SPELLCHECK          = 1 << 0,
    WEBKIT_INPUT_HINT_LOWERCASE           = 1 << 1,
    WEBKIT_INPUT_HINT_UPPERCASE_CHARS     = 1 << 2,
    WEBKIT_INPUT_HINT_UPPERCASE_WORDS     = 1 << 3,
    WEBKIT_INPUT_HINT_UPPERCASE_SENTENCES = 1 << 4,
    WEBKIT_INPUT_HINT_INHIBIT_OSK         = 1 << 5
} WebKitInputHints;

typedef struct _WebKitInputMethodUnderline      WebKitInputMethodUnderline;

struct _WebKitInputMethodContextClass {
    GObjectClass parent_class;

    /*< public >*/

    /* Signals */
    void     (* preedit_started)    (WebKitInputMethodContext *context);
    void     (* preedit_changed)    (WebKitInputMethodContext *context);
    void     (* preedit_finished)   (WebKitInputMethodContext *context);
    void     (* committed)          (WebKitInputMethodContext *context,
                                     const char               *text);
    void     (* delete_surrounding) (WebKitInputMethodContext *context,
                                     int                       offset,
                                     guint                     n_chars);

    /* Virtual functions */
    void     (* set_enable_preedit) (WebKitInputMethodContext *context,
                                     gboolean                  enabled);
    void     (* get_preedit)        (WebKitInputMethodContext *context,
                                     gchar                   **text,
                                     GList                   **underlines,
                                     guint                    *cursor_offset);
#if PLATFORM(GTK) && USE(GTK4)
    gboolean (* filter_key_event)   (WebKitInputMethodContext *context,
                                     GdkEvent                 *key_event);
#elif PLATFORM(GTK)
    gboolean (* filter_key_event)   (WebKitInputMethodContext *context,
                                     GdkEventKey              *key_event);
#elif PLATFORM(WPE)
    gboolean (* filter_key_event)   (WebKitInputMethodContext        *context,
                                     gpointer                         key_event);
#endif
    void     (* notify_focus_in)    (WebKitInputMethodContext *context);
    void     (* notify_focus_out)   (WebKitInputMethodContext *context);
    void     (* notify_cursor_area) (WebKitInputMethodContext *context,
                                     int                       x,
                                     int                       y,
                                     int                       width,
                                     int                       height);
    void     (* notify_surrounding) (WebKitInputMethodContext *context,
                                     const gchar              *text,
                                     guint                     length,
                                     guint                     cursor_index,
                                     guint                     selection_index);
    void     (* reset)              (WebKitInputMethodContext *context);

    /*< private >*/
    void (*_webkit_reserved0)  (void);
    void (*_webkit_reserved1)  (void);
    void (*_webkit_reserved2)  (void);
    void (*_webkit_reserved3)  (void);
    void (*_webkit_reserved4)  (void);
    void (*_webkit_reserved5)  (void);
    void (*_webkit_reserved6)  (void);
    void (*_webkit_reserved7)  (void);
#if ENABLE(2022_GLIB_API)
    void (*_webkit_reserved8)  (void);
    void (*_webkit_reserved9)  (void);
    void (*_webkit_reserved10) (void);
    void (*_webkit_reserved11) (void);
    void (*_webkit_reserved12) (void);
    void (*_webkit_reserved13) (void);
    void (*_webkit_reserved14) (void);
    void (*_webkit_reserved15) (void);
#endif
};

WEBKIT_API void
webkit_input_method_context_set_enable_preedit (WebKitInputMethodContext   *context,
                                                gboolean                    enabled);

WEBKIT_API void
webkit_input_method_context_get_preedit        (WebKitInputMethodContext   *context,
                                                char                      **text,
                                                GList                     **underlines,
                                                guint                      *cursor_offset);

#if PLATFORM(GTK) && USE(GTK4)
WEBKIT_API gboolean
webkit_input_method_context_filter_key_event   (WebKitInputMethodContext   *context,
                                                GdkEvent                   *key_event);                                       
#elif PLATFORM(GTK)
WEBKIT_API gboolean
webkit_input_method_context_filter_key_event   (WebKitInputMethodContext   *context,
                                                GdkEventKey                *key_event);
#elif PLATFORM(WPE)
WEBKIT_API gboolean
webkit_input_method_context_filter_key_event   (WebKitInputMethodContext        *context,
                                                gpointer                         key_event);
#endif

WEBKIT_API void
webkit_input_method_context_notify_focus_in    (WebKitInputMethodContext   *context);

WEBKIT_API void
webkit_input_method_context_notify_focus_out   (WebKitInputMethodContext   *context);

WEBKIT_API void
webkit_input_method_context_notify_cursor_area (WebKitInputMethodContext   *context,
                                                int                         x,
                                                int                         y,
                                                int                         width,
                                                int                         height);

WEBKIT_API void
webkit_input_method_context_notify_surrounding (WebKitInputMethodContext   *context,
                                                const gchar                *text,
                                                int                         length,
                                                guint                       cursor_index,
                                                guint                       selection_index);

WEBKIT_API void
webkit_input_method_context_reset              (WebKitInputMethodContext   *context);


WEBKIT_API GType
webkit_input_method_underline_get_type         (void);

WEBKIT_API WebKitInputMethodUnderline *
webkit_input_method_underline_new              (guint                       start_offset,
                                                guint                       end_offset);

WEBKIT_API WebKitInputMethodUnderline *
webkit_input_method_underline_copy             (WebKitInputMethodUnderline *underline);

WEBKIT_API void
webkit_input_method_underline_free             (WebKitInputMethodUnderline *underline);

#if PLATFORM(GTK)
WEBKIT_API void
webkit_input_method_underline_set_color        (WebKitInputMethodUnderline *underline,
                                                const GdkRGBA              *rgba);
#elif PLATFORM(WPE)
WEBKIT_API void
webkit_input_method_underline_set_color        (WebKitInputMethodUnderline *underline,
                                                WebKitColor                *color);
#endif

WEBKIT_API WebKitInputPurpose
webkit_input_method_context_get_input_purpose  (WebKitInputMethodContext   *context);

WEBKIT_API void
webkit_input_method_context_set_input_purpose  (WebKitInputMethodContext   *context,
                                                WebKitInputPurpose          purpose);

WEBKIT_API WebKitInputHints
webkit_input_method_context_get_input_hints    (WebKitInputMethodContext   *context);

WEBKIT_API void
webkit_input_method_context_set_input_hints    (WebKitInputMethodContext   *context,
                                                WebKitInputHints            hints);


G_END_DECLS

#endif