| Flutter Linux Embedder |

fl_text_input_channel.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXT_INPUT_CHANNEL_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXT_INPUT_CHANNEL_H_
7
8 #include <gtk/gtk.h>
9
10 #include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
11
12 G_BEGIN_DECLS
13
14 typedef enum {
15 FL_TEXT_INPUT_TYPE_TEXT,
16 // Send newline when multi-line and enter is pressed.
17 FL_TEXT_INPUT_TYPE_MULTILINE,
18 // The input method is not shown at all.
19 FL_TEXT_INPUT_TYPE_NONE,
20 } FlTextInputType;
21
22 typedef enum {
23 FL_TEXT_AFFINITY_UPSTREAM,
24 FL_TEXT_AFFINITY_DOWNSTREAM,
25 } FlTextAffinity;
26
27 G_DECLARE_FINAL_TYPE(FlTextInputChannel,
28 fl_text_input_channel,
29 FL,
30 TEXT_INPUT_CHANNEL,
31 GObject);
32
33 /**
34 * FlTextInputChannel:
35 *
36 * #FlTextInputChannel is a channel that implements the shell side
37 * of SystemChannels.textInput from the Flutter services library.
38 */
39
40 typedef struct {
41 void (*set_client)(int64_t client_id,
42 const gchar* input_action,
43 gboolean enable_delta_model,
44 FlTextInputType input_type,
45 gpointer user_data);
46 void (*hide)(gpointer user_data);
47 void (*show)(gpointer user_data);
48 void (*set_editing_state)(const gchar* text,
49 int64_t selection_base,
50 int64_t selection_extent,
51 int64_t composing_base,
52 int64_t composing_extent,
53 gpointer user_data);
54 void (*clear_client)(gpointer user_data);
55 void (*set_editable_size_and_transform)(double* transform,
56 gpointer user_data);
57 void (*set_marked_text_rect)(double x,
58 double y,
59 double width,
60 double height,
61 gpointer user_data);
62 } FlTextInputChannelVTable;
63
64 /**
65 * fl_text_input_channel_new:
66 * @messenger: an #FlBinaryMessenger.
67 * @vtable: callbacks for incoming method calls.
68 * @user_data: data to pass in callbacks.
69 *
70 * Creates a new channel that implements SystemChannels.textInput from the
71 * Flutter services library.
72 *
73 * Returns: a new #FlTextInputChannel.
74 */
75 FlTextInputChannel* fl_text_input_channel_new(FlBinaryMessenger* messenger,
76 FlTextInputChannelVTable* vtable,
77 gpointer user_data);
78
79 /**
80 * fl_text_input_channel_update_editing_state:
81 * @channel: an #FlTextInputChannel.
82 * @client_id:
83 * @text:
84 * @selection_base:
85 * @selection_extent:
86 * @selection_affinity:
87 * @selection_is_directional:
88 * @composing_base:
89 * @composing_extent:
90 * @cancellable: (allow-none): a #GCancellable or %NULL.
91 * @callback: (scope async): a #GAsyncReadyCallback to call when the method
92 * returns.
93 * @user_data: (closure): user data to pass to @callback.
94 */
95 void fl_text_input_channel_update_editing_state(
96 FlTextInputChannel* channel,
97 int64_t client_id,
98 const gchar* text,
99 int64_t selection_base,
100 int64_t selection_extent,
101 FlTextAffinity selection_affinity,
102 gboolean selection_is_directional,
103 int64_t composing_base,
104 int64_t composing_extent,
105 GCancellable* cancellable,
106 GAsyncReadyCallback callback,
107 gpointer user_data);
108
109 /**
110 * fl_text_input_channel_update_editing_state_finish:
111 * @object:
112 * @result: a #GAsyncResult.
113 * @error: (allow-none): #GError location to store the error occurring, or %NULL
114 * to ignore.
115 *
116 * Completes request started with fl_text_input_channel_update_editing_state().
117 *
118 * Returns: %TRUE on success.
119 */
120 gboolean fl_text_input_channel_update_editing_state_finish(GObject* object,
121 GAsyncResult* result,
122 GError** error);
123
124 /**
125 * fl_text_input_channel_update_editing_state_with_deltas:
126 * @channel: an #FlTextInputChannel.
127 * @client_id:
128 * @old_text:
129 * @delta_text:
130 * @delta_start:
131 * @delta_end:
132 * @selection_base:
133 * @selection_extent:
134 * @selection_affinity:
135 * @selection_is_directional:
136 * @composing_base:
137 * @composing_extent:
138 * @cancellable: (allow-none): a #GCancellable or %NULL.
139 * @callback: (scope async): a #GAsyncReadyCallback to call when the method
140 * returns.
141 * @user_data: (closure): user data to pass to @callback.
142 */
143 void fl_text_input_channel_update_editing_state_with_deltas(
144 FlTextInputChannel* channel,
145 int64_t client_id,
146 const gchar* old_text,
147 const gchar* delta_text,
148 int64_t delta_start,
149 int64_t delta_end,
150 int64_t selection_base,
151 int64_t selection_extent,
152 FlTextAffinity selection_affinity,
153 gboolean selection_is_directional,
154 int64_t composing_base,
155 int64_t composing_extent,
156 GCancellable* cancellable,
157 GAsyncReadyCallback callback,
158 gpointer user_data);
159
160 /**
161 * fl_text_input_channel_update_editing_state_with_deltas_finish:
162 * @object:
163 * @result: a #GAsyncResult.
164 * @error: (allow-none): #GError location to store the error occurring, or %NULL
165 * to ignore.
166 *
167 * Completes request started with
168 * fl_text_input_channel_update_editing_state_with_deltas().
169 *
170 * Returns: %TRUE on success.
171 */
172 gboolean fl_text_input_channel_update_editing_state_with_deltas_finish(
173 GObject* object,
174 GAsyncResult* result,
175 GError** error);
176
177 /**
178 * fl_text_input_channel_perform_action:
179 * @channel: an #FlTextInputChannel.
180 * @client_id:
181 * @input_action: action to perform.
182 * @cancellable: (allow-none): a #GCancellable or %NULL.
183 * @callback: (scope async): a #GAsyncReadyCallback to call when the method
184 * returns.
185 * @user_data: (closure): user data to pass to @callback.
186 */
187 void fl_text_input_channel_perform_action(FlTextInputChannel* channel,
188 int64_t client_id,
189 const gchar* input_action,
190 GCancellable* cancellable,
191 GAsyncReadyCallback callback,
192 gpointer user_data);
193
194 /**
195 * fl_text_input_channel_perform_action_finish:
196 * @object:
197 * @result: a #GAsyncResult.
198 * @error: (allow-none): #GError location to store the error occurring, or %NULL
199 * to ignore.
200 *
201 * Completes request started with fl_text_input_channel_perform_action().
202 *
203 * Returns: %TRUE on success.
204 */
205 gboolean fl_text_input_channel_perform_action_finish(GObject* object,
206 GAsyncResult* result,
207 GError** error);
208
209 G_END_DECLS
210
211 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXT_INPUT_CHANNEL_H_
fl_text_input_channel_update_editing_state_with_deltas
void fl_text_input_channel_update_editing_state_with_deltas(FlTextInputChannel *channel, int64_t client_id, const gchar *old_text, const gchar *delta_text, int64_t delta_start, int64_t delta_end, int64_t selection_base, int64_t selection_extent, FlTextAffinity selection_affinity, gboolean selection_is_directional, int64_t composing_base, int64_t composing_extent, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_text_input_channel.cc:317
fl_text_input_channel_new
FlTextInputChannel * fl_text_input_channel_new(FlBinaryMessenger *messenger, FlTextInputChannelVTable *vtable, gpointer user_data)
Definition: fl_text_input_channel.cc:245
clear_client
static FlMethodResponse * clear_client(FlTextInputChannel *self)
Definition: fl_text_input_channel.cc:149
FlTextInputType
FlTextInputType
Definition: fl_text_input_channel.h:14
set_marked_text_rect
static FlMethodResponse * set_marked_text_rect(FlTextInputChannel *self, FlValue *args)
Definition: fl_text_input_channel.cc:185
fl_text_input_channel_update_editing_state_with_deltas_finish
gboolean fl_text_input_channel_update_editing_state_with_deltas_finish(GObject *object, GAsyncResult *result, GError **error)
Definition: fl_text_input_channel.cc:372
set_editable_size_and_transform
static FlMethodResponse * set_editable_size_and_transform(FlTextInputChannel *self, FlValue *args)
Definition: fl_text_input_channel.cc:160
FL_TEXT_AFFINITY_DOWNSTREAM
@ FL_TEXT_AFFINITY_DOWNSTREAM
Definition: fl_text_input_channel.h:24
FL_TEXT_INPUT_TYPE_TEXT
@ FL_TEXT_INPUT_TYPE_TEXT
Definition: fl_text_input_channel.h:15
set_client
static FlMethodResponse * set_client(FlTextInputChannel *self, FlValue *args)
Definition: fl_text_input_channel.cc:72
FlTextAffinity
FlTextAffinity
Definition: fl_text_input_channel.h:22
user_data
G_BEGIN_DECLS G_MODULE_EXPORT FlValue gpointer user_data
Definition: fl_event_channel.h:90
fl_text_input_channel_perform_action
void fl_text_input_channel_perform_action(FlTextInputChannel *channel, int64_t client_id, const gchar *input_action, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_text_input_channel.cc:384
G_DECLARE_FINAL_TYPE
G_DECLARE_FINAL_TYPE(FlTextInputChannel, fl_text_input_channel, FL, TEXT_INPUT_CHANNEL, GObject)
fl_text_input_channel_update_editing_state_finish
gboolean fl_text_input_channel_update_editing_state_finish(GObject *object, GAsyncResult *result, GError **error)
Definition: fl_text_input_channel.cc:306
fl_binary_messenger.h
fl_text_input_channel_update_editing_state
void fl_text_input_channel_update_editing_state(FlTextInputChannel *channel, int64_t client_id, const gchar *text, int64_t selection_base, int64_t selection_extent, FlTextAffinity selection_affinity, gboolean selection_is_directional, int64_t composing_base, int64_t composing_extent, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_text_input_channel.cc:266
FL_TEXT_INPUT_TYPE_MULTILINE
@ FL_TEXT_INPUT_TYPE_MULTILINE
Definition: fl_text_input_channel.h:17
FL
FL
Definition: fl_binary_messenger.cc:27
set_editing_state
static FlMethodResponse * set_editing_state(FlTextInputChannel *self, FlValue *args)
Definition: fl_text_input_channel.cc:128
FlTextInputChannelVTable
Definition: fl_text_input_channel.h:40
height
const uint8_t uint32_t uint32_t * height
Definition: fl_pixel_buffer_texture_test.cc:39
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
FL_TEXT_INPUT_TYPE_NONE
@ FL_TEXT_INPUT_TYPE_NONE
Definition: fl_text_input_channel.h:19
fl_text_input_channel_perform_action_finish
gboolean fl_text_input_channel_perform_action_finish(GObject *object, GAsyncResult *result, GError **error)
Definition: fl_text_input_channel.cc:400
FL_TEXT_AFFINITY_UPSTREAM
@ FL_TEXT_AFFINITY_UPSTREAM
Definition: fl_text_input_channel.h:23
hide
static FlMethodResponse * hide(FlTextInputChannel *self)
Definition: fl_text_input_channel.cc:116
show
static FlMethodResponse * show(FlTextInputChannel *self)
Definition: fl_text_input_channel.cc:122
width
const uint8_t uint32_t * width
Definition: fl_pixel_buffer_texture_test.cc:38