Flutter Engine
The Flutter Engine
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/windows/public/flutter_windows.h"
16#include "flutter/shell/platform/windows/window_binding_handler_delegate.h"
17
18namespace ui {
19class AXPlatformNodeWin;
20}
21
22namespace flutter {
23
24class 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_
virtual void SetFlutterCursor(HCURSOR cursor)=0
virtual void OnResetImeComposing()=0
virtual PointerLocation GetPrimaryPointerLocation()=0
virtual HWND GetWindowHandle()=0
virtual bool OnBitmapSurfaceUpdated(const void *allocation, size_t row_bytes, size_t height)=0
virtual ui::AXPlatformNodeWin * GetAlert()=0
virtual void UpdateFlutterCursor(const std::string &cursor_name)=0
virtual bool OnBitmapSurfaceCleared()=0
virtual PhysicalWindowBounds GetPhysicalWindowBounds()=0
virtual float GetDpiScale()=0
virtual void SetView(WindowBindingHandlerDelegate *view)=0
virtual AlertPlatformNodeDelegate * GetAlertDelegate()=0
virtual void OnCursorRectUpdated(const Rect &rect)=0
virtual ~WindowBindingHandler()=default
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
int32_t height