Move NSGlView into libgtkmm2ext

This allows to re-use the concept with CairoWidget
This commit is contained in:
Robin Gareus 2017-03-20 04:21:08 +01:00
parent b726255007
commit b5e613d453
7 changed files with 91 additions and 41 deletions

View file

@ -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 *);