home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / tools / bachmann / bachmann.exe / CW / incsCW6 / PageMgr.h next >
Encoding:
C/C++ Source or Header  |  2000-11-08  |  5.0 KB  |  165 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. #include <PalmOS.h>
  43. #include <PalmCompatibility.h>
  44.  
  45. // PageMgr Definitions
  46. #include <PageMgrDefines.h>
  47. #include <SystemMgr.h>
  48.  
  49. //-----------------------------------------------------------------------------
  50. // Page Manager library function trap ID's. Each library call gets a trap number:
  51. //   pagTrapXXXX which serves as an index into the library's dispatch table.
  52. //   The constant sysLibTrapCustom is the first available trap number after
  53. //   the system predefined library traps Open,Close,Sleep & Wake.
  54. //
  55. // WARNING!!! The order of these traps MUST match the order of the dispatch
  56. //  table in SampleLibDispatch.c!!!
  57. //-----------------------------------------------------------------------------
  58.  
  59. typedef enum {
  60.    pagTrapGetLibAPIVersion = sysLibTrapCustom,
  61.    pagTrapSetOption,
  62.    pagTrapPrintText,
  63.    pagTrapPrintLine,
  64.    pagTrapNewLine,
  65.    pagTrapNewPage,
  66.    pagTrapSetFont,
  67.    pagTrapWrite,
  68.    pagTrapOpenByConfig,
  69.    pagTrapGetConfigValue,
  70.    pagTrapPrintParagraph,
  71.    pagTrapPrintPage,
  72.    
  73.     pagTrapLast
  74.     } PageMgrTrapNumberEnum;
  75.  
  76. /********************************************************************
  77.  * API Prototypes
  78.  ********************************************************************/
  79.  
  80. #ifdef __cplusplus
  81. extern "C" {
  82. #endif
  83.  
  84. //--------------------------------------------------
  85. // Standard library open, close, sleep and wake functions
  86. //--------------------------------------------------
  87.  
  88. extern Err PagOpen(UInt refNum, CharPtr printerName, CharPtr portName)
  89.                 PAGE_MGR_TRAP(sysLibTrapOpen);
  90.                 
  91. extern Err PagClose(UInt refNum)
  92.                 PAGE_MGR_TRAP(sysLibTrapClose);
  93.  
  94. extern Err PagSleep(UInt refNum)
  95.                 PAGE_MGR_TRAP(sysLibTrapSleep);
  96.  
  97. extern Err PagWake(UInt refNum)
  98.                 PAGE_MGR_TRAP(sysLibTrapWake);
  99.  
  100.  
  101. //--------------------------------------------------
  102. // Custom library API functions
  103. //--------------------------------------------------
  104.     
  105. // Get our library API version
  106. extern Err PagGetLibAPIVersion(UInt refNum, DWordPtr dwVerP)
  107.                 PAGE_MGR_TRAP(pagTrapGetLibAPIVersion);
  108.  
  109. // Set an option.
  110. extern Err PagSetOption(UInt refNum, PagOptionEnum option, DWord value)
  111.             PAGE_MGR_TRAP(pagTrapSetOption);
  112.  
  113. // Print text.
  114. extern Err PagPrintText(UInt refNum, CharPtr text)
  115.                 PAGE_MGR_TRAP(pagTrapPrintText);
  116.                 
  117. // Print a line of text.
  118. extern Err PagPrintLine(UInt refNum, CharPtr line)
  119.                 PAGE_MGR_TRAP(pagTrapPrintLine);
  120.                 
  121. // Go to next line.
  122. extern Err PagNewLine(UInt refNum)
  123.                 PAGE_MGR_TRAP(pagTrapNewLine);
  124.                 
  125. // Eject the current page.
  126. extern Err PagNewPage(UInt refNum)
  127.                 PAGE_MGR_TRAP(pagTrapNewPage);
  128.                 
  129. // Set the font.
  130. extern Err PagSetFont(UInt refNum, PagFontPtr fontP)
  131.                 PAGE_MGR_TRAP(pagTrapSetFont);
  132.                 
  133. // Write bytes to the printer.
  134. extern Err PagWrite(UInt refNum, BytePtr bytes, UInt len)
  135.                 PAGE_MGR_TRAP(pagTrapWrite);
  136.  
  137. // Open via BPMConfig settings
  138. extern Err PagOpenByConfig (UInt refNum)                
  139.             PAGE_MGR_TRAP(pagTrapOpenByConfig);
  140.  
  141. // get config value 
  142. extern Err  PagGetConfigValue(UInt refNum,CharPtr szKey,CharPtr szBuf,Int size)
  143.             PAGE_MGR_TRAP(pagTrapGetConfigValue);
  144.  
  145. // PrintParagraph 
  146. extern Err  PagPrintParagraph(UInt refNum,CharPtr line, Int tabsize)
  147.             PAGE_MGR_TRAP(pagTrapPrintParagraph);
  148.             
  149. // PrintPage
  150. extern Err  PagPrintPage(UInt refNum,CharPtr text)
  151.             PAGE_MGR_TRAP(pagTrapPrintPage);
  152.             
  153. // For loading the library in PalmPilot Mac emulation mode
  154. extern Err PagInstall(UInt refNum, SysLibTblEntryPtr entryP);
  155.  
  156. #ifdef __cplusplus 
  157. }
  158. #endif
  159.  
  160. /********************************************************************
  161.  * Public Macros
  162.  ********************************************************************/
  163.  
  164. #endif    // __PAGE_MGR_H__
  165.