home *** CD-ROM | disk | FTP | other *** search
/ Kyūkyoku!! X68000 Emulator / X68000Book.dat / mac / OLS / X68000 / Ko-Window / kow142s.lzh / wsrv / simple.c < prev    next >
C/C++ Source or Header  |  1995-11-29  |  2KB  |  99 lines

  1. /*
  2.  *        âEâCâôâhâEÅêù¥è╓Éö
  3.  *
  4.  *            Copyright    T.Kobayashi
  5.  *            1990.2.3
  6.  */
  7. #include    "clip.h"
  8. #include    "window.h"
  9. #include    "simple.h"
  10. #include    "wopen.h"
  11.  
  12. #define    SHADOW    2
  13.  
  14. /*
  15.     proto -s simple.c > temp
  16. */
  17. /*static    int        SimpleEvent( SimpleClass*, EventInfo* );*/
  18. static    void    SimpleRedraw( SimpleClass* );
  19.  
  20. void    SimpleSet( wp, x, y, h, v, parent, id, event )
  21. SimpleClass    *wp ;
  22. int            x, y, h, v ;
  23. WindowClass    *parent ;
  24. int            id ;
  25. int            (*event)();
  26. {
  27.     WindowSet( (WindowClass*)wp, x, y, h+(2+SHADOW), v+(2+SHADOW), parent, -1,
  28.                                      systemfunc[SimpleType].eventfunc );
  29.     wp->window.type = SimpleType ;
  30.     WindowSetEventAttr( (WindowClass*)wp, EventAttrDefault );
  31.     WindowSetAttr( (WindowClass*)wp, 0 );
  32.     ClipSet( &(wp->window.curclip), 1, 1, h, v );
  33.     wp->simple.id = id ;
  34.     wp->simple.event = event ;
  35. }
  36.  
  37. void    SimpleResize( wp, x, y, h, v )
  38. SimpleClass    *wp ;
  39. int        x, y, h, v ;
  40. {
  41.     WindowResize( (WindowClass*)wp, x, y, h+(2+SHADOW), v+(2+SHADOW) );
  42. }
  43.  
  44. int        SimpleEvent( wp, info )
  45. SimpleClass    *wp ;
  46. EventInfo    *info ;
  47. {
  48.     switch( info->option )
  49.     {
  50.         case EventRedraw :
  51.             SimpleRedraw( wp );
  52.         case EventMouseSwitch :
  53.         case EventMouseMove :
  54.         case EventKey :
  55.             info->x -= 1 ;
  56.             info->y -= 1 ;
  57.         case EventOpen :
  58.         case EventClose :
  59.         case EventPop :
  60.         case EventPush :
  61.         case EventMove :
  62.         case EventResize :
  63.         case EventScroll :
  64.         case EventZoom :
  65.         case EventIconify :
  66.         case EventInterval :
  67.         case EventMouseEnter :
  68.         case EventMouseOut :
  69.         case EventUser :
  70.         case EventGraphic :
  71.             return( SendEvent( wp->simple.id, wp->simple.event, (WindowClass*)wp, info ) );
  72.         default :
  73.             ErrorCheck( FALSE, "SimpleEvent" );
  74.     }
  75.     return( FALSE );
  76. }
  77.  
  78. static    void    SimpleRedraw( wp )
  79. SimpleClass    *wp ;
  80. {
  81.     int            h, v ;
  82.     DrawBuf        buf[6], *bufp = buf ;
  83.  
  84.     ClipGetSize( (ClipClass*)wp, &h, &v );
  85.     h -= SHADOW + 2 ;
  86.     v -= SHADOW + 2 ;
  87.  
  88.     /*  ÿg  */
  89.     DrawSetLine( bufp++, 0, 0, h+1, v+1, ShadowUp, OptionShadow );
  90.  
  91.     /*  ëe  */
  92.     DrawSetLine( bufp++, SHADOW+1, v+2, h+1, v+(1+SHADOW), 0, OptionFill );
  93.     DrawSetLine( bufp++, h+2, SHADOW+1, h+(1+SHADOW), v+(1+SHADOW), 0, OptionFill );
  94.  
  95.     WindowDrawAbs( (WindowClass*)wp, buf, 3/*bufp-buf*/ );
  96.  
  97.     ClipSet( &(wp->window.curclip), 1, 1, h, v );
  98. }
  99.