Flutter Engine
The Flutter Engine
keyboard_handler_base.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_WINDOWS_KEYBOARD_HANDLER_BASE_H_
6#define FLUTTER_SHELL_PLATFORM_WINDOWS_KEYBOARD_HANDLER_BASE_H_
7
8#include <string>
9
10namespace flutter {
11
12// Interface for classes that handles keyboard input events.
13//
14// Keyboard handlers are added to |FlutterWindowsView| in a chain.
15// When a key event arrives, |KeyboardHook| is called on each handler
16// until the first one that returns true. Then the proper text hooks
17// are called on each handler.
19 public:
20 using KeyEventCallback = std::function<void(bool)>;
21
22 virtual ~KeyboardHandlerBase() = default;
23
24 // A function for hooking into keyboard input.
25 virtual void KeyboardHook(int key,
26 int scancode,
27 int action,
28 char32_t character,
29 bool extended,
30 bool was_down,
32
33 // If needed, synthesize modifier keys events by comparing the
34 // given modifiers state to the known pressing state..
35 virtual void SyncModifiersIfNeeded(int modifiers_state) = 0;
36
37 // Returns the keyboard pressed state.
38 //
39 // Returns the keyboard pressed state. The map contains one entry per
40 // pressed keys, mapping from the logical key to the physical key.
41 virtual std::map<uint64_t, uint64_t> GetPressedState() = 0;
42};
43
44} // namespace flutter
45
46#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_KEYBOARD_HANDLER_BASE_H_
virtual void SyncModifiersIfNeeded(int modifiers_state)=0
virtual ~KeyboardHandlerBase()=default
std::function< void(bool)> KeyEventCallback
virtual void KeyboardHook(int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback)=0
virtual std::map< uint64_t, uint64_t > GetPressedState()=0
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_NativeFunction function
Definition: fuchsia.cc:51