#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOW_H_
#define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOW_H_
#include <windowsx.h>
#include <string>
#include <vector>
#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h"
#include "flutter/shell/platform/common/cpp/incoming_message_dispatcher.h"
#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/windows/angle_surface_manager.h"
#include "flutter/shell/platform/windows/key_event_handler.h"
#include "flutter/shell/platform/windows/keyboard_hook_handler.h"
#include "flutter/shell/platform/windows/platform_handler.h"
#include "flutter/shell/platform/windows/public/flutter_windows.h"
#include "flutter/shell/platform/windows/text_input_plugin.h"
#include "flutter/shell/platform/windows/win32_window.h"
#include "flutter/shell/platform/windows/window_state.h"
namespace flutter {
class Win32FlutterWindow : public Win32Window {
public:
Win32FlutterWindow();
Win32FlutterWindow(const char* title,
const int x,
const int y,
const int width,
const int height) noexcept;
~Win32FlutterWindow();
static FlutterDesktopWindowControllerRef CreateWin32FlutterWindow(
const char* title,
const int x,
const int y,
const int width,
const int height);
void FlutterMessageLoop();
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) override;
void OnPointerUp(double x, double y) override;
void OnChar(unsigned int code_point) override;
void OnKey(int key, int scancode, int action, int mods) override;
void OnScroll(double delta_x, double delta_y) override;
void OnClose();
void SetState(FLUTTER_API_SYMBOL(FlutterEngine) state);
FlutterDesktopPluginRegistrarRef GetRegistrar();
void HandlePlatformMessage(const FlutterPlatformMessage*);
void CreateRenderSurface();
void DestroyRenderSurface();
bool ClearContext();
bool MakeCurrent();
bool SwapBuffers();
void SendWindowMetrics();
private:
void SendPointerMove(double x, double y);
void SendPointerDown(double x, double y);
void SendPointerUp(double x, double y);
void SendChar(unsigned int code_point);
void SendKey(int key, int scancode, int action, int mods);
void SendScroll(double delta_x, double delta_y);
void SetEventLocationFromCursorPosition(FlutterPointerEvent* event_data);
void SetEventPhaseFromCursorButtonState(FlutterPointerEvent* event_data);
void SendPointerEventWithData(const FlutterPointerEvent& event_data);
std::unique_ptr<AngleSurfaceManager> surface_manager = nullptr;
EGLSurface render_surface = EGL_NO_SURFACE;
bool pointer_is_down_ = false;
FLUTTER_API_SYMBOL(FlutterEngine) engine_ = nullptr;
bool hover_tracking_is_enabled_ = false;
bool pointer_currently_added_ = false;
std::unique_ptr<FlutterDesktopWindow> window_wrapper_;
std::unique_ptr<FlutterDesktopPluginRegistrar> plugin_registrar_;
std::unique_ptr<flutter::IncomingMessageDispatcher> message_dispatcher_;
std::unique_ptr<flutter::PluginRegistrar> internal_plugin_registrar_;
std::vector<std::unique_ptr<flutter::KeyboardHookHandler>>
keyboard_hook_handlers_;
std::unique_ptr<flutter::PlatformHandler> platform_handler_;
bool process_events_ = false;
bool messageloop_running_ = false;
};
}
#endif