home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PM-M2B.ZIP / PMWIN.MOD < prev    next >
Text File  |  1990-10-04  |  4KB  |  108 lines

  1. (*----------------------------------------------------------------------------*)
  2. (* Example programs written in JPI Modula-2 Version 2 for OS/2 1.2 by         *)
  3. (* Chris Barker, October 1990                                                 *)
  4. (*                                                                            *)
  5. (* Notes:  I am distributing these programs so that others can learn and also *)
  6. (*         so I can elicit feedback from the user community on programming for*)
  7. (*         OS/2 PM using Modula-2.  If your have any questions, suggestions,  *)
  8. (*         or comments I'd love to hear from you.  I may be reached at the    *)
  9. (*         following addresses:                                               *)
  10. (*                                                                            *)
  11. (*         Compuserve ID: 72261,2312                                          *)
  12. (*         Pete Norloff's OS/2 Shareware BBS - (703) 385-4325                 *)
  13. (*         Max's Doghouse BBS - (703) 548-7849                                *)
  14. (*           The above two BBS carry the Fidonet OS/2 echo which I read       *)
  15. (*           regularly.                                                       *)
  16. (*         Programmer's Corner - (301) 596-1180                               *)
  17. (*         CPCUG Mix (Window Sig) BBS - (301) 738-9060                        *)
  18. (*                                                                            *)
  19. (*         I hope I hear from you!                                            *)
  20. (*                                                                            *)
  21. (*               - Chris                                                      *)
  22. (*                                                                            *)
  23. (*----------------------------------------------------------------------------*)
  24.  
  25. (*----------------------------------------------------------------------------*)
  26. (*  Program Notes:                                                            *)
  27. (*    My first attempt at creating an encapsulated PM window library that     *)
  28. (*    would simplify the task of creating PM windows.  This program           *)
  29. (*    demonstrates the use of JPI's OOP extensions to Modula-2.               *)
  30. (*                                                                            *)
  31. (*----------------------------------------------------------------------------*)
  32.  
  33. (*# call(same_ds => off) *)
  34. (*# data(heap_size=> 3000) *)
  35.  
  36. IMPLEMENTATION MODULE Pmwin;
  37.  
  38.  
  39. IMPORT OS2DEF,Win,Gpi,Dos,Lib,SYSTEM;
  40. FROM OS2DEF IMPORT HDC,HRGN,HAB,HPS,HBITMAP,HWND,HMODULE,HSEM,
  41.                    POINTL,RECTL,PID,TID,LSET,NULL,
  42.                    COLOR,NullVar,NullStr,BOOL ;
  43. FROM OS2MAC IMPORT SHORT1FROMMP,SHORT2FROMMP,MPFROMSHORT,MPFROM2SHORT;
  44.  
  45. TYPE
  46.   StrPtr = POINTER TO ARRAY[0..0] OF CHAR;
  47.  
  48.   Stdwin = CLASS
  49.     x , y,
  50.     cx, cy        : INTEGER;
  51.     hab           : HAB;
  52.     hmq           : Win.HMQ;
  53.     qmsg          : Win.QMSG;
  54.     client,
  55.     hwnd          : HWND;
  56.     r             : Win.MRESULT;
  57.  
  58.     PROCEDURE Init(details : LSET; titlestr : ARRAY OF CHAR);
  59.     BEGIN
  60.       hab := Win.Initialize(NULL);
  61.       hmq := Win.CreateMsgQueue(hab,0);
  62.  
  63.       hwnd := Win.CreateStdWindow(
  64.               Win.HWND_DESKTOP,
  65.               Win.WS_VISIBLE,
  66.               details,
  67.               StrPtr(NULL)^,
  68.               titlestr,
  69.               0,
  70.               NULL,
  71.               0,
  72.               client);
  73.     END Init;
  74.  
  75.     PROCEDURE Error;
  76.     BEGIN
  77.     END Error;
  78.  
  79.     PROCEDURE Done;
  80.     BEGIN
  81.       IF NOT Win.DestroyWindow(hwnd) THEN
  82.         Error;
  83.       END;
  84.  
  85.       IF NOT Win.DestroyMsgQueue( hmq ) THEN
  86.         Error;
  87.       END;
  88.  
  89.       IF NOT Win.Terminate(hab) THEN
  90.         Error;
  91.       END;
  92.     END Done;
  93.  
  94.     PROCEDURE Draw;
  95.     BEGIN
  96.     END Draw;
  97.  
  98.     PROCEDURE Process;
  99.     BEGIN
  100.       WHILE( Win.GetMsg(hab, qmsg, HWND(NULL),0,0)) DO
  101.         r := Win.DispatchMsg(hab,qmsg);
  102.       END;
  103.     END Process;
  104.  
  105.   END;
  106.  
  107. END Pmwin.
  108.