<HTML
><HEAD
><TITLE
>Organization of items</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK
REL="HOME"
TITLE="Gnome Developers' Information"
HREF="book1.html"><LINK
REL="UP"
TITLE="The GnomeCanvas widget"
HREF="gnome-canvas.html"><LINK
REL="PREVIOUS"
TITLE="The GnomeCanvas widget"
HREF="gnome-canvas.html"><LINK
REL="NEXT"
TITLE="Coordinates"
HREF="gnome-canvas-coordinates.html"></HEAD
><BODY
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Gnome Developers' Information</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="gnome-canvas.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 8. The <SPAN
CLASS="TYPE"
>GnomeCanvas</SPAN
> widget</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="gnome-canvas-coordinates.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GNOME-CANVAS-ORGANIZATION-OF-ITEMS"
>Organization of items</A
></H1
><P
>	Items in the canvas are organized in a tree hierarchy.  Items
	can be groups (nodes in the tree), or terminal items (leaves in
	the tree).  Groups can contain any number of children, which can
	be terminal items or other groups.  Thus, items can be nested to
	an arbitrary depth inside a canvas.
      </P
><P
>	A canvas has a single root group.  For simple drawings, it is
	likely that you will want to put all your items directly inside
	this group.  For more complex drawings, it may be convenient to
	use a hierarchical structure of nested canvas groups.
      </P
><P
>	For example, consider a circuit editor.  You could define
	groups that contain the items that are necessary to draw a
	certain type of logic gate.  Then you could define groups for
	different components.  A group representing an adder would
	contain several logic gates and some wires.  You would then
	group some adders with other components to form a more complex
	circuit.  This makes it convenient to handle whole hierarchies
	as single entities, for when you want to move all the items
	that define a chain of adders, for example.
      </P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="GNOME-CANVAS-STACKING-ORDER"
>Stacking order</A
></H2
><P
>	  The items you put inside groups are stacked on top of each
	  other, and items nearer the top of the stack obscure the items
	  below them.  When an item is created, it is put on top of all
	  the items in its parent group.
	</P
><P
>	  The canvas provides several functions to let you change the
	  stacking order of items inside groups.  You can move items
	  to the top or bottom of their parent group, and raise or
	  lower them by an arbitrary number of positions.
	</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="GNOME-CANVAS-BEHAVIOR-AND-EVENTS"
>Behavior and events</A
></H2
><P
>	  The canvas does <I
CLASS="EMPHASIS"
>not</I
> have any predefined
	  behavior for items.  You can define the behavior of items by
	  explicitly operating on them (change the color if item Foo
	  when the user selects a menu item), or by defining actions
	  that should take place when items receive events (let the
	  user drag items with the mouse).
	</P
><P
>	  The rationale behind this is that the canvas should be as
	  general-purpose as possible.  If it had predefined behavior
	  for items, it may not be suitable to all kinds of
	  applications &#8212; a program for drawing schematic
	  diagrams may benefit from having dragging functionality
	  predefined in the canvas, but this would not be very useful
	  (or even desirable) for a calendar display program.
	</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="gnome-canvas.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="gnome-canvas-coordinates.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The <SPAN
CLASS="TYPE"
>GnomeCanvas</SPAN
> widget</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="gnome-canvas.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Coordinates</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>