Annotation of libwww/Library/src/HText.html, revision 2.7
2.6 timbl 1: <HTML>
2: <HEAD>
3: <TITLE>Rich Hypertext object for libWWW</TITLE></HEAD>
2.5 timbl 4: <BODY>
5: <H1>Rich HyperText Object</H1>
2.1 timbl 6: <PRE>
2.5 timbl 7: </PRE>This is the C interface to the Objective-C
2.6 timbl 8: (or whatever) Style-oriented HyperText
9: class. It is used when a style-oriented
10: text object is available or craeted
11: in order to display hypertext.
2.5 timbl 12: <PRE>#ifndef HTEXT_H
2.1 timbl 13: #define HTEXT_H
14: #include "HTAnchor.h"
15: #include "HTStyle.h"
16: #include "HTStream.h"
2.7 ! timbl 17: #include "SGML.h"
2.1 timbl 18:
19: #ifdef SHORT_NAMES
20: #define HTMainText HTMaText
21: #define HTMainAnchor HtMaAnch
22: #define HText_new HTHTNew
2.5 timbl 23: #define HText_new2 HTHTNew2
2.1 timbl 24: #define HText_free HTHTFree
25: #define HText_beginAppend HTHTBeAp
26: #define HText_endAppend HTHTEnAp
27: #define HText_setStyle HTHTSeSt
28: #define HText_appendCharacter HTHTApCh
2.6 timbl 29: #define HText_appendImage HTHTApIm
2.1 timbl 30: #define HText_appendText HTHTApTe
31: #define HText_appendParagraph HTHTApPa
32: #define HText_beginAnchor HTHTBeAn
33: #define HText_endAnchor HTHTEnAn
34: #define HText_dump HTHTDump
35: #define HText_nodeAnchor HTHTNoAn
36: #define HText_select HTHTSele
37: #define HText_selectAnchor HTHTSeAn
38: #define HText_applyStyle HTHTApSt
39: #define HText_updateStyle HTHTUpSt
40: #define HText_selectionStyle HTHTStyl
41: #define HText_replaceSel HTHTRepl
42: #define HText_applyToSimilar HTHTApTo
43: #define HText_selectUnstyled HTHTSeUn
44: #define HText_unlinkSelection HTHTUnSe
45: #define HText_linkSelTo HTHTLiSe
46: #define HText_referenceSelected HTHTRefS
47: #endif
48:
49: #ifndef THINK_C
50: #ifndef HyperText /* Objective C version defined HyperText */
51: typedef struct _HText HText; /* Normal Library */
52: #endif
53: #else
54: class CHyperText; /* Mac Think-C browser hook */
55: typedef CHyperText HText;
56: #endif
57:
58: extern HText * HTMainText; /* Pointer to current main text */
59: extern HTParentAnchor * HTMainAnchor; /* Pointer to current text's anchor */
60:
2.6 timbl 61: </PRE>
62: <H2>Creation and deletion</H2>
2.7 ! timbl 63: <H3>HText_new: Create hypertext object</H3>There are several methods depending
! 64: on how much you want to specify.
! 65: The output stream is used with objects
! 66: which need to output the hypertext
! 67: to a stream. The structure is for
! 68: objects which need to refer to the
! 69: structure which is kep by the creating
! 70: stream.
2.6 timbl 71: <PRE> extern HText * HText_new PARAMS((HTParentAnchor * anchor));
2.7 ! timbl 72:
2.1 timbl 73: extern HText * HText_new2 PARAMS((HTParentAnchor * anchor,
74: HTStream * output_stream));
75:
2.7 ! timbl 76: extern HText * HText_new3 PARAMS((HTParentAnchor * anchor,
! 77: HTStream * output_stream,
! 78: HTStructured * structure));
! 79:
! 80: </PRE>
! 81: <H3>Free hypertext object</H3>
! 82: <PRE>extern void HText_free PARAMS((HText * me));
2.1 timbl 83:
84:
2.6 timbl 85: </PRE>
86: <H2>Object Building methods</H2>These are used by a parser to build
87: the text in an object HText_beginAppend
88: must be called, then any combination
89: of other append calls, then HText_endAppend.
90: This allows optimised handling using
91: buffers and caches which are flushed
92: at the end.
93: <PRE>extern void HText_beginAppend PARAMS((HText * text));
2.1 timbl 94:
95: extern void HText_endAppend PARAMS((HText * text));
96:
2.6 timbl 97: </PRE>
98: <H3>Set the style for future text</H3>
99: <PRE>
2.1 timbl 100: extern void HText_setStyle PARAMS((HText * text, HTStyle * style));
101:
2.6 timbl 102: </PRE>
103: <H3>Add one character</H3>
104: <PRE>extern void HText_appendCharacter PARAMS((HText * text, char ch));
2.1 timbl 105:
2.6 timbl 106: </PRE>
107: <H3>Add a zero-terminated string</H3>
108: <PRE>
2.1 timbl 109: extern void HText_appendText PARAMS((HText * text, CONST char * str));
110:
2.6 timbl 111: </PRE>
112: <H3>New Paragraph</H3>and similar things
113: <PRE>extern void HText_appendParagraph PARAMS((HText * text));
114:
115: extern void HText_appendLineBreak PARAMS((HText * text));
116:
117: extern void HText_appendHorizontalRule PARAMS((HText * text));
118:
2.1 timbl 119:
120:
2.6 timbl 121: </PRE>
122: <H3>Start/end sensitive text</H3>
123: <PRE>
124: </PRE>The anchor object is created and
125: passed to HText_beginAnchor. The
126: senstive text is added to the text
127: object, and then HText_endAnchor
128: is called. Anchors may not be nested.
129: <PRE>extern void HText_beginAnchor PARAMS((HText * text, HTChildAnchor * anc));
2.1 timbl 130: extern void HText_endAnchor PARAMS((HText * text));
131:
132:
2.6 timbl 133: </PRE>
134: <H3>Append an inline image</H3>The image is handled by the creation
135: of an anchor whose destination is
136: the image document to be included.
137: The semantics is the intended inline
138: display of the image.<P>
139: An alternative implementation could
140: be, for example, to begin an anchor,
141: append the alternative text or "IMAGE",
142: then end the anchor. This would simply
143: generate some text linked to the
144: image itself as a separate document.
145: <PRE>extern void HText_appendImage PARAMS((
146: HText * text,
147: HTChildAnchor * anc,
148: CONST char * alternative_text,
149: int alignment,
150: BOOL isMap));
151:
152: </PRE>
153: <H3>Dump diagnostics to stderr</H3>
154: <PRE>
2.1 timbl 155: extern void HText_dump PARAMS((HText * me));
156:
2.6 timbl 157: </PRE>
158: <H3>Return the anchor associated with
159: this node</H3>
160: <PRE>extern HTParentAnchor * HText_nodeAnchor PARAMS((HText * me));
2.1 timbl 161:
162:
2.6 timbl 163: </PRE>
164: <H2>Browsing functions</H2>
165: <PRE>
2.1 timbl 166:
2.6 timbl 167: </PRE>
168: <H3>Bring to front and highlight it</H3>
169: <PRE>
2.1 timbl 170:
171: extern BOOL HText_select PARAMS((HText * text));
172: extern BOOL HText_selectAnchor PARAMS((HText * text, HTChildAnchor* anchor));
173:
2.6 timbl 174: </PRE>
175: <H2>Editing functions</H2>These are called from the application.
176: There are many more functions not
177: included here from the orginal text
178: object. These functions NEED NOT
179: BE IMPLEMENTED in a browser which
180: cannot edit.
181: <PRE>/* Style handling:
2.1 timbl 182: */
183: /* Apply this style to the selection
184: */
185: extern void HText_applyStyle PARAMS((HText * me, HTStyle *style));
186:
187: /* Update all text with changed style.
188: */
189: extern void HText_updateStyle PARAMS((HText * me, HTStyle *style));
190:
191: /* Return style of selection
192: */
193: extern HTStyle * HText_selectionStyle PARAMS((
194: HText * me,
195: HTStyleSheet* sheet));
196:
197: /* Paste in styled text
198: */
199: extern void HText_replaceSel PARAMS((HText * me,
200: CONST char *aString,
201: HTStyle* aStyle));
202:
203: /* Apply this style to the selection and all similarly formatted text
204: ** (style recovery only)
205: */
206: extern void HTextApplyToSimilar PARAMS((HText * me, HTStyle *style));
207:
208: /* Select the first unstyled run.
209: ** (style recovery only)
210: */
211: extern void HTextSelectUnstyled PARAMS((HText * me, HTStyleSheet *sheet));
212:
213:
214: /* Anchor handling:
215: */
216: extern void HText_unlinkSelection PARAMS((HText * me));
217: extern HTAnchor * HText_referenceSelected PARAMS((HText * me));
218: extern HTAnchor * HText_linkSelTo PARAMS((HText * me, HTAnchor* anchor));
219:
220:
221: #endif /* HTEXT_H */
2.5 timbl 222: </PRE>end</BODY>
2.6 timbl 223: </HTML>
Webmaster