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 NativeWindow {
  13. public:
  14. void show(WindowShowMode showMode)
  15. {
  16. std::cout << "I'm a window!";
  17. }
  18. };
  19.  
  20. class Window {
  21. public:
  22. Window();
  23. ~Window();
  24. void show();
  25. void hide();
  26. private:
  27. class NativeControl;
  28. std::unique_ptr<NativeControl> _window;
  29. };
  30.  
  31. class Window::NativeControl : public NativeWindow {
  32. public:
  33. NativeControl() : NativeWindow() { }
  34. };
  35.  
  36. Window::Window()
  37. : _window(std::make_unique<Window::NativeControl>()) {
  38. }
  39.  
  40. Window::~Window() {
  41. }
  42.  
  43. void Window::show()
  44. {
  45. _window->show(WindowShowMode::Show);
  46. }
  47.  
  48. void Window::hide()
  49. {
  50. _window->show(WindowShowMode::Hide);
  51. }
  52.  
  53. int main()
  54. {
  55. Window window;
  56.  
  57. window.show();
  58. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
I'm a window!