home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / tools / bachmann / bachmann.exe / CW / incsCW6 / PrintMgr.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-11-08  |  8.1 KB  |  252 lines

  1. /***********************************************************************
  2.  *
  3.  * Copyright ⌐ 1998, Bachmann Software and Services.
  4.  * All rights reserved.
  5.  *
  6.  * FileName:
  7.  *        PrintMgr.h
  8.  *
  9.  * Description:
  10.  *        Print Manager library API definitions.  The Print Manager library
  11.  *        provides graphical printing for the Palm Computing Platform.
  12.  *
  13.  * History:
  14.  *       12/14/98    Greg Winton    Created file.
  15.  *
  16.  *    12/21/98    Greg Winton    Added functions:
  17.  *                               -  PrnDrawBitmap
  18.  *                               -  PrnGetPageExtent
  19.  *                               -  PrnGetPattern
  20.  *                               -  PrnSetPattern
  21.  *                               -  PrnSetUnderlineMode
  22.  *
  23.  *    12/22/98    Greg Winton    Added functions:
  24.  *                               -  PrnGetAverageCharWidth
  25.  *                               -  PrnGetCharHeight
  26.  *                               -  PrnGetCharWidth
  27.  *                               -  PrnGetCharsInWidth
  28.  *                               -  PrnGetCharsWidth
  29.  *
  30.  *******************************************************************/
  31.  
  32. #ifndef __PRINT_MGR_H__
  33. #define __PRINT_MGR_H__
  34.  
  35. // If we're actually compiling the library code, then we need to
  36. // eliminate the trap glue that would otherwise be generated from
  37. // this header file in order to prevent compiler errors in CW Pro 2.
  38. #ifdef BUILDING_PRINT_MGR
  39.     #define PRINT_MGR_TRAP(trapNum)
  40. #else
  41.     #define PRINT_MGR_TRAP(trapNum) SYS_TRAP(trapNum)
  42. #endif
  43.  
  44.  
  45. // PalmPilot common definitions
  46. // #include <Common.h>
  47. // #include <SystemMgr.rh>
  48.  
  49. // PrintMgr Definitions
  50. #include <PrintMgrDefines.h>
  51.  
  52. //-----------------------------------------------------------------------------
  53. // Print Manager library function trap ID's. Each library call gets a trap number:
  54. //   prnTrapXXXX which serves as an index into the library's dispatch table.
  55. //   The constant sysLibTrapCustom is the first available trap number after
  56. //   the system predefined library traps Open,Close,Sleep & Wake.
  57. //
  58. // WARNING!!! The order of these traps MUST match the order of the dispatch
  59. //  table in SampleLibDispatch.c!!!
  60. //-----------------------------------------------------------------------------
  61.  
  62. typedef enum {
  63.     prnTrapGetLibAPIVersion = sysLibTrapCustom,
  64.    prnTrapDrawBitmap,
  65.     prnTrapDrawChars,
  66.     prnTrapDrawGrayLine,
  67.    prnTrapDrawGrayRectangle,
  68.    prnTrapDrawGrayRectangleFrame,
  69.     prnTrapDrawLine,
  70.    prnTrapDrawRectangle,
  71.    prnTrapDrawRectangleFrame,
  72.    prnTrapDrawText,
  73.    prnTrapFillRectangle,
  74.    prnTrapGetFont,
  75.    prnTrapGetPageExtent,
  76.    prnTrapGetPattern,
  77.    prnTrapGetUnderlineMode,
  78.    prnTrapNewPage,
  79.    prnTrapSetFont,
  80.    prnTrapSetOrientation,
  81.    prnTrapSetPattern,
  82.    prnTrapSetUnderlineMode,
  83.  
  84.    prnTrapGetAverageCharWidth,
  85.    prnTrapGetCharHeight,
  86.    prnTrapGetCharWidth,
  87.    prnTrapGetCharsInWidth,
  88.    prnTrapGetCharsWidth,
  89.  
  90.    prnTrapWrite,
  91.    prnTrapDrawBitmapStretch,
  92.    prnTrapOpenByConfig,
  93.    prnTrapGetConfigValue,
  94.     prnTrapLast
  95.     } PrintMgrTrapNumberEnum;
  96.  
  97. /********************************************************************
  98.  * API Prototypes
  99.  ********************************************************************/
  100.  
  101. #ifdef __cplusplus
  102. extern "C" {
  103. #endif
  104.  
  105. //--------------------------------------------------
  106. // Standard library open, close, sleep and wake functions
  107. //--------------------------------------------------
  108.  
  109. extern Err PrnOpen(UInt refNum, CharPtr printerName, CharPtr portName)
  110.                 PRINT_MGR_TRAP(sysLibTrapOpen);
  111.                 
  112. extern Err PrnClose(UInt refNum)
  113.                 PRINT_MGR_TRAP(sysLibTrapClose);
  114.  
  115. extern Err PrnSleep(UInt refNum)
  116.                 PRINT_MGR_TRAP(sysLibTrapSleep);
  117.  
  118. extern Err PrnWake(UInt refNum)
  119.                 PRINT_MGR_TRAP(sysLibTrapWake);
  120.  
  121.  
  122. //--------------------------------------------------
  123. // Custom library API functions
  124. //--------------------------------------------------
  125.     
  126. // Get our library API version
  127. extern Err PrnGetLibAPIVersion(UInt refNum, DWordPtr dwVerP)
  128.                 PRINT_MGR_TRAP(prnTrapGetLibAPIVersion);
  129.  
  130. // Draw bitmap
  131. extern Err PrnDrawBitmap(UInt refNum, BitmapPtr bitmapP, SWord x, SWord y)
  132.                 PRINT_MGR_TRAP(prnTrapDrawBitmap);
  133.                 
  134. // Draw chars
  135. extern Err PrnDrawChars(UInt refNum, CharPtr chars, Word len, SWord x, SWord y)
  136.                 PRINT_MGR_TRAP(prnTrapDrawChars);
  137.                 
  138. // Draw gray line
  139. extern Err PrnDrawGrayLine(UInt refNum, SWord x1, SWord y1, SWord x2, SWord y2)
  140.                 PRINT_MGR_TRAP(prnTrapDrawGrayLine);
  141.                 
  142. // Draw gray rectangle
  143. extern Err PrnDrawGrayRectangle (UInt refNum, RectanglePtr r, Word cornerDiam)
  144.                 PRINT_MGR_TRAP(prnTrapDrawGrayRectangle);
  145.  
  146. // Draw gray rectangle frame
  147. extern Err PrnDrawGrayRectangleFrame (UInt refNum, RectanglePtr r)
  148.                 PRINT_MGR_TRAP(prnTrapDrawGrayRectangleFrame);
  149.  
  150. // Draw line
  151. extern Err PrnDrawLine (UInt refNum, SWord x1, SWord y1, SWord x2, SWord y2)
  152.                 PRINT_MGR_TRAP(prnTrapDrawLine);
  153.  
  154. // Draw rectangle
  155. extern Err PrnDrawRectangle (UInt refNum, RectanglePtr r, Word cornerDiam)
  156.                 PRINT_MGR_TRAP(prnTrapDrawRectangle);
  157.  
  158. // Draw rectangle frame
  159. extern Err PrnDrawRectangleFrame (UInt refNum, RectanglePtr r)
  160.                 PRINT_MGR_TRAP(prnTrapDrawRectangleFrame);
  161.  
  162. // Draw text
  163. extern Err PrnDrawText (UInt refNum, CharPtr text, Word len, RectanglePtr r, UInt flags)
  164.                 PRINT_MGR_TRAP(prnTrapDrawText);
  165.  
  166. // Fill rectangle
  167. extern Err PrnFillRectangle (UInt refNum, RectanglePtr r, Word cornerDiam)
  168.                 PRINT_MGR_TRAP(prnTrapFillRectangle);
  169.  
  170. // Get current font
  171. extern Err PrnGetFont (UInt refNum, PrnFontPtr fontP)
  172.                 PRINT_MGR_TRAP(prnTrapGetFont);
  173.  
  174. // Get extent of printed page
  175. extern Err PrnGetPageExtent (UInt refNum, SWordPtr extentX, SWordPtr extentY)
  176.             PRINT_MGR_TRAP(prnTrapGetPageExtent);
  177.  
  178. // Get current fill pattern
  179. extern Err PrnGetPattern (UInt refNum, CustomPatternType pattern)
  180.             PRINT_MGR_TRAP(prnTrapGetPattern);
  181.  
  182. // Get underline mode
  183. extern Err PrnGetUnderlineMode (UInt refNum, UnderlineModeType* modeP)
  184.             PRINT_MGR_TRAP(prnTrapGetUnderlineMode);
  185.  
  186. // Start a new printed page
  187. extern Err PrnNewPage (UInt refNum)
  188.                 PRINT_MGR_TRAP(prnTrapNewPage);
  189.  
  190. // Set font
  191. extern Err PrnSetFont (UInt refNum, PrnFontPtr fontP)
  192.                 PRINT_MGR_TRAP(prnTrapSetFont);
  193.  
  194. // Set printer orientation
  195. extern Err PrnSetOrientation (UInt refNum, PrnOrientEnum orient)
  196.                 PRINT_MGR_TRAP(prnTrapSetOrientation);
  197.  
  198. // Set fill pattern
  199. extern Err PrnSetPattern (UInt refNum, CustomPatternType pattern)
  200.             PRINT_MGR_TRAP(prnTrapSetPattern);
  201.  
  202. // Set underline mode
  203. extern Err PrnSetUnderlineMode (UInt refNum, UnderlineModeType mode)
  204.             PRINT_MGR_TRAP(prnTrapSetUnderlineMode);
  205.  
  206. extern Err PrnGetAverageCharWidth (UInt refNum, Int* widthP)
  207.             PRINT_MGR_TRAP(prnTrapGetAverageCharWidth);
  208.  
  209. extern Err PrnGetCharHeight (UInt refNum, Int* heightP)
  210.             PRINT_MGR_TRAP(prnTrapGetCharHeight);
  211.  
  212. extern Err PrnGetCharWidth (UInt refNum, Char ch, Int* widthP)
  213.             PRINT_MGR_TRAP(prnTrapGetCharWidth);
  214.  
  215. extern Err PrnGetCharsInWidth (UInt refNum, CharPtr string, Int *stringWidthP, Int *stringLengthP, Boolean *fitWithinWidth)
  216.             PRINT_MGR_TRAP(prnTrapGetCharsInWidth);
  217.  
  218. extern Err PrnGetCharsWidth (UInt refNum, CharPtr chars, Word len, Int* widthP)
  219.             PRINT_MGR_TRAP(prnTrapGetCharsWidth);
  220.  
  221. extern Err PrnWrite (UInt refNum, BytePtr bytes, Word len)
  222.             PRINT_MGR_TRAP(prnTrapWrite);
  223.  
  224. // Draw bitmap Stretch
  225. extern Err PrnDrawBitmapStretch(UInt refNum, BitmapPtr bitmapP, RectanglePtr rectP)
  226.                 PRINT_MGR_TRAP(prnTrapDrawBitmapStretch);
  227.  
  228.  
  229. // PrnOpenByConfig
  230. extern Err PrnOpenByConfig(UInt refNum )
  231.                 PRINT_MGR_TRAP(prnTrapOpenByConfig);
  232.  
  233. // PrnGetConfigValue
  234. extern Err PrnGetConfigValue(UInt refNum,CharPtr key,CharPtr buf,Int max )
  235.                 PRINT_MGR_TRAP(prnTrapGetConfigValue);
  236.  
  237. // For loading the library in PalmPilot Mac emulation mode
  238. extern Err PrnInstall(UInt refNum, SysLibTblEntryPtr entryP);
  239.  
  240. #ifdef __cplusplus 
  241. }
  242. #endif
  243.  
  244. /********************************************************************
  245.  * Public Macros
  246.  ********************************************************************/
  247.  
  248.  
  249.  
  250.  
  251. #endif    // __PRINT_MGR_H__
  252.