home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mandlcpp.zip / pmprocess.h < prev    next >
C/C++ Source or Header  |  1993-06-24  |  8KB  |  233 lines

  1. #ifndef PMPROCESS_H
  2. #define PMPROCESS_H
  3.  
  4.  
  5. #define INCL_WIN
  6.  
  7.  
  8. #include "process.h"
  9.  
  10.  
  11. class pmMsgThread;
  12.  
  13.  
  14. #define idForeachWindowTreeCallInit (idForeachTreeLast + 1)
  15. #define idForeachWindowTreeWinDestroyWindow (idForeachTreeLast + 2)
  16. #define idForeachWindowTreeCallDestructAll (idForeachTreeLast + 3)
  17. #define idForeachWindowTreeCanClose (idForeachTreeLast + 4)
  18. #define idForeachWindowTreeLast (idForeachTreeLast + 4)
  19.  
  20. #define idGetChainElementWindowTreeThis (idGetChainElementTreeLast + 1)
  21. #define idGetChainElementWindowTreePMsgThread (idGetChainElementTreeLast + 2)
  22. #define idGetChainElementWindowTreeHwndFrame (idGetChainElementTreeLast + 3)
  23. #define idGetChainElementWindowTreeHwndClient (idGetChainElementTreeLast + 4)
  24. #define idGetChainElementWindowTreeHWindowDC (idGetChainElementTreeLast + 5)
  25. #define idGetChainElementWindowTreeClassStyle (idGetChainElementTreeLast + 6)
  26. #define idGetChainElementWindowTreeWindowStyle (idGetChainElementTreeLast + 7)
  27. #define idGetChainElementWindowTreePTitelBarText (idGetChainElementTreeLast + 8)
  28. #define idGetChainElementWindowTreeFrameFlags (idGetChainElementTreeLast + 9)
  29. #define idGetChainElementWindowTreeResourceId (idGetChainElementTreeLast + 10)
  30. #define idGetChainElementWindowTreePWindowClassName (idGetChainElementTreeLast + 11)
  31. #define idGetChainElementWindowTreeLast (idGetChainElementTreeLast + 11)
  32.  
  33.  
  34. class windowTree:public tree, public construct
  35. {    public:
  36.     // pointer to the message thread.
  37.     // actual this should be the thread with tid == 1
  38.     pmMsgThread *pMsgThread;
  39.     // contains threads, which are not assigned to the process.
  40.     // This threads are doing only jobs for this window
  41.     chain chainThreads;
  42.     // The window has the focus
  43.     Boolean bFocus;
  44.     // Pointer to my birthday
  45.     HWND hwndFrame;
  46.     HWND hwndClient;
  47.     HDC hWindowDC;
  48.     // The following stuff can be written to in constructors
  49.     // of derived classes
  50.     ULONG classStyle;    ULONG windowStyle;
  51.     char *pTitelBarText;
  52.     ULONG frameFlags;
  53.     ULONG resourceId;
  54.     char *pWindowClassName;
  55.     /*windowProperties *pWindowProperties;*/
  56.     windowTree *getParentWindow(void)
  57.     {    return getDepth() > 1
  58.             ? (windowTree*)pParent->getChainMember(
  59.             idGetChainElementWindowTreeThis)
  60.             : (windowTree*)0;
  61.     }
  62.     windowTree(pmMsgThread *pMsgThreadNew, int idResource, char *pTitle);
  63.     windowTree(windowTree *pParent, int idResource, char *pTitle);
  64.     virtual MRESULT windowProc(ULONG msg, MPARAM mp1, MPARAM mp2);
  65.     virtual MRESULT WMPaint(MPARAM mp1, MPARAM mp2);
  66.     virtual void doPaint(HPS hps, RECTL *pStructRectl);
  67.     virtual ~windowTree(void);
  68.     //void runWindow(void);
  69.     virtual Boolean create(void);
  70.     virtual MRESULT WMClose(MPARAM mp1, MPARAM mp2);
  71.     virtual MRESULT WMDestroy(MPARAM mp1, MPARAM mp2);
  72.     virtual MRESULT WMFocusChange(MPARAM mp1, MPARAM mp2);
  73.     virtual Boolean canClose(void);
  74.     virtual Boolean canCloseHierarchy(void)
  75.     {    if (foreach(idForeachWindowTreeCanClose, (void*)0))
  76.             return FALSE;
  77.         else
  78.             return TRUE;
  79.     }    virtual int toBeCalledPost(unsigned int iMsg, void *pDummy);    virtual int toBeCalledPre(unsigned int iMsg, void *pDummy);
  80.     virtual Boolean initPost(void);
  81.     virtual void *getChainElementMember(unsigned int iMsg)
  82.     {    switch (iMsg)
  83.         {    default:
  84.                 return tree::getChainElementMember(iMsg);
  85. /*
  86. pmMsgThread *pMsgThread;     // Backpointer
  87.     //windowTree *pParentWindow;
  88.         HWND hwndFrame;
  89.     HWND hwndClient;
  90.     HDC hWindowDC;
  91.     ULONG classStyle;
  92.     ULONG windowStyle;
  93.     char *pTitelBarText;
  94.     ULONG frameFlags;
  95.     ULONG resourceId;
  96.     char *pWindowClassName;
  97. */
  98.             case idGetChainElementWindowTreeThis:
  99.                 return (void*)this;
  100.             case idGetChainElementWindowTreePMsgThread:
  101.                 return (void*)pMsgThread;
  102.             case idGetChainElementWindowTreeHwndFrame:
  103.                 return (void*)hwndFrame;
  104.             case idGetChainElementWindowTreeHwndClient:
  105.                 return (void*)hwndClient;
  106.             case idGetChainElementWindowTreeHWindowDC:
  107.                 return (void*)hWindowDC;
  108.             case idGetChainElementWindowTreeClassStyle:
  109.                 return (void*)classStyle;
  110.             case idGetChainElementWindowTreeWindowStyle:
  111.                 return (void*)windowStyle;
  112.             case idGetChainElementWindowTreePTitelBarText:
  113.                 return (void*)pTitelBarText;
  114.             case idGetChainElementWindowTreeFrameFlags:
  115.                 return (void*)frameFlags;
  116.             case idGetChainElementWindowTreeResourceId:
  117.                 return (void*)resourceId;
  118.             case idGetChainElementWindowTreePWindowClassName:
  119.                 return (void*)pWindowClassName;
  120.         }
  121.     }
  122. };
  123.  
  124.  
  125. #define idGetChainElementProcessWindow idGetChainElementWindowTreeLast
  126. class processWindow:public windowTree
  127. {    public:
  128.     processWindow(pmMsgThread *pMsgThreadNew, int idResource, char *pTitle)
  129.         :windowTree(pMsgThreadNew, idResource, pTitle)
  130.     {}
  131.     processWindow(windowTree *pParent, int idResource, char *pTitle)
  132.         :windowTree(pParent, idResource, pTitle)
  133.     {}
  134.     virtual MRESULT WMClose(MPARAM mp1, MPARAM mp2);
  135. };
  136.  
  137.  
  138. class pmProcess;
  139.  
  140.  
  141. #define idForeachPmThreadLast idForeachThreadLast
  142.  
  143.  
  144. #define idGetChainElementPmThreadThis (idGetChainElementThreadLast + 1)
  145. #define idGetChainElementPmThreadHab (idGetChainElementThreadLast + 2)
  146. #define idGetChainElementPmThreadLast (idGetChainElementThreadLast + 2)
  147. class pmThread: public thread
  148. {    public:
  149.     HAB hab;
  150.     pmThread(pmProcess *pProcessNew);
  151.     pmThread(pmProcess *pProcessNew, chain *pParent);
  152.     virtual ~pmThread(void);
  153.     virtual void *getChainElementMember(unsigned int iMsg)
  154.     {    switch (iMsg)
  155.         {    default:
  156.                 return thread::getChainElementMember(iMsg);
  157.             case idGetChainElementPmThreadThis:
  158.                 return (void*)this;
  159.             case idGetChainElementPmThreadHab:
  160.                 return (void*)hab;
  161.         }
  162.     }
  163. };
  164.  
  165.  
  166. #define idForeachPmWindowThreadSetBackgroundPriority (idForeachPmThreadLast + 1)
  167. #define idForeachPmWindowThreadSetForegroundPriority (idForeachPmThreadLast + 2)
  168. #define idForeachPmWindowThreadLast (idForeachPmThreadLast + 2)
  169. class pmWindowThread:public pmThread
  170. {    public:
  171.     windowTree *pWindow;
  172.     //    Values for priority,
  173.     //    dependent on the window owns the focus or not.
  174.     //    Initialy the foreground values will be set to normal values,
  175.     //    and the background values to idle state
  176.     unsigned int iClassF, iValueF, iClassB, iValueB;
  177.     pmWindowThread(windowTree *pWindowNew);
  178.     virtual int toBeCalledForeachElement(unsigned int iMsg, void *pDummy);
  179.     virtual Boolean initPre(void);
  180. };
  181.  
  182.  
  183. #define idGetChainElementPmMsgThreadTreeThis (idGetChainElementPmThreadLast + 1)
  184. #define idGetChainElementPmMsgThreadTreeHmq (idGetChainElementPmThreadLast + 2)
  185. #define idGetChainElementPmMsgThreadTreeLast (idGetChainElementPmThreadLast + 2)
  186. class pmMsgThread:public pmThread
  187. {    public:
  188.     HMQ hmq;
  189.     // contains the windows assigned to this message thread
  190.     tree structTreeWindows;
  191.     //    windowTree *pWindowTree;
  192.     pmMsgThread(pmProcess *pProcess);
  193.     //    pmMsgThread(threadTree *pParentNew);
  194.     virtual ~pmMsgThread(void);
  195.     virtual Boolean create(void);
  196.     virtual Boolean initPost(void);
  197.     virtual void destruct(void);
  198.     virtual void destructPre(void);
  199.     virtual void doSomething(void);
  200.     virtual void *getChainElementMember(unsigned int iMsg)
  201.     {    switch (iMsg)
  202.         {    default:
  203.                 return pmThread::getChainElementMember(iMsg);
  204.             case idGetChainElementPmMsgThreadTreeHmq:
  205.                 return (void*)hmq;
  206.             case idGetChainElementPmMsgThreadTreeThis:
  207.                 return (void*)this;
  208.         }
  209.     }
  210. };
  211.  
  212.  
  213. #define idGetChainPmProcessThis (idGetChainProcessLast + 1)
  214. #define idGetChainPmProcessLast (idGetChainProcessLast + 1)
  215. class pmProcess: public process
  216. {    public:
  217.     //    virtual void runProcess(void);
  218.     virtual Boolean create(void);
  219.     pmProcess(int argc, char **argv):process(argc, argv)
  220.     {
  221.     }
  222.     virtual void *getChainMember(unsigned int iMsg)
  223.     {    switch (iMsg)
  224.         {    default:
  225.                 return process::getChainMember(iMsg);
  226.             case idGetChainPmProcessThis:
  227.                 return (void*)this;
  228.         }
  229.     }};
  230.  
  231.  
  232. #endif PMPROCESS_H
  233.