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 
11 
12 G_BEGIN_DECLS
13 
14 typedef enum {
16  // Send newline when multi-line and enter is pressed.
18  // The input method is not shown at all.
21 
22 typedef enum {
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);
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,
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  */
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. If `error` is not %NULL, `*error` must be initialized (typically
115  * %NULL, but an error from a previous call using GLib error handling is
116  * explicitly valid).
117  *
118  * Completes request started with fl_text_input_channel_update_editing_state().
119  *
120  * Returns: %TRUE on success.
121  */
123  GAsyncResult* result,
124  GError** error);
125 
126 /**
127  * fl_text_input_channel_update_editing_state_with_deltas:
128  * @channel: an #FlTextInputChannel.
129  * @client_id:
130  * @old_text:
131  * @delta_text:
132  * @delta_start:
133  * @delta_end:
134  * @selection_base:
135  * @selection_extent:
136  * @selection_affinity:
137  * @selection_is_directional:
138  * @composing_base:
139  * @composing_extent:
140  * @cancellable: (allow-none): a #GCancellable or %NULL.
141  * @callback: (scope async): a #GAsyncReadyCallback to call when the method
142  * returns.
143  * @user_data: (closure): user data to pass to @callback.
144  */
146  FlTextInputChannel* channel,
147  int64_t client_id,
148  const gchar* old_text,
149  const gchar* delta_text,
150  int64_t delta_start,
151  int64_t delta_end,
152  int64_t selection_base,
153  int64_t selection_extent,
154  FlTextAffinity selection_affinity,
155  gboolean selection_is_directional,
156  int64_t composing_base,
157  int64_t composing_extent,
158  GCancellable* cancellable,
159  GAsyncReadyCallback callback,
160  gpointer user_data);
161 
162 /**
163  * fl_text_input_channel_update_editing_state_with_deltas_finish:
164  * @object:
165  * @result: a #GAsyncResult.
166  * @error: (allow-none): #GError location to store the error occurring, or %NULL
167  * to ignore. If `error` is not %NULL, `*error` must be initialized (typically
168  * %NULL, but an error from a previous call using GLib error handling is
169  * explicitly valid).
170  *
171  * Completes request started with
172  * fl_text_input_channel_update_editing_state_with_deltas().
173  *
174  * Returns: %TRUE on success.
175  */
177  GObject* object,
178  GAsyncResult* result,
179  GError** error);
180 
181 /**
182  * fl_text_input_channel_perform_action:
183  * @channel: an #FlTextInputChannel.
184  * @client_id:
185  * @input_action: action to perform.
186  * @cancellable: (allow-none): a #GCancellable or %NULL.
187  * @callback: (scope async): a #GAsyncReadyCallback to call when the method
188  * returns.
189  * @user_data: (closure): user data to pass to @callback.
190  */
191 void fl_text_input_channel_perform_action(FlTextInputChannel* channel,
192  int64_t client_id,
193  const gchar* input_action,
194  GCancellable* cancellable,
195  GAsyncReadyCallback callback,
196  gpointer user_data);
197 
198 /**
199  * fl_text_input_channel_perform_action_finish:
200  * @object:
201  * @result: a #GAsyncResult.
202  * @error: (allow-none): #GError location to store the error occurring, or %NULL
203  * to ignore. If `error` is not %NULL, `*error` must be initialized (typically
204  * %NULL, but an error from a previous call using GLib error handling is
205  * explicitly valid).
206  *
207  * Completes request started with fl_text_input_channel_perform_action().
208  *
209  * Returns: %TRUE on success.
210  */
211 gboolean fl_text_input_channel_perform_action_finish(GObject* object,
212  GAsyncResult* result,
213  GError** error);
214 
215 G_END_DECLS
216 
217 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXT_INPUT_CHANNEL_H_
self height
self width
G_BEGIN_DECLS G_MODULE_EXPORT FlValue gpointer user_data
const uint8_t uint32_t uint32_t GError ** error
static FlMethodResponse * set_editing_state(FlTextInputChannel *self, FlValue *args)
static FlMethodResponse * set_editable_size_and_transform(FlTextInputChannel *self, FlValue *args)
static FlMethodResponse * hide(FlTextInputChannel *self)
static FlMethodResponse * set_client(FlTextInputChannel *self, FlValue *args)
static FlMethodResponse * show(FlTextInputChannel *self)
static FlMethodResponse * set_marked_text_rect(FlTextInputChannel *self, FlValue *args)
static FlMethodResponse * clear_client(FlTextInputChannel *self)
G_DECLARE_FINAL_TYPE(FlTextInputChannel, fl_text_input_channel, FL, TEXT_INPUT_CHANNEL, GObject)
@ FL_TEXT_AFFINITY_DOWNSTREAM
@ FL_TEXT_AFFINITY_UPSTREAM
void fl_text_input_channel_perform_action(FlTextInputChannel *channel, int64_t client_id, const gchar *input_action, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
FlTextInputChannel * fl_text_input_channel_new(FlBinaryMessenger *messenger, FlTextInputChannelVTable *vtable, gpointer user_data)
gboolean fl_text_input_channel_update_editing_state_finish(GObject *object, GAsyncResult *result, GError **error)
gboolean fl_text_input_channel_perform_action_finish(GObject *object, GAsyncResult *result, GError **error)
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)
@ FL_TEXT_INPUT_TYPE_MULTILINE
@ FL_TEXT_INPUT_TYPE_TEXT
@ FL_TEXT_INPUT_TYPE_NONE
gboolean fl_text_input_channel_update_editing_state_with_deltas_finish(GObject *object, GAsyncResult *result, GError **error)
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)