home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / som / somk / c / tp / page.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-24  |  4.9 KB  |  207 lines

  1.  
  2. /*
  3.  *  This file was generated by the SOM Compiler.
  4.  *  Generated using:
  5.  *     SOM incremental update: 10.9
  6.  */
  7.  
  8.  
  9. #ifndef lint
  10. static char *sccsid = "%Z% %I% %W% %G% %U% [%H% %T%] (c)IBM Corp. 1992";
  11. #endif
  12.  
  13. /*
  14.  * This class is adapted from the book
  15.  *   Class Construction in C and C++, Object Oriented Fundamentals
  16.  *   by Roger Sessions, Copyright (c) 1992 Prentice Hall.
  17.  * Reprinted with permission.
  18.  */
  19.  
  20. #define page_Class_Source
  21. #if defined(_WIN32)
  22. #include "statcls.h"
  23. #endif
  24. #include <stdio.h>
  25. #include "page.ih"
  26.  
  27. #define MAX_WORDS_IN_HEADER 100
  28. #define MAX_WORDS_IN_FOOTER 100
  29.  
  30. /* ************************************************************ */
  31. SOM_Scope void SOMLINK pgPrint(page * somSelf,
  32.                 FILE * output)
  33. {
  34.     pageData *somThis = pageGetData(somSelf);
  35.     char buffer[10];
  36.     pageMethodDebug("page", "pgPrint");
  37.  
  38. /* Print header.
  39.    ------------- */
  40.     _pageNumber++;
  41.     if (_pageWord) {
  42.     sprintf(buffer, "%d", _pageNumber);
  43.     _wrdReplace(_pageWord, buffer);
  44.     }
  45.     fprintf(output, "\n\f");
  46.     if (_header)
  47.     _print(_header, output);
  48.     fprintf(output, "\n\n");
  49.  
  50. /* Print text.
  51.    ----------- */
  52.     if (_columns)
  53.     _print(_columns, output);
  54.     fprintf(output, "\n\n");
  55.  
  56. /* Print footer.
  57.    ------------- */
  58.     if (_footer)
  59.     _print(_footer, output);
  60.  
  61. /* Clear out text from somThis column block.
  62.    -------------------------------------- */
  63.     _somFree(_columns);
  64.     _columns = 0;
  65. }
  66.  
  67. /* ************************************************************ */
  68. /*
  69.  *  Set the height of a page in characters.
  70.  */
  71.  
  72. SOM_Scope void  SOMLINK pgSetHeight(page *somSelf,
  73.         long newHeight)
  74. {
  75.     pageData *somThis = pageGetData(somSelf);
  76.     pageMethodDebug("page", "pgSetHeight");
  77.     _height = newHeight;
  78. }
  79.  
  80. /* ************************************************************ */
  81. /*
  82.  *  Set the width of a page in characters.
  83.  */
  84.  
  85. SOM_Scope void  SOMLINK pgSetWidth(page *somSelf,
  86.         long newWidth)
  87. {
  88.     pageData *somThis = pageGetData(somSelf);
  89.     pageMethodDebug("page", "pgSetWidth");
  90.     _width = newWidth;
  91.  
  92. }
  93.  
  94. /* ************************************************************ */
  95. /*
  96.  *  Set the number of columns in a page.
  97.  */
  98.  
  99. SOM_Scope void  SOMLINK pgSetNumberOfColumns(page *somSelf,
  100.         long ncolumns)
  101. {
  102.     pageData *somThis = pageGetData(somSelf);
  103.     pageMethodDebug("page", "pgSetNumberOfColumns");
  104.     _ncolumns = ncolumns;
  105. }
  106.  
  107. /* ************************************************************ */
  108. /*
  109.  *  Tell the page about a special word to be used to
  110.  *  store page numbers.
  111.  */
  112.  
  113. SOM_Scope void SOMLINK pgSetPageNumber(page * somSelf,
  114.                        TPWord * newPageWord)
  115. {
  116.     pageData *somThis = pageGetData(somSelf);
  117.     pageMethodDebug("page", "pgSetPageNumber");
  118.     _pageWord = newPageWord;
  119. }
  120.  
  121. /* ************************************************************ */
  122. /*
  123.  *  Get the columnBlock being used by this page.
  124.  */
  125.  
  126. SOM_Scope columnBlock *SOMLINK pgGetColumnBlock(page * somSelf)
  127. {
  128.     pageData *somThis = pageGetData(somSelf);
  129.     pageMethodDebug("page", "pgGetColumnBlock");
  130.  
  131.     if (!_columns) {
  132.     _columns = columnBlockNew();
  133.     _cbInit(_columns, _ncolumns, _height, _width);
  134.     }
  135.     return _columns;
  136. }
  137.  
  138. /* ************************************************************ */
  139. /*
  140.  *  Get the textLine representing the page header.
  141.  */
  142.  
  143. SOM_Scope textLine *SOMLINK pgGetHeaderBlock(page * somSelf)
  144. {
  145.     pageData *somThis = pageGetData(somSelf);
  146.     pageMethodDebug("page", "pgGetHeaderBlock");
  147.  
  148.     if (!_header) {
  149.     _header = textLineNew();
  150.     _tlInit(_header, MAX_WORDS_IN_HEADER);
  151.     }
  152.     return _header;
  153. }
  154.  
  155. /* ************************************************************ */
  156. /*
  157.  *  Get the textLine representing the page footer.
  158.  */
  159.  
  160. SOM_Scope textLine *SOMLINK pgGetFooterBlock(page * somSelf)
  161. {
  162.     pageData *somThis = pageGetData(somSelf);
  163.     pageMethodDebug("page", "pgGetFooterBlock");
  164.     if (!_footer) {
  165.     _footer = textLineNew();
  166.     _tlInit(_footer, MAX_WORDS_IN_FOOTER);
  167.     }
  168.     return _footer;
  169. }
  170.  
  171. /* ************************************************************ */
  172. SOM_Scope void SOMLINK somInit(page * somSelf)
  173. {
  174.     pageData *somThis = pageGetData(somSelf);
  175.     pageMethodDebug("page", "somInit");
  176.  
  177.     parent_somInit(somSelf);
  178. }
  179.  
  180. /* ************************************************************ */
  181. SOM_Scope void SOMLINK somUninit(page * somSelf)
  182. {
  183.     pageData *somThis = pageGetData(somSelf);
  184.     pageMethodDebug("page", "somUninit");
  185.  
  186.     parent_somUninit(somSelf);
  187. }
  188.  
  189. /* ************************************************************ */
  190.  
  191. /*
  192.  * SOM_Scope void SOMLINK somDumpSelfInt(page * somSelf,
  193.  *                        int level)
  194.  */
  195.  
  196. /*
  197.  * The prototype for somDumpSelfInt was replaced by the following prototype:
  198.  */
  199. SOM_Scope void  SOMLINK somDumpSelfInt(page *somSelf,
  200.         long level)
  201. {
  202.     pageData *somThis = pageGetData(somSelf);
  203.     pageMethodDebug("page", "somDumpSelfInt");
  204.  
  205.     parent_somDumpSelfInt(somSelf, level);
  206. }
  207.