#include <layer.h>
Inherits Graphic.
Inherited by AnimationSlide, LogicConnectionPath, LogicConnector, MemBoard, MemDisplay, MemRegister, RobotBuilder, RobotModel, and TestAnimate.

Public Member Functions | |
| Layer () | |
| Location (0,0), fills the screen. | |
| Layer (Point location, Point size) | |
| Layer (int x, int y, int w, int h) | |
| ~Layer () | |
| A deleted layer takes all its objects with it. | |
| void | draw (BITMAP *canvas, Point offset) |
| Calls the draw() methods of every object in this Layer. | |
| void | add (Graphic *g) |
| Adds g on top of existing objects. | |
| void | addBehind (Graphic *g) |
| Adds g behind existing objects. | |
| void | remove (Graphic *g) |
| Removes g from this object. | |
| int | w () |
| The width of this object. | |
| int | h () |
| The height of this object. | |
| Point | layerSize () |
| A Point representing the size of this object. | |
Protected Attributes | |
| Point | size |
| std::list< Graphic * > | items |
The Layer class provides a tree structure to Graphics objects. It contains a list of Graphics and displays them in its draw() method. Note that Layers are themselves Graphics, and thus can be stored inside other Layers. This means that calling the draw() method of the root of a tree composed of Layers will draw the entire structure, with the leaves on top.
Because the location of Graphics objects is relative, moving a layer (via the move() and moveTo() methods of Graphic) will also move all objects it contains. Each Layer also has a size, which restricts the area in which its children may be drawn. Nothing in a Layer can be drawn outside the rectangle with its top left corner at (location) and its bottom right corner at (location + size).
| Layer::Layer | ( | ) |
Location (0,0), fills the screen.
| Layer::Layer | ( | int | x, | |
| int | y, | |||
| int | w, | |||
| int | h | |||
| ) |
| Layer::~Layer | ( | ) |
A deleted layer takes all its objects with it.
| void Layer::add | ( | Graphic * | g | ) |
Adds g on top of existing objects.
| void Layer::addBehind | ( | Graphic * | g | ) |
Adds g behind existing objects.
| void Layer::draw | ( | BITMAP * | canvas, | |
| Point | offset | |||
| ) | [virtual] |
| int Layer::h | ( | ) | [inline] |
The height of this object.
| void Layer::remove | ( | Graphic * | g | ) |
Removes g from this object.
Note that g must be the same pointer as the object that was originally added. Passing an identical object will not work.
| int Layer::w | ( | ) | [inline] |
The width of this object.
std::list<Graphic*> Layer::items [protected] |
Point Layer::size [protected] |
1.5.7.1