The SimpleCxxLib package


#include "gobjects.h"

class GCompound : public GObject

This graphical object subclass consists of a collection of other graphical objects. Once assembled, the internal objects can be manipulated as a unit. The GCompound keeps track of its own position, and all items within it are drawn relative to that location.
Constructor
GCompound() Creates a GCompound object with no internal components.
Methods
add(gobj)
add(gobj, x, y) 
Adds a new graphical object to the GCompound.
getElement(index) Returns a pointer to the graphical object at the specified index, numbering from back to front in the the z dimension.
getElementCount() Returns the number of graphical objects stored in the GCompound.
remove(gobj) Removes the specified object from the GCompound.
removeAll() Removes all graphical objects from the GCompound.

Constructor detail


GCompound();
Creates a GCompound object with no internal components.

Usage:

GCompound *comp = new GCompound();

Method detail


void add(GObject *gobj);
void add(GObject *gobj, double x, double y);
Adds a new graphical object to the GCompound. The second form moves the object to the point (x, y) first.

Usage:

comp->add(gobj);
comp->add(gobj, x, y);

void remove(GObject *gobj);
Removes the specified object from the GCompound.

Usage:

comp->remove(gobj);

void removeAll();
Removes all graphical objects from the GCompound.

Usage:

comp->removeAll();

int getElementCount();
Returns the number of graphical objects stored in the GCompound.

Usage:

int n = comp->getElementCount();

GObject *getElement(int index);
Returns a pointer to the graphical object at the specified index, numbering from back to front in the the z dimension.

Usage:

GObject *gobj = comp->getElement(index);