fork download
  1. #include <memory>
  2. #include <iostream>
  3.  
  4. enum class WindowShowMode
  5. {
  6. Hide = 0, // SW_HIDE,
  7. Show = 1, // SW_SHOWNORMAL,
  8. Minimize = 6, // SW_MINIMIZE,
  9. Maximize = 3, // SW_SHOWMAXIMIZED,
  10. };
  11.  
  12. class Window {
  13. public:
  14. Window();
  15. ~Window();
  16. void show();
  17. void hide();
  18. private:
  19. class NativeControl;
  20. std::unique_ptr<NativeControl> _window;
  21. };
  22.  
  23. class Window::NativeControl {
  24. public:
  25. void show(WindowShowMode showMode)
  26. {
  27. std::cout << "I'm a window!";
  28. }
  29. };
  30.  
  31. Window::Window()
  32. : _window(std::make_unique<Window::NativeControl>()) {
  33. }
  34.  
  35. Window::~Window() {
  36. }
  37.  
  38. void Window::show()
  39. {
  40. _window->show(WindowShowMode::Show);
  41. }
  42.  
  43. void Window::hide()
  44. {
  45. _window->show(WindowShowMode::Hide);
  46. }
  47.  
  48. int main()
  49. {
  50. Window window;
  51.  
  52. window.show();
  53. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
I'm a window!