meet rhythm ferret: cute, furry and always on time (ardour build now requires fftw3...
[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/AudioUnitCarbonView.h>
7 #include <AudioUnit/AudioUnit.h>
8
9 /* fix up stupid apple macros */
10
11 #undef check
12 #undef require
13 #undef verify
14
15 #include <gtkmm/box.h>
16 #include "plugin_ui.h"
17
18 namespace ARDOUR {
19         class AUPlugin;
20         class PluginInsert;
21         class Redirect;
22 }
23
24 class AUPluginUI : public PlugUIBase, public Gtk::VBox
25 {
26   public:
27         AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>);
28         ~AUPluginUI ();
29         
30         gint get_preferred_height () { return prefheight; }
31         gint get_preferred_width () { return prefwidth; }
32         bool start_updating(GdkEventAny*);
33         bool stop_updating(GdkEventAny*);
34         
35         virtual void activate ();
36         virtual void deactivate ();
37
38         void on_realize ();
39         void on_show ();
40         void on_hide ();
41         bool on_map_event (GdkEventAny*);
42         bool on_focus_in_event (GdkEventFocus*);
43         bool on_focus_out_event (GdkEventFocus*);
44
45         OSStatus carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event);
46
47   private:
48         boost::shared_ptr<ARDOUR::AUPlugin> au;
49         int prefheight;
50         int prefwidth;
51
52         /* Cocoa */
53
54         NSWindow*           cocoa_window;
55         NSScrollView*       scroll_view;
56         NSView*             au_view;
57
58         /* Carbon */
59
60         NSWindow*            cocoa_parent;
61         ComponentDescription carbon_descriptor;
62         AudioUnitCarbonView  editView;
63         WindowRef            carbon_window;     
64         EventHandlerRef      carbon_event_handler;
65         bool                 carbon_parented;
66         bool                 cocoa_parented;
67         bool                 _activating_from_app;
68
69         void test_view_support (bool&, bool&);
70         bool test_cocoa_view_support ();
71         bool test_carbon_view_support ();
72         int  create_carbon_view (bool generic);
73         int  create_cocoa_view ();
74
75         int parent_carbon_window ();
76         int parent_cocoa_window ();
77         NSWindow* get_nswindow();
78
79         bool plugin_class_valid (Class pluginClass);
80 };
81
82 #endif /* __gtk2_ardour_auplugin_ui_h__  */