DISTRHO Plugin Framework
VstGuiWidget.hpp
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 
17 #ifndef DISTRHO_VSTGUI_TOP_LEVEL_WIDGET_HPP_INCLUDED
18 #define DISTRHO_VSTGUI_TOP_LEVEL_WIDGET_HPP_INCLUDED
19 
20 #include "Base.hpp"
21 #include "../distrho/extra/String.hpp"
22 
23 START_NAMESPACE_DGL
24 
25 // -----------------------------------------------------------------------
26 
27 /**
28  VstGui VstGuiStandaloneWindow class.
29 
30  This is a vstgui on top of DGL/DPF, with similar semantics as a VstGuiStandaloneWindow (Window + TopLevelWidget).
31  The intention is to make it usable as a plugin UI target.
32 
33  Work-in-progress.
34  */
36 {
37 public:
38  /**
39  Constructor.
40  */
41  VstGuiStandaloneWindow(const uint w = 1, const uint h = 1, const char* const t = "")
42  : width(w),
43  height(h),
44  title(t),
45  transientWinId(0),
46  visible(false) {}
47 
48  virtual ~VstGuiStandaloneWindow()
49  {
50  }
51 
52  uint getWidth() const noexcept
53  {
54  return width;
55  }
56 
57  uint getHeight() const noexcept
58  {
59  return height;
60  }
61 
62  const char* getTitle() const noexcept
63  {
64  return title;
65  }
66 
67  uintptr_t getTransientWinId() const noexcept
68  {
69  return transientWinId;
70  }
71 
72  bool isVisible() const noexcept
73  {
74  return visible;
75  }
76 
77  bool isRunning() noexcept
78  {
79  return visible;
80  }
81 
82  virtual void idle() {}
83 
84  virtual void setSize(uint w, uint h)
85  {
86  width = w;
87  height = h;
88  }
89 
90  virtual void setTitle(const char* const t)
91  {
92  title = t;
93  }
94 
95  virtual void setTransientWinId(const uintptr_t winId)
96  {
97  transientWinId = winId;
98  }
99 
100  virtual void setVisible(const bool yesNo)
101  {
102  visible = yesNo;
103  }
104 
105 private:
106  uint width;
107  uint height;
108  DISTRHO_NAMESPACE::String title;
109  uintptr_t transientWinId;
110  bool visible;
111 
112  DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VstGuiStandaloneWindow)
113 };
114 
115 // -----------------------------------------------------------------------
116 
117 END_NAMESPACE_DGL
118 
119 #endif // DISTRHO_VSTGUI_TOP_LEVEL_WIDGET_HPP_INCLUDED
VstGuiStandaloneWindow::VstGuiStandaloneWindow
VstGuiStandaloneWindow(const uint w=1, const uint h=1, const char *const t="")
Definition: VstGuiWidget.hpp:41
VstGuiStandaloneWindow
Definition: VstGuiWidget.hpp:35