home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / toolkt21 / c / samples / tp / blep.c next >
Encoding:
C/C++ Source or Header  |  1993-03-12  |  2.4 KB  |  76 lines

  1. #ifndef lint
  2. static char *sccsid = "@(#)blep.c 1.3 1/22/92 16:08:17 [1/26/92] (c)IBM Corp. 1992";
  3. #endif
  4.  
  5. /*
  6.  * This class is adapted from the book
  7.  *   Class Construction in C and C++, Object Oriented Fundamentals
  8.  *   by Roger Sessions, Copyright (c) 1992 Prentice Hall.
  9.  * Reprinted with permission.
  10.  */
  11.  
  12. #define bulletedList_Class_Source
  13. #include "blep.ih"
  14. #include "tpword.h"
  15.  
  16. #define PARAGRAPH_INDENTATION 0
  17. #define LINE_INDENTATION 2
  18. #define BULLET " - "
  19.  
  20. /* ************************************************************ */
  21. SOM_Scope int SOMLINK epGetParagraphIndentation(bulletedList * somSelf)
  22. {
  23.     /* bulletedListData *somThis = bulletedListGetData(somSelf); */
  24.     bulletedListMethodDebug("bulletedList", "epGetParagraphIndentation");
  25.  
  26.     somSelf;                   /* Avoid unreferenced parameter compiler
  27.                     * warning for OS/2 compiler */
  28.     return PARAGRAPH_INDENTATION;
  29.  
  30. }
  31.  
  32. /* ************************************************************ */
  33. SOM_Scope int SOMLINK epGetLineIndentation(bulletedList * somSelf)
  34. {
  35.     /* bulletedListData *somThis = bulletedListGetData(somSelf); */
  36.     envProcessor *lastEnv = _epGetPreviousEnv(somSelf);
  37.     bulletedListMethodDebug("bulletedList", "epGetLineIndentation");
  38.  
  39.     if (lastEnv)
  40.     return _epGetLineIndentation(lastEnv) + LINE_INDENTATION;
  41.     else
  42.     return LINE_INDENTATION;
  43. }
  44.  
  45. /* ************************************************************ */
  46. SOM_Scope void SOMLINK epInitializeEnvironment(bulletedList * somSelf)
  47. {
  48.     /* bulletedListData *somThis = bulletedListGetData(somSelf); */
  49.     textLine *thisLine;
  50.     TPWord *bullet;
  51.     bulletedListMethodDebug("bulletedList", "epInitializeEnvironment");
  52.  
  53.     parent_epInitializeEnvironment(somSelf);
  54.  
  55.     bullet = TPWordNew();
  56.     _wordInit1(bullet, BULLET);
  57.     thisLine = _tpGetLine(somSelf);
  58.     _llAddTail(thisLine, (baseType *) bullet);
  59. }
  60.  
  61. /* ************************************************************ */
  62. SOM_Scope void SOMLINK tpProcessNewParagraph(bulletedList * somSelf)
  63. {
  64. /* bulletedListData *somThis = bulletedListGetData(somSelf); */
  65.     textLine *thisLine;
  66.     TPWord *bullet;
  67.     bulletedListMethodDebug("bulletedList", "tpProcessNewParagraph");
  68.  
  69.     parent_tpProcessNewParagraph(somSelf);
  70.  
  71.     bullet = TPWordNew();
  72.     _wordInit1(bullet, BULLET);
  73.     thisLine = _tpGetLine(somSelf);
  74.     _llAddTail(thisLine, (baseType *) bullet);
  75. }
  76.