Flutter Engine
win32_flutter_window.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_FLUTTER_WINDOW_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOW_H_
7 
8 #include <windowsx.h>
9 
10 #include <iostream>
11 #include <string>
12 #include <vector>
13 
14 #include "flutter/shell/platform/embedder/embedder.h"
15 #include "flutter/shell/platform/windows/flutter_windows_view.h"
16 #include "flutter/shell/platform/windows/win32_window.h"
17 #include "flutter/shell/platform/windows/window_binding_handler.h"
18 
19 namespace flutter {
20 
21 // A win32 flutter child window used as implementatin for flutter view. In the
22 // future, there will likely be a CoreWindow-based FlutterWindow as well. At
23 // the point may make sense to dependency inject the native window rather than
24 // inherit.
26  public:
27  // Create flutter Window for use as child window
29 
30  virtual ~Win32FlutterWindow();
31 
32  // |Win32Window|
33  void OnDpiScale(unsigned int dpi) override;
34 
35  // |Win32Window|
36  void OnResize(unsigned int width, unsigned int height) override;
37 
38  // |Win32Window|
39  void OnPointerMove(double x, double y) override;
40 
41  // |Win32Window|
42  void OnPointerDown(double x, double y, UINT button) override;
43 
44  // |Win32Window|
45  void OnPointerUp(double x, double y, UINT button) override;
46 
47  // |Win32Window|
48  void OnPointerLeave() override;
49 
50  // |Win32Window|
51  void OnSetCursor() override;
52 
53  // |Win32Window|
54  void OnText(const std::u16string& text) override;
55 
56  // |Win32Window|
57  void OnKey(int key, int scancode, int action, char32_t character) override;
58 
59  // |Win32Window|
60  void OnScroll(double delta_x, double delta_y) override;
61 
62  // |FlutterWindowBindingHandler|
63  void SetView(WindowBindingHandlerDelegate* view) override;
64 
65  // |FlutterWindowBindingHandler|
67 
68  // |FlutterWindowBindingHandler|
69  float GetDpiScale() override;
70 
71  // |FlutterWindowBindingHandler|
73 
74  // |FlutterWindowBindingHandler|
75  void UpdateFlutterCursor(const std::string& cursor_name) override;
76 
77  private:
78  // A pointer to a FlutterWindowsView that can be used to update engine
79  // windowing and input state.
80  WindowBindingHandlerDelegate* binding_handler_delegate_;
81 
82  // The last cursor set by Flutter. Defaults to the arrow cursor.
83  HCURSOR current_cursor_;
84 };
85 
86 } // namespace flutter
87 
88 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOW_H_
void UpdateFlutterCursor(const std::string &cursor_name) override
PhysicalWindowBounds GetPhysicalWindowBounds() override
std::variant< HWND > WindowsRenderTarget
void OnPointerDown(double x, double y, UINT button) override
void OnScroll(double delta_x, double delta_y) override
void OnKey(int key, int scancode, int action, char32_t character) override
void OnText(const std::u16string &text) override
WindowsRenderTarget GetRenderTarget() override
void OnPointerMove(double x, double y) override
SemanticsAction action
int32_t height
int32_t width
void SetView(WindowBindingHandlerDelegate *view) override
void OnDpiScale(unsigned int dpi) override
Win32FlutterWindow(int width, int height)
void OnPointerUp(double x, double y, UINT button) override
void OnResize(unsigned int width, unsigned int height) override