Re: Need help with GnomeCanvasImage



On Mon, Feb 14, 2000 at 11:07:43AM +0100, Jens Finke wrote:
> BTW: This should be somewhere in the FAQ. I think this is the most done
> error if you are new in GNOME programming.

I can't help myself but to shamefully plug gob here again.  If the canvas
items were done in gob, then some macros would be created and the user could
rewrite

item=gnome_canvas_item_new(group,
                           gnome_canvas_image_get_type(),
                           "image",gnome_canvas_load_alpha(file),
                           "x", 100,
                           "y", 100,
                           "width", 100,
                           "height", 100,
                           "anchor", GTK_ANCHOR_NW,
                           NULL);

as:

item=gnome_canvas_item_new(group, gnome_canvas_image_get_type(),
                           GNOME_CANVAS_IMAGE_ARG_IMAGE(gnome_canvas_load_alpha(file)),
                           GNOME_CANVAS_IMAGE_ARG_X(100),
                           GNOME_CANVAS_IMAGE_ARG_Y(100),
                           GNOME_CANVAS_IMAGE_ARG_WIDTH(100),
                           GNOME_CANVAS_IMAGE_ARG_HEIGHT(100),
                           GNOME_CANVAS_IMAGE_ARG_ANCHOR(GTK_ANCHOR_NW),
                           NULL);

Yes it's a little bit more verbose, but for example with the
gnome_canvas_load_alpha, it can also check for passing the wrong pointer
type.  Of course this point is moot since gnome-canvas doesn't use gob and
I'm pretty sure it won't.  But perhaps similiar macros could be provided for
the canvas.

George



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]