1 /* HyperText Object HText.h
3 ** This is the C intreface to the Objective-C HyperText class.
12 #define HTMainText HTMaText
13 #define HTMainAnchor HtMaAnch
14 #define HText_new HTHTNew
15 #define HText_free HTHTFree
16 #define HText_beginAppend HTHTBeAp
17 #define HText_endAppend HTHTEnAp
18 #define HText_setStyle HTHTSeSt
19 #define HText_appendCharacter HTHTApCh
20 #define HText_appendText HTHTApTe
21 #define HText_appendParagraph HTHTApPa
22 #define HText_beginAnchor HTHTBeAn
23 #define HText_endAnchor HTHTEnAn
24 #define HText_dump HTHTDump
25 #define HText_nodeAnchor HTHTNoAn
26 #define HText_select HTHTSele
27 #define HText_selectAnchor HTHTSeAn
28 #define HText_applyStyle HTHTApSt
29 #define HText_updateStyle HTHTUpSt
30 #define HText_selectionStyle HTHTStyl
31 #define HText_replaceSel HTHTRepl
32 #define HText_applyToSimilar HTHTApTo
33 #define HText_selectUnstyled HTHTSeUn
34 #define HText_unlinkSelection HTHTUnSe
35 #define HText_linkSelTo HTHTLiSe
36 #define HText_referenceSelected HTHTRefS
40 typedef struct _HText HText;
42 class CHyperText; /* Part of the Mac browser */
43 typedef CHyperText HText
46 extern HText * HTMainText; /* Pointer to current main text */
47 extern HTParentAnchor * HTMainAnchor; /* Pointer to current text's anchor */
49 /* Creation and deletion
51 ** Create hypertext object HText_new
53 extern HText * HText_new PARAMS((HTParentAnchor * anchor));
55 /* Free hypertext object HText_free
57 extern void HText_free PARAMS((HText * me));
60 /* Object Building methods
61 ** -----------------------
63 ** These are used by a parser to build the text in an object
64 ** HText_beginAppend must be called, then any combination of other
65 ** append calls, then HText_endAppend. This allows optimised
66 ** handling using buffers and caches which are flushed at the end.
68 extern void HText_beginAppend PARAMS((HText * text));
70 extern void HText_endAppend PARAMS((HText * text));
72 /* Set the style for future text
74 extern void HText_setStyle PARAMS((HText * text, HTStyle * style));
78 extern void HText_appendCharacter PARAMS((HText * text, char ch));
80 /* Add a zero-terminated string
82 extern void HText_appendText PARAMS((HText * text, CONST char * str));
86 extern void HText_appendParagraph PARAMS((HText * text));
88 /* Start/end sensitive text
90 ** The anchor object is created and passed to HText_beginAnchor.
91 ** The senstive text is added to the text object, and then HText_endAnchor
92 ** is called. Anchors may not be nested.
95 extern void HText_beginAnchor PARAMS((HText * text, HTChildAnchor * anc));
96 extern void HText_endAnchor PARAMS((HText * text));
99 /* Dump diagnostics to stderr
101 extern void HText_dump PARAMS((HText * me));
103 /* Return the anchor associated with this node
105 extern HTParentAnchor * HText_nodeAnchor PARAMS((HText * me));
108 /* Browsing functions
109 ** ------------------
112 /* Bring to front and highlight it
115 extern BOOL HText_select PARAMS((HText * text));
116 extern BOOL HText_selectAnchor PARAMS((HText * text, HTChildAnchor* anchor));
121 ** These are called from the application. There are many more functions
122 ** not included here from the orginal text object. These functions
123 ** NEED NOT BE IMPLEMENTED in a browser which cannot edit.
128 /* Apply this style to the selection
130 extern void HText_applyStyle PARAMS((HText * me, HTStyle *style));
132 /* Update all text with changed style.
134 extern void HText_updateStyle PARAMS((HText * me, HTStyle *style));
136 /* Return style of selection
138 extern HTStyle * HText_selectionStyle PARAMS((
140 HTStyleSheet* sheet));
142 /* Paste in styled text
144 extern void HText_replaceSel PARAMS((HText * me,
148 /* Apply this style to the selection and all similarly formatted text
149 ** (style recovery only)
151 extern void HTextApplyToSimilar PARAMS((HText * me, HTStyle *style));
153 /* Select the first unstyled run.
154 ** (style recovery only)
156 extern void HTextSelectUnstyled PARAMS((HText * me, HTStyleSheet *sheet));
161 extern void HText_unlinkSelection PARAMS((HText * me));
162 extern HTAnchor * HText_referenceSelected PARAMS((HText * me));
163 extern HTAnchor * HText_linkSelTo PARAMS((HText * me, HTAnchor* anchor));