All Classes Functions
Pens.h
1 #ifndef PENS_H
2 #define PENS_H
3 
4 #include "MyDC.h"
5 
6 class Pens
7 {
8  public:
9  Pens();
10  virtual ~Pens();
11 
12  // Use this enum select the pen that you want with a call like:
13  // Pens::GetPen( Pens::Green );
14  enum LineStyle
15  {
16  Green,
17  Yellow,
18  GreenDashed,
19  White,
20  Grey,
21  Red
22  };
23 
24  // Class' interface - returns a constant reference to MyPEN
25  // You can select the pen you want from the LineStyle
26  const MyPEN & GetPen(LineStyle style) const;
27  protected:
28  private:
29  // Declaring copy constructor and assignment operator private makes the class non-copyable
30  // This takes away the pain of manual memory management. If you need the class again,
31  // just declare it again.
32  Pens(const Pens & other);
33  Pens & operator=(const Pens & other);
34 
35  // Adds a pen with bounds checking
36  void AddPen( LineStyle style, MyPEN pen );
37 
38  const static int cNumPens = 6; // keep this number in order by counting the number of LineStyle colors
39  MyPEN m_pens[cNumPens]; // an array of pens.
40 };
41 
42 #endif // PENS_H