home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / tools / bachmann / bachmann.exe / CW / Inc / PageMgr.h next >
Encoding:
C/C++ Source or Header  |  2000-10-06  |  4.9 KB  |  163 lines

  1. /***********************************************************************
  2.  *
  3.  * Copyright ⌐ 1998, Bachmann Software and Services.
  4.  * All rights reserved.
  5.  *
  6.  * FileName:
  7.  *        PageMgr.h
  8.  *
  9.  * Description:
  10.  *        Page Manager library API definitions.  The Page Manager library
  11.  *        provides graphical printing for the Palm Computing Platform.
  12.  *
  13.  * History:
  14.  *       03/30/99    Greg Winton    Created file.
  15.  *
  16.  *    04/07/99    Greg Winton    Added functions:
  17.  *                               - PagPrintText
  18.  *                               - PagPrintLine
  19.  *                               - PagNewLine
  20.  *                               - PagNewPage
  21.  *                               - PagSetFont
  22.  *                               - PagWrite
  23.  *
  24.  *******************************************************************/
  25.  
  26. #ifndef __PAGE_MGR_H__
  27. #define __PAGE_MGR_H__
  28.  
  29. // If we're actually compiling the library code, then we need to
  30. // eliminate the trap glue that would otherwise be generated from
  31. // this header file in order to prevent compiler errors in CW Pro 2.
  32. #ifdef BUILDING_PAGE_MGR
  33.     #define PAGE_MGR_TRAP(trapNum)
  34. #else
  35.     #define PAGE_MGR_TRAP(trapNum) SYS_TRAP(trapNum)
  36. #endif
  37.  
  38.  
  39. // PalmPilot common definitions
  40. #include <Common.h>
  41. #include <SystemMgr.rh>
  42.  
  43. // PageMgr Definitions
  44. #include <PageMgrDefines.h>
  45. #include <SystemMgr.h>
  46.  
  47. //-----------------------------------------------------------------------------
  48. // Page Manager library function trap ID's. Each library call gets a trap number:
  49. //   pagTrapXXXX which serves as an index into the library's dispatch table.
  50. //   The constant sysLibTrapCustom is the first available trap number after
  51. //   the system predefined library traps Open,Close,Sleep & Wake.
  52. //
  53. // WARNING!!! The order of these traps MUST match the order of the dispatch
  54. //  table in SampleLibDispatch.c!!!
  55. //-----------------------------------------------------------------------------
  56.  
  57. typedef enum {
  58.    pagTrapGetLibAPIVersion = sysLibTrapCustom,
  59.    pagTrapSetOption,
  60.    pagTrapPrintText,
  61.    pagTrapPrintLine,
  62.    pagTrapNewLine,
  63.    pagTrapNewPage,
  64.    pagTrapSetFont,
  65.    pagTrapWrite,
  66.    pagTrapOpenByConfig,
  67.    pagTrapGetConfigValue,
  68.    pagTrapPrintParagraph,
  69.    pagTrapPrintPage,
  70.    
  71.     pagTrapLast
  72.     } PageMgrTrapNumberEnum;
  73.  
  74. /********************************************************************
  75.  * API Prototypes
  76.  ********************************************************************/
  77.  
  78. #ifdef __cplusplus
  79. extern "C" {
  80. #endif
  81.  
  82. //--------------------------------------------------
  83. // Standard library open, close, sleep and wake functions
  84. //--------------------------------------------------
  85.  
  86. extern Err PagOpen(UInt refNum, CharPtr printerName, CharPtr portName)
  87.                 PAGE_MGR_TRAP(sysLibTrapOpen);
  88.                 
  89. extern Err PagClose(UInt refNum)
  90.                 PAGE_MGR_TRAP(sysLibTrapClose);
  91.  
  92. extern Err PagSleep(UInt refNum)
  93.                 PAGE_MGR_TRAP(sysLibTrapSleep);
  94.  
  95. extern Err PagWake(UInt refNum)
  96.                 PAGE_MGR_TRAP(sysLibTrapWake);
  97.  
  98.  
  99. //--------------------------------------------------
  100. // Custom library API functions
  101. //--------------------------------------------------
  102.     
  103. // Get our library API version
  104. extern Err PagGetLibAPIVersion(UInt refNum, DWordPtr dwVerP)
  105.                 PAGE_MGR_TRAP(pagTrapGetLibAPIVersion);
  106.  
  107. // Set an option.
  108. extern Err PagSetOption(UInt refNum, PagOptionEnum option, DWord value)
  109.             PAGE_MGR_TRAP(pagTrapSetOption);
  110.  
  111. // Print text.
  112. extern Err PagPrintText(UInt refNum, CharPtr text)
  113.                 PAGE_MGR_TRAP(pagTrapPrintText);
  114.                 
  115. // Print a line of text.
  116. extern Err PagPrintLine(UInt refNum, CharPtr line)
  117.                 PAGE_MGR_TRAP(pagTrapPrintLine);
  118.                 
  119. // Go to next line.
  120. extern Err PagNewLine(UInt refNum)
  121.                 PAGE_MGR_TRAP(pagTrapNewLine);
  122.                 
  123. // Eject the current page.
  124. extern Err PagNewPage(UInt refNum)
  125.                 PAGE_MGR_TRAP(pagTrapNewPage);
  126.                 
  127. // Set the font.
  128. extern Err PagSetFont(UInt refNum, PagFontPtr fontP)
  129.                 PAGE_MGR_TRAP(pagTrapSetFont);
  130.                 
  131. // Write bytes to the printer.
  132. extern Err PagWrite(UInt refNum, BytePtr bytes, UInt len)
  133.                 PAGE_MGR_TRAP(pagTrapWrite);
  134.  
  135. // Open via BPMConfig settings
  136. extern Err PagOpenByConfig (UInt refNum)                
  137.             PAGE_MGR_TRAP(pagTrapOpenByConfig);
  138.  
  139. // get config value 
  140. extern Err  PagGetConfigValue(UInt refNum,CharPtr szKey,CharPtr szBuf,Int size)
  141.             PAGE_MGR_TRAP(pagTrapGetConfigValue);
  142.  
  143. // PrintParagraph 
  144. extern Err  PagPrintParagraph(UInt refNum,CharPtr line, Int tabsize)
  145.             PAGE_MGR_TRAP(pagTrapPrintParagraph);
  146.             
  147. // PrintPage
  148. extern Err  PagPrintPage(UInt refNum,CharPtr text)
  149.             PAGE_MGR_TRAP(pagTrapPrintPage);
  150.             
  151. // For loading the library in PalmPilot Mac emulation mode
  152. extern Err PagInstall(UInt refNum, SysLibTblEntryPtr entryP);
  153.  
  154. #ifdef __cplusplus 
  155. }
  156. #endif
  157.  
  158. /********************************************************************
  159.  * Public Macros
  160.  ********************************************************************/
  161.  
  162. #endif    // __PAGE_MGR_H__
  163.