gl_window.h 852 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // This file is part of Desktop App Toolkit,
  2. // a set of libraries for developing nice desktop applications.
  3. //
  4. // For license and copyright information please follow this link:
  5. // https://github.com/desktop-app/legal/blob/master/LEGAL
  6. //
  7. #pragma once
  8. namespace Ui {
  9. class RpWindow;
  10. class RpWidget;
  11. } // namespace Ui
  12. namespace Ui::GL {
  13. enum class Backend;
  14. struct Capabilities;
  15. class Window final {
  16. public:
  17. Window();
  18. explicit Window(Fn<Backend(Capabilities)> chooseBackend);
  19. ~Window();
  20. [[nodiscard]] Backend backend() const;
  21. [[nodiscard]] not_null<RpWindow*> window() const;
  22. [[nodiscard]] not_null<RpWidget*> widget() const;
  23. private:
  24. [[nodiscard]] std::unique_ptr<RpWindow> createWindow(
  25. const Fn<Backend(Capabilities)> &chooseBackend);
  26. Backend _backend = Backend();
  27. const std::unique_ptr<RpWindow> _window;
  28. };
  29. } // namespace Ui::GL