diff options
author | Robin Gareus <robin@gareus.org> | 2017-03-20 04:21:08 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-03-20 04:35:05 +0100 |
commit | b5e613d453921f87d59a911bd555e96e46abc5cc (patch) | |
tree | 366a800d3163757ac5d9d50da10afdd654f43022 /libs/canvas/canvas | |
parent | b726255007bfdafb29c547bafd71bbe32d11f58e (diff) |
Move NSGlView into libgtkmm2ext
This allows to re-use the concept with CairoWidget
Diffstat (limited to 'libs/canvas/canvas')
-rw-r--r-- | libs/canvas/canvas/canvas.h | 13 | ||||
-rw-r--r-- | libs/canvas/canvas/nsglview.h | 15 |
2 files changed, 11 insertions, 17 deletions
diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h index 20adfa4c45..3e554cacf2 100644 --- a/libs/canvas/canvas/canvas.h +++ b/libs/canvas/canvas/canvas.h @@ -34,8 +34,9 @@ #include "pbd/signals.h" -#include "canvas/visibility.h" +#include "gtkmm2ext/cairo_canvas.h" +#include "canvas/visibility.h" #include "canvas/root_group.h" namespace Gtk { @@ -174,7 +175,7 @@ public: }; /** A canvas which renders onto a GTK EventBox */ -class LIBCANVAS_API GtkCanvas : public Canvas, public Gtk::EventBox +class LIBCANVAS_API GtkCanvas : public Canvas, public Gtk::EventBox, public Gtkmm2ext::CairoCanvas { public: GtkCanvas (); @@ -203,6 +204,14 @@ public: Glib::RefPtr<Pango::Context> get_pango_context(); + void render (Cairo::RefPtr<Cairo::Context> const & ctx, cairo_rectangle_t* r) + { + ArdourCanvas::Rect rect (r->x, r->y, r->width + r->x, r->height + r->y); + Canvas::render (rect, ctx); + } + + uint32_t background_color() { return Canvas::background_color (); } + protected: void on_size_allocate (Gtk::Allocation&); bool on_scroll_event (GdkEventScroll *); diff --git a/libs/canvas/canvas/nsglview.h b/libs/canvas/canvas/nsglview.h deleted file mode 100644 index e18a0f68ab..0000000000 --- a/libs/canvas/canvas/nsglview.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __CANVAS_NSGLVIEW_H__ -#define __CANVAS_NSGLVIEW_H__ - -#include <gdk/gdk.h> - -namespace ArdourCanvas -{ - class GtkCanvas; - - void* nsglview_create (GtkCanvas*); - void nsglview_overlay (void*, GdkWindow*); - void nsglview_resize (void*, int x, int y, int w, int h); - void nsglview_queue_draw (void*, int x, int y, int w, int h); -} -#endif |