Reader small image

You're reading from  C++ Windows Programming

Product typeBook
Published inSep 2016
Reading LevelIntermediate
PublisherPackt
ISBN-139781786464224
Edition1st Edition
Languages
Right arrow
Author (1)
Stefan Björnander
Stefan Björnander
author image
Stefan Björnander

Stefan Björnander is the author of the books Microsoft Windows C++ and C++ Windows Programming. He holds a Master of Engineering and a Licentiate in Computer Science. He has worked as a software developer and as a teacher in computer science and mathematics for many years.
Read more about Stefan Björnander

Right arrow

The LineFigure class


A line is drawn between two points, represented by the firstPoint field to the lastPoint field in the LineFigure class, as shown in the following image:

The header file overrides some of the methods of its DrawFigure base class. The DoubleClick method does nothing. As I see it, there is no really meaningful response to a double-click on a line. However, we still need to override the DoubleClick method, since it is a pure virtual method in the DrawFigure base class. If we do not override it, the LineFigure class will be abstract.

LineFigure.h

class LineFigure : public DrawFigure { 
  public: 
    LineFigure(const Window* windowPtr); 
    virtual FigureId GetId() const {return LineId;} 
    virtual void SetFirstPoint(Point point); 
 
    virtual bool IsClick(Point mousePoint); 
    virtual bool IsInside(Rect rectangleArea); 
    virtual void DoubleClick(Point mousePoint) {/* Empty. */} 
 
    virtual void Modify(Size distanceSize...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
C++ Windows Programming
Published in: Sep 2016Publisher: PacktISBN-13: 9781786464224

Author (1)

author image
Stefan Björnander

Stefan Björnander is the author of the books Microsoft Windows C++ and C++ Windows Programming. He holds a Master of Engineering and a Licentiate in Computer Science. He has worked as a software developer and as a teacher in computer science and mathematics for many years.
Read more about Stefan Björnander