home *** CD-ROM | disk | FTP | other *** search
- /*
- MiniDisplay - TransDisplay Demonstration. Very simple: just
- demonstrates the various output calls.
-
- The project should include MiniDisplay.c (this file),
- TransDisplay.c (or a project made from TransDisplay.c),
- TransSkel.c (or a project made from TransSkel.c), and MacTraps.
-
- 04 Oct 86 Paul DuBois
- 02 Feb 89 Changed to work with TransSkel2.0 and TransDisplay2.0.
- 2-byte and 4-byte integer types are typedef'ed to Integer
- and Longint to ease porting.
- */
-
- # include <MenuMgr.h>
- # include "TransDisplay.h"
-
-
- typedef int Integer; /* compiler 2-byte integer type */
- typedef long Longint; /* compiler 4-byte integer type */
-
-
-
- DoFileMenu (item)
- Integer item; /* ignored - there's only Quit */
- {
- SkelWhoa (); /* tell SkelMain to quit */
- }
-
-
- main ()
- {
- Rect r;
- MenuHandle m;
- WindowPtr w;
-
- SkelInit (6, nil); /* initialize */
- SkelApple (nil, nil); /* handle desk accessories */
-
- m = NewMenu (2, "\pFile"); /* create menu and tell TransSkel */
- AppendMenu (m, "\pQuit/Q"); /* to handle it */
- (void) SkelMenu (m, DoFileMenu, nil, true);
-
- SetRect (&r, 100, 75, 400, 250);
- w = NewDWindow (&r, "\pMiniDisplay", false, -1L, false, 0L);
-
- DisplayString ("\pThis is MiniDisplay, a minimal demonstration of ");
- DisplayString ("\pTransDisplay. The following types of output may ");
- DisplayString ("\pbe written with the built-in output calls:\r");
-
- DisplayString ("\p\rArbitrary length text: ");
- DisplayText ("Some text", 9L);
- DisplayString ("\p\rString: ");
- DisplayString ("\p\"\\pThis is a string.\"");
- DisplayString ("\p\rChar: '");
- DisplayChar ('x');
- DisplayString ("\p' Hex char: ");
- DisplayHexChar ('x');
- DisplayString ("\p\rInt: ");
- DisplayInt (1023);
- DisplayString ("\p Hex int: ");
- DisplayHexInt (1023);
- DisplayString ("\p\rLong: ");
- DisplayLong (32768L);
- DisplayString ("\p Hex long: ");
- DisplayHexLong (32768L);
- DisplayString ("\p\rBoolean: ");
- DisplayBoolean (true);
- DisplayString ("\p, ");
- DisplayBoolean (false);
- DisplayString ("\p\rCarriage return. ");
- DisplayString ("\p\r\rSelect Quit from the File menu to exit.");
- SetDWindowPos (w, 0); /* scroll back to top */
- ShowWindow (w);
-
- SkelMain (); /* loop 'til Quit selected */
- SkelClobber (); /* clean up */
- }
-