flutter_window.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef RUNNER_FLUTTER_WINDOW_H_
  2. #define RUNNER_FLUTTER_WINDOW_H_
  3. #include <flutter/dart_project.h>
  4. #include <flutter/flutter_view_controller.h>
  5. #include <memory>
  6. #include "run_loop.h"
  7. #include "win32_window.h"
  8. // A window that does nothing but host a Flutter view.
  9. class FlutterWindow : public Win32Window {
  10. public:
  11. // Creates a new FlutterWindow driven by the |run_loop|, hosting a
  12. // Flutter view running |project|.
  13. explicit FlutterWindow(RunLoop* run_loop,
  14. const flutter::DartProject& project);
  15. virtual ~FlutterWindow();
  16. protected:
  17. // Win32Window:
  18. bool OnCreate() override;
  19. void OnDestroy() override;
  20. LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
  21. LPARAM const lparam) noexcept override;
  22. private:
  23. // The run loop driving events for this window.
  24. RunLoop* run_loop_;
  25. // The project to run.
  26. flutter::DartProject project_;
  27. // The Flutter instance hosted by this window.
  28. std::unique_ptr<flutter::FlutterViewController> flutter_controller_;
  29. };
  30. #endif // RUNNER_FLUTTER_WINDOW_H_