home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / reference / amiga_mail_vol2 / iv-69 / zoom.c < prev   
C/C++ Source or Header  |  1996-01-30  |  4KB  |  117 lines

  1. ;/* Zoom.c - Execute me to compile me with SAS/C 6.56
  2. sc DATA=NEAR NMINC STRMERGE STREQ NOSTKCHK SAVEDS IGNORE=73 Zoom.c
  3. slink FROM LIB:c.o,Zoom.o TO Zoom LIBRARY LIB:sc.lib,LIB:amiga.lib
  4. quit
  5. */
  6. /*
  7. Copyright (c) 1991 Commodore-Amiga, Inc.
  8.  
  9. This example is provided in electronic form by Commodore-Amiga,
  10. Inc. for use with the Amiga Mail Volume II technical publication.
  11. Amiga Mail Volume II contains additional information on the correct
  12. usage of the techniques and operating system functions presented in
  13. these examples.  The source and executable code of these examples may
  14. only be distributed in free electronic form, via bulletin board or
  15. as part of a fully non-commercial and freely redistributable
  16. diskette.  Both the source and executable code (including comments)
  17. must be included, without modification, in any copy.  This example
  18. may not be published in printed form or distributed with any
  19. commercial product. However, the programming techniques and support
  20. routines set forth in these examples may be used in the development
  21. of original executable software products for Commodore Amiga
  22. computers.
  23.  
  24. All other rights reserved.
  25.  
  26. This example is provided "as-is" and is subject to change; no
  27. warranties are made.  All use is at your own risk. No liability or
  28. responsibility is assumed.
  29. */
  30.  
  31. #include <intuition/intuition.h>
  32. #include <intuition/screens.h>
  33.  
  34. #ifdef LATTICE
  35. #include <clib/exec_protos.h>
  36. #include <clib/intuition_protos.h>
  37. /* disable SAS/C CTRL-C handing */
  38.  
  39. int             CXBRK(void)
  40. {
  41.     return (0);
  42. }
  43.  
  44. int             chkabort(void)
  45. {
  46.     return (0);
  47. }
  48. #endif
  49.  
  50. struct IntuitionBase *IntuitionBase;
  51.  
  52. LONG            main(void);
  53.  
  54. LONG main(void)
  55. {
  56.     struct IBox     ibox;    /* The structure we'll use to specify the zoom'ed
  57.                               * dimension. */
  58.     struct Screen  *wbscreen;
  59.     struct Window  *window;
  60.     struct Message *msg;     /* Make this an IntuiMessage when you want to use
  61.                               * it */
  62.  
  63.  
  64.     if (IntuitionBase = OpenLibrary("intuition.library", 37))
  65.     {
  66.  
  67.         /* Lock workbench screen so we can watch it closely */
  68.         if (wbscreen = LockPubScreen("Workbench"))
  69.         {
  70.  
  71.             /*
  72.              * Generate a nice position for the zoom'ed window. Note that this
  73.              * specifies the INITIAL position of the window. Since we don't
  74.              * have a size gadget, the user can't change the height and width,
  75.              * but the offset is changed as the window is dragged.
  76.              */
  77.             ibox.Left = wbscreen->Width - 180;   /* far right corner */
  78.             ibox.Top = wbscreen->BarHeight + 1;  /* Just below screen bar */
  79.             ibox.Width = 180;
  80.             /* ght of the window topborder */
  81.             ibox.Height = wbscreen->WBorTop + wbscreen->Font->ta_YSize + 1;
  82.  
  83.             /* open a window with tags */
  84.             if (window = OpenWindowTags(NULL,    /* no NewWindow structure,
  85.                                                   * tags only */
  86.                                         WA_Left, 0,     /* Open at far left
  87.                                                          * corner */
  88.                                         WA_Top, wbscreen->BarHeight + 1,
  89.                                         WA_Width, 200,
  90.                                         WA_Height, 100,
  91.                                         WA_Title, (LONG) "A simple window",
  92.                 WA_Flags, WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET |
  93.                      WFLG_ACTIVATE | WFLG_SIMPLE_REFRESH | WFLG_NOCAREREFRESH,
  94.  
  95.                                         /* Only interested in closewindow      */
  96.                                         WA_IDCMP, IDCMP_CLOSEWINDOW,
  97.  
  98.                                         /* pass the alternate zoom dimension   */
  99.                                         WA_Zoom, (LONG) & ibox,
  100.  
  101.                                         TAG_DONE))
  102.             {
  103.  
  104.                 /* And just wait for windowclose */
  105.                 WaitPort(window->UserPort);
  106.                 /* clear the message port */
  107.                 while (msg = GetMsg(window->UserPort))
  108.                     ReplyMsg(msg);
  109.  
  110.                 CloseWindow(window);
  111.             }
  112.             UnlockPubScreen(NULL, wbscreen);
  113.         }
  114.         CloseLibrary(IntuitionBase);
  115.     }
  116. }
  117.