flutter_flutter/shell/platform/windows/window_binding_handler.h
James Clarke d0d6a4c236
Refactor Win32FlutterWindow in preparation for UWP windowing implementation (#18878)
* Add flutter_windows_view and window_binding_handler

Switch input handling infra to FlutterWindowsView

win32_flutter_window implement WindowBindingHandler

Strip unneeded functionality from win32flutterwindow

Fulfill WindowBindingHandler interface in Win32FlutterWindow

Add implementations for missing input handling in Win32FlutterWindow

Cleanup dead code

Correctly hook up rendering again

Fix resizing

clang-format

Fix clipboard

Cleanup

Rename

Add comments

cleanup

* clang-format

* CR Feedback

* clang-format; gn format

* Fix licensing

* CR feedback

* CR feedback

* CR feedback

* Git rid of unnecessar :: prefixes

* Extract WindowBindingHandlerDelegate as an interface

* Missing file

* Extract physical window bounds as a struct

* CR Feedback

* CR feedback

* clang-format

Co-authored-by: Stuart Morgan <stuartmorgan@google.com>
2020-07-07 06:49:51 -07:00

53 lines
1.5 KiB
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOW_BINDING_HANDLER_H_
#define FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOW_BINDING_HANDLER_H_
#include "flutter/shell/platform/windows/public/flutter_windows.h"
#include <string>
#include <variant>
#include <windows.h>
#include "flutter/shell/platform/windows/window_binding_handler_delegate.h"
namespace flutter {
class FlutterWindowsView;
// Structure containing physical bounds of a Window
struct PhysicalWindowBounds {
size_t width;
size_t height;
};
using WindowsRenderTarget = std::variant<
/*winrt::Windows::UI::Composition::SpriteVisual, */ HWND>;
// Abstract class for binding Windows platform windows to Flutter views.
class WindowBindingHandler {
public:
virtual ~WindowBindingHandler() = default;
// Sets the delegate used to communicate state changes from window to view
// such as key presses, mouse position updates etc.
virtual void SetView(WindowBindingHandlerDelegate* view) = 0;
// Returns a valid WindowsRenderTarget representing the backing
// window.
virtual WindowsRenderTarget GetRenderTarget() = 0;
// Returns the scale factor for the backing window.
virtual float GetDpiScale() = 0;
// Returns the bounds of the backing window in physical pixels.
virtual PhysicalWindowBounds GetPhysicalWindowBounds() = 0;
};
} // namespace flutter
#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOW_BINDING_HANDLER_H_