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.

76 lines
3.1KB

  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 without parent.
  28. */
  29. StandaloneWindow(Application& app)
  30. : Window(app),
  31. TopLevelWidget((Window&)*this) {}
  32. /**
  33. Constructor with parent window, typically used to run as modal.
  34. */
  35. StandaloneWindow(Application& app, Window& parentWindow)
  36. : Window(app, parentWindow),
  37. TopLevelWidget((Window&)*this) {}
  38. /**
  39. Overloaded functions to ensure they apply to the Window class.
  40. */
  41. bool isVisible() const noexcept { return Window::isVisible(); }
  42. void setVisible(bool yesNo) { Window::setVisible(yesNo); }
  43. void hide() { Window::hide(); }
  44. void show() { Window::show(); }
  45. uint getWidth() const noexcept { return Window::getWidth(); }
  46. uint getHeight() const noexcept { return Window::getHeight(); }
  47. const Size<uint> getSize() const noexcept { return Window::getSize(); }
  48. void repaint() noexcept { Window::repaint(); }
  49. void setWidth(uint width) { Window::setWidth(width); }
  50. void setHeight(uint height) { Window::setHeight(height); }
  51. void setSize(uint width, uint height) { Window::setSize(width, height); }
  52. void setSize(const Size<uint>& size) { Window::setSize(size); }
  53. bool addIdleCallback(IdleCallback* callback, uint timerFrequencyInMs = 0)
  54. { return Window::addIdleCallback(callback, timerFrequencyInMs); }
  55. bool removeIdleCallback(IdleCallback* callback) { return Window::removeIdleCallback(callback); }
  56. const GraphicsContext& getGraphicsContext() const noexcept { return Window::getGraphicsContext(); }
  57. void setGeometryConstraints(uint minimumWidth, uint minimumHeight,
  58. bool keepAspectRatio = false, bool automaticallyScale = false)
  59. { Window::setGeometryConstraints(minimumWidth, minimumHeight, keepAspectRatio, automaticallyScale); }
  60. DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(StandaloneWindow)
  61. };
  62. // -----------------------------------------------------------------------
  63. END_NAMESPACE_DGL
  64. #endif // DGL_STANDALONE_WINDOW_HPP_INCLUDED