-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubpatch.hpp
More file actions
61 lines (47 loc) · 1.2 KB
/
Subpatch.hpp
File metadata and controls
61 lines (47 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Copyright (C) 2026 Wasted Audio
* SPDX-License-Identifier: ISC
*/
#pragma once
#include "NanoVG.hpp"
#include "nanovg.h"
#include "Widget.hpp"
#include "PDWidget.hpp"
#include "Common.hpp"
START_NAMESPACE_DISTRHO
class PDSubpatch : public PDWidget
{
public:
explicit PDSubpatch(NanoSubWidget* parent);
void setColors(NVGcolor borderColor);
void setSubpatches(std::vector<Rectangle<float>> subpatches);
void addManagedChild(PDWidget* child)
{
managedChildren.push_back(child);
}
bool onMouse(const MouseEvent& ev) override
{
for (auto* child : managedChildren)
child->forwardMouseEvent(ev);
return false;
}
bool onMotion(const MotionEvent& ev) override
{
for (auto* child : managedChildren)
child->forwardMotionEvent(ev);
return false;
}
bool onScroll(const ScrollEvent& ev) override
{
for (auto* child : managedChildren)
child->forwardScrollEvent(ev);
return false;
}
protected:
void onNanoDisplay() override;
private:
NVGcolor borderColor;
std::vector<PDWidget*> managedChildren;
DISTRHO_LEAK_DETECTOR(PDSubpatch)
};
END_NAMESPACE_DISTRHO