system_context_wx.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. //
  3. // Copyright (c) 2019-2020 Ivan Baidakou (basiliscos) (the dot dmol at gmail dot com)
  4. //
  5. // Distributed under the MIT Software License
  6. //
  7. #include "rotor/arc.hpp"
  8. #include "rotor/wx/supervisor_config_wx.h"
  9. #include "rotor/system_context.h"
  10. #include <wx/app.h>
  11. namespace rotor {
  12. namespace wx {
  13. struct supervisor_wx_t;
  14. /** \brief intrusive pointer for wx supervisor */
  15. using supervisor_ptr_t = intrusive_ptr_t<supervisor_wx_t>;
  16. /** \struct system_context_wx_t
  17. * \brief The wxWidgets system context, which holds a pointer to wxApp and
  18. * root wx-supervisor
  19. *
  20. */
  21. struct system_context_wx_t : public system_context_t {
  22. /** \brief intrusive pointer type for wx system context */
  23. using ptr_t = rotor::intrusive_ptr_t<system_context_wx_t>;
  24. /** \brief construct the context from wx application
  25. *
  26. * If `app` is null, then the wx application is taken via `wxTheApp` macro
  27. *
  28. */
  29. system_context_wx_t(wxAppConsole *app = nullptr);
  30. /** \brief returns wx application */
  31. inline wxAppConsole *get_app() noexcept { return app; }
  32. protected:
  33. friend struct supervisor_wx_t;
  34. /** \brief non-owning pointer to the wx application */
  35. wxAppConsole *app;
  36. };
  37. /** \brief intrusive pointer type for wx system context */
  38. using system_context_ptr_t = typename system_context_wx_t::ptr_t;
  39. } // namespace wx
  40. } // namespace rotor