| Flutter Windows Embedder |

window_binding_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_WINDOW_BINDING_HANDLER_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOW_BINDING_HANDLER_H_
7
8 #include <windows.h>
9
10 #include <string>
11 #include <variant>
12
13 #include "flutter/shell/platform/common/alert_platform_node_delegate.h"
14 #include "flutter/shell/platform/common/geometry.h"
15 #include "flutter/shell/platform/embedder/embedder.h"
16 #include "flutter/shell/platform/windows/public/flutter_windows.h"
17 #include "flutter/shell/platform/windows/window_binding_handler_delegate.h"
18
19 namespace ui {
20 class AXPlatformNodeWin;
21 }
22
23 namespace flutter {
24
25 class FlutterWindowsView;
26
27 // Structure containing physical bounds of a Window
28 struct PhysicalWindowBounds {
29 size_t width;
30 size_t height;
31 };
32
33 // Structure containing the position of a mouse pointer in the coordinate system
34 // specified by the function where it's used.
35 struct PointerLocation {
36 size_t x;
37 size_t y;
38 };
39
40 // Abstract class for binding Windows platform windows to Flutter views.
41 class WindowBindingHandler {
42 public:
43 virtual ~WindowBindingHandler() = default;
44
45 // Sets the delegate used to communicate state changes from window to view
46 // such as key presses, mouse position updates etc.
47 virtual void SetView(WindowBindingHandlerDelegate* view) = 0;
48
49 // Returns the underlying HWND backing the window.
50 virtual HWND GetWindowHandle() = 0;
51
52 // Returns the scale factor for the backing window.
53 virtual float GetDpiScale() = 0;
54
55 // Returns the bounds of the backing window in physical pixels.
56 virtual PhysicalWindowBounds GetPhysicalWindowBounds() = 0;
57
58 // Invoked when the cursor/composing rect has been updated in the framework.
59 virtual void OnCursorRectUpdated(const Rect& rect) = 0;
60
61 // Invoked when the embedder clears the contents of this Flutter view.
62 //
63 // Returns whether the surface was successfully updated or not.
64 virtual bool OnBitmapSurfaceCleared() = 0;
65
66 // Invoked when the embedder provides us with new bitmap data for the contents
67 // of this Flutter view.
68 //
69 // Returns whether the surface was successfully updated or not.
70 virtual bool OnBitmapSurfaceUpdated(const void* allocation,
71 size_t row_bytes,
72 size_t height) = 0;
73
74 // Invoked when the app ends IME composing, such when the active text input
75 // client is cleared.
76 virtual void OnResetImeComposing() = 0;
77
78 // Returns the last known position of the primary pointer in window
79 // coordinates.
80 virtual PointerLocation GetPrimaryPointerLocation() = 0;
81
82 // Retrieve the delegate for the alert.
83 virtual AlertPlatformNodeDelegate* GetAlertDelegate() = 0;
84
85 // Retrieve the alert node.
86 virtual ui::AXPlatformNodeWin* GetAlert() = 0;
87
88 // Focuses the current window.
89 // Returns true if the window was successfully focused.
90 virtual bool Focus() = 0;
91
92 // Retrieve the display ID of the display that this window has the largest
93 // area of intersection with.
94 virtual FlutterEngineDisplayId GetDisplayId() = 0;
95 };
96
97 } // namespace flutter
98
99 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOW_BINDING_HANDLER_H_
alert_platform_node_delegate.h
flutter::AlertPlatformNodeDelegate
Definition: alert_platform_node_delegate.h:18
flutter::Rect
Definition: geometry.h:59
flutter::WindowBindingHandlerDelegate
Definition: window_binding_handler_delegate.h:18
flutter::WindowBindingHandler
Definition: window_binding_handler.h:41
flutter::WindowBindingHandler::OnResetImeComposing
virtual void OnResetImeComposing()=0
flutter::WindowBindingHandler::GetAlert
virtual ui::AXPlatformNodeWin * GetAlert()=0
flutter::WindowBindingHandler::GetPrimaryPointerLocation
virtual PointerLocation GetPrimaryPointerLocation()=0
flutter::WindowBindingHandler::GetWindowHandle
virtual HWND GetWindowHandle()=0
flutter::WindowBindingHandler::Focus
virtual bool Focus()=0
flutter::WindowBindingHandler::GetAlertDelegate
virtual AlertPlatformNodeDelegate * GetAlertDelegate()=0
flutter::WindowBindingHandler::OnBitmapSurfaceUpdated
virtual bool OnBitmapSurfaceUpdated(const void *allocation, size_t row_bytes, size_t height)=0
flutter::WindowBindingHandler::GetDisplayId
virtual FlutterEngineDisplayId GetDisplayId()=0
flutter::WindowBindingHandler::OnBitmapSurfaceCleared
virtual bool OnBitmapSurfaceCleared()=0
flutter::WindowBindingHandler::GetPhysicalWindowBounds
virtual PhysicalWindowBounds GetPhysicalWindowBounds()=0
flutter::WindowBindingHandler::GetDpiScale
virtual float GetDpiScale()=0
flutter::WindowBindingHandler::SetView
virtual void SetView(WindowBindingHandlerDelegate *view)=0
flutter::WindowBindingHandler::OnCursorRectUpdated
virtual void OnCursorRectUpdated(const Rect &rect)=0
flutter::WindowBindingHandler::~WindowBindingHandler
virtual ~WindowBindingHandler()=default
flutter_windows.h
geometry.h
flutter
Definition: accessibility_bridge_windows.cc:11
ui
Definition: window_binding_handler.h:19
flutter::PhysicalWindowBounds
Definition: window_binding_handler.h:28
flutter::PhysicalWindowBounds::height
size_t height
Definition: window_binding_handler.h:30
flutter::PhysicalWindowBounds::width
size_t width
Definition: window_binding_handler.h:29
flutter::PointerLocation
Definition: window_binding_handler.h:35
flutter::PointerLocation::x
size_t x
Definition: window_binding_handler.h:36
flutter::PointerLocation::y
size_t y
Definition: window_binding_handler.h:37
window_binding_handler_delegate.h