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

  1. /* 1995 11/25 âfâUâCâôò╧ìXé¬é┼é½éΘéµéñé╔ò╧ìX COR. */
  2.  
  3. #include    <stdio.h>
  4. #include    "clip.h"
  5. #include    "slider.h"
  6. #include    "window.h"
  7. #include    "simple.h"
  8. #include    "title.h"
  9. #include    "scroll.h"
  10. #include    "manager.h"
  11. #include    "wopen.h"
  12.  
  13. static    void    SendEventOpen( WindowClass*, int, int, int, int );
  14.  
  15. SystemWindowFunc    systemfunc[]= {
  16.     {    WindowResize,    WindowScroll,    WindowSet,    SendEvent    },
  17.     {    SimpleResize,    WindowScroll,    SimpleSet,    SimpleEvent    },
  18.     {    TitleResize,    WindowScroll,    TitleSet,    TitleEvent    },
  19.     {    ScrollResize,    ScrollScroll,    ScrollSet,    ScrollEvent    },
  20. };
  21.  
  22. void *
  23. WindowSetManagerExec( type, page, args )
  24. int        type, page;
  25. void    *args;
  26. {
  27.     void    **vp= (void*)&systemfunc[type],
  28.             *ret= vp[page];
  29.     if( args )
  30.         vp[page]= args;
  31.     return    ret;
  32. }
  33.  
  34. WindowClass    *WindowOpen( id, x, y, h, v, parent, event )
  35. int            id ;
  36. int            x, y, h, v ;
  37. WindowClass    *parent ;
  38. int            (*event)() ;
  39. {
  40.     WindowClass    *wp ;
  41.  
  42.     if ( parent == NULL )
  43.         parent = & RootWindow ;
  44.     wp = WindowMemoryAlloc( sizeof( WindowClass ) );
  45.     WindowSet( wp, x, y, h, v, parent, id, event );
  46.     wp->window.ownerid = id ;
  47.     SendEventOpen( wp, x, y, h, v );
  48.     return( wp );
  49. }
  50.  
  51. SimpleClass    *SimpleOpen( id, x, y, h, v, parent, event )
  52. int            id ;
  53. int            x, y, h, v ;
  54. WindowClass    *parent ;
  55. int            (*event)() ;
  56. {
  57.     SimpleClass    *wp ;
  58.  
  59.     if ( parent == NULL )
  60.         parent = & RootWindow ;
  61.     wp = WindowMemoryAlloc( sizeof( SimpleClass ) );
  62.     (*systemfunc[SimpleType].setfunc)( wp, x, y, h, v, parent, id, event );
  63. /*    SimpleSet( wp, x, y, h, v, parent, id, event );*/
  64.     wp->window.ownerid = id ;
  65.     SendEventOpen( (WindowClass*)wp, x, y, h, v );
  66.     return( wp );
  67. }
  68.  
  69. TitleClass    *TitleOpen( id, x, y, h, v, parent, label, button, event )
  70. int            id ;
  71. int            x, y, h, v ;
  72. WindowClass    *parent ;
  73. char        *label ;
  74. int            button ;
  75. int            (*event)();
  76. {
  77.     TitleClass    *wp ;
  78.  
  79.     if ( parent == NULL )
  80.         parent = & RootWindow ;
  81.     wp = WindowMemoryAlloc( sizeof( TitleClass ) );
  82.     (*systemfunc[TitleType].setfunc)(
  83.                         wp, x, y, h, v, parent, label, button, id, event );
  84. /*    TitleSet( wp, x, y, h, v, parent, label, button, id, event );*/
  85.     wp->window.ownerid = id ;
  86.     SendEventOpen( (WindowClass*)wp, x, y, h, v );
  87.     return( wp );
  88. }
  89.  
  90. ScrollClass    *ScrollOpen( id, x, y, h, v, parent, maxh, maxv, dir, xstep, ystep, event )
  91. int            id ;
  92. int            x, y, h, v ;
  93. WindowClass    *parent ;
  94. int            maxh, maxv ;
  95. int            dir, xstep, ystep ;
  96. int            (*event)() ;
  97. {
  98.     ScrollClass    *wp ;
  99.  
  100.     if ( parent == NULL )
  101.         parent = & RootWindow ;
  102.     wp = WindowMemoryAlloc( sizeof( ScrollClass ) );
  103.     (*systemfunc[ScrollType].setfunc)( wp, x, y, h, v, parent,
  104.                                 maxh, maxv, dir, xstep, ystep, id, event );
  105. /*    ScrollSet( wp, x, y, h, v, parent, maxh, maxv, dir, xstep, ystep, id, event );*/
  106.     wp->window.ownerid = id ;
  107.     SendEventOpen( (WindowClass*)wp, x, y, h, v );
  108.     return( wp );
  109. }
  110.  
  111. static    void    SendEventOpen( wp, x, y, h, v )
  112. WindowClass    *wp ;
  113. int        x, y, h, v ;
  114. {
  115.     EventInfo    info ;
  116.  
  117.     info.option = EventOpen ;
  118.     info.x = x ;
  119.     info.y = y ;
  120.     info.h = h ;
  121.     info.v = v ;
  122.     WindowSendEvent( wp, &info );
  123. }
  124.  
  125. void    SelectResize( wp, x, y, h, v )
  126. WindowClass    *wp ;
  127. int            x, y, h, v ;
  128. {
  129. /*    static    void    (*resizefunc[])() =
  130.         { WindowResize, SimpleResize, TitleResize, ScrollResize };*/
  131.     (*systemfunc[ wp->window.type].resizefunc)( wp, x, y, h, v );
  132. }
  133.  
  134. void    SelectScroll( wp, dx, dy )
  135. WindowClass    *wp ;
  136. int            dx, dy ;
  137. {
  138. /*    static    void    (*scrollfunc[])() =
  139.         { WindowScroll, WindowScroll, WindowScroll, ScrollScroll };*/
  140.     (*systemfunc[ wp->window.type].scrollfunc)( wp, dx, dy );
  141. }
  142.