LMMS
Loading...
Searching...
No Matches
view.h
Go to the documentation of this file.
1/*
2 * travesty, pure C VST3-compatible interface
3 * Copyright (C) 2021-2023 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#pragma once
18
19#include "base.h"
20
24
31
32#define V3_VIEW_PLATFORM_TYPE_HWND "HWND"
33#define V3_VIEW_PLATFORM_TYPE_NSVIEW "NSView"
34#define V3_VIEW_PLATFORM_TYPE_X11 "X11EmbedWindowID"
35
36#if defined(__APPLE__)
37# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_NSVIEW
38#elif defined(_WIN32)
39# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_HWND
40#elif !defined(__EMSCRIPTEN__)
41# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_X11
42#endif
43
47
48struct v3_plugin_frame;
49
51#ifndef __cplusplus
52 struct v3_funknown;
53#endif
54 v3_result (V3_API* is_platform_type_supported)(void* self, const char* platform_type);
55 v3_result (V3_API* attached)(void* self, void* parent, const char* platform_type);
56 v3_result (V3_API* removed)(void* self);
57 v3_result (V3_API* on_wheel)(void* self, float distance);
60 v3_result (V3_API* get_size)(void* self, struct v3_view_rect*);
61 v3_result (V3_API* on_size)(void* self, struct v3_view_rect*);
62 v3_result (V3_API* on_focus)(void* self, v3_bool state);
63 v3_result (V3_API* set_frame)(void* self, struct v3_plugin_frame**);
64 v3_result (V3_API* can_resize)(void* self);
65 v3_result (V3_API* check_size_constraint)(void* self, struct v3_view_rect*);
66};
67
68static constexpr const v3_tuid v3_plugin_view_iid =
69 V3_ID(0x5BC32507, 0xD06049EA, 0xA6151B52, 0x2B755B29);
70
74
76#ifndef __cplusplus
77 struct v3_funknown;
78#endif
79 v3_result (V3_API* resize_view)(void* self, struct v3_plugin_view**, struct v3_view_rect*);
80};
81
82static constexpr const v3_tuid v3_plugin_frame_iid =
83 V3_ID(0x367FAF01, 0xAFA94693, 0x8D4DA2A0, 0xED0882A3);
84
89
91#ifndef __cplusplus
92 struct v3_funknown;
93#endif
94 v3_result (V3_API* set_content_scale_factor)(void* self, float factor);
95};
96
98 V3_ID(0x65ED9690, 0x8AC44525, 0x8AADEF7A, 0x72EA703F);
99
103
105#ifndef __cplusplus
106 struct v3_funknown;
107#endif
108 v3_result (V3_API* find_parameter)(void* self, int32_t x, int32_t y, v3_param_id *);
109};
110
112 V3_ID(0x0F618302, 0x215D4587, 0xA512073C, 0x77B9D383);
113
117
119#ifndef __cplusplus
120 struct v3_funknown;
121#endif
122 void (V3_API* on_fd_is_set)(void* self, int fd);
123};
124
125static constexpr const v3_tuid v3_event_handler_iid =
126 V3_ID(0x561E65C9, 0x13A0496F, 0x813A2C35, 0x654D7983);
127
131
133#ifndef __cplusplus
134 struct v3_funknown;
135#endif
136 void (V3_API* on_timer)(void* self);
137};
138
139static constexpr const v3_tuid v3_timer_handler_iid =
140 V3_ID(0x10BDD94F, 0x41424774, 0x821FAD8F, 0xECA72CA9);
141
145
147#ifndef __cplusplus
148 struct v3_funknown;
149#endif
150 v3_result (V3_API* register_event_handler)(void* self, v3_event_handler** handler, int fd);
151 v3_result (V3_API* unregister_event_handler)(void* self, v3_event_handler** handler);
152 v3_result (V3_API* register_timer)(void* self, v3_timer_handler** handler, uint64_t ms);
153 v3_result (V3_API* unregister_timer)(void* self, v3_timer_handler** handler);
154};
155
156static constexpr const v3_tuid v3_run_loop_iid =
157 V3_ID(0x18C35366, 0x97764F1A, 0x9C5B8385, 0x7A871389);
158
159#ifdef __cplusplus
160
164
165struct v3_plugin_view_cpp : v3_funknown {
166 v3_plugin_view view;
167};
168
169struct v3_plugin_frame_cpp : v3_funknown {
170 v3_plugin_frame frame;
171};
172
173struct v3_plugin_view_content_scale_cpp : v3_funknown {
174 v3_plugin_view_content_scale scale;
175};
176
177struct v3_plugin_view_parameter_finder_cpp : v3_funknown {
178 v3_plugin_view_parameter_finder finder;
179};
180
181struct v3_event_handler_cpp : v3_funknown {
182 v3_event_handler handler;
183};
184
185struct v3_timer_handler_cpp : v3_funknown {
186 v3_timer_handler timer;
187};
188
189struct v3_run_loop_cpp : v3_funknown {
190 v3_run_loop loop;
191};
192
193#endif
#define V3_ID(a, b, c, d)
Definition base.h:111
uint32_t v3_param_id
Definition base.h:40
#define V3_API
Definition base.h:59
int32_t v3_result
Definition base.h:35
uint8_t v3_bool
Definition base.h:38
uint8_t v3_tuid[16]
Definition base.h:46
goto loop
Definition Spc_Cpu.h:155
int int32_t
Definition mid.cpp:97
short int16_t
Definition mid.cpp:96
Definition view.h:118
int fd
Definition view.h:122
Definition base.h:142
Definition view.h:75
v3_result(V3_API *resize_view)(void *self
Definition view.h:90
float factor
Definition view.h:94
Definition view.h:104
v3_result(V3_API *find_parameter)(void *self
int32_t x
Definition view.h:108
int32_t int32_t y
Definition view.h:108
Definition view.h:50
int16_t int16_t key_code
Definition view.h:58
const char * platform_type
Definition view.h:54
v3_result(V3_API *removed)(void *self)
int16_t int16_t int16_t modifiers
Definition view.h:58
struct v3_view_rect * v3_result(V3_API *on_size)(void *self
v3_result(V3_API *check_size_constraint)(void *self
void * parent
Definition view.h:55
struct v3_plugin_frame ** v3_result(V3_API *can_resize)(void *self)
v3_result(V3_API *set_frame)(void *self
struct v3_view_rect struct v3_view_rect v3_bool state
Definition view.h:62
v3_result(V3_API *on_key_up)(void *self
float distance
Definition view.h:57
int16_t key_char
Definition view.h:58
v3_result(V3_API *get_size)(void *self
Definition view.h:146
v3_event_handler int fd
Definition view.h:150
v3_result(V3_API *unregister_timer)(void *self
v3_event_handler ** handler
Definition view.h:150
v3_timer_handler uint64_t ms
Definition view.h:152
v3_result(V3_API *unregister_event_handler)(void *self
Definition view.h:132
void(V3_API *on_timer)(void *self)
Definition view.h:25
int32_t left
Definition view.h:26
int32_t bottom
Definition view.h:29
int32_t top
Definition view.h:27
int32_t right
Definition view.h:28
void handler(int signal)
Definition fileio.c:1632
#define void
Definition unzip.h:396
static constexpr const v3_tuid v3_plugin_view_iid
Definition view.h:68
static constexpr const v3_tuid v3_timer_handler_iid
Definition view.h:139
static constexpr const v3_tuid v3_plugin_view_parameter_finder_iid
Definition view.h:111
static constexpr const v3_tuid v3_event_handler_iid
Definition view.h:125
static constexpr const v3_tuid v3_run_loop_iid
Definition view.h:156
static constexpr const v3_tuid v3_plugin_frame_iid
Definition view.h:82
static constexpr const v3_tuid v3_plugin_view_content_scale_iid
Definition view.h:97