Audio plugin host https://kx.studio/carla
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.

92 lines
2.5KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2014 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_WINDOW_HPP_INCLUDED
  17. #define DGL_WINDOW_HPP_INCLUDED
  18. #include "Geometry.hpp"
  19. START_NAMESPACE_DGL
  20. // -----------------------------------------------------------------------
  21. class App;
  22. class Widget;
  23. class Window
  24. {
  25. public:
  26. explicit Window(App& app);
  27. explicit Window(App& app, Window& parent);
  28. explicit Window(App& app, intptr_t parentId);
  29. virtual ~Window();
  30. void show();
  31. void hide();
  32. void close();
  33. void exec(bool lockWait = false);
  34. void focus();
  35. void repaint() noexcept;
  36. bool isVisible() const noexcept;
  37. void setVisible(bool yesNo);
  38. bool isResizable() const noexcept;
  39. void setResizable(bool yesNo);
  40. int getWidth() const noexcept;
  41. int getHeight() const noexcept;
  42. Size<uint> getSize() const noexcept;
  43. void setSize(uint width, uint height);
  44. void setSize(Size<uint> size);
  45. void setTitle(const char* title);
  46. void setTransientWinId(intptr_t winId);
  47. App& getApp() const noexcept;
  48. intptr_t getWindowId() const noexcept;
  49. void addIdleCallback(IdleCallback* const callback);
  50. void removeIdleCallback(IdleCallback* const callback);
  51. protected:
  52. virtual void onDisplayBefore();
  53. virtual void onDisplayAfter();
  54. virtual void onReshape(int width, int height);
  55. virtual void onClose();
  56. private:
  57. struct PrivateData;
  58. PrivateData* const pData;
  59. friend class App;
  60. friend class Widget;
  61. friend class StandaloneWindow;
  62. virtual void _addWidget(Widget* const widget);
  63. virtual void _removeWidget(Widget* const widget);
  64. void _idle();
  65. DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Window)
  66. };
  67. // -----------------------------------------------------------------------
  68. END_NAMESPACE_DGL
  69. #endif // DGL_WINDOW_HPP_INCLUDED