Flutter Windows Embedder
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
keyboard_key_channel_handler.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_KEY_CHANNEL_HANDLER_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_KEYBOARD_KEY_CHANNEL_HANDLER_H_
7 
8 #include <deque>
9 #include <memory>
10 #include <string>
11 
12 #include "flutter/fml/macros.h"
16 #include "rapidjson/document.h"
17 
18 namespace flutter {
19 
20 // A delegate of |KeyboardKeyHandler| that handles events by sending the
21 // raw information through the method channel.
22 //
23 // This class communicates with the RawKeyboard API in the framework.
26  public:
27  // Create a |KeyboardKeyChannelHandler| by specifying the messenger
28  // through which the events are sent.
30 
32 
33  // |KeyboardKeyHandler::KeyboardKeyHandlerDelegate|
34  void KeyboardHook(int key,
35  int scancode,
36  int action,
37  char32_t character,
38  bool extended,
39  bool was_down,
40  std::function<void(bool)> callback);
41 
42  void SyncModifiersIfNeeded(int modifiers_state);
43 
44  std::map<uint64_t, uint64_t> GetPressedState();
45 
46  private:
47  // The Flutter system channel for key event messages.
48  std::unique_ptr<flutter::BasicMessageChannel<rapidjson::Document>> channel_;
49 
50  FML_DISALLOW_COPY_AND_ASSIGN(KeyboardKeyChannelHandler);
51 };
52 
53 } // namespace flutter
54 
55 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_KEYBOARD_KEY_CHANNEL_HANDLER_H_
void KeyboardHook(int key, int scancode, int action, char32_t character, bool extended, bool was_down, std::function< void(bool)> callback)
KeyboardKeyChannelHandler(flutter::BinaryMessenger *messenger)
std::map< uint64_t, uint64_t > GetPressedState()
FlutterDesktopBinaryReply callback