PMWin

Description
The base class is obviously PMWin: this class contains some data (a PMAnchorBlock, the window handle, the frame window handle, and a pointer to a CreateArgs structure, which is used during the window creation). The PM window is not  created  in  the constructor: only the CreateArgs structure is filled. The PM window is than created by a separate functions. With this hack it is possible for derived classes to change some CreateArgs in the constructor before  the window is created. Once allocated with the new operator, a  PMWin  is  never  deleted:  when  a WM_DESTROY  message arrives  to the window message procedure, the PMWin object is automatically deleted by the PM++ system. There are a lot of inline functions to hide the PM APIs that refer to  the  window handle (HWND),  and  some  inline  functions  to query the internal data of the PMWin class (the HWND etc.)  There  is  also a certain number of virtual functions for processing the most common messages (WM_PAINT, WM_COMMAND, WM_CHAR...). All other messages are processed in the other function.

The PMWin object (and all derived classes) is connected to the HWND troughall  the  whole  system  with  the  typical  WinSet/QueryWindowPtr method,  with  the PMWin pointer stored in the QWP_USER position (offset 0). This lets the standard C  window procedure call always the message dispacher routine of the right PMWin  object,  without  allocating  more window instance data.

PMWin is  the  base  class  for PMMainWin, which adds some standard functions for main  application  window  (special  menu selections: file open, file new, etc., and a special version of the paint function  which gets  a  ready-to-use  referece to a PMPresSpace (the PM++ equivalent of the HPS).

The message processing virtual functions  must return FALSE if they don't process the message (so that the message dispatcher will call  the default PM routine), or TRUE if they do. The return code of the message processing (MRESULT  in  PM  jargon)  can  be set by the message return function trough the ret field of the PMEvent structure.