1 /*
2  * Copyright (C) 2020 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __ardour_vst3_nsview_plugin_ui_h__
20 #define __ardour_vst3_nsview_plugin_ui_h__
21 
22 #ifdef VST3_SUPPORT
23 
24 #include <AppKit/AppKit.h>
25 
26 /* fix up stupid apple macros */
27 #undef check
28 #undef require
29 #undef verify
30 
31 #ifdef YES
32 #undef YES
33 #endif
34 #ifdef NO
35 #undef NO
36 #endif
37 
38 #include <gtkmm/widget.h>
39 #include <gtkmm/eventbox.h>
40 
41 #include "vst3_plugin_ui.h"
42 
43 class VST3NSViewPluginUI : public VST3PluginUI
44 {
45 public:
46 	VST3NSViewPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VST3Plugin>);
47 	~VST3NSViewPluginUI ();
48 
49 	bool on_window_show(const std::string&);
50 	void on_window_hide ();
51 	void forward_key_event (GdkEventKey*);
52 	void grab_focus();
non_gtk_gui()53 	bool non_gtk_gui() const { return true; }
54 
55 private:
56 	void view_realized ();
57 	void view_size_request (GtkRequisition*);
58 	void view_size_allocate (Gtk::Allocation&);
59 	void resize_callback (int, int);
60 
61 	bool view_visibility_notify (GdkEventVisibility*);
62 	void view_map ();
63 	void view_unmap ();
64 
65 	NSWindow* get_nswindow();
66 
67 	Gtk::EventBox _gui_widget;
68 	NSView*       _ns_view;
69 };
70 
71 #endif // VST3_SUPPORT
72 #endif
73