home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************************
- *
- * Copyright ⌐ 1998, Bachmann Software and Services.
- * All rights reserved.
- *
- * FileName:
- * PrintMgr.h
- *
- * Description:
- * Print Manager library API definitions. The Print Manager library
- * provides graphical printing for the Palm Computing Platform.
- *
- * History:
- * 12/14/98 Greg Winton Created file.
- *
- * 12/21/98 Greg Winton Added functions:
- * - PrnDrawBitmap
- * - PrnGetPageExtent
- * - PrnGetPattern
- * - PrnSetPattern
- * - PrnSetUnderlineMode
- *
- * 12/22/98 Greg Winton Added functions:
- * - PrnGetAverageCharWidth
- * - PrnGetCharHeight
- * - PrnGetCharWidth
- * - PrnGetCharsInWidth
- * - PrnGetCharsWidth
- *
- *******************************************************************/
-
- #ifndef __PRINT_MGR_H__
- #define __PRINT_MGR_H__
-
- // If we're actually compiling the library code, then we need to
- // eliminate the trap glue that would otherwise be generated from
- // this header file in order to prevent compiler errors in CW Pro 2.
- #ifdef BUILDING_PRINT_MGR
- #define PRINT_MGR_TRAP(trapNum)
- #else
- #define PRINT_MGR_TRAP(trapNum) SYS_TRAP(trapNum)
- #endif
-
-
- // PalmPilot common definitions
- // #include <Common.h>
- // #include <SystemMgr.rh>
-
- // PrintMgr Definitions
- #include <PrintMgrDefines.h>
-
- //-----------------------------------------------------------------------------
- // Print Manager library function trap ID's. Each library call gets a trap number:
- // prnTrapXXXX which serves as an index into the library's dispatch table.
- // The constant sysLibTrapCustom is the first available trap number after
- // the system predefined library traps Open,Close,Sleep & Wake.
- //
- // WARNING!!! The order of these traps MUST match the order of the dispatch
- // table in SampleLibDispatch.c!!!
- //-----------------------------------------------------------------------------
-
- typedef enum {
- prnTrapGetLibAPIVersion = sysLibTrapCustom,
- prnTrapDrawBitmap,
- prnTrapDrawChars,
- prnTrapDrawGrayLine,
- prnTrapDrawGrayRectangle,
- prnTrapDrawGrayRectangleFrame,
- prnTrapDrawLine,
- prnTrapDrawRectangle,
- prnTrapDrawRectangleFrame,
- prnTrapDrawText,
- prnTrapFillRectangle,
- prnTrapGetFont,
- prnTrapGetPageExtent,
- prnTrapGetPattern,
- prnTrapGetUnderlineMode,
- prnTrapNewPage,
- prnTrapSetFont,
- prnTrapSetOrientation,
- prnTrapSetPattern,
- prnTrapSetUnderlineMode,
-
- prnTrapGetAverageCharWidth,
- prnTrapGetCharHeight,
- prnTrapGetCharWidth,
- prnTrapGetCharsInWidth,
- prnTrapGetCharsWidth,
-
- prnTrapWrite,
- prnTrapDrawBitmapStretch,
- prnTrapOpenByConfig,
- prnTrapGetConfigValue,
- prnTrapLast
- } PrintMgrTrapNumberEnum;
-
- /********************************************************************
- * API Prototypes
- ********************************************************************/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- //--------------------------------------------------
- // Standard library open, close, sleep and wake functions
- //--------------------------------------------------
-
- extern Err PrnOpen(UInt refNum, CharPtr printerName, CharPtr portName)
- PRINT_MGR_TRAP(sysLibTrapOpen);
-
- extern Err PrnClose(UInt refNum)
- PRINT_MGR_TRAP(sysLibTrapClose);
-
- extern Err PrnSleep(UInt refNum)
- PRINT_MGR_TRAP(sysLibTrapSleep);
-
- extern Err PrnWake(UInt refNum)
- PRINT_MGR_TRAP(sysLibTrapWake);
-
-
- //--------------------------------------------------
- // Custom library API functions
- //--------------------------------------------------
-
- // Get our library API version
- extern Err PrnGetLibAPIVersion(UInt refNum, DWordPtr dwVerP)
- PRINT_MGR_TRAP(prnTrapGetLibAPIVersion);
-
- // Draw bitmap
- extern Err PrnDrawBitmap(UInt refNum, BitmapPtr bitmapP, SWord x, SWord y)
- PRINT_MGR_TRAP(prnTrapDrawBitmap);
-
- // Draw chars
- extern Err PrnDrawChars(UInt refNum, CharPtr chars, Word len, SWord x, SWord y)
- PRINT_MGR_TRAP(prnTrapDrawChars);
-
- // Draw gray line
- extern Err PrnDrawGrayLine(UInt refNum, SWord x1, SWord y1, SWord x2, SWord y2)
- PRINT_MGR_TRAP(prnTrapDrawGrayLine);
-
- // Draw gray rectangle
- extern Err PrnDrawGrayRectangle (UInt refNum, RectanglePtr r, Word cornerDiam)
- PRINT_MGR_TRAP(prnTrapDrawGrayRectangle);
-
- // Draw gray rectangle frame
- extern Err PrnDrawGrayRectangleFrame (UInt refNum, RectanglePtr r)
- PRINT_MGR_TRAP(prnTrapDrawGrayRectangleFrame);
-
- // Draw line
- extern Err PrnDrawLine (UInt refNum, SWord x1, SWord y1, SWord x2, SWord y2)
- PRINT_MGR_TRAP(prnTrapDrawLine);
-
- // Draw rectangle
- extern Err PrnDrawRectangle (UInt refNum, RectanglePtr r, Word cornerDiam)
- PRINT_MGR_TRAP(prnTrapDrawRectangle);
-
- // Draw rectangle frame
- extern Err PrnDrawRectangleFrame (UInt refNum, RectanglePtr r)
- PRINT_MGR_TRAP(prnTrapDrawRectangleFrame);
-
- // Draw text
- extern Err PrnDrawText (UInt refNum, CharPtr text, Word len, RectanglePtr r, UInt flags)
- PRINT_MGR_TRAP(prnTrapDrawText);
-
- // Fill rectangle
- extern Err PrnFillRectangle (UInt refNum, RectanglePtr r, Word cornerDiam)
- PRINT_MGR_TRAP(prnTrapFillRectangle);
-
- // Get current font
- extern Err PrnGetFont (UInt refNum, PrnFontPtr fontP)
- PRINT_MGR_TRAP(prnTrapGetFont);
-
- // Get extent of printed page
- extern Err PrnGetPageExtent (UInt refNum, SWordPtr extentX, SWordPtr extentY)
- PRINT_MGR_TRAP(prnTrapGetPageExtent);
-
- // Get current fill pattern
- extern Err PrnGetPattern (UInt refNum, CustomPatternType pattern)
- PRINT_MGR_TRAP(prnTrapGetPattern);
-
- // Get underline mode
- extern Err PrnGetUnderlineMode (UInt refNum, UnderlineModeType* modeP)
- PRINT_MGR_TRAP(prnTrapGetUnderlineMode);
-
- // Start a new printed page
- extern Err PrnNewPage (UInt refNum)
- PRINT_MGR_TRAP(prnTrapNewPage);
-
- // Set font
- extern Err PrnSetFont (UInt refNum, PrnFontPtr fontP)
- PRINT_MGR_TRAP(prnTrapSetFont);
-
- // Set printer orientation
- extern Err PrnSetOrientation (UInt refNum, PrnOrientEnum orient)
- PRINT_MGR_TRAP(prnTrapSetOrientation);
-
- // Set fill pattern
- extern Err PrnSetPattern (UInt refNum, CustomPatternType pattern)
- PRINT_MGR_TRAP(prnTrapSetPattern);
-
- // Set underline mode
- extern Err PrnSetUnderlineMode (UInt refNum, UnderlineModeType mode)
- PRINT_MGR_TRAP(prnTrapSetUnderlineMode);
-
- extern Err PrnGetAverageCharWidth (UInt refNum, Int* widthP)
- PRINT_MGR_TRAP(prnTrapGetAverageCharWidth);
-
- extern Err PrnGetCharHeight (UInt refNum, Int* heightP)
- PRINT_MGR_TRAP(prnTrapGetCharHeight);
-
- extern Err PrnGetCharWidth (UInt refNum, Char ch, Int* widthP)
- PRINT_MGR_TRAP(prnTrapGetCharWidth);
-
- extern Err PrnGetCharsInWidth (UInt refNum, CharPtr string, Int *stringWidthP, Int *stringLengthP, Boolean *fitWithinWidth)
- PRINT_MGR_TRAP(prnTrapGetCharsInWidth);
-
- extern Err PrnGetCharsWidth (UInt refNum, CharPtr chars, Word len, Int* widthP)
- PRINT_MGR_TRAP(prnTrapGetCharsWidth);
-
- extern Err PrnWrite (UInt refNum, BytePtr bytes, Word len)
- PRINT_MGR_TRAP(prnTrapWrite);
-
- // Draw bitmap Stretch
- extern Err PrnDrawBitmapStretch(UInt refNum, BitmapPtr bitmapP, RectanglePtr rectP)
- PRINT_MGR_TRAP(prnTrapDrawBitmapStretch);
-
-
- // PrnOpenByConfig
- extern Err PrnOpenByConfig(UInt refNum )
- PRINT_MGR_TRAP(prnTrapOpenByConfig);
-
- // PrnGetConfigValue
- extern Err PrnGetConfigValue(UInt refNum,CharPtr key,CharPtr buf,Int max )
- PRINT_MGR_TRAP(prnTrapGetConfigValue);
-
- // For loading the library in PalmPilot Mac emulation mode
- extern Err PrnInstall(UInt refNum, SysLibTblEntryPtr entryP);
-
- #ifdef __cplusplus
- }
- #endif
-
- /********************************************************************
- * Public Macros
- ********************************************************************/
-
-
-
-
- #endif // __PRINT_MGR_H__
-