| Flutter Windows Embedder |

window_binding_handler_delegate.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_WINDOW_BINDING_HANDLER_DELEGATE_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOW_BINDING_HANDLER_DELEGATE_H_
7
8 #include <functional>
9
10 #include "flutter/shell/platform/common/geometry.h"
11 #include "flutter/shell/platform/embedder/embedder.h"
12 #include "flutter/shell/platform/windows/windows_lifecycle_manager.h"
13 #include "flutter/third_party/accessibility/ax/platform/ax_fragment_root_delegate_win.h"
14 #include "flutter/third_party/accessibility/gfx/native_widget_types.h"
15
16 namespace flutter {
17
18 class WindowBindingHandlerDelegate {
19 public:
20 using KeyEventCallback = std::function<void(bool)>;
21
22 // Notifies delegate that backing window size has changed.
23 // Typically called by currently configured WindowBindingHandler, this is
24 // called on the platform thread.
25 virtual void OnWindowSizeChanged(size_t width, size_t height) = 0;
26
27 // Notifies delegate that backing window needs to be repainted.
28 // Typically called by currently configured WindowBindingHandler.
29 virtual void OnWindowRepaint() = 0;
30
31 // Notifies delegate that backing window mouse has moved.
32 // Typically called by currently configured WindowBindingHandler.
33 virtual void OnPointerMove(double x,
34 double y,
35 FlutterPointerDeviceKind device_kind,
36 int32_t device_id,
37 int modifiers_state) = 0;
38
39 // Notifies delegate that backing window mouse pointer button has been
40 // pressed. Typically called by currently configured WindowBindingHandler.
41 virtual void OnPointerDown(double x,
42 double y,
43 FlutterPointerDeviceKind device_kind,
44 int32_t device_id,
45 FlutterPointerMouseButtons button) = 0;
46
47 // Notifies delegate that backing window mouse pointer button has been
48 // released. Typically called by currently configured WindowBindingHandler.
49 virtual void OnPointerUp(double x,
50 double y,
51 FlutterPointerDeviceKind device_kind,
52 int32_t device_id,
53 FlutterPointerMouseButtons button) = 0;
54
55 // Notifies delegate that backing window mouse pointer has left the window.
56 // Typically called by currently configured WindowBindingHandler.
57 virtual void OnPointerLeave(double x,
58 double y,
59 FlutterPointerDeviceKind device_kind,
60 int32_t device_id) = 0;
61
62 // Notifies delegate that a pan/zoom gesture has started.
63 // Typically called by DirectManipulationEventHandler.
64 virtual void OnPointerPanZoomStart(int32_t device_id) = 0;
65
66 // Notifies delegate that a pan/zoom gesture has updated.
67 // Typically called by DirectManipulationEventHandler.
68 virtual void OnPointerPanZoomUpdate(int32_t device_id,
69 double pan_x,
70 double pan_y,
71 double scale,
72 double rotation) = 0;
73
74 // Notifies delegate that a pan/zoom gesture has ended.
75 // Typically called by DirectManipulationEventHandler.
76 virtual void OnPointerPanZoomEnd(int32_t device_id) = 0;
77
78 // Notifies delegate that backing window has received text.
79 // Typically called by currently configured WindowBindingHandler.
80 virtual void OnText(const std::u16string&) = 0;
81
82 // Notifies delegate that backing window size has received key press. Should
83 // return true if the event was handled and should not be propagated.
84 // Typically called by currently configured WindowBindingHandler.
85 virtual void OnKey(int key,
86 int scancode,
87 int action,
88 char32_t character,
89 bool extended,
90 bool was_down,
91 KeyEventCallback callback) = 0;
92
93 // Notifies the delegate that IME composing mode has begun.
94 //
95 // Triggered when the user begins editing composing text using a multi-step
96 // input method such as in CJK text input.
97 virtual void OnComposeBegin() = 0;
98
99 // Notifies the delegate that IME composing region have been committed.
100 //
101 // Triggered when the user commits the current composing text while using a
102 // multi-step input method such as in CJK text input. Composing continues with
103 // the next keypress.
104 virtual void OnComposeCommit() = 0;
105
106 // Notifies the delegate that IME composing mode has ended.
107 //
108 // Triggered when the user commits the composing text while using a multi-step
109 // input method such as in CJK text input.
110 virtual void OnComposeEnd() = 0;
111
112 // Notifies the delegate that IME composing region contents have changed.
113 //
114 // Triggered when the user edits the composing text while using a multi-step
115 // input method such as in CJK text input.
116 virtual void OnComposeChange(const std::u16string& text, int cursor_pos) = 0;
117
118 // Notifies delegate that backing window size has recevied scroll.
119 // Typically called by currently configured WindowBindingHandler.
120 virtual void OnScroll(double x,
121 double y,
122 double delta_x,
123 double delta_y,
124 int scroll_offset_multiplier,
125 FlutterPointerDeviceKind device_kind,
126 int32_t device_id) = 0;
127
128 // Notifies delegate that scroll inertia should be cancelled.
129 // Typically called by DirectManipulationEventHandler
130 virtual void OnScrollInertiaCancel(int32_t device_id) = 0;
131
132 // Notifies delegate that the Flutter semantics tree should be enabled or
133 // disabled.
134 virtual void OnUpdateSemanticsEnabled(bool enabled) = 0;
135
136 // Returns the root view accessibility node, or nullptr if none.
137 virtual gfx::NativeViewAccessible GetNativeViewAccessible() = 0;
138
139 // Update the status of the high contrast feature
140 virtual void UpdateHighContrastEnabled(bool enabled) = 0;
141
142 // Obtain a pointer to the fragment root delegate.
143 // This is required by UIA in order to obtain the fragment root that
144 // contains a fragment obtained by, for example, a hit test. Unlike
145 // MSAA, UIA elements do not explicitly store or enumerate their
146 // children and parents, so a method such as this is required.
147 virtual ui::AXFragmentRootDelegateWin* GetAxFragmentRootDelegate() = 0;
148
149 // Called when a window receives an event that may alter application lifecycle
150 // state.
151 virtual void OnWindowStateEvent(HWND hwnd, WindowStateEvent event) = 0;
152 };
153
154 } // namespace flutter
155
156 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOW_BINDING_HANDLER_DELEGATE_H_
flutter::WindowStateEvent
WindowStateEvent
An event representing a change in window state that may update the.
Definition: windows_lifecycle_manager.h:24
flutter::WindowBindingHandlerDelegate::OnWindowRepaint
virtual void OnWindowRepaint()=0
flutter::WindowBindingHandlerDelegate::OnPointerPanZoomEnd
virtual void OnPointerPanZoomEnd(int32_t device_id)=0
scancode
int scancode
Definition: keyboard_key_handler_unittests.cc:115
windows_lifecycle_manager.h
geometry.h
was_down
bool was_down
Definition: keyboard_key_handler_unittests.cc:119
extended
bool extended
Definition: keyboard_key_handler_unittests.cc:118
character
char32_t character
Definition: keyboard_key_handler_unittests.cc:117
flutter::WindowBindingHandlerDelegate::OnPointerMove
virtual void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state)=0
flutter::WindowBindingHandlerDelegate
Definition: window_binding_handler_delegate.h:18
flutter::WindowBindingHandlerDelegate::GetAxFragmentRootDelegate
virtual ui::AXFragmentRootDelegateWin * GetAxFragmentRootDelegate()=0
flutter::WindowBindingHandlerDelegate::OnText
virtual void OnText(const std::u16string &)=0
flutter::WindowBindingHandlerDelegate::KeyEventCallback
std::function< void(bool)> KeyEventCallback
Definition: window_binding_handler_delegate.h:20
text
std::u16string text
Definition: keyboard_unittests.cc:332
flutter::WindowBindingHandlerDelegate::OnPointerPanZoomUpdate
virtual void OnPointerPanZoomUpdate(int32_t device_id, double pan_x, double pan_y, double scale, double rotation)=0
flutter::WindowBindingHandlerDelegate::OnPointerLeave
virtual void OnPointerLeave(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)=0
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::WindowBindingHandlerDelegate::OnWindowStateEvent
virtual void OnWindowStateEvent(HWND hwnd, WindowStateEvent event)=0
flutter::WindowBindingHandlerDelegate::OnComposeBegin
virtual void OnComposeBegin()=0
flutter::WindowBindingHandlerDelegate::OnComposeEnd
virtual void OnComposeEnd()=0
flutter::WindowBindingHandlerDelegate::OnScrollInertiaCancel
virtual void OnScrollInertiaCancel(int32_t device_id)=0
flutter::WindowBindingHandlerDelegate::OnComposeCommit
virtual void OnComposeCommit()=0
flutter::WindowBindingHandlerDelegate::UpdateHighContrastEnabled
virtual void UpdateHighContrastEnabled(bool enabled)=0
flutter::WindowBindingHandlerDelegate::OnPointerDown
virtual void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button)=0
flutter::WindowBindingHandlerDelegate::OnPointerPanZoomStart
virtual void OnPointerPanZoomStart(int32_t device_id)=0
action
int action
Definition: keyboard_key_handler_unittests.cc:116
flutter::WindowBindingHandlerDelegate::GetNativeViewAccessible
virtual gfx::NativeViewAccessible GetNativeViewAccessible()=0
flutter::WindowBindingHandlerDelegate::OnKey
virtual void OnKey(int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback)=0
flutter::WindowBindingHandlerDelegate::OnScroll
virtual void OnScroll(double x, double y, double delta_x, double delta_y, int scroll_offset_multiplier, FlutterPointerDeviceKind device_kind, int32_t device_id)=0
key
int key
Definition: keyboard_key_handler_unittests.cc:114
flutter::WindowBindingHandlerDelegate::OnPointerUp
virtual void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button)=0
flutter::WindowBindingHandlerDelegate::OnComposeChange
virtual void OnComposeChange(const std::u16string &text, int cursor_pos)=0
flutter::WindowBindingHandlerDelegate::OnUpdateSemanticsEnabled
virtual void OnUpdateSemanticsEnabled(bool enabled)=0
flutter::WindowBindingHandlerDelegate::OnWindowSizeChanged
virtual void OnWindowSizeChanged(size_t width, size_t height)=0
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:46