home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / progrmng / trnsdspl.sit / MiniDisplay.c.bin / MiniDisplay.c
Encoding:
C/C++ Source or Header  |  1989-02-18  |  2.2 KB  |  79 lines  |  [TEXT/KAHL]

  1. /*
  2.     MiniDisplay - TransDisplay Demonstration.  Very simple:  just
  3.     demonstrates the various output calls.
  4.  
  5.     The project should include MiniDisplay.c (this file),
  6.     TransDisplay.c (or a project made from TransDisplay.c),
  7.     TransSkel.c (or a project made from TransSkel.c), and MacTraps.
  8.  
  9.     04 Oct 86 Paul DuBois
  10.     02 Feb 89 Changed to work with TransSkel2.0 and TransDisplay2.0.
  11.               2-byte and 4-byte integer types are typedef'ed to Integer
  12.               and Longint to ease porting.
  13. */
  14.  
  15. # include    <MenuMgr.h>
  16. # include    "TransDisplay.h"
  17.  
  18.  
  19. typedef    int        Integer;    /* compiler 2-byte integer type */
  20. typedef    long    Longint;    /* compiler 4-byte integer type */
  21.  
  22.  
  23.  
  24. DoFileMenu (item)
  25. Integer    item;                    /* ignored - there's only Quit */
  26. {
  27.     SkelWhoa ();                /* tell SkelMain to quit */
  28. }
  29.  
  30.  
  31. main ()
  32. {
  33. Rect        r;
  34. MenuHandle    m;
  35. WindowPtr    w;
  36.  
  37.     SkelInit (6, nil);                /* initialize */
  38.     SkelApple (nil, nil);            /* handle desk accessories */
  39.  
  40.     m = NewMenu (2, "\pFile");        /* create menu and tell TransSkel */
  41.     AppendMenu (m, "\pQuit/Q");        /* to handle it */
  42.     (void) SkelMenu (m, DoFileMenu, nil, true);
  43.  
  44.     SetRect (&r, 100, 75, 400, 250);
  45.     w = NewDWindow (&r, "\pMiniDisplay", false, -1L, false, 0L);
  46.  
  47.     DisplayString ("\pThis is MiniDisplay, a minimal demonstration of ");
  48.     DisplayString ("\pTransDisplay.  The following types of output may ");
  49.     DisplayString ("\pbe written with the built-in output calls:\r");
  50.  
  51.     DisplayString ("\p\rArbitrary length text: ");
  52.     DisplayText ("Some text", 9L);
  53.     DisplayString ("\p\rString: ");
  54.     DisplayString ("\p\"\\pThis is a string.\"");
  55.     DisplayString ("\p\rChar: '");
  56.     DisplayChar ('x');
  57.     DisplayString ("\p'    Hex char: ");
  58.     DisplayHexChar ('x');
  59.     DisplayString ("\p\rInt: ");
  60.     DisplayInt (1023);
  61.     DisplayString ("\p    Hex int: ");
  62.     DisplayHexInt (1023);
  63.     DisplayString ("\p\rLong: ");
  64.     DisplayLong (32768L);
  65.     DisplayString ("\p  Hex long: ");
  66.     DisplayHexLong (32768L);
  67.     DisplayString ("\p\rBoolean: ");
  68.     DisplayBoolean (true);
  69.     DisplayString ("\p, ");
  70.     DisplayBoolean (false);
  71.     DisplayString ("\p\rCarriage return. ");
  72.     DisplayString ("\p\r\rSelect Quit from the File menu to exit.");
  73.     SetDWindowPos (w, 0);    /* scroll back to top */
  74.     ShowWindow (w);
  75.  
  76.     SkelMain ();                    /* loop 'til Quit selected */
  77.     SkelClobber ();                    /* clean up */
  78. }
  79.