Flutter Engine
flutter::Win32FlutterWindow Class Reference

#include <win32_flutter_window.h>

Inheritance diagram for flutter::Win32FlutterWindow:
flutter::Win32Window flutter::WindowBindingHandler flutter::testing::Win32FlutterWindowTest

Public Member Functions

 Win32FlutterWindow (int width, int height)
 
virtual ~Win32FlutterWindow ()
 
void OnDpiScale (unsigned int dpi) override
 
void OnResize (unsigned int width, unsigned int height) override
 
void OnPointerMove (double x, double y) override
 
void OnPointerDown (double x, double y, UINT button) override
 
void OnPointerUp (double x, double y, UINT button) override
 
void OnPointerLeave () override
 
void OnSetCursor () override
 
void OnText (const std::u16string &text) override
 
void OnKey (int key, int scancode, int action, char32_t character) override
 
void OnScroll (double delta_x, double delta_y) override
 
void SetView (WindowBindingHandlerDelegate *view) override
 
WindowsRenderTarget GetRenderTarget () override
 
float GetDpiScale () override
 
PhysicalWindowBounds GetPhysicalWindowBounds () override
 
void UpdateFlutterCursor (const std::string &cursor_name) override
 
- Public Member Functions inherited from flutter::Win32Window
 Win32Window ()
 
virtual ~Win32Window ()
 
void InitializeChild (const char *title, unsigned int width, unsigned int height)
 
HWND GetWindowHandle ()
 
- Public Member Functions inherited from flutter::WindowBindingHandler
virtual ~WindowBindingHandler ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from flutter::Win32Window
std::wstring NarrowToWide (const char *source)
 
WNDCLASS RegisterWindowClass (std::wstring &title)
 
LRESULT HandleMessage (UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept
 
LRESULT HandleDpiChange (HWND hWnd, WPARAM wParam, LPARAM lParam, bool top_level)
 
virtual void OnDpiScale (UINT dpi)=0
 
virtual void OnResize (UINT width, UINT height)=0
 
UINT GetCurrentDPI ()
 
UINT GetCurrentWidth ()
 
UINT GetCurrentHeight ()
 
- Static Protected Member Functions inherited from flutter::Win32Window
static LRESULT CALLBACK WndProc (HWND const window, UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept
 

Detailed Description

Definition at line 25 of file win32_flutter_window.h.

Constructor & Destructor Documentation

◆ Win32FlutterWindow()

flutter::Win32FlutterWindow::Win32FlutterWindow ( int  width,
int  height 
)

Definition at line 67 of file win32_flutter_window.cc.

References flutter::Win32Window::InitializeChild().

68  : binding_handler_delegate_(nullptr) {
69  Win32Window::InitializeChild("FLUTTERVIEW", width, height);
70  current_cursor_ = ::LoadCursor(nullptr, IDC_ARROW);
71 }
void InitializeChild(const char *title, unsigned int width, unsigned int height)
Definition: win32_window.cc:31
int32_t height
int32_t width

◆ ~Win32FlutterWindow()

flutter::Win32FlutterWindow::~Win32FlutterWindow ( )
virtual

Definition at line 73 of file win32_flutter_window.cc.

73 {}

Member Function Documentation

◆ GetDpiScale()

float flutter::Win32FlutterWindow::GetDpiScale ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 83 of file win32_flutter_window.cc.

References flutter::Win32Window::GetCurrentDPI().

83  {
84  return static_cast<float>(GetCurrentDPI()) / static_cast<float>(base_dpi);
85 }

◆ GetPhysicalWindowBounds()

PhysicalWindowBounds flutter::Win32FlutterWindow::GetPhysicalWindowBounds ( )
overridevirtual

◆ GetRenderTarget()

WindowsRenderTarget flutter::Win32FlutterWindow::GetRenderTarget ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 79 of file win32_flutter_window.cc.

References flutter::Win32Window::GetWindowHandle().

79  {
81 }
std::variant< HWND > WindowsRenderTarget

◆ OnDpiScale()

void flutter::Win32FlutterWindow::OnDpiScale ( unsigned int  dpi)
override

Definition at line 116 of file win32_flutter_window.cc.

116 {};

◆ OnKey()

void flutter::Win32FlutterWindow::OnKey ( int  key,
int  scancode,
int  action,
char32_t  character 
)
overridevirtual

Implements flutter::Win32Window.

Definition at line 158 of file win32_flutter_window.cc.

References flutter::WindowBindingHandlerDelegate::OnKey().

161  {
162  binding_handler_delegate_->OnKey(key, scancode, action, character);
163 }
virtual void OnKey(int key, int scancode, int action, char32_t character)=0
SemanticsAction action

◆ OnPointerDown()

void flutter::Win32FlutterWindow::OnPointerDown ( double  x,
double  y,
UINT  button 
)
overridevirtual

Implements flutter::Win32Window.

Definition at line 130 of file win32_flutter_window.cc.

References flutter::ConvertWinButtonToFlutterButton(), and flutter::WindowBindingHandlerDelegate::OnPointerDown().

130  {
131  uint64_t flutter_button = ConvertWinButtonToFlutterButton(button);
132  if (flutter_button != 0) {
133  binding_handler_delegate_->OnPointerDown(
134  x, y, static_cast<FlutterPointerMouseButtons>(flutter_button));
135  }
136 }
virtual void OnPointerDown(double x, double y, FlutterPointerMouseButtons button)=0
static uint64_t ConvertWinButtonToFlutterButton(UINT button)

◆ OnPointerLeave()

void flutter::Win32FlutterWindow::OnPointerLeave ( )
overridevirtual

Implements flutter::Win32Window.

Definition at line 146 of file win32_flutter_window.cc.

References flutter::WindowBindingHandlerDelegate::OnPointerLeave().

146  {
147  binding_handler_delegate_->OnPointerLeave();
148 }

◆ OnPointerMove()

void flutter::Win32FlutterWindow::OnPointerMove ( double  x,
double  y 
)
overridevirtual

Implements flutter::Win32Window.

Definition at line 126 of file win32_flutter_window.cc.

References flutter::WindowBindingHandlerDelegate::OnPointerMove().

126  {
127  binding_handler_delegate_->OnPointerMove(x, y);
128 }
virtual void OnPointerMove(double x, double y)=0

◆ OnPointerUp()

void flutter::Win32FlutterWindow::OnPointerUp ( double  x,
double  y,
UINT  button 
)
overridevirtual

Implements flutter::Win32Window.

Definition at line 138 of file win32_flutter_window.cc.

References flutter::ConvertWinButtonToFlutterButton(), and flutter::WindowBindingHandlerDelegate::OnPointerUp().

138  {
139  uint64_t flutter_button = ConvertWinButtonToFlutterButton(button);
140  if (flutter_button != 0) {
141  binding_handler_delegate_->OnPointerUp(
142  x, y, static_cast<FlutterPointerMouseButtons>(flutter_button));
143  }
144 }
virtual void OnPointerUp(double x, double y, FlutterPointerMouseButtons button)=0
static uint64_t ConvertWinButtonToFlutterButton(UINT button)

◆ OnResize()

void flutter::Win32FlutterWindow::OnResize ( unsigned int  width,
unsigned int  height 
)
override

Definition at line 120 of file win32_flutter_window.cc.

References flutter::WindowBindingHandlerDelegate::OnWindowSizeChanged().

120  {
121  if (binding_handler_delegate_ != nullptr) {
122  binding_handler_delegate_->OnWindowSizeChanged(width, height);
123  }
124 }
virtual void OnWindowSizeChanged(size_t width, size_t height) const =0
int32_t height
int32_t width

◆ OnScroll()

void flutter::Win32FlutterWindow::OnScroll ( double  delta_x,
double  delta_y 
)
overridevirtual

Implements flutter::Win32Window.

Definition at line 165 of file win32_flutter_window.cc.

References flutter::Win32Window::GetWindowHandle(), and flutter::WindowBindingHandlerDelegate::OnScroll().

165  {
166  POINT point;
167  GetCursorPos(&point);
168 
169  ScreenToClient(GetWindowHandle(), &point);
170  binding_handler_delegate_->OnScroll(point.x, point.y, delta_x, delta_y,
171  kScrollOffsetMultiplier);
172 }
virtual void OnScroll(double x, double y, double delta_x, double delta_y, int scroll_offset_multiplier)=0

◆ OnSetCursor()

void flutter::Win32FlutterWindow::OnSetCursor ( )
overridevirtual

Implements flutter::Win32Window.

Definition at line 150 of file win32_flutter_window.cc.

150  {
151  ::SetCursor(current_cursor_);
152 }

◆ OnText()

void flutter::Win32FlutterWindow::OnText ( const std::u16string &  text)
overridevirtual

Implements flutter::Win32Window.

Definition at line 154 of file win32_flutter_window.cc.

References flutter::WindowBindingHandlerDelegate::OnText().

154  {
155  binding_handler_delegate_->OnText(text);
156 }
virtual void OnText(const std::u16string &)=0

◆ SetView()

void flutter::Win32FlutterWindow::SetView ( WindowBindingHandlerDelegate view)
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 75 of file win32_flutter_window.cc.

75  {
76  binding_handler_delegate_ = window;
77 }

◆ UpdateFlutterCursor()

void flutter::Win32FlutterWindow::UpdateFlutterCursor ( const std::string &  cursor_name)
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 91 of file win32_flutter_window.cc.

91  {
92  current_cursor_ = GetCursorByName(cursor_name);
93 }

The documentation for this class was generated from the following files: