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