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