home *** CD-ROM | disk | FTP | other *** search
- /*
- ==============================================================================
- Copyright 1992, esp, All Rights Reserved
- ------------------------------------------------------------------------------
- Project: POV
-
- File Name: printf2window.h
-
- Description:
- General-purpose printf-capturing routines that allow a console-like
- output window for c programs that otherwise prefer to use printf/fprintf.
- This code was "inspired heavily" from sources such as MacDTS'es TESample,
- MacApp's Transcript window, and previous code of mine. It is fairly well
- self-contained, and works in MPW C 3.2 and Think C 5.0.
-
- This file contains global definitions used by the p2w routines.
- It is expected to be included only by source files that are
- Macintosh-toolbox-aware.
-
- Related Files:
- stdio_p2w.h - generic header for sources that would otherwise use <stdio.h>
- printf2window.h - Mac-specific header for p2w routines
- printf2window.c - the main source for the p2w routines
- ------------------------------------------------------------------------------
- Author:
- Eduard [esp] Schwan
- ------------------------------------------------------------------------------
- Copyright 1992 POV-Team.
- This source code is distributed exclusively with POV, and is subject to
- the same distribution restrictions as the rest of the source code.
-
- * Copying, distribution and legal info is in the file povlegal.doc which
- * should be distributed with this file. If povlegal.doc is not available
- * or for more information please contact:
- *
- * Drew Wells [POV-Team Leader]
- * CIS: 73767,1244 Internet: 73767.1244@compuserve.com
- * Phone: (213) 254-4041
- *
- ------------------------------------------------------------------------------
- Change History:
- 920318 [esp] Created.
- 920325 [esp] Added prototypes for Std C routines
- 920330 [esp] Updated file header with copyright & related files info
- 920401 [esp] Added p2wSignature to window record for safety checking
- ==============================================================================
- */
-
- #ifndef __printf2window__
- #define __printf2window__
-
-
- // include our minimal stuff
-
- #include "stdio_p2w.h"
-
-
- // ==== Extended p2w window record
-
- typedef struct
- {
- WindowRecord p2wWindowRec; // our window/grafport record
- OSType p2wSignature; // Magic value that identifies this as a true p2w window
- Boolean p2wOpenedOK; // true if p2wWindowRec is valid, for p2w_DisposeWindow
- TEHandle p2wTEHandle; // the TE record we use
- ControlHandle p2wVScroller; // the vertical scrollbar in the window
- ControlHandle p2wHScroller; // the horizontal scrollbar in the window
- ProcPtr p2wClickHandler; // the autoscroll routine (not yet)
- short p2wMaxDocWidth; // TE record's max wrap width
- Boolean p2wAlwaysScrollToBottom; // true means always stay scrolled to bottom of TE
- }
- p2w_WindowRecord,
- *p2w_WindowPtr,
- **p2w_WindowHandle;
-
-
-
- // ==== Public p2w library routines
-
- OSErr p2w_Init(void);
-
- OSErr p2w_Terminate(void);
-
- p2w_WindowPtr p2w_NewWindow
- (const Rect *windBounds,
- const Str255 windTitle,
- const Boolean windIsVisible,
- const int windFont,
- const short windFontSize,
- OSErr *anError);
-
- void p2w_DisposeWindow
- ( p2w_WindowPtr the_p2wPtr);
-
- OSErr p2w_AddCString
- ( p2w_WindowPtr the_p2wPtr,
- const char *theCStrPtr);
-
- void p2w_DrawWindow
- (const p2w_WindowPtr the_p2wPtr);
-
- void p2w_DoUpdate
- (const p2w_WindowPtr thep2wWindow);
-
- void p2w_DoActivate
- (const p2w_WindowPtr thep2wWindow,
- Boolean becomingActive);
-
- void p2w_DoGrow
- (const p2w_WindowPtr thep2wWindow,
- EventRecord *theEvent);
-
- void p2w_DoZoom
- (const p2w_WindowPtr thep2wWindow,
- short part);
-
- void p2w_DoContentClick
- (const p2w_WindowPtr thep2wWindow,
- EventRecord *theEvent);
-
-
- #endif __printf2window__
-