home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ctdemo.zip / classes / @CLSLIB1.ZIP / cls / iclui / aertwndw.cpp < prev    next >
C/C++ Source or Header  |  1994-06-19  |  4KB  |  163 lines

  1. #ifndef INCL_AEARTHWINDOW
  2. #define INCL_AEARTHWINDOW
  3.  
  4. #ifndef __FIRST__
  5. #define __FIRST__
  6. #define __IMPL__AEARTHWINDOW
  7. #endif
  8.  
  9. /////V AEarthWindow PCM f:\cls_ibm\cls\iclui 0 PM 20.10.94 19:37:12
  10.  
  11. /*
  12. /////H 
  13. 20.10.94 19:37 PM 0 copied from: AEarthWindow TOS f:\cls_ibm\cls\iclui 0 PM 19.10.94 00:26:00
  14. 30.03.95 10:34 PM 0 archived: AEarthWindow PCM f:\cls_ibm\cls\iclui 0 PM 20.10.94 19:37:12
  15. /////
  16. */
  17.  
  18. /////1
  19. #undef inline
  20.  
  21. #include <bsa.h>
  22.  
  23. /////I istattxt.hpp @ @ @ @ pre 
  24. #include <istattxt.hpp>
  25.  
  26. /////I ipainhdr.hpp @ @ @ @ pre 
  27. #include <ipainhdr.hpp>
  28.  
  29.  
  30. #ifndef __INLINE__
  31. #define inline
  32. #endif
  33.  
  34. /////C AEarthWindow @ @ 
  35. class AEarthWindow :
  36.  
  37. /////B IStaticText @ @ visible extern 
  38. public                 IStaticText,
  39.  
  40. /////B IPaintHandler @ @ visible extern 
  41. public                 IPaintHandler
  42.  
  43. {
  44.  
  45. public:
  46.     AEarthWindow (unsigned long,IWindow*,const IRectangle& =IRectangle());
  47.     Boolean    paintWindow (IPaintEvent&);
  48. };
  49.  
  50.  
  51. /////2
  52. #undef inline
  53.  
  54.  
  55. #if (defined __INLINE__) || (defined __IMPL__AEARTHWINDOW)
  56.  
  57. #ifndef __INLINE__
  58. #define inline
  59. #endif
  60.  
  61. /////
  62. #endif
  63.  
  64. /////3
  65. #undef inline
  66.  
  67. #ifdef __IMPL__AEARTHWINDOW
  68. /////I irect.hpp @ @ @ @ impl 
  69. #include <irect.hpp>
  70.  
  71. /////I ipainevt.hpp @ @ @ @ impl 
  72. #include <ipainevt.hpp>
  73.  
  74. /////I ihandle.hpp @ @ @ @ impl 
  75. #include <ihandle.hpp>
  76.  
  77. /////I os2.h @ @ INCL_GPIPRIMITIVES INCL_GPIPATHS @ @ impl 
  78. #define INCL_GPIPRIMITIVES
  79. #define INCL_GPIPATHS
  80. #include <os2.h>
  81. #undef INCL_GPIPRIMITIVES
  82. #undef INCL_GPIPATHS
  83.  
  84. /////F AEarthWindow @ IRectangle() @ instance public 
  85. AEarthWindow :: AEarthWindow(unsigned long windowId,
  86.                              IWindow * parowWindow,
  87.                              const IRectangle& rect) :
  88.                 IStaticText(windowId, parowWindow, parowWindow, rect)
  89. {
  90.   handleEventsFor(this);
  91.   show();
  92. }
  93.  
  94. /////F paintWindow @ @ instance public 
  95. Boolean AEarthWindow :: paintWindow(IPaintEvent & paintEvent)
  96. {
  97.   POINTL pt0, pt1, pt2 ;
  98.   POINTL ptlist[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ;
  99.   LONG   delta ;
  100.   IPresSpaceHandle hps ;
  101.  
  102.   hps = paintEvent.presSpaceHandle() ;
  103.   pt0.x = 0 ;
  104.   pt0.y = 0 ;
  105.   GpiMove (hps, &pt0) ;
  106.   GpiSetColor (hps, CLR_BLACK) ;
  107.   pt1.x = size().width() ;
  108.   pt1.y = size().height() ;
  109.   GpiBox (hps, DRO_OUTLINEFILL, &pt1, 0, 0) ;
  110.  
  111.   pt2.x = (pt1.x-pt0.x)/2 ;
  112.   pt2.y = (pt1.y-pt0.y)/2 ;
  113.   delta = pt2.x/8 ;
  114.   ptlist[0].x = pt0.x + delta ;
  115.   ptlist[0].y = pt0.y ;
  116.   ptlist[1].x = pt0.x + pt2.x ;
  117.   ptlist[1].y = pt0.y + pt2.y ;
  118.   ptlist[2].x = pt1.x - delta ;
  119.   ptlist[2].y = pt0.y ;
  120.   GpiSetColor (hps, CLR_BLUE);
  121.   GpiBeginPath (hps, 1L) ;
  122.   GpiMove (hps, &ptlist[0]) ;
  123.   GpiPointArc (hps, &ptlist[1]);
  124.   GpiLine (hps, &ptlist[0]);
  125.   GpiEndPath (hps) ;
  126.   GpiFillPath(hps, 1L, FPATH_ALTERNATE);
  127.  
  128.   ptlist[0].x = ptlist[0].x + 30 ;
  129.   ptlist[1].y = ptlist[1].y - 10 ;
  130.   ptlist[2].x = ptlist[2].x - 30 ;
  131.   GpiSetColor (hps, CLR_CYAN) ;
  132.   GpiBeginPath (hps, 1L) ;
  133.   GpiMove (hps, &ptlist[0]) ;
  134.   GpiPointArc (hps, &ptlist[1]) ;
  135.   GpiLine (hps, &ptlist[0]) ;
  136.   GpiEndPath (hps) ;
  137.   GpiFillPath(hps, 1L, FPATH_ALTERNATE);
  138.  
  139.   ptlist[0].x = ptlist[0].x - delta ;
  140.   ptlist[1].x = ptlist[1].x - delta ;
  141.   ptlist[2].x = ptlist[2].x + delta ;
  142.   ptlist[3].x = ptlist[0].x + (delta*3);
  143.   ptlist[4].x = ptlist[1].x + delta ;
  144.   ptlist[5].x = ptlist[2].x - (delta*2);
  145.   delta = pt2.y/3 ;
  146.   ptlist[0].y = pt1.y - delta ;
  147.   ptlist[1].y = ptlist[1].y + delta ;
  148.   ptlist[2].y = ptlist[2].y + delta ;
  149.   ptlist[3].y = pt1.y - (delta*2) ;
  150.   ptlist[4].y = ptlist[1].y + (delta*2);
  151.   ptlist[5].y = ptlist[2].y + (delta*3);
  152.   GpiSetColor (hps, CLR_WHITE) ;
  153.   GpiSetMarker (hps, MARKSYM_DOT) ;
  154.   GpiPolyMarker (hps, 6L, &ptlist[0]) ;
  155.   return (true) ;
  156.  
  157. }
  158.  
  159. /////
  160. #endif
  161.  
  162. #endif
  163.