home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / lynx-2.4 / WWW / Library / Implementation / HText.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-28  |  6.7 KB  |  263 lines

  1. /*                                                           Rich Hypertext object for libWWW
  2.                                   RICH HYPERTEXT OBJECT
  3.                                              
  4.  */
  5.  
  6. /*
  7.  
  8.    This is the C interface to the Objective-C (or whatever) Style-oriented HyperText
  9.    class. It is used when a style-oriented text object is available or craeted in order to
  10.    display hypertext.
  11.    
  12.  */
  13. #ifndef HTEXT_H
  14. #define HTEXT_H
  15. #include "HTAnchor.h"
  16. #include "HTStyle.h"
  17. #include "HTStream.h"
  18. #include "SGML.h"
  19.  
  20. #ifdef SHORT_NAMES
  21. #define HTMainText                      HTMaText
  22. #define HTMainAnchor                    HtMaAnch
  23. #define HText_new                       HTHTNew
  24. #define HText_new2                      HTHTNew2
  25. #define HText_free                      HTHTFree
  26. #define HText_beginAppend               HTHTBeAp
  27. #define HText_endAppend                 HTHTEnAp
  28. #define HText_setStyle                  HTHTSeSt
  29. #define HText_appendCharacter           HTHTApCh
  30. #define HText_appendImage               HTHTApIm
  31. #define HText_appendText                HTHTApTe
  32. #define HText_appendParagraph           HTHTApPa
  33. #define HText_beginAnchor               HTHTBeAn
  34. #define HText_endAnchor                 HTHTEnAn
  35. #define HText_dump                      HTHTDump
  36. #define HText_nodeAnchor                HTHTNoAn
  37. #define HText_select                    HTHTSele
  38. #define HText_selectAnchor              HTHTSeAn
  39. #define HText_applyStyle                HTHTApSt
  40. #define HText_updateStyle               HTHTUpSt
  41. #define HText_selectionStyle            HTHTStyl
  42. #define HText_replaceSel                HTHTRepl
  43. #define HText_applyToSimilar            HTHTApTo
  44. #define HText_selectUnstyled            HTHTSeUn
  45. #define HText_unlinkSelection           HTHTUnSe
  46. #define HText_linkSelTo                 HTHTLiSe
  47. #define HText_referenceSelected         HTHTRefS
  48. #endif
  49.  
  50. #ifndef THINK_C
  51. #ifndef HyperText               /* Objective C version defined HyperText */
  52. typedef struct _HText HText;    /* Normal Library */
  53. #endif
  54. #else
  55. class CHyperText;               /* Mac Think-C browser hook */
  56. typedef CHyperText HText;
  57. #endif
  58.  
  59. extern HText * HTMainText;              /* Pointer to current main text */
  60. extern HTParentAnchor * HTMainAnchor;   /* Pointer to current text's anchor */
  61.  
  62. /*
  63.  
  64. Creation and deletion
  65.  
  66.   HTEXT_NEW: CREATE HYPERTEXT OBJECT
  67.   
  68.    There are several methods depending on how much you want to specify. The output stream
  69.    is used with objects which need to output the hypertext to a stream.  The structure is
  70.    for objects which need to refer to the structure which is kep by the creating stream.
  71.    
  72.  */
  73.  extern HText * HText_new PARAMS((HTParentAnchor * anchor));
  74.  
  75.  extern HText * HText_new2 PARAMS((HTParentAnchor * anchor,
  76.                                 HTStream * output_stream));
  77.  
  78.  extern HText * HText_new3 PARAMS((HTParentAnchor * anchor,
  79.                                 HTStream * output_stream,
  80.                                 HTStructured * structure));
  81.  
  82. /*
  83.  
  84.   FREE HYPERTEXT OBJECT
  85.   
  86.  */
  87. extern void     HText_free PARAMS((HText * me));
  88.  
  89.  
  90. /*
  91.  
  92. Object Building methods
  93.  
  94.    These are used by a parser to build the text in an object HText_beginAppend must be
  95.    called, then any combination of other append calls, then HText_endAppend. This allows
  96.    optimised handling using buffers and caches which are flushed at the end.
  97.    
  98.  */
  99. extern void HText_beginAppend PARAMS((HText * text));
  100.  
  101. extern void HText_endAppend PARAMS((HText * text));
  102.  
  103. /*
  104.  
  105.   SET THE STYLE FOR FUTURE TEXT
  106.   
  107.  */
  108.  
  109. extern void HText_setStyle PARAMS((HText * text, HTStyle * style));
  110.  
  111. /*
  112.  
  113.   ADD ONE CHARACTER
  114.   
  115.  */
  116. extern void HText_appendCharacter PARAMS((HText * text, char ch));
  117.  
  118. /*
  119.  
  120.   ADD A ZERO-TERMINATED STRING
  121.   
  122.  */
  123.  
  124. extern void HText_appendText PARAMS((HText * text, CONST char * str));
  125.  
  126. /*
  127.  
  128.   NEW PARAGRAPH
  129.   
  130.    and similar things
  131.    
  132.  */
  133. extern void HText_appendParagraph PARAMS((HText * text));
  134.  
  135. extern void HText_appendLineBreak PARAMS((HText * text));
  136.  
  137. extern void HText_appendHorizontalRule PARAMS((HText * text));
  138.  
  139.  
  140.  
  141. /*
  142.  
  143.   START/END SENSITIVE TEXT
  144.   
  145.  */
  146.  
  147. /*
  148.  
  149.    The anchor object is created and passed to HText_beginAnchor. The senstive text is
  150.    added to the text object, and then HText_endAnchor is called. Anchors may not be
  151.    nested.
  152.    
  153.  */
  154. extern void HText_beginAnchor PARAMS((HText * text, HTChildAnchor * anc));
  155. extern void HText_endAnchor PARAMS((HText * text));
  156.  
  157.  
  158. /*
  159.  
  160.   APPEND AN INLINE IMAGE
  161.   
  162.    The image is handled by the creation of an anchor whose destination is the image
  163.    document to be included. The semantics is the intended inline display of the image.
  164.    
  165.    An alternative implementation could be, for example, to begin an anchor, append the
  166.    alternative text or "IMAGE", then end the anchor. This would simply generate some text
  167.    linked to the image itself as a separate document.
  168.    
  169.  */
  170. extern void HText_appendImage PARAMS((
  171.         HText *         text,
  172.         HTChildAnchor * anc,
  173.         CONST char *    alternative_text,
  174.         int             alignment,
  175.         BOOL            isMap));
  176.  
  177. /*
  178.  
  179.   DUMP DIAGNOSTICS TO STDERR
  180.   
  181.  */
  182.  
  183. extern void HText_dump PARAMS((HText * me));
  184.  
  185. /*
  186.  
  187.   RETURN THE ANCHOR ASSOCIATED WITH THIS NODE
  188.   
  189.  */
  190. extern HTParentAnchor * HText_nodeAnchor PARAMS((HText * me));
  191.  
  192.  
  193. /*
  194.  
  195. Browsing functions
  196.  
  197.  */
  198.  
  199.  
  200. /*
  201.  
  202.   BRING TO FRONT AND HIGHLIGHT IT
  203.   
  204.  */
  205.  
  206.  
  207. extern BOOL HText_select PARAMS((HText * text));
  208. extern BOOL HText_selectAnchor PARAMS((HText * text, HTChildAnchor* anchor));
  209.  
  210. /*
  211.  
  212. Editing functions
  213.  
  214.    These are called from the application. There are many more functions not included here
  215.    from the orginal text object. These functions NEED NOT BE IMPLEMENTED in a browser
  216.    which cannot edit.
  217.    
  218.  */
  219. /*      Style handling:
  220. */
  221. /*      Apply this style to the selection
  222. */
  223. extern void HText_applyStyle PARAMS((HText * me, HTStyle *style));
  224.  
  225. /*      Update all text with changed style.
  226. */
  227. extern void HText_updateStyle PARAMS((HText * me, HTStyle *style));
  228.  
  229. /*      Return style of  selection
  230. */
  231. extern HTStyle * HText_selectionStyle PARAMS((
  232.         HText * me,
  233.         HTStyleSheet* sheet));
  234.  
  235. /*      Paste in styled text
  236. */
  237. extern void HText_replaceSel PARAMS((HText * me,
  238.         CONST char *aString,
  239.         HTStyle* aStyle));
  240.  
  241. /*      Apply this style to the selection and all similarly formatted text
  242. **      (style recovery only)
  243. */
  244. extern void HTextApplyToSimilar PARAMS((HText * me, HTStyle *style));
  245.  
  246. /*      Select the first unstyled run.
  247. **      (style recovery only)
  248. */
  249. extern void HTextSelectUnstyled PARAMS((HText * me, HTStyleSheet *sheet));
  250.  
  251.  
  252. /*      Anchor handling:
  253. */
  254. extern void             HText_unlinkSelection PARAMS((HText * me));
  255. extern HTAnchor *       HText_referenceSelected PARAMS((HText * me));
  256. extern HTAnchor *       HText_linkSelTo PARAMS((HText * me, HTAnchor* anchor));
  257.  
  258.  
  259. #endif /* HTEXT_H */
  260. /*
  261.  
  262.    end */
  263.