1 / 8

The CanvasWidget

The CanvasWidget. The Canvas Widget. A GnomeCanvas widget can be used to: draw figures display graphics position widgets gain detailed control over position and size of widgets. The Canvas Widget.

galen
Télécharger la présentation

The CanvasWidget

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The CanvasWidget

  2. The Canvas Widget • A GnomeCanvas widget can be used to: • draw figures • display graphics • position widgets • gain detailed control over position and size of • widgets

  3. The Canvas Widget A GnomeCanvas may be used to display a collection of graphic structures for use in the creation of interactive or dynamic graphic displays • Each graphic object: • is independent • can be moved, resized, modified • make use of available affine transforms • can receive events from the keyboard

  4. The Canvas Widget • Canvas items can be organized into groups in a hierarchical tree structure • Groups of items: • can be moved, resized, modified • make use of available affine transforms • can receive events from the keyboard

  5. The Canvas Widget Canvas Items are created with the following convenience function: gnome_canvas_item_new( rootGroup, gnome_canvas_rect_get_type(), "x1",(double)10, "y1",(double)10, "x2",(double)(WIDTH - 10), "y2",(double)(HEIGHT - 10), "fill_color","white", "outline_color","black", NULL);(arguments p.742)

  6. The Canvas Widget Possible canvas Items include: gnome_canvas_rect_get_type() gnome_canvas_line_get_type() gnome_canvas_ellipse_get_type( gnome_canvas_image_get_type() gnome_canvas_text_get_type() gnome_canvas_polygon_get_type( gnome_canvas_widget_get_type()

  7. The Canvas Widget Canvas items may respond to signals such as mouse events: gtk_signal_connect( GTK_OBJECT(item),"event", (GtkSignalFunc)itemEvent,NULL); static gint itemEvent(GnomeCanvasItem *item, GdkEvent *event, gpointer data) { if(event->type == GDK_ENTER_NOTIFY) gnome_canvas_item_raise_to_top(item); return(0); }

  8. The Canvas Widget Canvas items may respond to signals such as mouse events: gtk_signal_connect( GTK_OBJECT(item),"event", (GtkSignalFunc)itemEvent,NULL); static gint itemEvent(GnomeCanvasItem *item, GdkEvent *event, gpointer data) { if(event->type == GDK_ENTER_NOTIFY) gnome_canvas_item_raise_to_top(item); return(0); }

More Related