Flutter Engine
fl_text_input_plugin.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_TEXT_INPUT_LINUX_FL_TEXT_INPUT_PLUGIN_H_
6 #define FLUTTER_SHELL_TEXT_INPUT_LINUX_FL_TEXT_INPUT_PLUGIN_H_
7 
8 #include <gdk/gdk.h>
9 
10 #include "flutter/shell/platform/linux/fl_key_event.h"
11 #include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
12 #include "flutter/shell/platform/linux/public/flutter_linux/fl_view.h"
13 
14 /**
15  * FlTextInputPluginImFilter:
16  * @event: the pointer to the GdkEventKey.
17  *
18  * The signature for a callback with which a #FlTextInputPlugin allow an input
19  * method to internally handle key press and release events.
20  *
21  * The #gdk_event is an opaque pointer. It will be GdkEvent* in actual
22  * applications, or a dummy pointer in unit tests.
23  **/
24 typedef gboolean (*FlTextInputPluginImFilter)(GtkIMContext* im_context,
25  gpointer gdk_event);
26 
27 G_BEGIN_DECLS
28 
29 G_DECLARE_DERIVABLE_TYPE(FlTextInputPlugin,
30  fl_text_input_plugin,
31  FL,
32  TEXT_INPUT_PLUGIN,
33  GObject);
34 
35 /**
36  * FlTextInputPlugin:
37  *
38  * #FlTextInputPlugin is a plugin that implements the shell side
39  * of SystemChannels.textInput from the Flutter services library.
40  */
41 
43  GObjectClass parent_class;
44 
45  /**
46  * Virtual method called to filter a keypress.
47  */
48  gboolean (*filter_keypress)(FlTextInputPlugin* self, FlKeyEvent* event);
49 };
50 
51 /**
52  * fl_text_input_plugin_new:
53  * @messenger: an #FlBinaryMessenger.
54  * @view: the #FlView with which the text input plugin is associated.
55  * @im_filter: a function used to allow an input method to internally handle
56  * key press and release events. Typically a wrap of
57  * #gtk_im_context_filter_keypress. Must not be nullptr.
58  *
59  * Creates a new plugin that implements SystemChannels.textInput from the
60  * Flutter services library.
61  *
62  * Returns: a new #FlTextInputPlugin.
63  */
64 FlTextInputPlugin* fl_text_input_plugin_new(
65  FlBinaryMessenger* messenger,
66  FlView* view,
67  FlTextInputPluginImFilter im_filter);
68 
69 /**
70  * fl_text_input_plugin_filter_keypress
71  * @plugin: an #FlTextInputPlugin.
72  * @event: a #FlKeyEvent
73  *
74  * Process a Gdk key event.
75  *
76  * Returns: %TRUE if the event was used.
77  */
78 gboolean fl_text_input_plugin_filter_keypress(FlTextInputPlugin* plugin,
79  FlKeyEvent* event);
80 
81 G_END_DECLS
82 
83 #endif // FLUTTER_SHELL_TEXT_INPUT_LINUX_FL_TEXT_INPUT_PLUGIN_H_
FlKeyEvent * event
gboolean(* FlTextInputPluginImFilter)(GtkIMContext *im_context, gpointer gdk_event)
gboolean fl_text_input_plugin_filter_keypress(FlTextInputPlugin *plugin, FlKeyEvent *event)
FlView * view
G_BEGIN_DECLS FL
FlTextInputPlugin * fl_text_input_plugin_new(FlBinaryMessenger *messenger, FlView *view, FlTextInputPluginImFilter im_filter)
gboolean(* filter_keypress)(FlTextInputPlugin *self, FlKeyEvent *event)
G_BEGIN_DECLS G_DECLARE_DERIVABLE_TYPE(FlTextInputPlugin, fl_text_input_plugin, FL, TEXT_INPUT_PLUGIN, GObject)