Rectangle3

This class represents a rectangular shape that is constructed only the the RectangleFactory that guarantees that all objects it produces have the same Shape. To insure the uniformity of their Shapes, the Rectangle3 constructor is private and the RectangleFactory is declared as a friend class so that it alone has access to the Rectangle3 constructor. The dimensions and initial position of the Rectangle3 within a Canvas are specified when the Rectangle3 is constructed by the RectangleFactory. The Rectangle3 may be moved relative to its current positions, drawn, and erased, but not resized. This class uses a static (class) variable defined as:
  
        static Color rectangleColor; 
 
  
which is the color used to draw all rectangles. The SetColor method changes this static (class) variable and, thereby, affects the drawing color of all rectangles.

[ Index | Source | Summary | Member Functions ]

Quick Index


Class Summary

class Rectangle3

{

public:
void MoveUp (int deltaY);
void MoveDown (int deltaY);
void MoveLeft (int deltaX);
void MoveRight (int deltaX);
void Draw(Canvas& canvas);
void Clear(Canvas& canvas);
void SetColor(Color color);
~Rectangle3();
}; // Rectangle3

Back to the top of Rectangle3


void MoveUp (int deltaY);

Move the Location of the rectangle a given amount toward the top edge of the Canvas relative to its current position.

	  void MoveUp    (int deltaY);

Back to the top of Rectangle3


void MoveDown (int deltaY);

Move the Location of the rectangle a given amount toward the bottom edge of the Canvas relative to its current position.

	  void MoveDown  (int deltaY);

Back to the top of Rectangle3


void MoveLeft (int deltaX);

Move the Location of the rectangle a given amount toward the left edge of the Canvas relative to its current position.

	  void MoveLeft  (int deltaX);

Back to the top of Rectangle3


void MoveRight (int deltaX);

Move the Location of the rectangle a given amount toward the right edge of the Canvas relative to its current position.

	  void MoveRight (int deltaX);

Back to the top of Rectangle3


void Draw(Canvas& canvas);

Draw the rectangle at its current position in a given Canvas.

	  void Draw(Canvas& canvas);

Back to the top of Rectangle3


void Clear(Canvas& canvas);

Erase the rectangle from the given Canvas in which it is drawn. Note: no check is made that the rectangle is actually drawn in this Canvas; it is the programmer's responsibility to insure this condition.

	  void Clear(Canvas& canvas);

Back to the top of Rectangle3


void SetColor(Color color);

Change the color of all rectangles. This is accomplished by setting the static (class) variable that records the color used in drawing the rectangle. A rectangles will be affected by this change the next time that it is redrawn.

	  void SetColor(Color color);

Back to the top of Rectangle3


~Rectangle3();

Release the resources held by the Rectangle3 object.

	  ~Rectangle3();

Back to the top of Rectangle3


Member Functions

public:
void MoveUp (int deltaY);
void MoveDown (int deltaY);
void MoveLeft (int deltaX);
void MoveRight (int deltaX);
void Draw(Canvas& canvas);
void Clear(Canvas& canvas);
void SetColor(Color color);

Back to the top of Rectangle3


Generated from source by the Cocoon utilities on Thu Apr 02 12:40:36 1998 .

Report problems to jkotula@unimax.com