-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathview.h
193 lines (155 loc) · 5.14 KB
/
view.h
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/*
* travesty, pure C VST3-compatible interface
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "base.h"
/**
* base view stuff
*/
struct v3_view_rect {
int32_t left;
int32_t top;
int32_t right;
int32_t bottom;
};
#define V3_VIEW_PLATFORM_TYPE_HWND "HWND"
#define V3_VIEW_PLATFORM_TYPE_NSVIEW "NSView"
#define V3_VIEW_PLATFORM_TYPE_X11 "X11EmbedWindowID"
#if defined(__APPLE__)
# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_NSVIEW
#elif defined(_WIN32)
# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_HWND
#elif !defined(__EMSCRIPTEN__)
# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_X11
#endif
/**
* plugin view
*/
struct v3_plugin_frame;
struct v3_plugin_view {
#ifndef __cplusplus
struct v3_funknown;
#endif
v3_result (V3_API* is_platform_type_supported)(void* self, const char* platform_type);
v3_result (V3_API* attached)(void* self, void* parent, const char* platform_type);
v3_result (V3_API* removed)(void* self);
v3_result (V3_API* on_wheel)(void* self, float distance);
v3_result (V3_API* on_key_down)(void* self, int16_t key_char, int16_t key_code, int16_t modifiers);
v3_result (V3_API* on_key_up)(void* self, int16_t key_char, int16_t key_code, int16_t modifiers);
v3_result (V3_API* get_size)(void* self, struct v3_view_rect*);
v3_result (V3_API* on_size)(void* self, struct v3_view_rect*);
v3_result (V3_API* on_focus)(void* self, v3_bool state);
v3_result (V3_API* set_frame)(void* self, struct v3_plugin_frame**);
v3_result (V3_API* can_resize)(void* self);
v3_result (V3_API* check_size_constraint)(void* self, struct v3_view_rect*);
};
static constexpr const v3_tuid v3_plugin_view_iid =
V3_ID(0x5BC32507, 0xD06049EA, 0xA6151B52, 0x2B755B29);
/**
* plugin frame
*/
struct v3_plugin_frame {
#ifndef __cplusplus
struct v3_funknown;
#endif
v3_result (V3_API* resize_view)(void* self, struct v3_plugin_view**, struct v3_view_rect*);
};
static constexpr const v3_tuid v3_plugin_frame_iid =
V3_ID(0x367FAF01, 0xAFA94693, 0x8D4DA2A0, 0xED0882A3);
/**
* steinberg content scaling support
* (same IID/iface as presonus view scaling)
*/
struct v3_plugin_view_content_scale {
#ifndef __cplusplus
struct v3_funknown;
#endif
v3_result (V3_API* set_content_scale_factor)(void* self, float factor);
};
static constexpr const v3_tuid v3_plugin_view_content_scale_iid =
V3_ID(0x65ED9690, 0x8AC44525, 0x8AADEF7A, 0x72EA703F);
/**
* support for querying the view to find what control is underneath the mouse
*/
struct v3_plugin_view_parameter_finder {
#ifndef __cplusplus
struct v3_funknown;
#endif
v3_result (V3_API* find_parameter)(void* self, int32_t x, int32_t y, v3_param_id *);
};
static constexpr const v3_tuid v3_plugin_view_parameter_finder_iid =
V3_ID(0x0F618302, 0x215D4587, 0xA512073C, 0x77B9D383);
/**
* linux event handler
*/
struct v3_event_handler {
#ifndef __cplusplus
struct v3_funknown;
#endif
void (V3_API* on_fd_is_set)(void* self, int fd);
};
static constexpr const v3_tuid v3_event_handler_iid =
V3_ID(0x561E65C9, 0x13A0496F, 0x813A2C35, 0x654D7983);
/**
* linux timer handler
*/
struct v3_timer_handler {
#ifndef __cplusplus
struct v3_funknown;
#endif
void (V3_API* on_timer)(void* self);
};
static constexpr const v3_tuid v3_timer_handler_iid =
V3_ID(0x10BDD94F, 0x41424774, 0x821FAD8F, 0xECA72CA9);
/**
* linux host run loop
*/
struct v3_run_loop {
#ifndef __cplusplus
struct v3_funknown;
#endif
v3_result (V3_API* register_event_handler)(void* self, v3_event_handler** handler, int fd);
v3_result (V3_API* unregister_event_handler)(void* self, v3_event_handler** handler);
v3_result (V3_API* register_timer)(void* self, v3_timer_handler** handler, uint64_t ms);
v3_result (V3_API* unregister_timer)(void* self, v3_timer_handler** handler);
};
static constexpr const v3_tuid v3_run_loop_iid =
V3_ID(0x18C35366, 0x97764F1A, 0x9C5B8385, 0x7A871389);
#ifdef __cplusplus
/**
* C++ variants
*/
struct v3_plugin_view_cpp : v3_funknown {
v3_plugin_view view;
};
struct v3_plugin_frame_cpp : v3_funknown {
v3_plugin_frame frame;
};
struct v3_plugin_view_content_scale_cpp : v3_funknown {
v3_plugin_view_content_scale scale;
};
struct v3_plugin_view_parameter_finder_cpp : v3_funknown {
v3_plugin_view_parameter_finder finder;
};
struct v3_event_handler_cpp : v3_funknown {
v3_event_handler handler;
};
struct v3_timer_handler_cpp : v3_funknown {
v3_timer_handler timer;
};
struct v3_run_loop_cpp : v3_funknown {
v3_run_loop loop;
};
#endif