provide (Static)ActionMapOwner::action_map()
[ardour.git] / libs / gtkmm2ext / cairo_widget.cc
index ca46d1aecffbf0c240988283f96b73b1b3b7be2c..7741de86ca7d0db226279075a7caf6d48d69daf2 100644 (file)
@@ -34,6 +34,7 @@
 static const char* has_cairo_widget_background_info = "has_cairo_widget_background_info";
 
 bool CairoWidget::_flat_buttons = false;
+bool CairoWidget::_boxy_buttons = false;
 bool CairoWidget::_widget_prelight = true;
 
 sigc::slot<void,Gtk::Widget*> CairoWidget::focus_handler;
@@ -85,10 +86,8 @@ CairoWidget::use_nsglview ()
        assert (!_canvas_widget);
        assert (!is_realized());
 #ifdef ARDOUR_CANVAS_NSVIEW_TAG // patched gdkquartz.h
-# ifndef __ppc__ // would need to flip RGBA <> RGBA
        _nsglview = Gtkmm2ext::nsglview_create (this);
 #endif
-#endif
 }
 
 int
@@ -195,7 +194,7 @@ CairoWidget::on_expose_event (GdkEventExpose *ev)
         cr->fill ();
     }
 
-       render (cr->cobj(), &expose_area);
+       render (cr, &expose_area);
 
 #ifdef USE_CAIRO_IMAGE_SURFACE_FOR_CAIRO_WIDGET
        if(get_visible_window ()) {
@@ -283,7 +282,7 @@ CairoWidget::on_expose_event (GdkEventExpose *ev)
        expose_area.width = ev->area.width;
        expose_area.height = ev->area.height;
 
-       render (cr->cobj(), &expose_area);
+       render (cr, &expose_area);
 
 #ifdef OPTIONAL_CAIRO_IMAGE_SURFACE
        if (getenv("ARDOUR_IMAGE_SURFACE")) {
@@ -472,6 +471,35 @@ CairoWidget::on_realize ()
 #endif
 }
 
+void
+CairoWidget::on_map ()
+{
+       Gtk::EventBox::on_map();
+#ifdef __APPLE__
+       if (_nsglview) {
+               Gtkmm2ext::nsglview_set_visible (_nsglview, true);
+               Gtk::Allocation a = get_allocation();
+               gint xx, yy;
+               gtk_widget_translate_coordinates(
+                               GTK_WIDGET(gobj()),
+                               GTK_WIDGET(get_toplevel()->gobj()),
+                               0, 0, &xx, &yy);
+               Gtkmm2ext::nsglview_resize (_nsglview, xx, yy, a.get_width(), a.get_height());
+       }
+#endif
+}
+
+void
+CairoWidget::on_unmap ()
+{
+       Gtk::EventBox::on_unmap();
+#ifdef __APPLE__
+       if (_nsglview) {
+               Gtkmm2ext::nsglview_set_visible (_nsglview, false);
+       }
+#endif
+}
+
 void
 CairoWidget::on_state_changed (Gtk::StateType)
 {
@@ -515,6 +543,13 @@ CairoWidget::set_flat_buttons (bool yn)
        _flat_buttons = yn;
 }
 
+void
+CairoWidget::set_boxy_buttons (bool yn)
+{
+       _boxy_buttons = yn;
+}
+
+
 void
 CairoWidget::set_widget_prelight (bool yn)
 {