HP Integrity NonStop J-Series User Manual
Page 266

//17 If the message is a WM_CREATE message, it was generated by the CreateWindow
function and this is the first time through for this procedure. Use the rather baroque
procedure to fetch the this pointer from the CREATESTRUCT (recall it had been inserted
at line 4), and put it into the Windows extra data. The function RWSetWindowPtr will be
defined later.
//18 The function RWGetWindowPtr(HWND) is used to retrieve the pointer to the appropriate
DemoWindow, given a Windows HANDLE.
//19 If a WM_PAINT has been retrieved, then call the paint() member function, which we have
already seen.
//20 This function is used to put a this pointer into the Windows extra data. The idea is to have
a one-to-one mapping of Windows handles to instances of DemoWindow.
//21 This function is used to fetch the this pointer back out.
An Excerpt from SHAPES.H
This section deals with the subclasses of RWDrawable. Class RWDrawable is an abstract base
class that inherits from the Tools.h++ class
RWCollectable
, and adds a new member function
drawWith(HDC). Subclasses specializing RWDrawable should implement this function to draw
itself onto the supplied device context handle.
We have reprinted only one subclass here, RWRectangle. Class RWRectangle inherits from
RWDrawable. Note that it uses the struct RECT provided by Windows as member data to hold
the corners of the rectangle.
class RWDrawable : public RWCollectable{
public:
virtual void drawWith(HDC) const = 0;
};
class RWRectangle : public RWDrawable{
RWDECLARE_COLLECTABLE(RWRectangle)
public:
RWRectangle() { }
RWRectangle(int, int, int, int);
// Inherited from RWDrawable:
virtual void drawWith(HDC) const;
// Inherited from RWCollectable:
virtual Rwspace binaryStoreSize() const
{return 4*sizeof(int);}
virtual unsigned hash() const;
virtual RWBoolean isEqual(const RWCollectable*) const;