2 Copyright (C) 2012 Paul Davis
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.
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.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __gtk2_ardour_auplugin_ui_h__
21 #define __gtk2_ardour_auplugin_ui_h__
26 #include <AppKit/AppKit.h>
27 #include <Carbon/Carbon.h>
28 #include <AudioUnit/AudioUnitCarbonView.h>
29 #include <AudioUnit/AudioUnit.h>
31 /* fix up stupid apple macros */
37 #include <gtkmm/box.h>
38 #include <gtkmm/combobox.h>
39 #include <gtkmm/button.h>
40 #include <gtkmm/label.h>
42 #include "plugin_ui.h"
52 @interface NotificationObject : NSObject {
54 AUPluginUI* plugin_ui;
55 NSWindow* cocoa_parent;
56 NSWindow* top_level_parent;
60 class AUPluginUI : public PlugUIBase, public Gtk::VBox
63 AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>);
66 gint get_preferred_height () { return prefheight; }
67 gint get_preferred_width () { return prefwidth; }
68 bool start_updating(GdkEventAny*);
69 bool stop_updating(GdkEventAny*);
74 bool non_gtk_gui() const { return true; }
76 void lower_box_realized ();
77 void cocoa_view_resized ();
79 bool on_map_event (GdkEventAny*);
80 bool on_focus_in_event (GdkEventFocus*);
81 bool on_focus_out_event (GdkEventFocus*);
82 void forward_key_event (GdkEventKey*);
84 bool on_window_show (const std::string& /*title*/);
85 void on_window_hide ();
87 OSStatus carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event);
91 boost::shared_ptr<ARDOUR::AUPlugin> au;
96 Gtk::EventBox low_box;
98 Gtk::Label automation_mode_label;
99 Gtk::ComboBoxText automation_mode_selector;
100 Gtk::Label preset_label;
102 static std::vector<std::string> automation_mode_strings;
106 NSWindow* cocoa_window;
111 NSWindow* cocoa_parent;
112 ComponentDescription carbon_descriptor;
113 AudioUnitCarbonView editView;
114 WindowRef carbon_window;
115 EventHandlerRef carbon_event_handler;
116 bool _activating_from_app;
117 NotificationObject* _notify;
119 bool test_cocoa_view_support ();
120 bool test_carbon_view_support ();
121 int create_carbon_view ();
122 int create_cocoa_view ();
124 int parent_carbon_window ();
125 int parent_cocoa_window ();
126 NSWindow* get_nswindow();
128 bool plugin_class_valid (Class pluginClass);
131 #endif /* __gtk2_ardour_auplugin_ui_h__ */