### Working with Bundles

The following section provides tasks for adopting, orphaning and getting bundles for IMGraphic.

### Adopting Bundles for IMGraphic

To attach ownership of a bundle to the graphic, a graphic calls the adoptBundle function. A graphic can have ownership of only one bundle at a time. If the graphic already owns a bundle, the existing bundle is deleted and the new bundle is adopted. (As pointers are passed, it is important for the clients not to keep references to the bundle passed as the parameter.) The bundle is deleted when the graphic that adopted it is deleted.

virtual void adoptBundle(IGrafBundle *bundle);

### Orphaning Bundles for IMGraphic

A bundle should not be modified while it is under adoption. The bundle must be orphaned, modified, and then readopted when you want to change its attributes. The orphanBundle function orphans a bundle by returning ownership of the bundle to the caller. The caller is then responsible for deleting the bundle and changing the bundle attributes.

virtual IGrafBundle* orphanBundle();

When orphaned, the IMGraphic bundle is set to NIL, and when drawn, the IMGraphic uses the default mechanism of attributes/bundles, or its parents bundle as the case may be.

### Getting Bundles for IMGraphic

The inquiry function, bundle, returns a pointer to a constant bundle that cannot be changed. Use this function to make inquiries about the attributes present in the bundle. This function provides an alias to the bundle stored in the IMGraphic object.

virtual const IGrafBundle* bundle() const;