- rectangle_t m_rectangle;
-
- GtkWidget* m_widget;
- GdkGC* m_gc;
-
- bool initialised() const
- {
- return m_gc != 0;
- }
- void lazy_init()
- {
- if(!initialised())
- {
- m_gc = gdk_gc_new(m_widget->window);
-
- GdkColor color = { 0, 0xffff, 0xffff, 0xffff, };
- GdkColormap* colormap = gdk_window_get_colormap(m_widget->window);
- gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE);
- gdk_gc_copy(m_gc, m_widget->style->white_gc);
- gdk_gc_set_foreground(m_gc, &color);
- gdk_gc_set_background(m_gc, &color);
-
- gdk_gc_set_function(m_gc, GDK_INVERT);
- }
- }
- void draw() const
- {
- const int x = float_to_integer(m_rectangle.x);
- const int y = float_to_integer(m_rectangle.y);
- const int w = float_to_integer(m_rectangle.w);
- const int h = float_to_integer(m_rectangle.h);
- gdk_draw_rectangle(m_widget->window, m_gc, FALSE, x, -(h) - (y - m_widget->allocation.height), w, h);
- }