Merge libs/ardour and gtk2_ardour with 2.0-ongoing R2837.
[ardour.git] / gtk2_ardour / au_pluginui.h
1 #ifndef __gtk2_ardour_auplugin_ui_h__
2 #define __gtk2_ardour_auplugin_ui_h__
3
4 #include <AppKit/AppKit.h>
5 #include <Carbon/Carbon.h>
6 #include <AudioUnit/AudioUnit.h>
7
8 /* fix up stupid apple macros */
9
10 #undef check
11 #undef require
12 #undef verify
13
14 #include <gtkmm/box.h>
15 #include "plugin_ui.h"
16
17 namespace ARDOUR {
18         class AUPlugin;
19         class PluginInsert;
20         class IOProcessor;
21 }
22
23 class AUPluginUI : public PlugUIBase, public Gtk::VBox
24 {
25   public:
26         AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>);
27         ~AUPluginUI ();
28         
29         gint get_preferred_height () { return prefheight; }
30         gint get_preferred_width () { return prefwidth; }
31         bool start_updating(GdkEventAny*);
32         bool stop_updating(GdkEventAny*);
33         
34         virtual void activate ();
35         virtual void deactivate ();
36
37         void on_realize ();
38         void on_show ();
39
40         OSStatus carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event);
41
42   private:
43         WindowRef wr;
44         boost::shared_ptr<ARDOUR::AUPlugin> au;
45         int prefheight;
46         int prefwidth;
47
48         /* Cocoa */
49
50         NSWindow*           cocoa_window;
51         NSScrollView*       scroll_view;
52         NSView*             au_view;
53
54         /* Carbon */
55
56         NSWindow*            cocoa_parent;
57         ComponentDescription carbon_descriptor;
58         AudioUnitCarbonView  editView;
59         WindowRef            carbon_window;     
60         EventHandlerRef      carbon_event_handler;
61         bool                 carbon_parented;
62         bool                 cocoa_parented;
63
64         void test_view_support (bool&, bool&);
65         bool test_cocoa_view_support ();
66         bool test_carbon_view_support ();
67         int  create_carbon_view (bool generic);
68         int  create_cocoa_view ();
69
70         int parent_carbon_window ();
71         int parent_cocoa_window ();
72         NSWindow* get_nswindow();
73
74         bool plugin_class_valid (Class pluginClass);
75 };
76
77 #endif /* __gtk2_ardour_auplugin_ui_h__  */