#include "gtkmm2ext/cairo_widget.h"
#include "gtkmm2ext/gui_thread.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
static const char* has_cairo_widget_background_info = "has_cairo_widget_background_info";
bool CairoWidget::_flat_buttons = false;
bool CairoWidget::_widget_prelight = true;
-static void noop() { }
-sigc::slot<void> CairoWidget::focus_handler (sigc::ptr_fun (noop));
+sigc::slot<void,Gtk::Widget*> CairoWidget::focus_handler;
void CairoWidget::set_source_rgb_a( cairo_t* cr, Gdk::Color col, float a) //ToDo: this one and the Canvas version should be in a shared file (?)
{
bool
CairoWidget::on_button_press_event (GdkEventButton*)
{
- focus_handler();
+ focus_handler (this);
return false;
}
#endif
cr->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height);
- cr->clip_preserve ();
- /* paint expose area the color of the parent window bg
- */
+ if (_need_bg) {
+ cr->clip_preserve ();
- Gdk::Color bg (get_parent_bg());
+ /* paint expose area the color of the parent window bg
+ */
- cr->set_source_rgb (bg.get_red_p(), bg.get_green_p(), bg.get_blue_p());
- cr->fill ();
+ Gdk::Color bg (get_parent_bg());
+
+ cr->set_source_rgb (bg.get_red_p(), bg.get_green_p(), bg.get_blue_p());
+ cr->fill ();
+ } else {
+ std::cerr << get_name() << " skipped bg fill\n";
+ cr->clip ();
+ }
cairo_rectangle_t expose_area;
expose_area.x = ev->area.x;
*/
void
-CairoWidget::set_dirty ()
+CairoWidget::set_dirty (cairo_rectangle_t *area)
{
ENSURE_GUI_THREAD (*this, &CairoWidget::set_dirty);
- queue_draw ();
+ if (!area) {
+ queue_draw ();
+ } else {
+ queue_draw_area (area->x, area->y, area->width, area->height);
+ }
}
/** Handle a size allocation.
}
void
-CairoWidget::set_focus_handler (sigc::slot<void> s)
+CairoWidget::set_focus_handler (sigc::slot<void,Gtk::Widget*> s)
{
focus_handler = s;
}