Canvas items are realized and mapped just as widgets are.
These methods play the same role they do for widgets;
realizing a canvas item allocates any GDK resources it
plans to use, unrealizing it deallocates the same
resources. Mapping a canvas item shows its GdkWindow, unmapping it hides the
GdkWindow. Very few
canvas items have a
GdkWindow (GnomeCanvasWidget is the big
exception), so most canvas items will not even implement
map and unmap methods.
GnomeCanvasRect does not. It does have realize and
unrealize methods, however.
Here is its realize method:
static void
gnome_canvas_re_realize (GnomeCanvasItem *item)
{
GnomeCanvasRE *re;
re = GNOME_CANVAS_RE (item);
if (re_parent_class->realize)
(* re_parent_class->realize) (item);
if (!item->canvas->aa) {
re->fill_gc = gdk_gc_new (item->canvas->layout.bin_window);
re->outline_gc = gdk_gc_new (item->canvas->layout.bin_window);
}
}
|
And unrealize:
static void
gnome_canvas_re_unrealize (GnomeCanvasItem *item)
{
GnomeCanvasRE *re;
re = GNOME_CANVAS_RE (item);
if (!item->canvas->aa) {
gdk_gc_unref (re->fill_gc);
gdk_gc_unref (re->outline_gc);
}
if (re_parent_class->unrealize)
(* re_parent_class->unrealize) (item);
}
|
Note that your realize and unrealize methods are unlikely
to have anything to do in antialiased mode, since there
won't be any GDK resources to worry about.