home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / source / povsrc.sit / MACHINE / MAC.SIT / printf2window.h / printf2window.h
Encoding:
C/C++ Source or Header  |  1992-04-25  |  3.7 KB  |  123 lines  |  [TEXT/KAHL]

  1. /*
  2. ==============================================================================
  3. Copyright 1992, esp, All Rights Reserved
  4. ------------------------------------------------------------------------------
  5. Project:    POV
  6.  
  7. File Name:    printf2window.h
  8.  
  9. Description:
  10.     General-purpose printf-capturing routines that allow a console-like
  11.     output window for c programs that otherwise prefer to use printf/fprintf.
  12.     This code was "inspired heavily" from sources such as MacDTS'es TESample,
  13.     MacApp's Transcript window, and previous code of mine.  It is fairly well
  14.     self-contained, and works in MPW C 3.2 and Think C 5.0.
  15.  
  16.     This file contains global definitions used by the p2w routines.
  17.     It is expected to be included only by source files that are
  18.     Macintosh-toolbox-aware.
  19.  
  20. Related Files:
  21.     stdio_p2w.h        - generic header for sources that would otherwise use <stdio.h>
  22.     printf2window.h    - Mac-specific header for p2w routines
  23.     printf2window.c    - the main source for the p2w routines
  24. ------------------------------------------------------------------------------
  25. Author:
  26.     Eduard [esp] Schwan
  27. ------------------------------------------------------------------------------
  28. Copyright 1992 POV-Team.
  29.     This source code is distributed exclusively with POV, and is subject to
  30.     the same distribution restrictions as the rest of the source code.
  31.  
  32. *  Copying, distribution and legal info is in the file povlegal.doc which
  33. *  should be distributed with this file. If povlegal.doc is not available
  34. *  or for more information please contact:
  35. *
  36. *       Drew Wells [POV-Team Leader] 
  37. *       CIS: 73767,1244  Internet: 73767.1244@compuserve.com
  38. *       Phone: (213) 254-4041
  39. ------------------------------------------------------------------------------
  40. Change History:
  41.     920318    [esp]    Created.
  42.     920325    [esp]    Added prototypes for Std C routines
  43.     920330    [esp]    Updated file header with copyright & related files info
  44.     920401    [esp]    Added p2wSignature to window record for safety checking
  45. ==============================================================================
  46. */
  47.  
  48. #ifndef __printf2window__
  49. #define __printf2window__
  50.  
  51.  
  52. // include our minimal stuff
  53.  
  54. #include "stdio_p2w.h"
  55.  
  56.  
  57. // ==== Extended p2w window record
  58.  
  59. typedef struct
  60.     {
  61.     WindowRecord    p2wWindowRec;        // our window/grafport record
  62.     OSType            p2wSignature;        // Magic value that identifies this as a true p2w window
  63.     Boolean            p2wOpenedOK;        // true if p2wWindowRec is valid, for p2w_DisposeWindow
  64.     TEHandle        p2wTEHandle;        // the TE record we use
  65.     ControlHandle    p2wVScroller;        // the vertical scrollbar in the window
  66.     ControlHandle    p2wHScroller;        // the horizontal scrollbar in the window
  67.     ProcPtr            p2wClickHandler;    // the autoscroll routine (not yet)
  68.     short            p2wMaxDocWidth;        // TE record's max wrap width
  69.     Boolean            p2wAlwaysScrollToBottom;    // true means always stay scrolled to bottom of TE
  70.     }
  71.     p2w_WindowRecord,
  72.     *p2w_WindowPtr,
  73.     **p2w_WindowHandle;
  74.  
  75.  
  76.  
  77. // ==== Public p2w library routines
  78.  
  79. OSErr p2w_Init(void);
  80.  
  81. OSErr p2w_Terminate(void);
  82.  
  83. p2w_WindowPtr p2w_NewWindow
  84.                     (const    Rect            *windBounds,
  85.                     const    Str255            windTitle,
  86.                     const    Boolean            windIsVisible,
  87.                     const    int                windFont,
  88.                     const    short            windFontSize,
  89.                             OSErr            *anError);
  90.  
  91. void p2w_DisposeWindow
  92.                     (        p2w_WindowPtr    the_p2wPtr);
  93.  
  94. OSErr p2w_AddCString
  95.                     (        p2w_WindowPtr    the_p2wPtr,
  96.                     const    char            *theCStrPtr);
  97.  
  98. void p2w_DrawWindow
  99.                     (const    p2w_WindowPtr    the_p2wPtr);
  100.  
  101. void p2w_DoUpdate
  102.                     (const    p2w_WindowPtr    thep2wWindow);
  103.  
  104. void p2w_DoActivate
  105.                     (const    p2w_WindowPtr    thep2wWindow,
  106.                             Boolean            becomingActive);
  107.  
  108. void p2w_DoGrow
  109.                     (const    p2w_WindowPtr    thep2wWindow,
  110.                             EventRecord        *theEvent);
  111.  
  112. void p2w_DoZoom
  113.                     (const    p2w_WindowPtr    thep2wWindow,
  114.                             short            part);
  115.  
  116. void p2w_DoContentClick
  117.                     (const    p2w_WindowPtr    thep2wWindow,
  118.                             EventRecord        *theEvent);
  119.  
  120.  
  121. #endif __printf2window__
  122.