home *** CD-ROM | disk | FTP | other *** search
/ Kyūkyoku!! X68000 Emulator / X68000Book.dat / mac / OLS / X68000 / Ko-Window / kow142s.lzh / corlib / DialogMessage.c < prev    next >
C/C++ Source or Header  |  1995-04-16  |  1KB  |  54 lines

  1. /* 1995 H.Ogasawara (COR.) */
  2.  
  3. #include    <corlib.h>
  4. #include    <HS_wlib.h>
  5.  
  6.  
  7. #define    DIALOGSIZEH    (34*8)
  8. #define    DIALOGSIZEV    (16*2)
  9. #define    FONT        16
  10. #define    OFX        8
  11. #define    OFY        8
  12.  
  13. static
  14. DialogExec( wp, info )
  15. WindowID    wp;
  16. EventInfo    *info;
  17. {
  18.     switch( info->option ){
  19.         DrawBuf    dbuf[4];
  20.     case EventRedraw:
  21.         DrawSetClear( dbuf, ColorGray );
  22.         DrawSetSymbol( dbuf+1, OFX, OFY, HS_WindowGetClientPointer(wp),
  23.                 HS_WindowGetClientData(wp), FONT );
  24.         DrawSetLine( dbuf+2, 4, 4, DIALOGSIZEH-4, DIALOGSIZEV-4,
  25.                         ShadowDown, OptionShadow );
  26.         WindowDraw( wp, dbuf, 3 );
  27.         break;
  28.     case EventClose:
  29.         WindowClose( wp );
  30.         break;
  31.     }
  32.     return    TRUE;
  33. }
  34.  
  35. WindowID
  36. DialogMessageOpen( msg, attr )
  37. char    *msg;
  38. {
  39.     int        x, y;
  40.     unsigned short    *sp;
  41.     WindowID    wp;
  42.     WindowGetRootScroll( &x, &y );
  43.     sp= WindowGetScreenTable( WindowGetScreenMode() );
  44.     x+= (sp[0]-DIALOGSIZEH)/2;
  45.     y+= (sp[1]-DIALOGSIZEV)/2;
  46.     wp= WindowSimpleOpen( x, y, DIALOGSIZEH, DIALOGSIZEV,
  47.                             NULL, DialogExec );
  48.     HS_WindowGetClientPointer( wp )= msg;
  49.     HS_WindowGetClientData( wp )= attr;
  50.     WindowRedraw( wp );
  51.     return    wp;
  52. }
  53.  
  54.