Flutter Engine
Loading...
Searching...
No Matches
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_PLATFORM_GLFW_TEXT_INPUT_PLUGIN_H_
6
#define FLUTTER_SHELL_PLATFORM_GLFW_TEXT_INPUT_PLUGIN_H_
7
8
#include <map>
9
#include <memory>
10
11
#include "
flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h
"
12
#include "
flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h
"
13
#include "
flutter/shell/platform/common/text_input_model.h
"
14
#include "
flutter/shell/platform/glfw/keyboard_hook_handler.h
"
15
#include "
flutter/shell/platform/glfw/public/flutter_glfw.h
"
16
17
#include "rapidjson/document.h"
18
19
namespace
flutter
{
20
21
// Implements a text input plugin.
22
//
23
// Specifically handles window events within GLFW.
24
class
TextInputPlugin
:
public
KeyboardHookHandler
{
25
public
:
26
explicit
TextInputPlugin
(
flutter::BinaryMessenger
* messenger);
27
28
virtual
~TextInputPlugin
();
29
30
// |KeyboardHookHandler|
31
void
KeyboardHook
(GLFWwindow*
window
,
32
int
key
,
33
int
scancode
,
34
int
action
,
35
int
mods)
override
;
36
37
// |KeyboardHookHandler|
38
void
CharHook
(GLFWwindow*
window
,
unsigned
int
code_point)
override
;
39
40
private
:
41
// Sends the current state of the given model to the Flutter engine.
42
void
SendStateUpdate(
const
TextInputModel
& model);
43
44
// Sends an action triggered by the Enter key to the Flutter engine.
45
void
EnterPressed(
TextInputModel
* model);
46
47
// Called when a method is called on |channel_|;
48
void
HandleMethodCall(
49
const
flutter::MethodCall<rapidjson::Document>
&
method_call
,
50
std::unique_ptr<
flutter::MethodResult<rapidjson::Document>
> result);
51
52
// The MethodChannel used for communication with the Flutter engine.
53
std::unique_ptr<flutter::MethodChannel<rapidjson::Document>> channel_;
54
55
// The active client id.
56
int
client_id_ = 0;
57
58
// The active model. nullptr if not set.
59
std::unique_ptr<TextInputModel> active_model_;
60
61
// Keyboard type of the client. See available options:
62
// https://api.flutter.dev/flutter/services/TextInputType-class.html
63
std::string input_type_;
64
65
// An action requested by the user on the input client. See available options:
66
// https://api.flutter.dev/flutter/services/TextInputAction-class.html
67
std::string input_action_;
68
};
69
70
}
// namespace flutter
71
72
#endif
// FLUTTER_SHELL_PLATFORM_GLFW_TEXT_INPUT_PLUGIN_H_
binary_messenger.h
flutter::BinaryMessenger
Definition
binary_messenger.h:28
flutter::KeyboardHookHandler
Definition
keyboard_hook_handler.h:15
flutter::MethodCall
Definition
method_call.h:18
flutter::MethodResult
Definition
method_result.h:17
flutter::TextInputModel
Definition
text_input_model.h:18
flutter::TextInputPlugin
Definition
text_input_plugin.h:24
flutter::TextInputPlugin::KeyboardHook
void KeyboardHook(GLFWwindow *window, int key, int scancode, int action, int mods) override
Definition
text_input_plugin.cc:52
flutter::TextInputPlugin::~TextInputPlugin
virtual ~TextInputPlugin()
flutter::TextInputPlugin::CharHook
void CharHook(GLFWwindow *window, unsigned int code_point) override
Definition
text_input_plugin.cc:44
window
GLFWwindow * window
Definition
main.cc:60
method_call
G_BEGIN_DECLS G_MODULE_EXPORT FlMethodCall * method_call
Definition
fl_method_channel.h:120
flutter_glfw.h
keyboard_hook_handler.h
key
int key
Definition
keyboard_key_handler_unittests.cc:114
action
int action
Definition
keyboard_key_handler_unittests.cc:116
scancode
int scancode
Definition
keyboard_key_handler_unittests.cc:115
method_channel.h
flutter
Definition
asset_manager.cc:10
text_input_model.h
shell
platform
glfw
text_input_plugin.h
Generated on Thu Nov 6 2025 16:11:29 for Flutter Engine by
1.9.8