Loading...
Searching...
No Matches
PlugFrame.hpp
1#pragma once
2#include <Vst3/UI/WindowContainer.hpp>
3
4#include <QTimer>
5#include <QWindow>
6
7#include <pluginterfaces/gui/iplugview.h>
8
9namespace vst3
10{
11
12#if defined(_WIN32)
13class PlugFrame final : public Steinberg::IPlugFrame
14{
15public:
16 Steinberg::tresult queryInterface(const Steinberg::TUID _iid, void** obj) override
17 {
18 *obj = nullptr;
19 return Steinberg::kResultFalse;
20 }
21
22 Steinberg::uint32 addRef() override { return 1; }
23 Steinberg::uint32 release() override { return 1; }
24
25 QDialog* w;
26 WindowContainer wc;
27 PlugFrame(QDialog& w, WindowContainer& wc)
28 : w{&w}
29 , wc{wc}
30 {
31 }
32
33 Steinberg::tresult
34 resizeView(Steinberg::IPlugView* view, Steinberg::ViewRect* newSize) override
35 {
36 wc.setSizeFromVst(*view, *newSize, *w);
37 return Steinberg::kResultOk;
38 }
39};
40#endif
41
42#if defined(__APPLE__)
43class PlugFrame final : public Steinberg::IPlugFrame
44{
45public:
46 Steinberg::tresult queryInterface(const Steinberg::TUID _iid, void** obj) override
47 {
48 *obj = nullptr;
49 return Steinberg::kResultFalse;
50 }
51
52 Steinberg::uint32 addRef() override { return 1; }
53 Steinberg::uint32 release() override { return 1; }
54
55 QDialog* w;
56 WindowContainer wc;
57 PlugFrame(QDialog& w, WindowContainer& wc)
58 : w{&w}
59 , wc{wc}
60 {
61 }
62
63 Steinberg::tresult
64 resizeView(Steinberg::IPlugView* view, Steinberg::ViewRect* newSize) override
65 {
66 wc.setSizeFromVst(*view, *newSize, *w);
67 return Steinberg::kResultOk;
68 }
69};
70#endif
71}