home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff214.lzh / SmartIcon / src / window.c < prev   
C/C++ Source or Header  |  1989-05-30  |  3KB  |  117 lines

  1. /***************************************************************************/
  2. /*                                       */
  3. /* SmartIcon, release 1.0 - An Intuition object iconifier for the Amiga    */
  4. /* Copyright (c) 1988 Gauthier H. Groult                                   */
  5. /*                                       */
  6. /* Written in January 1988 by Gauthier H. Groult               */
  7. /*                  33, Boulevard Saint Denis,           */
  8. /*                  92400 Courbevoie                   */
  9. /*                  France - Europe                   */
  10. /*                  Tel: (16) 1 47 89 09 54                      */
  11. /*                  email: mcvax!inria!litp!germinal!groult       */
  12. /*                                       */
  13. /* This source code is not in public domain, please do not distribute.       */
  14. /* The binary program is shareaware. Read docs files for details.       */
  15. /*                                       */
  16. /***************************************************************************/
  17.  
  18. #include <exec/types.h>
  19. #include <intuition/intuition.h>
  20. #include <string.h>
  21.  
  22. struct NewWindow theNewWindow =
  23.    {
  24.    265, 25,
  25.    320, 170,
  26.    0, 1,
  27.    CLOSEWINDOW | MOUSEBUTTONS,
  28.    WINDOWDRAG | WINDOWDEPTH | WINDOWCLOSE,
  29.    NULL,
  30.    NULL,
  31.    "SmartIcon 1.0",
  32.    NULL,
  33.    NULL,
  34.    0, 0,
  35.    0, 0,
  36.    WBENCHSCREEN
  37.    };
  38.  
  39. extern     VOID  Cleanup();
  40.  
  41. /* This code just opens the starting window and fill it with text.   */
  42. /* This is straightforward, no tricks.                     */
  43.  
  44. VOID  DisplayWindow(), emit();
  45.  
  46. VOID
  47. DisplayWindow()
  48. {
  49.    ULONG    class;
  50.    struct   Window       *theWindow;
  51.    struct   IntuiMessage   *msg;
  52.  
  53.    theWindow = (struct Window *)OpenWindow(&theNewWindow);
  54.    if (!theWindow)   Cleanup(30);
  55.  
  56.    SetAPen(theWindow->RPort, 1);
  57.    SetBPen(theWindow->RPort, 1);
  58.    SetDrMd(theWindow->RPort, JAM1);
  59.    RectFill(theWindow->RPort, 3, 11, 316, 167);
  60.  
  61.    emit(theWindow, "SmartIcon 1.0",                         0, 20, 3, 1);
  62.    emit(theWindow, "Copyright © 1988 Gauthier H. Groult",  15, 30, 3, 1);
  63.    emit(theWindow, "This is a shareware program: if you",  15, 50, 2, 0);
  64.    emit(theWindow, "decide to use it, please send $15 or", 15, 60, 2, 0);
  65.    emit(theWindow, "100 FF to the following address:",     15, 70, 2, 0);
  66.    emit(theWindow, "Gauthier H. Groult",                    0, 85, 2, 0);
  67.    emit(theWindow, "33, Boulevard Saint Denis",             0, 95, 2, 0);
  68.    emit(theWindow, "92400 Courbevoie",                      0, 105, 2, 0);
  69.    emit(theWindow, "France - Europe",                       0, 115, 2, 0);
  70.    emit(theWindow, "Read more about registering in the",   15, 130, 2, 0);
  71.    emit(theWindow, "doc files along with this program.",    15, 140, 2, 0);
  72.    emit(theWindow, "Click in this window to enjoy!",         0, 160, 3, 1);
  73.  
  74.    for(;;)
  75.    {
  76.    Wait(1<< theWindow->UserPort->mp_SigBit);
  77.    while (msg = (struct IntuiMessage *)GetMsg(theWindow->UserPort))
  78.      {
  79.      class = msg->Class;
  80.      ReplyMsg(msg);
  81.  
  82.      if (class == CLOSEWINDOW)
  83.         {
  84.         CloseWindow(theWindow);
  85.         Cleanup(0);
  86.         }
  87.      else if  (class == MOUSEBUTTONS)
  88.           {
  89.           CloseWindow(theWindow);
  90.           return;
  91.           }
  92.      }
  93.    }
  94. }
  95.  
  96. VOID
  97. emit(window, OutText, htab, vtab, color, shadow)
  98. struct     Window   *window;
  99. UBYTE     *OutText;
  100. USHORT     htab, vtab, color, shadow;
  101. {
  102.    if (!htab)
  103.       htab = ( window->Width -
  104.            TextLength(window->RPort, &OutText, strlen(OutText)) )/2;
  105.  
  106.    if (shadow)
  107.       {
  108.       SetAPen(window->RPort, 2);
  109.       Move(window->RPort, htab, vtab+1);
  110.       Text(window->RPort, OutText, strlen(OutText));
  111.       }
  112.    SetAPen(window->RPort, color);
  113.    Move(window->RPort, htab, vtab);
  114.    Text(window->RPort, OutText, strlen(OutText));
  115. }
  116.  
  117.