1 #include "cairo_widget.h"
2 #include "gui_thread.h"
4 CairoWidget::CairoWidget ()
13 CairoWidget::~CairoWidget ()
16 gdk_pixmap_unref (_pixmap);
21 CairoWidget::on_expose_event (GdkEventExpose *event)
23 Gdk::Rectangle const exposure (
24 event->area.x, event->area.y, event->area.width, event->area.height
27 Gdk::Rectangle r = exposure;
28 Gdk::Rectangle content (0, 0, _width, _height);
30 r.intersect (content, intersects);
34 GdkDrawable* drawable = get_window()->gobj ();
39 gdk_pixmap_unref (_pixmap);
42 _pixmap = gdk_pixmap_new (drawable, _width, _height, -1);
44 cairo_t* cr = gdk_cairo_create (_pixmap);
53 get_style()->get_fg_gc (Gtk::STATE_NORMAL)->gobj(),
68 CairoWidget::set_dirty ()
70 ENSURE_GUI_THREAD (mem_fun (*this, &CairoWidget::set_dirty));
76 /** Handle a size allocation.
77 * @param alloc GTK allocation.
80 CairoWidget::on_size_allocate (Gtk::Allocation& alloc)
82 Gtk::EventBox::on_size_allocate (alloc);
84 _width = alloc.get_width ();
85 _height = alloc.get_height ();