Class GCompound

GObject
  extended by GCompound

This class defines a graphical object that consists of a collection of other graphical objects. Once assembled, the internal objects can be manipulated as a unit.


Constructor Summary
GCompound()
Creates a new GCompound object with no internal components.
 
Method Summary
add(gobj)
Adds a new graphical object to this GCompound.
add(gobj, x, y)
Adds the graphical object to this canvas and sets its location to the point (xy).
contains(x, y)
Checks to see whether a point is "inside" the compound, which means that it is inside one of the components.
getBounds()
Returns the bounding rectangle for this compound object, which consists of the union of the bounding rectangles for each of the components.
getElement(k)
Returns the graphical object at the specified index, numbering from back to front in the the z dimension.
getElementAt(x, y)
Returns the topmost graphical object that contains the point (x, y), or None if no such object exists.
getElementCount()
Returns the number of graphical objects stored in this container.
remove(gobj)
Removes a graphical object from this GCompound.
removeAll()
Removes all graphical objects from this GCompound.
 
Inherited Method Summary
contains(x, y)
Checks to see whether a point is inside the object.
getBounds()
Returns the bounding box for this object.
getColor()
Returns the color used to display this object.
getHeight()
Returns the height of this object, which is defined to be the height of the bounding box.
getLocation()
Returns the location of this object as a GPoint.
getSize()
Returns the size of the bounding box for this object.
getWidth()
Returns the width of this object, which is defined to be the width of the bounding box.
getX()
Returns the x-coordinate of the object.
getY()
Returns the y-coordinate of the object.
isVisible()
Checks to see whether the object is visible.
move(dx, dy)
Moves the object on the screen using the displacements dx and dy.
movePolar(r, theta)
Moves the object using displacements given in polar coordinates.
scale(sf)
Scales the object on the screen by the scale factor sf, which applies in both dimensions.
sendBackward()
Moves this object one step toward the back in the z dimension.
sendForward()
Moves this object one step toward the front in the z dimension.
sendToBack()
Moves this object to the back of the display in the z dimension.
sendToFront()
Moves this object to the front of the display in the z dimension.
setColor(color)
Sets the color used to display this object.
setLocation(x, y)
Sets the location of the GCompound to the point (x, y).
setVisible(flag)
Sets the visibility status of the GCompound.
 

Constructor Detail

GCompound()

Creates a new GCompound object with no internal components.
Usage: gcomp = GCompound() 
 

Method Detail

add(gobj)

Adds a new graphical object to this GCompound.
Usage: gcomp.add(gobj) 
Parameter: 
gobj  The graphical object to add
 


add(gobj, x, y)

Adds the graphical object to this canvas and sets its location to the point (xy).
Usage: gc.add(gobj, x, y) 
Parameters: 
gobj  The graphical object to add
 The new x-coordinate for the object
 The new y-coordinate for the object
 


add(gobj, pt)

Adds the graphical object to this canvas and sets its location to the specified point.
Usage: gc.add(gobj, pt) 
Parameters: 
gobj  The graphical object to add
pt  A GPoint object giving the coordinates of the point
 


contains(x, y)

Checks to see whether a point is "inside" the compound, which means that it is inside one of the components.
Usage: if gcomp.contains(x, y): 
Parameters: 
 The x-coordinate of the point being tested
 The y-coordinate of the point being tested
Returns: True if the point (xy) is inside the compound, and False otherwise
 


getBounds()

Returns the bounding rectangle for this compound object, which consists of the union of the bounding rectangles for each of the components.
Usage: bounds = gcomp.getBounds() 
Returns: A GRectangle that bounds the components of this object
 


getElement(k)

Returns the graphical object at the specified index, numbering from back to front in the the z dimension.
Usage: gobj = gcomp.getElement(index) 
Parameter: 
index  The index of the component to return
Returns: The graphical object at the specified index
 


getElementAt(x, y)

Returns the topmost graphical object that contains the point (x, y), or None if no such object exists. Note that these coordinates are relative to the location of the compound object and not to the canvas in which it is displayed.
Usage: gobj = gcomp.getElementAt(x, y) 
Parameters: 
 The x-coordinate of the point being tested
 The y-coordinate of the point being tested
Returns: The graphical object at the specified location, or None if no such object exists
 


getElementAt pt)

Returns the topmost graphical object that contains the specified point, or None if no such object exists.
Usage: gobj = gc.getElementAt(pt) 
Parameter: 
pt  The coordinates being tested
Returns: The graphical object at the specified location, or None if no such object exists
 


getElementCount()

Returns the number of graphical objects stored in this container.
Usage: n = gcomp.getElementCount() 
Returns: The number of graphical objects in this container
 


remove(gobj) gobj)

Removes a graphical object from this GCompound.
Usage: gcomp.remove(gobj) 
Parameter: 
gobj  The graphical object to remove
 


removeAll()

Removes all graphical objects from this GCompound.
Usage: gcomp.removeAll()