Some compile fixes, not enough
[erwise] / Cl / WWWLibrary / HText.h
1 /*                      HyperText Object                        HText.h
2 **                      ================
3 **      This is the C intreface to the Objective-C HyperText class.
4 */
5
6 #ifndef HTEXT_H
7 #define HTEXT_H
8 #include "HTAnchor.h"
9 #include "HTStyle.h"
10
11 #ifdef SHORT_NAMES
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
37 #endif
38
39 #ifndef THINK_C
40 typedef struct _HText HText;
41 #else
42 class CHyperText;               /* Part of the Mac browser */
43 typedef CHyperText HText
44 #endif
45
46 extern HText * HTMainText;              /* Pointer to current main text */
47 extern HTParentAnchor * HTMainAnchor;   /* Pointer to current text's anchor */
48
49 /*                      Creation and deletion
50 **
51 **      Create hypertext object                                 HText_new
52 */
53  extern HText * HText_new PARAMS((HTParentAnchor * anchor));
54
55 /*      Free hypertext object                                   HText_free
56 */
57 extern void     HText_free PARAMS((HText * me));
58
59
60 /*                      Object Building methods
61 **                      -----------------------
62 **
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.
67 */
68 extern void HText_beginAppend PARAMS((HText * text));
69
70 extern void HText_endAppend PARAMS((HText * text));
71
72 /*      Set the style for future text
73 */
74 extern void HText_setStyle PARAMS((HText * text, HTStyle * style));
75
76 /*      Add one character
77 */
78 extern void HText_appendCharacter PARAMS((HText * text, char ch));
79
80 /*      Add a zero-terminated string
81 */
82 extern void HText_appendText PARAMS((HText * text, CONST char * str));
83
84 /*      New Paragraph
85 */
86 extern void HText_appendParagraph PARAMS((HText * text));
87
88 /*      Start/end sensitive text
89 **
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.
93 */
94
95 extern void HText_beginAnchor PARAMS((HText * text, HTChildAnchor * anc));
96 extern void HText_endAnchor PARAMS((HText * text));
97
98
99 /*      Dump diagnostics to stderr
100 */
101 extern void HText_dump PARAMS((HText * me));    
102
103 /*      Return the anchor associated with this node
104 */
105 extern HTParentAnchor * HText_nodeAnchor PARAMS((HText * me));
106
107
108 /*              Browsing functions
109 **              ------------------
110 */
111
112 /*      Bring to front and highlight it
113 */
114
115 extern BOOL HText_select PARAMS((HText * text)); 
116 extern BOOL HText_selectAnchor PARAMS((HText * text, HTChildAnchor* anchor)); 
117
118 /*              Editing functions
119 **              -----------------
120 **
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.
124 */
125
126 /*      Style handling:
127 */
128 /*      Apply this style to the selection
129 */
130 extern void HText_applyStyle PARAMS((HText * me, HTStyle *style));
131
132 /*      Update all text with changed style.
133 */
134 extern void HText_updateStyle PARAMS((HText * me, HTStyle *style));
135
136 /*      Return style of  selection
137 */
138 extern HTStyle * HText_selectionStyle PARAMS((
139         HText * me,
140         HTStyleSheet* sheet));
141
142 /*      Paste in styled text
143 */
144 extern void HText_replaceSel PARAMS((HText * me,
145         CONST char *aString, 
146         HTStyle* aStyle));
147
148 /*      Apply this style to the selection and all similarly formatted text
149 **      (style recovery only)
150 */
151 extern void HTextApplyToSimilar PARAMS((HText * me, HTStyle *style));
152  
153 /*      Select the first unstyled run.
154 **      (style recovery only)
155 */
156 extern void HTextSelectUnstyled PARAMS((HText * me, HTStyleSheet *sheet));
157
158
159 /*      Anchor handling:
160 */
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));
164
165
166 #endif /* HTEXT_H */