File: WebKitInputMethodContext.h

package info (click to toggle)
wpewebkit 2.38.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 311,508 kB
  • sloc: cpp: 2,653,313; javascript: 289,013; ansic: 121,268; xml: 64,149; python: 35,534; ruby: 17,287; perl: 15,877; asm: 11,072; yacc: 2,326; sh: 1,863; lex: 1,319; java: 937; makefile: 146; pascal: 60
file content (227 lines) | stat: -rw-r--r-- 10,674 bytes parent folder | download | duplicates (2)
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
/*
 * 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.
 */

#if !defined(__WEBKIT_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
#error "Only <wpe/webkit.h> can be included directly."
#endif

#ifndef WebKitInputMethodContext_h
#define WebKitInputMethodContext_h

#include <glib-object.h>
#include <wpe/WebKitDefines.h>
#include <wpe/WebKitColor.h>
#include <wpe/wpe.h>

G_BEGIN_DECLS

#define WEBKIT_TYPE_INPUT_METHOD_CONTEXT            (webkit_input_method_context_get_type())
#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))

#define WEBKIT_TYPE_INPUT_METHOD_UNDERLINE          (webkit_input_method_underline_get_type())

/**
 * 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 _WebKitInputMethodContext        WebKitInputMethodContext;
typedef struct _WebKitInputMethodContextClass   WebKitInputMethodContextClass;
typedef struct _WebKitInputMethodContextPrivate WebKitInputMethodContextPrivate;
typedef struct _WebKitInputMethodUnderline      WebKitInputMethodUnderline;

struct _WebKitInputMethodContext {
    GObject parent;

    /*< private >*/
    WebKitInputMethodContextPrivate *priv;
};

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);
    gboolean (* filter_key_event)   (WebKitInputMethodContext        *context,
                                     struct wpe_input_keyboard_event *key_event);
    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);
};

WEBKIT_API GType
webkit_input_method_context_get_type           (void);

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);

WEBKIT_API gboolean
webkit_input_method_context_filter_key_event   (WebKitInputMethodContext        *context,
                                                struct wpe_input_keyboard_event *key_event);

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);

WEBKIT_API void
webkit_input_method_underline_set_color        (WebKitInputMethodUnderline      *underline,
                                                WebKitColor                     *color);

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