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