home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / spmio10.zip / gcc2 / pmio / test6.cc < prev    next >
C/C++ Source or Header  |  1994-08-28  |  1KB  |  68 lines

  1. /*
  2.  * This program demonstrates the use of pmio facilities as a debugging
  3.  * aid for Presentation Manager programs.
  4.  */
  5.  
  6.  
  7. #include <stdio.h>
  8. #include <stdwin.h>
  9. #include <pmio.h>
  10.  
  11. class Test: public StdWin
  12. {
  13.   typedef StdWin inherited;
  14. private:
  15.   virtual MRESULT msg_create ();
  16.   virtual MRESULT msg_paint ();
  17.   virtual MRESULT msg_size (short old_width, short old_height,
  18.                 short new_width, short new_heigth);
  19. public:
  20.   Test ();
  21. };
  22.  
  23. Test::Test ()
  24. {
  25. }
  26.  
  27. MRESULT Test::msg_create ()
  28. {
  29.   printf ("msg_create received\n");
  30.   MRESULT ret = inherited::msg_create ();
  31.   printf ("msg_create is returning %u\n", (unsigned int) ret);
  32.   return ret;
  33. }
  34.  
  35. MRESULT Test::msg_paint ()
  36. {
  37.   // Just do a blank client window
  38.   RECTL rectl;
  39.   HPS hps = WinBeginPaint (window, 0, &rectl);
  40.   printf ("Repainting (%ld,%ld) through (%ld,%ld)\n",
  41.       rectl.xLeft, rectl.yBottom,
  42.       rectl.xRight, rectl.yTop);
  43.   GpiErase (hps);
  44.   WinEndPaint (hps);
  45.   return 0;
  46. }
  47.  
  48. MRESULT Test::msg_size (short old_width, short old_height,
  49.             short new_width, short new_height)
  50. {
  51.   printf ("Window size changed from %dx%d to %dx%d\n",
  52.       old_width, old_height,
  53.       new_width, new_height);
  54.   return inherited::msg_size (old_width, old_height, new_width, new_height);
  55. }
  56.  
  57. int main ()
  58. {
  59.   start_pmio ();
  60.   set_fg (WHITE);
  61.   set_bg (CYAN);
  62.   clrscr ();
  63.   Test test;
  64.   test.activate_window ();
  65.   StdWin::StdMessageLoop ();
  66.   return 0;
  67. }
  68.