DISTRHO Plugin Framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.6KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef DGL_STANDALONE_WINDOW_HPP_INCLUDED
  17. #define DGL_STANDALONE_WINDOW_HPP_INCLUDED
  18. #include "TopLevelWidget.hpp"
  19. #include "Window.hpp"
  20. START_NAMESPACE_DGL
  21. // -----------------------------------------------------------------------
  22. class StandaloneWindow : public Window,
  23. public TopLevelWidget
  24. {
  25. public:
  26. /**
  27. Constructor.
  28. */
  29. StandaloneWindow(Application& app)
  30. : Window(app),
  31. TopLevelWidget((Window&)*this) {}
  32. /**
  33. Overloaded functions to ensure they apply to the Window class.
  34. */
  35. bool isVisible() const noexcept { return Window::isVisible(); }
  36. void setVisible(bool yesNo) { Window::setVisible(yesNo); }
  37. void hide() { Window::hide(); }
  38. void show() { Window::show(); }
  39. uint getWidth() const noexcept { return Window::getWidth(); }
  40. uint getHeight() const noexcept { return Window::getHeight(); }
  41. const Size<uint> getSize() const noexcept { return Window::getSize(); }
  42. /**
  43. Overloaded functions to ensure size changes apply on both TopLevelWidget and Window classes.
  44. */
  45. void setWidth(uint width)
  46. {
  47. TopLevelWidget::setWidth(width);
  48. Window::setWidth(width);
  49. }
  50. void setHeight(uint height)
  51. {
  52. TopLevelWidget::setHeight(height);
  53. Window::setHeight(height);
  54. }
  55. void setSize(uint width, uint height)
  56. {
  57. TopLevelWidget::setSize(width, height);
  58. Window::setSize(width, height);
  59. }
  60. void setSize(const Size<uint>& size)
  61. {
  62. TopLevelWidget::setSize(size);
  63. Window::setSize(size);
  64. }
  65. DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(StandaloneWindow)
  66. };
  67. // -----------------------------------------------------------------------
  68. END_NAMESPACE_DGL
  69. #endif // DGL_STANDALONE_WINDOW_HPP_INCLUDED