1994689c1Smrg<sect1 id="TextSink_Object">
2994689c1Smrg<title>TextSink Object</title>
3994689c1Smrg<para>
4994689c1Smrg<!-- .LP -->
5994689c1Smrg<!-- .XS -->
6994689c1Smrg<!-- 	TextSink Object -->
7994689c1Smrg<!-- .XE -->
85ec34c4cSmrg<indexterm significance="preferred"><primary>TextSink object</primary></indexterm>
9994689c1Smrg</para>
10994689c1Smrg<para>
11994689c1Smrg<!-- .LP -->
12994689c1Smrg<literallayout class="monospaced">
13994689c1Smrg<!-- .TA 2.0i -->
14994689c1Smrg<!-- .ta 2.0i -->
15994689c1SmrgApplication Header file	&lt;X11/Xaw/TextSink.h&gt;
165ec34c4cSmrg<indexterm><primary>TextSink.h</primary></indexterm>
17994689c1SmrgClass Header file	&lt;X11/Xaw/TextSinkP.h&gt;
185ec34c4cSmrg<indexterm><primary>TextSinkP.h</primary></indexterm>
19994689c1SmrgClass		textSinkObjectClass
205ec34c4cSmrg<indexterm><primary>textSinkObjectClass</primary></indexterm>
21994689c1SmrgClass Name	TextSink
225ec34c4cSmrg<indexterm><primary>TextSink object</primary><secondary>class name</secondary></indexterm>
23994689c1SmrgSuperclass	Object
24994689c1Smrg</literallayout>
25994689c1Smrg</para>
26994689c1Smrg<para>
27994689c1Smrg<!-- .LP -->
28994689c1SmrgThe TextSink object is the root object for all text sinks.  Any new text
29994689c1Smrgsink objects should be subclasses of the TextSink Object.  The TextSink
30994689c1SmrgClass contains all methods that the Text widget expects a text sink to
31994689c1Smrgexport.
32994689c1Smrg</para>
33994689c1Smrg<para>
34994689c1Smrg<!-- .LP -->
35994689c1SmrgSince all text sinks will have some resources in common, the TextSink
36994689c1Smrgdefines a few new resources.
37994689c1Smrg</para>
38421c997bSmrg<sect2 id='TextSink::Resources'>
39994689c1Smrg<title>Resources</title>
40994689c1Smrg<para>
41994689c1Smrg<!-- .LP -->
42994689c1SmrgWhen creating an TextSink object instance, the following resources are
43994689c1Smrgretrieved from the argument list or from the resource database:
44994689c1Smrg</para>
45994689c1Smrg<para>
46994689c1Smrg<!-- .LP -->
475ec34c4cSmrg<indexterm><primary>AsciiSink object</primary><secondary>resources</secondary></indexterm>
48994689c1Smrg<informaltable>
49994689c1Smrg  <tgroup cols='5' align='center'>
50994689c1Smrg  <colspec colname='c1'/>
51994689c1Smrg  <colspec colname='c2'/>
52994689c1Smrg  <colspec colname='c3'/>
53994689c1Smrg  <colspec colname='c4'/>
54994689c1Smrg  <colspec colname='c5'/>
55994689c1Smrg  <thead>
56994689c1Smrg    <row>
57994689c1Smrg      <entry>Name</entry>
58994689c1Smrg      <entry>Class</entry>
59994689c1Smrg      <entry>Type</entry>
60994689c1Smrg      <entry>Notes</entry>
61994689c1Smrg      <entry>Default Value</entry>
62994689c1Smrg    </row>
63994689c1Smrg  </thead>
64994689c1Smrg  <tbody>
65994689c1Smrg    <row>
66994689c1Smrg      <entry>background</entry>
67994689c1Smrg      <entry>Background</entry>
68994689c1Smrg      <entry>Pixel</entry>
69994689c1Smrg      <entry></entry>
70994689c1Smrg      <entry>XtDefaultBackground</entry>
71994689c1Smrg    </row>
72994689c1Smrg    <row>
73994689c1Smrg      <entry>destroyCallback</entry>
74994689c1Smrg      <entry>Callback</entry>
75994689c1Smrg      <entry>XtCallbackList</entry>
76994689c1Smrg      <entry></entry>
77994689c1Smrg      <entry>NULL</entry>
78994689c1Smrg    </row>
79994689c1Smrg    <row>
80994689c1Smrg      <entry>foreground</entry>
81994689c1Smrg      <entry>Foreground</entry>
82994689c1Smrg      <entry>Pixel</entry>
83994689c1Smrg      <entry></entry>
84994689c1Smrg      <entry>XtDefaultForeground</entry>
85994689c1Smrg    </row>
86994689c1Smrg    <row>
87994689c1Smrg      <entry>_</entry>
88994689c1Smrg    </row>
89994689c1Smrg  </tbody>
90994689c1Smrg  </tgroup>
91994689c1Smrg</informaltable>
92994689c1Smrg<!-- .Bg Bold -->
93994689c1Smrg<!-- .Dc -->
94994689c1Smrg<!-- .Sg Bold -->
95994689c1Smrg</para>
96994689c1Smrg</sect2>
97994689c1Smrg<sect2 id="Subclassing_the_TextSink">
98994689c1Smrg<title>Subclassing the TextSink</title>
995ec34c4cSmrg<indexterm significance="preferred"><primary>TextSink object</primary><secondary>subclassing</secondary></indexterm>
100994689c1Smrg<para>
101994689c1Smrg<!-- .LP -->
102994689c1SmrgThe only purpose of the TextSink Object is to be subclassed.  It
103994689c1Smrgcontains the minimum set of class methods that all text sinks must have.
104994689c1SmrgWhile all may be inherited, the direct descendant of TextSink <function>must
105994689c1Smrgspecify</function> some of them as TextSink does contain enough information to
106994689c1Smrgbe a valid text sink by itself.  Do not try to use
107994689c1Smrgthe TextSink as a valid sink for the Text widget; it is not intended
108994689c1Smrgto be used as a sink by itself.
109994689c1Smrg<informaltable>
110994689c1Smrg  <tgroup cols='4' align='center'>
111994689c1Smrg  <colspec colname='c1'/>
112994689c1Smrg  <colspec colname='c2'/>
113994689c1Smrg  <colspec colname='c3'/>
114994689c1Smrg  <colspec colname='c4'/>
115994689c1Smrg  <thead>
116994689c1Smrg    <row>
117994689c1Smrg      <entry>Function</entry>
118994689c1Smrg      <entry>Inherit with</entry>
119994689c1Smrg      <entry>Public Interface</entry>
120994689c1Smrg      <entry>must specify</entry>
121994689c1Smrg    </row>
122994689c1Smrg  </thead>
123994689c1Smrg  <tbody>
124994689c1Smrg    <row>
125994689c1Smrg      <entry>DisplayText</entry>
126994689c1Smrg      <entry>XtInheritDisplayText</entry>
127994689c1Smrg      <entry>XawTextSinkDisplayText</entry>
128994689c1Smrg      <entry>yes</entry>
129994689c1Smrg    </row>
130994689c1Smrg    <row>
131994689c1Smrg      <entry>InsertCursor</entry>
132994689c1Smrg      <entry>XtInheritInsertCursor</entry>
133994689c1Smrg      <entry>XawTextSinkInsertCursor</entry>
134994689c1Smrg      <entry>yes</entry>
135994689c1Smrg    </row>
136994689c1Smrg    <row>
137994689c1Smrg      <entry>ClearToBackground</entry>
138994689c1Smrg      <entry>XtInheritClearToBackground</entry>
139994689c1Smrg      <entry>XawTextSinkClearToBackground</entry>
140994689c1Smrg      <entry>no</entry>
141994689c1Smrg    </row>
142994689c1Smrg    <row>
143994689c1Smrg      <entry>FindPosition</entry>
144994689c1Smrg      <entry>XtInheritFindPosition</entry>
145994689c1Smrg      <entry>XawTextSinkFindPosition</entry>
146994689c1Smrg      <entry>yes</entry>
147994689c1Smrg    </row>
148994689c1Smrg    <row>
149994689c1Smrg      <entry>FindDistance</entry>
150994689c1Smrg      <entry>XtInheritFindDistance</entry>
151994689c1Smrg      <entry>XawTextSinkFindDistance</entry>
152994689c1Smrg      <entry>yes</entry>
153994689c1Smrg    </row>
154994689c1Smrg    <row>
155994689c1Smrg      <entry>Resolve</entry>
156994689c1Smrg      <entry>XtInheritResolve</entry>
157994689c1Smrg      <entry>XawTextSinkResolve</entry>
158994689c1Smrg      <entry>yes</entry>
159994689c1Smrg    </row>
160994689c1Smrg    <row>
161994689c1Smrg      <entry>MaxLines</entry>
162994689c1Smrg      <entry>XtInheritMaxLines</entry>
163994689c1Smrg      <entry>XawTextSinkMaxLines</entry>
164994689c1Smrg      <entry>no</entry>
165994689c1Smrg    </row>
166994689c1Smrg    <row>
167994689c1Smrg      <entry>MaxHeight</entry>
168994689c1Smrg      <entry>XtInheritMaxHeight</entry>
169994689c1Smrg      <entry>XawTextSinkMaxHeight</entry>
170994689c1Smrg      <entry>no</entry>
171994689c1Smrg    </row>
172994689c1Smrg    <row>
173994689c1Smrg      <entry>SetTabs</entry>
174994689c1Smrg      <entry>XtInheritSetTabs</entry>
175994689c1Smrg      <entry>XawTextSinkSetTabs</entry>
176994689c1Smrg      <entry>no</entry>
177994689c1Smrg    </row>
178994689c1Smrg    <row>
179994689c1Smrg      <entry>GetCursorBounds</entry>
180994689c1Smrg      <entry>XtInheritGetCursorBounds</entry>
181994689c1Smrg      <entry>XawTextSinkGetCursorBounds</entry>
182994689c1Smrg      <entry>yes</entry>
183994689c1Smrg    </row>
184994689c1Smrg  </tbody>
185994689c1Smrg  </tgroup>
186994689c1Smrg</informaltable>
187994689c1Smrg</para>
188994689c1Smrg<sect3 id="Displaying_Text">
189994689c1Smrg<title>Displaying Text</title>
190994689c1Smrg<para>
191994689c1Smrg<!-- .LP -->
192994689c1SmrgTo display a section of the text buffer contained in the text source
193421c997bSmrguse the function <xref linkend='DisplayText' xrefstyle='select: title'/>:
1945ec34c4cSmrg<indexterm significance="preferred"><primary>TextSink object</primary><secondary>DisplayText</secondary></indexterm>
195421c997bSmrg<funcsynopsis id='DisplayText'>
196994689c1Smrg<funcprototype>
197994689c1Smrg  <funcdef>void<function> DisplayText</function></funcdef>
198994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
199994689c1Smrg  <paramdef>Positionx,<parameter> y</parameter></paramdef>
200994689c1Smrg  <paramdef>XawTextPositionpos1,<parameter> pos2</parameter></paramdef>
201994689c1Smrg  <paramdef>Boolean<parameter> highlight</parameter></paramdef>
202994689c1Smrg</funcprototype>
203994689c1Smrg</funcsynopsis>
204994689c1Smrg<!-- .FN -->
205994689c1Smrg<variablelist>
206994689c1Smrg  <varlistentry>
207994689c1Smrg    <term>
208994689c1Smrg      <emphasis remap='I'>w</emphasis>
209994689c1Smrg    </term>
210994689c1Smrg    <listitem>
211994689c1Smrg      <para>
212994689c1SmrgSpecifies the TextSink object.
213994689c1Smrg      </para>
214994689c1Smrg    </listitem>
215994689c1Smrg  </varlistentry>
216994689c1Smrg  <varlistentry>
217994689c1Smrg    <term>
218994689c1Smrg      <emphasis remap='I'>x</emphasis>
219994689c1Smrg    </term>
220994689c1Smrg    <listitem>
221994689c1Smrg      <para>
222994689c1SmrgSpecifies the x location to start drawing the text.
223994689c1Smrg      </para>
224994689c1Smrg    </listitem>
225994689c1Smrg  </varlistentry>
226994689c1Smrg  <varlistentry>
227994689c1Smrg    <term>
228994689c1Smrg      <emphasis remap='I'>y</emphasis>
229994689c1Smrg    </term>
230994689c1Smrg    <listitem>
231994689c1Smrg      <para>
232994689c1SmrgSpecifies the y location to start drawing text.
233994689c1Smrg      </para>
234994689c1Smrg    </listitem>
235994689c1Smrg  </varlistentry>
236994689c1Smrg  <varlistentry>
237994689c1Smrg    <term>
238994689c1Smrg      <emphasis remap='I'>pos1</emphasis>
239994689c1Smrg    </term>
240994689c1Smrg    <listitem>
241994689c1Smrg      <para>
242994689c1SmrgSpecifies the location within the text source of the first character
243994689c1Smrgto be printed.
244994689c1Smrg      </para>
245994689c1Smrg    </listitem>
246994689c1Smrg  </varlistentry>
247994689c1Smrg  <varlistentry>
248994689c1Smrg    <term>
249994689c1Smrg      <emphasis remap='I'>pos2</emphasis>
250994689c1Smrg    </term>
251994689c1Smrg    <listitem>
252994689c1Smrg      <para>
253994689c1SmrgSpecifies the location within the text source of the last character
254994689c1Smrgto be printed.
255994689c1Smrg      </para>
256994689c1Smrg    </listitem>
257994689c1Smrg  </varlistentry>
258994689c1Smrg  <varlistentry>
259994689c1Smrg    <term>
260994689c1Smrg      <emphasis remap='I'>highlight</emphasis>
261994689c1Smrg    </term>
262994689c1Smrg    <listitem>
263994689c1Smrg      <para>
264994689c1SmrgSpecifies whether or not to paint the text region highlighted.
265994689c1Smrg    </para>
266994689c1Smrg  </listitem>
267994689c1Smrg  </varlistentry>
268994689c1Smrg</variablelist>
269994689c1Smrg</para>
270994689c1Smrg<para>
271994689c1Smrg<!-- .LP -->
272994689c1SmrgThe Text widget will only pass one line at a time to the text sink, so
273994689c1Smrgthis function does not need to know how to line feed the text.  It is
274994689c1Smrgacceptable for this function to just ignore Carriage Returns.  <emphasis remap='I'>x</emphasis>
275994689c1Smrgand <emphasis remap='I'>y</emphasis> denote the upper left hand corner of the first character to
276994689c1Smrgbe displayed.
277994689c1Smrg</para>
278994689c1Smrg</sect3>
279994689c1Smrg<sect3 id="Displaying_the_Insert_Point">
280994689c1Smrg<title>Displaying the Insert Point</title>
281994689c1Smrg<para>
282994689c1Smrg<!-- .LP -->
283994689c1SmrgThe function that controls the display of the text cursor is
284421c997bSmrg<xref linkend='InsertCursor' xrefstyle='select: title'/>.  This function will be called whenever the text
285994689c1Smrgwidget desires to change the state of, or move the insert point.
286421c997bSmrg<funcsynopsis id='InsertCursor'>
287994689c1Smrg<funcprototype>
288994689c1Smrg  <funcdef>void<function> InsertCursor</function></funcdef>
289994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
290994689c1Smrg  <paramdef>Positionx,<parameter> y</parameter></paramdef>
291994689c1Smrg  <paramdef>XawTextInsertState<parameter> state</parameter></paramdef>
292994689c1Smrg</funcprototype>
293994689c1Smrg</funcsynopsis>
294994689c1Smrg<!-- .FN -->
295994689c1Smrg<variablelist>
296994689c1Smrg  <varlistentry>
297994689c1Smrg    <term>
298994689c1Smrg      <emphasis remap='I'>w</emphasis>
299994689c1Smrg    </term>
300994689c1Smrg    <listitem>
301994689c1Smrg      <para>
302994689c1SmrgSpecifies the TextSink object.
303994689c1Smrg      </para>
304994689c1Smrg    </listitem>
305994689c1Smrg  </varlistentry>
306994689c1Smrg  <varlistentry>
307994689c1Smrg    <term>
308994689c1Smrg      <emphasis remap='I'>x</emphasis>
309994689c1Smrg    </term>
310994689c1Smrg    <listitem>
311994689c1Smrg      <para>
312994689c1SmrgSpecifies the x location of the cursor in Pixels.
313994689c1Smrg      </para>
314994689c1Smrg    </listitem>
315994689c1Smrg  </varlistentry>
316994689c1Smrg  <varlistentry>
317994689c1Smrg    <term>
318994689c1Smrg      <emphasis remap='I'>y</emphasis>
319994689c1Smrg    </term>
320994689c1Smrg    <listitem>
321994689c1Smrg      <para>
322994689c1SmrgSpecifies the y location of the cursor in Pixels.
323994689c1Smrg      </para>
324994689c1Smrg    </listitem>
325994689c1Smrg  </varlistentry>
326994689c1Smrg  <varlistentry>
327994689c1Smrg    <term>
328994689c1Smrg      <emphasis remap='I'>state</emphasis>
329994689c1Smrg    </term>
330994689c1Smrg    <listitem>
331994689c1Smrg      <para>
332994689c1SmrgSpecifies the state of the cursor, may be one of <function>XawisOn</function> or
333994689c1Smrg<function>XawisOff</function>.
334994689c1Smrg    </para>
335994689c1Smrg  </listitem>
336994689c1Smrg  </varlistentry>
337994689c1Smrg</variablelist>
338994689c1Smrg</para>
339994689c1Smrg<para>
340994689c1Smrg<!-- .LP -->
341994689c1Smrg<emphasis remap='I'>X</emphasis> and <emphasis remap='I'>y</emphasis> denote the upper left hand corner of the insert point.
342994689c1Smrg</para>
343994689c1Smrg</sect3>
344994689c1Smrg<sect3 id="Clearing_Portions_of_the_Text_window">
345994689c1Smrg<title>Clearing Portions of the Text window</title>
346994689c1Smrg<para>
347994689c1Smrg<!-- .LP -->
348994689c1SmrgTo clear a portion of the Text window to its background color, the Text
349421c997bSmrgwidget will call <xref linkend='ClearToBackground' xrefstyle='select: title'/>.  The TextSink object already
350421c997bSmrgdefines this function as calling 
351421c997bSmrg<olink targetdoc='libX11' targetptr='XClearArea'><function>XClearArea</function></olink>
352421c997bSmrgon the region passed.
353994689c1SmrgThis behavior will be used if you specify
354994689c1Smrg<function>XtInheritClearToBackground</function> for this method.
3555ec34c4cSmrg<indexterm><primary>XtInheritClearToBackground</primary></indexterm>
3565ec34c4cSmrg<indexterm significance="preferred"><primary>TextSink object</primary><secondary>ClearToBackground</secondary></indexterm>
357421c997bSmrg<funcsynopsis id='ClearToBackground'>
358994689c1Smrg<funcprototype>
359994689c1Smrg  <funcdef>void<function> ClearToBackground</function></funcdef>
360994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
361994689c1Smrg  <paramdef>Positionx,<parameter> y</parameter></paramdef>
362994689c1Smrg  <paramdef>Dimensionwidth,<parameter> height</parameter></paramdef>
363994689c1Smrg</funcprototype>
364994689c1Smrg</funcsynopsis>
365994689c1Smrg<!-- .FN -->
366994689c1Smrg<variablelist>
367994689c1Smrg  <varlistentry>
368994689c1Smrg    <term>
369994689c1Smrg      <emphasis remap='I'>w</emphasis>
370994689c1Smrg    </term>
371994689c1Smrg    <listitem>
372994689c1Smrg      <para>
373994689c1SmrgSpecifies the TextSink object.
374994689c1Smrg      </para>
375994689c1Smrg    </listitem>
376994689c1Smrg  </varlistentry>
377994689c1Smrg  <varlistentry>
378994689c1Smrg    <term>
379994689c1Smrg      <emphasis remap='I'>x</emphasis>
380994689c1Smrg    </term>
381994689c1Smrg    <listitem>
382994689c1Smrg      <para>
383994689c1SmrgSpecifies the x location, in pixels, of the Region to clear.
384994689c1Smrg      </para>
385994689c1Smrg    </listitem>
386994689c1Smrg  </varlistentry>
387994689c1Smrg  <varlistentry>
388994689c1Smrg    <term>
389994689c1Smrg      <emphasis remap='I'>y</emphasis>
390994689c1Smrg    </term>
391994689c1Smrg    <listitem>
392994689c1Smrg      <para>
393994689c1SmrgSpecifies the y location, in pixels, of the Region to clear.
394994689c1Smrg      </para>
395994689c1Smrg    </listitem>
396994689c1Smrg  </varlistentry>
397994689c1Smrg  <varlistentry>
398994689c1Smrg    <term>
399994689c1Smrg      <emphasis remap='I'>width</emphasis>
400994689c1Smrg    </term>
401994689c1Smrg    <listitem>
402994689c1Smrg      <para>
403994689c1SmrgSpecifies the width, in pixels, of the Region to clear.
404994689c1Smrg      </para>
405994689c1Smrg    </listitem>
406994689c1Smrg  </varlistentry>
407994689c1Smrg  <varlistentry>
408994689c1Smrg    <term>
409994689c1Smrg      <emphasis remap='I'>height</emphasis>
410994689c1Smrg    </term>
411994689c1Smrg    <listitem>
412994689c1Smrg      <para>
413994689c1SmrgSpecifies the height, in pixels, of the Region to clear.
414994689c1Smrg    </para>
415994689c1Smrg  </listitem>
416994689c1Smrg  </varlistentry>
417994689c1Smrg</variablelist>
418994689c1Smrg</para>
419994689c1Smrg<para>
420994689c1Smrg<!-- .LP -->
421994689c1Smrg<emphasis remap='I'>X</emphasis> and <emphasis remap='I'>y</emphasis> denote the upper left hand corner of region to clear.
422994689c1Smrg</para>
423994689c1Smrg</sect3>
424994689c1Smrg<sect3 id="Finding_a_Text_Position_Given_Pixel_Values">
425994689c1Smrg<title>Finding a Text Position Given Pixel Values</title>
426994689c1Smrg<para>
427994689c1Smrg<!-- .LP -->
428994689c1SmrgTo find the text character position that will be rendered at a given x
429421c997bSmrglocation the Text widget uses the function <xref linkend='FindPosition' xrefstyle='select: title'/>:
4305ec34c4cSmrg<indexterm significance="preferred"><primary>TextSink object</primary><secondary>FindPosition</secondary></indexterm>
431421c997bSmrg<funcsynopsis id='FindPosition'>
432994689c1Smrg<funcprototype>
433994689c1Smrg  <funcdef>void<function> FindPosition</function></funcdef>
434994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
435994689c1Smrg  <paramdef>XawTextPosition<parameter> fromPos</parameter></paramdef>
436994689c1Smrg  <paramdef>intfromX,<parameter> width</parameter></paramdef>
437994689c1Smrg  <paramdef>Boolean<parameter> stopAtWordBreak</parameter></paramdef>
438994689c1Smrg  <paramdef>XawTextPosition<parameter> *pos_return</parameter></paramdef>
439994689c1Smrg  <paramdef>int*width_return,<parameter> *height_return</parameter></paramdef>
440994689c1Smrg</funcprototype>
441994689c1Smrg</funcsynopsis>
442994689c1Smrg<!-- .FN -->
443994689c1Smrg<variablelist>
444994689c1Smrg  <varlistentry>
445994689c1Smrg    <term>
446994689c1Smrg      <emphasis remap='I'>w</emphasis>
447994689c1Smrg    </term>
448994689c1Smrg    <listitem>
449994689c1Smrg      <para>
450994689c1SmrgSpecifies the TextSink object.
451994689c1Smrg      </para>
452994689c1Smrg    </listitem>
453994689c1Smrg  </varlistentry>
454994689c1Smrg  <varlistentry>
455994689c1Smrg    <term>
456994689c1Smrg      <emphasis remap='I'>fromPos</emphasis>
457994689c1Smrg    </term>
458994689c1Smrg    <listitem>
459994689c1Smrg      <para>
460994689c1SmrgSpecifies a reference position, usually the first character in this line.
461994689c1SmrgThis character is always to the left of the desired character location.
462994689c1Smrg      </para>
463994689c1Smrg    </listitem>
464994689c1Smrg  </varlistentry>
465994689c1Smrg  <varlistentry>
466994689c1Smrg    <term>
467994689c1Smrg      <emphasis remap='I'>fromX</emphasis>
468994689c1Smrg    </term>
469994689c1Smrg    <listitem>
470994689c1Smrg      <para>
471994689c1SmrgSpecifies the distance that the left edge of <emphasis remap='I'>fromPos</emphasis> is from the
472994689c1Smrgleft edge of the window.  This is the reference x location for the
473994689c1Smrgreference position.
474994689c1Smrg      </para>
475994689c1Smrg    </listitem>
476994689c1Smrg  </varlistentry>
477994689c1Smrg  <varlistentry>
478994689c1Smrg    <term>
479994689c1Smrg      <emphasis remap='I'>width</emphasis>
480994689c1Smrg    </term>
481994689c1Smrg    <listitem>
482994689c1Smrg      <para>
483994689c1SmrgSpecifies the distance, in pixels, from the reference position to the
484994689c1Smrgdesired character position.
485994689c1Smrg      </para>
486994689c1Smrg    </listitem>
487994689c1Smrg  </varlistentry>
488994689c1Smrg  <varlistentry>
489994689c1Smrg    <term>
490994689c1Smrg      <emphasis remap='I'>stopAtWordBreak</emphasis>
491994689c1Smrg    </term>
492994689c1Smrg    <listitem>
493994689c1Smrg      <para>
494994689c1SmrgSpecifies whether or not the position that is returned should be forced
495994689c1Smrgto be on a word boundary.
496994689c1Smrg      </para>
497994689c1Smrg    </listitem>
498994689c1Smrg  </varlistentry>
499994689c1Smrg  <varlistentry>
500994689c1Smrg    <term>
501994689c1Smrg      <emphasis remap='I'>pos_return</emphasis>
502994689c1Smrg    </term>
503994689c1Smrg    <listitem>
504994689c1Smrg      <para>
505994689c1SmrgReturns the character position that corresponds to the location that has
506994689c1Smrgbeen specified, or the work break immediately to the left of the
507994689c1Smrgposition if <emphasis remap='I'>stopAtWordBreak</emphasis> is <function>True</function>.
508994689c1Smrg      </para>
509994689c1Smrg    </listitem>
510994689c1Smrg  </varlistentry>
511994689c1Smrg  <varlistentry>
512994689c1Smrg    <term>
513994689c1Smrg      <emphasis remap='I'>width_return</emphasis>
514994689c1Smrg    </term>
515994689c1Smrg    <listitem>
516994689c1Smrg      <para>
517994689c1SmrgReturns the actual distance between <emphasis remap='I'>fromPos</emphasis> and <emphasis remap='I'>pos_return</emphasis>.
518994689c1Smrg      </para>
519994689c1Smrg    </listitem>
520994689c1Smrg  </varlistentry>
521994689c1Smrg  <varlistentry>
522994689c1Smrg    <term>
523994689c1Smrg      <emphasis remap='I'>height_return</emphasis>
524994689c1Smrg    </term>
525994689c1Smrg    <listitem>
526994689c1Smrg      <para>
527994689c1SmrgReturns the maximum height of the text between <emphasis remap='I'>fromPos</emphasis> and
528994689c1Smrg<emphasis remap='I'>pos_return</emphasis>.
529994689c1Smrg    </para>
530994689c1Smrg  </listitem>
531994689c1Smrg  </varlistentry>
532994689c1Smrg</variablelist>
533994689c1Smrg</para>
534994689c1Smrg<para>
535994689c1Smrg<!-- .LP -->
536994689c1SmrgThis function need make no attempt to deal with line feeds.  The text
537994689c1Smrgwidget will only call it one line at a time.
538994689c1Smrg</para>
539994689c1Smrg<para>
540994689c1Smrg<!-- .LP -->
541994689c1Smrg<!-- .sp -->
542421c997bSmrgAnother means of finding a text position is provided by the <xref linkend='Resolve' xrefstyle='select: title'/>
543994689c1Smrgfunction:
5445ec34c4cSmrg<indexterm significance="preferred"><primary>TextSink object</primary><secondary>Resolve</secondary></indexterm>
545421c997bSmrg<funcsynopsis id='Resolve'>
546994689c1Smrg<funcprototype>
547994689c1Smrg  <funcdef>void<function> Resolve</function></funcdef>
548994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
549994689c1Smrg  <paramdef>XawTextPosition<parameter> fromPos</parameter></paramdef>
550994689c1Smrg  <paramdef>intfromX,<parameter> width</parameter></paramdef>
551994689c1Smrg  <paramdef>XawTextPosition<parameter> *pos_return</parameter></paramdef>
552994689c1Smrg</funcprototype>
553994689c1Smrg</funcsynopsis>
554994689c1Smrg<!-- .FN -->
555994689c1Smrg<variablelist>
556994689c1Smrg  <varlistentry>
557994689c1Smrg    <term>
558994689c1Smrg      <emphasis remap='I'>w</emphasis>
559994689c1Smrg    </term>
560994689c1Smrg    <listitem>
561994689c1Smrg      <para>
562994689c1SmrgSpecifies the TextSink object.
563994689c1Smrg      </para>
564994689c1Smrg    </listitem>
565994689c1Smrg  </varlistentry>
566994689c1Smrg  <varlistentry>
567994689c1Smrg    <term>
568994689c1Smrg      <emphasis remap='I'>fromPos</emphasis>
569994689c1Smrg    </term>
570994689c1Smrg    <listitem>
571994689c1Smrg      <para>
572994689c1SmrgSpecifies a reference position, usually the first character in this line.
573994689c1SmrgThis character is always to the left of the desired character location.
574994689c1Smrg      </para>
575994689c1Smrg    </listitem>
576994689c1Smrg  </varlistentry>
577994689c1Smrg  <varlistentry>
578994689c1Smrg    <term>
579994689c1Smrg      <emphasis remap='I'>fromX</emphasis>
580994689c1Smrg    </term>
581994689c1Smrg    <listitem>
582994689c1Smrg      <para>
583994689c1SmrgSpecifies the distance that the left edge of <emphasis remap='I'>fromPos</emphasis> is from the
584994689c1Smrgleft edge of the window.  This is the reference x location for the
585994689c1Smrgreference position.
586994689c1Smrg      </para>
587994689c1Smrg    </listitem>
588994689c1Smrg  </varlistentry>
589994689c1Smrg  <varlistentry>
590994689c1Smrg    <term>
591994689c1Smrg      <emphasis remap='I'>width</emphasis>
592994689c1Smrg    </term>
593994689c1Smrg    <listitem>
594994689c1Smrg      <para>
595994689c1SmrgSpecifies the distance, in pixels, from the reference position to the
596994689c1Smrgdesired character position.
597994689c1Smrg      </para>
598994689c1Smrg    </listitem>
599994689c1Smrg  </varlistentry>
600994689c1Smrg  <varlistentry>
601994689c1Smrg    <term>
602994689c1Smrg      <emphasis remap='I'>pos_return</emphasis>
603994689c1Smrg    </term>
604994689c1Smrg    <listitem>
605994689c1Smrg      <para>
606994689c1SmrgReturns the character position that corresponds to the
607994689c1Smrglocation that has been specified, or the word break immediately to the left
608994689c1Smrgif <emphasis remap='I'>stopAtWordBreak</emphasis> is <function>True</function>.
609994689c1Smrg    </para>
610994689c1Smrg  </listitem>
611994689c1Smrg  </varlistentry>
612994689c1Smrg</variablelist>
613994689c1Smrg</para>
614994689c1Smrg<para>
615994689c1Smrg<!-- .LP -->
616994689c1SmrgThis function need make no attempt to deal with line feeds.  The text
617994689c1Smrgwidget will only call it one line at a time.  This is a more convenient
618421c997bSmrginterface to the <xref linkend='FindPosition' xrefstyle='select: title'/> function, and provides a subset of its
619994689c1Smrgfunctionality.
6205ec34c4cSmrg<indexterm><primary>FindPosition</primary></indexterm>
621994689c1Smrg</para>
622994689c1Smrg</sect3>
623994689c1Smrg<sect3 id="Finding_the_Distance_Between_two_Text_Positions">
624994689c1Smrg<title>Finding the Distance Between two Text Positions</title>
625994689c1Smrg<para>
626994689c1Smrg<!-- .LP -->
627994689c1SmrgTo find the distance in pixels between two text positions on the same
628421c997bSmrgline use the function <xref linkend='FindDistance' xrefstyle='select: title'/>.
6295ec34c4cSmrg<indexterm significance="preferred"><primary>TextSink object</primary><secondary>FindDistance</secondary></indexterm>
630421c997bSmrg<funcsynopsis id='FindDistance'>
631994689c1Smrg<funcprototype>
632994689c1Smrg  <funcdef>void<function> FindDistance</function></funcdef>
633994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
634994689c1Smrg  <paramdef>XawTextPositionfromPos,<parameter> toPos</parameter></paramdef>
635994689c1Smrg  <paramdef>int<parameter> fromX</parameter></paramdef>
636994689c1Smrg  <paramdef>XawTextPosition<parameter> *pos_return</parameter></paramdef>
637994689c1Smrg  <paramdef>int*width_return,<parameter> *height_return</parameter></paramdef>
638994689c1Smrg</funcprototype>
639994689c1Smrg</funcsynopsis>
640994689c1Smrg<!-- .FN -->
641994689c1Smrg<variablelist>
642994689c1Smrg  <varlistentry>
643994689c1Smrg    <term>
644994689c1Smrg      <emphasis remap='I'>w</emphasis>
645994689c1Smrg    </term>
646994689c1Smrg    <listitem>
647994689c1Smrg      <para>
648994689c1SmrgSpecifies the TextSink object.
649994689c1Smrg      </para>
650994689c1Smrg    </listitem>
651994689c1Smrg  </varlistentry>
652994689c1Smrg  <varlistentry>
653994689c1Smrg    <term>
654994689c1Smrg      <emphasis remap='I'>fromPos</emphasis>
655994689c1Smrg    </term>
656994689c1Smrg    <listitem>
657994689c1Smrg      <para>
658994689c1SmrgSpecifies the text buffer position, in characters, of the first position.
659994689c1Smrg      </para>
660994689c1Smrg    </listitem>
661994689c1Smrg  </varlistentry>
662994689c1Smrg  <varlistentry>
663994689c1Smrg    <term>
664994689c1Smrg      <emphasis remap='I'>fromX</emphasis>
665994689c1Smrg    </term>
666994689c1Smrg    <listitem>
667994689c1Smrg      <para>
668994689c1SmrgSpecifies the distance that the left edge of <emphasis remap='I'>fromPos</emphasis> is from the
669994689c1Smrgleft edge of the window.  This is the reference x location for the
670994689c1Smrgreference position.
671994689c1Smrg      </para>
672994689c1Smrg    </listitem>
673994689c1Smrg  </varlistentry>
674994689c1Smrg  <varlistentry>
675994689c1Smrg    <term>
676994689c1Smrg      <emphasis remap='I'>toPos</emphasis>
677994689c1Smrg    </term>
678994689c1Smrg    <listitem>
679994689c1Smrg      <para>
680994689c1SmrgSpecifies the text buffer position, in characters, of the second position.
681994689c1Smrg      </para>
682994689c1Smrg    </listitem>
683994689c1Smrg  </varlistentry>
684994689c1Smrg  <varlistentry>
685994689c1Smrg    <term>
686994689c1Smrg      <emphasis remap='I'>resWidth</emphasis>
687994689c1Smrg    </term>
688994689c1Smrg    <listitem>
689994689c1Smrg      <para>
690994689c1SmrgReturn the actual distance between <emphasis remap='I'>fromPos</emphasis>
691994689c1Smrgand <emphasis remap='I'>pos_return</emphasis>.
692994689c1Smrg      </para>
693994689c1Smrg    </listitem>
694994689c1Smrg  </varlistentry>
695994689c1Smrg  <varlistentry>
696994689c1Smrg    <term>
697994689c1Smrg      <emphasis remap='I'>resPos</emphasis>
698994689c1Smrg    </term>
699994689c1Smrg    <listitem>
700994689c1Smrg      <para>
701994689c1SmrgReturns the character position that corresponds to the actual character
702994689c1Smrgposition used for <emphasis remap='I'>toPos</emphasis> in the calculations.  This may be
703994689c1Smrgdifferent than <emphasis remap='I'>toPos</emphasis>, for example if <emphasis remap='I'>fromPos</emphasis> and <emphasis remap='I'>toPos</emphasis>
704994689c1Smrgare on different lines in the file.
705994689c1Smrg      </para>
706994689c1Smrg    </listitem>
707994689c1Smrg  </varlistentry>
708994689c1Smrg  <varlistentry>
709994689c1Smrg    <term>
710994689c1Smrg      <emphasis remap='I'>height_return</emphasis>
711994689c1Smrg    </term>
712994689c1Smrg    <listitem>
713994689c1Smrg      <para>
714994689c1SmrgReturns the maximum height of the text between <emphasis remap='I'>fromPos</emphasis> and
715994689c1Smrg<emphasis remap='I'>pos_return</emphasis>.
716994689c1Smrg    </para>
717994689c1Smrg  </listitem>
718994689c1Smrg  </varlistentry>
719994689c1Smrg</variablelist>
720994689c1Smrg</para>
721994689c1Smrg<para>
722994689c1Smrg<!-- .LP -->
723994689c1SmrgThis function need make no attempt to deal with line feeds.  The Text
724994689c1Smrgwidget will only call it one line at a time.
725994689c1Smrg</para>
726994689c1Smrg</sect3>
727994689c1Smrg<sect3 id="Finding_the_Size_of_the_Drawing_area">
728994689c1Smrg<title>Finding the Size of the Drawing area</title>
729994689c1Smrg<para>
730994689c1Smrg<!-- .LP -->
731994689c1SmrgTo find the maximum number of lines that will fit into the current Text
732421c997bSmrgwidget, use the function <xref linkend='MaxLines' xrefstyle='select: title'/>.  The TextSink already defines
733994689c1Smrgthis function to compute the maximum number of lines by using the height
734994689c1Smrgof <function>font</function>.
7355ec34c4cSmrg<indexterm significance="preferred"><primary>TextSink object</primary><secondary>MaxLines</secondary></indexterm>
736421c997bSmrg<funcsynopsis id='MaxLines'>
737994689c1Smrg<funcprototype>
738994689c1Smrg  <funcdef>int<function> MaxLines</function></funcdef>
739994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
740994689c1Smrg  <paramdef>Dimension<parameter> height</parameter></paramdef>
741994689c1Smrg</funcprototype>
742994689c1Smrg</funcsynopsis>
743994689c1Smrg<!-- .FN -->
744994689c1Smrg<variablelist>
745994689c1Smrg  <varlistentry>
746994689c1Smrg    <term>
747994689c1Smrg      <emphasis remap='I'>w</emphasis>
748994689c1Smrg    </term>
749994689c1Smrg    <listitem>
750994689c1Smrg      <para>
751994689c1SmrgSpecifies the TextSink object.
752994689c1Smrg      </para>
753994689c1Smrg    </listitem>
754994689c1Smrg  </varlistentry>
755994689c1Smrg  <varlistentry>
756994689c1Smrg    <term>
757994689c1Smrg      <emphasis remap='I'>height</emphasis>
758994689c1Smrg    </term>
759994689c1Smrg    <listitem>
760994689c1Smrg      <para>
761994689c1SmrgSpecifies the height of the current drawing area.
762994689c1Smrg    </para>
763994689c1Smrg  </listitem>
764994689c1Smrg  </varlistentry>
765994689c1Smrg</variablelist>
766994689c1Smrg</para>
767994689c1Smrg<para>
768994689c1Smrg<!-- .LP -->
769994689c1SmrgReturns the maximum number of lines that will fit in <emphasis remap='I'>height</emphasis>.
770994689c1Smrg</para>
771994689c1Smrg<para>
772994689c1Smrg<!-- .LP -->
773994689c1Smrg<!-- .sp -->
774994689c1SmrgTo find the height required for a given number of text lines, use
775421c997bSmrgthe function <xref linkend='MaxHeight' xrefstyle='select: title'/>.  The TextSink already defines this
776994689c1Smrgfunction to compute the maximum height of the window by using the
777994689c1Smrgheight of <function>font</function>.
7785ec34c4cSmrg<indexterm significance="preferred"><primary>TextSink object</primary><secondary>MaxHeight</secondary></indexterm>
779421c997bSmrg<funcsynopsis id='MaxHeight'>
780994689c1Smrg<funcprototype>
781994689c1Smrg  <funcdef>int<function> MaxHeight</function></funcdef>
782994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
783994689c1Smrg  <paramdef>int<parameter> lines</parameter></paramdef>
784994689c1Smrg</funcprototype>
785994689c1Smrg</funcsynopsis>
786994689c1Smrg<!-- .FN -->
787994689c1Smrg<variablelist>
788994689c1Smrg  <varlistentry>
789994689c1Smrg    <term>
790994689c1Smrg      <emphasis remap='I'>w</emphasis>
791994689c1Smrg    </term>
792994689c1Smrg    <listitem>
793994689c1Smrg      <para>
794994689c1SmrgSpecifies the TextSink object.
795994689c1Smrg      </para>
796994689c1Smrg    </listitem>
797994689c1Smrg  </varlistentry>
798994689c1Smrg  <varlistentry>
799994689c1Smrg    <term>
800994689c1Smrg      <emphasis remap='I'>height</emphasis>
801994689c1Smrg    </term>
802994689c1Smrg    <listitem>
803994689c1Smrg      <para>
804994689c1SmrgSpecifies the height of the current drawing area.
805994689c1Smrg    </para>
806994689c1Smrg  </listitem>
807994689c1Smrg  </varlistentry>
808994689c1Smrg</variablelist>
809994689c1Smrg</para>
810994689c1Smrg<para>
811994689c1Smrg<!-- .LP -->
812994689c1SmrgReturns the height that will be taken up by the number of lines passed.
813994689c1Smrg</para>
814994689c1Smrg</sect3>
815994689c1Smrg<sect3 id="Setting_the_Tab_Stops">
816994689c1Smrg<title>Setting the Tab Stops</title>
817994689c1Smrg<para>
818994689c1Smrg<!-- .LP -->
819421c997bSmrgTo set the tab stops for a text sink use the <xref linkend='SetTabs' xrefstyle='select: title'/> function.
820994689c1SmrgThe TextSink already defines this function to set the tab x location in
821994689c1Smrgpixels to be the number of characters times the figure width of
822994689c1Smrg<function>font</function>.
8235ec34c4cSmrg<indexterm significance="preferred"><primary>TextSink object</primary><secondary>SetTabs</secondary></indexterm>
824421c997bSmrg<funcsynopsis id='SetTabs'>
825994689c1Smrg<funcprototype>
826994689c1Smrg  <funcdef>void<function> SetTabs</function></funcdef>
827994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
828994689c1Smrg  <paramdef>inttab_count,<parameter> *tabs</parameter></paramdef>
829994689c1Smrg</funcprototype>
830994689c1Smrg</funcsynopsis>
831994689c1Smrg<!-- .FN -->
832994689c1Smrg<variablelist>
833994689c1Smrg  <varlistentry>
834994689c1Smrg    <term>
835994689c1Smrg      <emphasis remap='I'>w</emphasis>
836994689c1Smrg    </term>
837994689c1Smrg    <listitem>
838994689c1Smrg      <para>
839994689c1SmrgSpecifies the TextSink object.
840994689c1Smrg      </para>
841994689c1Smrg    </listitem>
842994689c1Smrg  </varlistentry>
843994689c1Smrg  <varlistentry>
844994689c1Smrg    <term>
845994689c1Smrg      <emphasis remap='I'>tab_count</emphasis>
846994689c1Smrg    </term>
847994689c1Smrg    <listitem>
848994689c1Smrg      <para>
849994689c1SmrgSpecifies the number of tabs passed in <emphasis remap='I'>tabs</emphasis>.
850994689c1Smrg      </para>
851994689c1Smrg    </listitem>
852994689c1Smrg  </varlistentry>
853994689c1Smrg  <varlistentry>
854994689c1Smrg    <term>
855994689c1Smrg      <emphasis remap='I'>tabs</emphasis>
856994689c1Smrg    </term>
857994689c1Smrg    <listitem>
858994689c1Smrg      <para>
859994689c1SmrgSpecifies the position, in characters, of the tab stops.
860994689c1Smrg    </para>
861994689c1Smrg  </listitem>
862994689c1Smrg  </varlistentry>
863994689c1Smrg</variablelist>
864994689c1Smrg</para>
865994689c1Smrg<para>
866994689c1Smrg<!-- .LP -->
867994689c1SmrgThis function is responsible for the converting character positions passed
868994689c1Smrgto it into whatever internal positions the TextSink uses for tab placement.
869994689c1Smrg</para>
870994689c1Smrg</sect3>
871421c997bSmrg<sect3 id='Getting_the_Insert_Points_Size_and_Location'>
872994689c1Smrg<title>Getting the Insert Point's Size and Location</title>
873994689c1Smrg<para>
874994689c1Smrg<!-- .LP -->
875994689c1SmrgTo get the size and location of the insert point use the
876421c997bSmrg<xref linkend='GetCursorBounds' xrefstyle='select: title'/> function.
8775ec34c4cSmrg<indexterm significance="preferred"><primary>TextSink object</primary><secondary>GetCursorBounds</secondary></indexterm>
878421c997bSmrg<funcsynopsis id='GetCursorBounds'>
879994689c1Smrg<funcprototype>
880994689c1Smrg  <funcdef>void<function> GetCursorBounds</function></funcdef>
881994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
882994689c1Smrg  <paramdef>XRectangle<parameter> *rect_return</parameter></paramdef>
883994689c1Smrg</funcprototype>
884994689c1Smrg</funcsynopsis>
885994689c1Smrg<!-- .FN -->
886994689c1Smrg<variablelist>
887994689c1Smrg  <varlistentry>
888994689c1Smrg    <term>
889994689c1Smrg      <emphasis remap='I'>w</emphasis>
890994689c1Smrg    </term>
891994689c1Smrg    <listitem>
892994689c1Smrg      <para>
893994689c1SmrgSpecifies the TextSinkObject.
894994689c1Smrg      </para>
895994689c1Smrg    </listitem>
896994689c1Smrg  </varlistentry>
897994689c1Smrg  <varlistentry>
898994689c1Smrg    <term>
899994689c1Smrg      <emphasis remap='I'>rect_return</emphasis>
900994689c1Smrg    </term>
901994689c1Smrg    <listitem>
902994689c1Smrg      <para>
903994689c1SmrgReturns the location and size of the insert point.
904994689c1Smrg    </para>
905994689c1Smrg  </listitem>
906994689c1Smrg  </varlistentry>
907994689c1Smrg</variablelist>
908994689c1Smrg</para>
909994689c1Smrg<para>
910994689c1Smrg<!-- .LP -->
911994689c1Smrg<emphasis remap='I'>Rect</emphasis> will be filled with the current size and location of the
912994689c1Smrginsert point.
913994689c1Smrg
914994689c1Smrg</para>
915994689c1Smrg</sect3>
916994689c1Smrg</sect2>
917994689c1Smrg</sect1>
918