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, gpointer user_data);
42  void (*configure)(const gchar* input_action,
43  gboolean enable_delta_model,
44  FlTextInputType input_type,
45  GtkInputPurpose im_purpose,
46  GtkInputHints im_hints,
47  gpointer user_data);
48  void (*hide)(gpointer user_data);
49  void (*show)(gpointer user_data);
50  void (*set_editing_state)(const gchar* text,
51  int64_t selection_base,
52  int64_t selection_extent,
53  int64_t composing_base,
54  int64_t composing_extent,
55  gpointer user_data);
56  void (*clear_client)(gpointer user_data);
57  void (*set_editable_size_and_transform)(double* transform,
58  gpointer user_data);
59  void (*set_marked_text_rect)(double x,
60  double y,
61  double width,
62  double height,
63  gpointer user_data);
65 
66 /**
67  * fl_text_input_channel_new:
68  * @messenger: an #FlBinaryMessenger.
69  * @vtable: callbacks for incoming method calls.
70  * @user_data: data to pass in callbacks.
71  *
72  * Creates a new channel that implements SystemChannels.textInput from the
73  * Flutter services library.
74  *
75  * Returns: a new #FlTextInputChannel.
76  */
77 FlTextInputChannel* fl_text_input_channel_new(FlBinaryMessenger* messenger,
79  gpointer user_data);
80 
81 /**
82  * fl_text_input_channel_update_editing_state:
83  * @channel: an #FlTextInputChannel.
84  * @client_id:
85  * @text:
86  * @selection_base:
87  * @selection_extent:
88  * @selection_affinity:
89  * @selection_is_directional:
90  * @composing_base:
91  * @composing_extent:
92  * @cancellable: (allow-none): a #GCancellable or %NULL.
93  * @callback: (scope async): a #GAsyncReadyCallback to call when the method
94  * returns.
95  * @user_data: (closure): user data to pass to @callback.
96  */
98  FlTextInputChannel* channel,
99  int64_t client_id,
100  const gchar* text,
101  int64_t selection_base,
102  int64_t selection_extent,
103  FlTextAffinity selection_affinity,
104  gboolean selection_is_directional,
105  int64_t composing_base,
106  int64_t composing_extent,
107  GCancellable* cancellable,
108  GAsyncReadyCallback callback,
109  gpointer user_data);
110 
111 /**
112  * fl_text_input_channel_update_editing_state_finish:
113  * @object:
114  * @result: a #GAsyncResult.
115  * @error: (allow-none): #GError location to store the error occurring, or %NULL
116  * to ignore. If `error` is not %NULL, `*error` must be initialized (typically
117  * %NULL, but an error from a previous call using GLib error handling is
118  * explicitly valid).
119  *
120  * Completes request started with fl_text_input_channel_update_editing_state().
121  *
122  * Returns: %TRUE on success.
123  */
125  GAsyncResult* result,
126  GError** error);
127 
128 /**
129  * fl_text_input_channel_update_editing_state_with_deltas:
130  * @channel: an #FlTextInputChannel.
131  * @client_id:
132  * @old_text:
133  * @delta_text:
134  * @delta_start:
135  * @delta_end:
136  * @selection_base:
137  * @selection_extent:
138  * @selection_affinity:
139  * @selection_is_directional:
140  * @composing_base:
141  * @composing_extent:
142  * @cancellable: (allow-none): a #GCancellable or %NULL.
143  * @callback: (scope async): a #GAsyncReadyCallback to call when the method
144  * returns.
145  * @user_data: (closure): user data to pass to @callback.
146  */
148  FlTextInputChannel* channel,
149  int64_t client_id,
150  const gchar* old_text,
151  const gchar* delta_text,
152  int64_t delta_start,
153  int64_t delta_end,
154  int64_t selection_base,
155  int64_t selection_extent,
156  FlTextAffinity selection_affinity,
157  gboolean selection_is_directional,
158  int64_t composing_base,
159  int64_t composing_extent,
160  GCancellable* cancellable,
161  GAsyncReadyCallback callback,
162  gpointer user_data);
163 
164 /**
165  * fl_text_input_channel_update_editing_state_with_deltas_finish:
166  * @object:
167  * @result: a #GAsyncResult.
168  * @error: (allow-none): #GError location to store the error occurring, or %NULL
169  * to ignore. If `error` is not %NULL, `*error` must be initialized (typically
170  * %NULL, but an error from a previous call using GLib error handling is
171  * explicitly valid).
172  *
173  * Completes request started with
174  * fl_text_input_channel_update_editing_state_with_deltas().
175  *
176  * Returns: %TRUE on success.
177  */
179  GObject* object,
180  GAsyncResult* result,
181  GError** error);
182 
183 /**
184  * fl_text_input_channel_perform_action:
185  * @channel: an #FlTextInputChannel.
186  * @client_id:
187  * @input_action: action to perform.
188  * @cancellable: (allow-none): a #GCancellable or %NULL.
189  * @callback: (scope async): a #GAsyncReadyCallback to call when the method
190  * returns.
191  * @user_data: (closure): user data to pass to @callback.
192  */
193 void fl_text_input_channel_perform_action(FlTextInputChannel* channel,
194  int64_t client_id,
195  const gchar* input_action,
196  GCancellable* cancellable,
197  GAsyncReadyCallback callback,
198  gpointer user_data);
199 
200 /**
201  * fl_text_input_channel_perform_action_finish:
202  * @object:
203  * @result: a #GAsyncResult.
204  * @error: (allow-none): #GError location to store the error occurring, or %NULL
205  * to ignore. If `error` is not %NULL, `*error` must be initialized (typically
206  * %NULL, but an error from a previous call using GLib error handling is
207  * explicitly valid).
208  *
209  * Completes request started with fl_text_input_channel_perform_action().
210  *
211  * Returns: %TRUE on success.
212  */
213 gboolean fl_text_input_channel_perform_action_finish(GObject* object,
214  GAsyncResult* result,
215  GError** error);
216 
217 G_END_DECLS
218 
219 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXT_INPUT_CHANNEL_H_
const char FlTextDirection FlAssertiveness gpointer user_data
self height
self width
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)
static void configure(const gchar *input_action, gboolean enable_delta_model, FlTextInputType input_type, GtkInputPurpose im_purpose, GtkInputHints im_hints, gpointer user_data)