Book Image

Microsoft Visual C++ Windows Applications by Example

By : Stefan Bjornander, Stefan Björnander
Book Image

Microsoft Visual C++ Windows Applications by Example

By: Stefan Bjornander, Stefan Björnander

Overview of this book

Table of Contents (15 chapters)
Microsoft Visual C++ Windows Applications by Example
Credits
About the Author
About the Reviewer
Preface
Index

The RectangleFigure Class


RectangleFigure manages a rectangle. It is a direct sub class of TwoDimensionalFigure. It has two fields m_ptTopLeft and m_ptBottomRight for the opposite corners. The fields are protected as they are accessed by EllipseFigure, which privately inherits RectangleFigure. RectangleFigure inherits TwoDimensionalFigure virtually in the same way as LineFigure inherits Figure virtually.

RectangleFigure.h

class RectangleFigure: public virtual TwoDimensionalFigure
{
  public:
    RectangleFigure();
    RectangleFigure(const Color& color, const CPoint&
                    ptTopLeft, BOOL bFilled);

    RectangleFigure(const RectangleFigure& rectangle);
    Figure* Copy() const;
    void Serialize(CArchive& archive);
    HCURSOR GetCursor() const;

    BOOL Click(const CPoint& ptMouse);
    BOOL DoubleClick(const CPoint& ptMouse);
    BOOL Inside(const CRect& rcInside) const;

    void MoveOrModify(const CSize& szDistance);
    void Move(const...