1<sect1 id="TextSink_Object">
2<title>TextSink Object</title>
3<para>
4<!-- .LP -->
5<!-- .XS -->
6<!-- 	TextSink Object -->
7<!-- .XE -->
8<indexterm significance="preferred"><primary>TextSink object</primary></indexterm>
9</para>
10<para>
11<!-- .LP -->
12<literallayout class="monospaced">
13<!-- .TA 2.0i -->
14<!-- .ta 2.0i -->
15Application Header file	&lt;X11/Xaw/TextSink.h&gt;
16<indexterm><primary>TextSink.h</primary></indexterm>
17Class Header file	&lt;X11/Xaw/TextSinkP.h&gt;
18<indexterm><primary>TextSinkP.h</primary></indexterm>
19Class		textSinkObjectClass
20<indexterm><primary>textSinkObjectClass</primary></indexterm>
21Class Name	TextSink
22<indexterm><primary>TextSink object</primary><secondary>class name</secondary></indexterm>
23Superclass	Object
24</literallayout>
25</para>
26<para>
27<!-- .LP -->
28The TextSink object is the root object for all text sinks.  Any new text
29sink objects should be subclasses of the TextSink Object.  The TextSink
30Class contains all methods that the Text widget expects a text sink to
31export.
32</para>
33<para>
34<!-- .LP -->
35Since all text sinks will have some resources in common, the TextSink
36defines a few new resources.
37</para>
38<sect2 id='TextSink::Resources'>
39<title>Resources</title>
40<para>
41<!-- .LP -->
42When creating an TextSink object instance, the following resources are
43retrieved from the argument list or from the resource database:
44</para>
45<para>
46<!-- .LP -->
47<indexterm><primary>AsciiSink object</primary><secondary>resources</secondary></indexterm>
48<informaltable>
49  <tgroup cols='5' align='center'>
50  <colspec colname='c1'/>
51  <colspec colname='c2'/>
52  <colspec colname='c3'/>
53  <colspec colname='c4'/>
54  <colspec colname='c5'/>
55  <thead>
56    <row>
57      <entry>Name</entry>
58      <entry>Class</entry>
59      <entry>Type</entry>
60      <entry>Notes</entry>
61      <entry>Default Value</entry>
62    </row>
63  </thead>
64  <tbody>
65    <row>
66      <entry>background</entry>
67      <entry>Background</entry>
68      <entry>Pixel</entry>
69      <entry></entry>
70      <entry>XtDefaultBackground</entry>
71    </row>
72    <row>
73      <entry>destroyCallback</entry>
74      <entry>Callback</entry>
75      <entry>XtCallbackList</entry>
76      <entry></entry>
77      <entry>NULL</entry>
78    </row>
79    <row>
80      <entry>foreground</entry>
81      <entry>Foreground</entry>
82      <entry>Pixel</entry>
83      <entry></entry>
84      <entry>XtDefaultForeground</entry>
85    </row>
86    <row>
87      <entry>_</entry>
88    </row>
89  </tbody>
90  </tgroup>
91</informaltable>
92<!-- .Bg Bold -->
93<!-- .Dc -->
94<!-- .Sg Bold -->
95</para>
96</sect2>
97<sect2 id="Subclassing_the_TextSink">
98<title>Subclassing the TextSink</title>
99<indexterm significance="preferred"><primary>TextSink object</primary><secondary>subclassing</secondary></indexterm>
100<para>
101<!-- .LP -->
102The only purpose of the TextSink Object is to be subclassed.  It
103contains the minimum set of class methods that all text sinks must have.
104While all may be inherited, the direct descendant of TextSink <function>must
105specify</function> some of them as TextSink does contain enough information to
106be a valid text sink by itself.  Do not try to use
107the TextSink as a valid sink for the Text widget; it is not intended
108to be used as a sink by itself.
109<informaltable>
110  <tgroup cols='4' align='center'>
111  <colspec colname='c1'/>
112  <colspec colname='c2'/>
113  <colspec colname='c3'/>
114  <colspec colname='c4'/>
115  <thead>
116    <row>
117      <entry>Function</entry>
118      <entry>Inherit with</entry>
119      <entry>Public Interface</entry>
120      <entry>must specify</entry>
121    </row>
122  </thead>
123  <tbody>
124    <row>
125      <entry>DisplayText</entry>
126      <entry>XtInheritDisplayText</entry>
127      <entry>XawTextSinkDisplayText</entry>
128      <entry>yes</entry>
129    </row>
130    <row>
131      <entry>InsertCursor</entry>
132      <entry>XtInheritInsertCursor</entry>
133      <entry>XawTextSinkInsertCursor</entry>
134      <entry>yes</entry>
135    </row>
136    <row>
137      <entry>ClearToBackground</entry>
138      <entry>XtInheritClearToBackground</entry>
139      <entry>XawTextSinkClearToBackground</entry>
140      <entry>no</entry>
141    </row>
142    <row>
143      <entry>FindPosition</entry>
144      <entry>XtInheritFindPosition</entry>
145      <entry>XawTextSinkFindPosition</entry>
146      <entry>yes</entry>
147    </row>
148    <row>
149      <entry>FindDistance</entry>
150      <entry>XtInheritFindDistance</entry>
151      <entry>XawTextSinkFindDistance</entry>
152      <entry>yes</entry>
153    </row>
154    <row>
155      <entry>Resolve</entry>
156      <entry>XtInheritResolve</entry>
157      <entry>XawTextSinkResolve</entry>
158      <entry>yes</entry>
159    </row>
160    <row>
161      <entry>MaxLines</entry>
162      <entry>XtInheritMaxLines</entry>
163      <entry>XawTextSinkMaxLines</entry>
164      <entry>no</entry>
165    </row>
166    <row>
167      <entry>MaxHeight</entry>
168      <entry>XtInheritMaxHeight</entry>
169      <entry>XawTextSinkMaxHeight</entry>
170      <entry>no</entry>
171    </row>
172    <row>
173      <entry>SetTabs</entry>
174      <entry>XtInheritSetTabs</entry>
175      <entry>XawTextSinkSetTabs</entry>
176      <entry>no</entry>
177    </row>
178    <row>
179      <entry>GetCursorBounds</entry>
180      <entry>XtInheritGetCursorBounds</entry>
181      <entry>XawTextSinkGetCursorBounds</entry>
182      <entry>yes</entry>
183    </row>
184  </tbody>
185  </tgroup>
186</informaltable>
187</para>
188<sect3 id="Displaying_Text">
189<title>Displaying Text</title>
190<para>
191<!-- .LP -->
192To display a section of the text buffer contained in the text source
193use the function <xref linkend='DisplayText' xrefstyle='select: title'/>:
194<indexterm significance="preferred"><primary>TextSink object</primary><secondary>DisplayText</secondary></indexterm>
195<funcsynopsis id='DisplayText'>
196<funcprototype>
197  <funcdef>void<function> DisplayText</function></funcdef>
198  <paramdef>Widget<parameter> w</parameter></paramdef>
199  <paramdef>Positionx,<parameter> y</parameter></paramdef>
200  <paramdef>XawTextPositionpos1,<parameter> pos2</parameter></paramdef>
201  <paramdef>Boolean<parameter> highlight</parameter></paramdef>
202</funcprototype>
203</funcsynopsis>
204<!-- .FN -->
205<variablelist>
206  <varlistentry>
207    <term>
208      <emphasis remap='I'>w</emphasis>
209    </term>
210    <listitem>
211      <para>
212Specifies the TextSink object.
213      </para>
214    </listitem>
215  </varlistentry>
216  <varlistentry>
217    <term>
218      <emphasis remap='I'>x</emphasis>
219    </term>
220    <listitem>
221      <para>
222Specifies the x location to start drawing the text.
223      </para>
224    </listitem>
225  </varlistentry>
226  <varlistentry>
227    <term>
228      <emphasis remap='I'>y</emphasis>
229    </term>
230    <listitem>
231      <para>
232Specifies the y location to start drawing text.
233      </para>
234    </listitem>
235  </varlistentry>
236  <varlistentry>
237    <term>
238      <emphasis remap='I'>pos1</emphasis>
239    </term>
240    <listitem>
241      <para>
242Specifies the location within the text source of the first character
243to be printed.
244      </para>
245    </listitem>
246  </varlistentry>
247  <varlistentry>
248    <term>
249      <emphasis remap='I'>pos2</emphasis>
250    </term>
251    <listitem>
252      <para>
253Specifies the location within the text source of the last character
254to be printed.
255      </para>
256    </listitem>
257  </varlistentry>
258  <varlistentry>
259    <term>
260      <emphasis remap='I'>highlight</emphasis>
261    </term>
262    <listitem>
263      <para>
264Specifies whether or not to paint the text region highlighted.
265    </para>
266  </listitem>
267  </varlistentry>
268</variablelist>
269</para>
270<para>
271<!-- .LP -->
272The Text widget will only pass one line at a time to the text sink, so
273this function does not need to know how to line feed the text.  It is
274acceptable for this function to just ignore Carriage Returns.  <emphasis remap='I'>x</emphasis>
275and <emphasis remap='I'>y</emphasis> denote the upper left hand corner of the first character to
276be displayed.
277</para>
278</sect3>
279<sect3 id="Displaying_the_Insert_Point">
280<title>Displaying the Insert Point</title>
281<para>
282<!-- .LP -->
283The function that controls the display of the text cursor is
284<xref linkend='InsertCursor' xrefstyle='select: title'/>.  This function will be called whenever the text
285widget desires to change the state of, or move the insert point.
286<funcsynopsis id='InsertCursor'>
287<funcprototype>
288  <funcdef>void<function> InsertCursor</function></funcdef>
289  <paramdef>Widget<parameter> w</parameter></paramdef>
290  <paramdef>Positionx,<parameter> y</parameter></paramdef>
291  <paramdef>XawTextInsertState<parameter> state</parameter></paramdef>
292</funcprototype>
293</funcsynopsis>
294<!-- .FN -->
295<variablelist>
296  <varlistentry>
297    <term>
298      <emphasis remap='I'>w</emphasis>
299    </term>
300    <listitem>
301      <para>
302Specifies the TextSink object.
303      </para>
304    </listitem>
305  </varlistentry>
306  <varlistentry>
307    <term>
308      <emphasis remap='I'>x</emphasis>
309    </term>
310    <listitem>
311      <para>
312Specifies the x location of the cursor in Pixels.
313      </para>
314    </listitem>
315  </varlistentry>
316  <varlistentry>
317    <term>
318      <emphasis remap='I'>y</emphasis>
319    </term>
320    <listitem>
321      <para>
322Specifies the y location of the cursor in Pixels.
323      </para>
324    </listitem>
325  </varlistentry>
326  <varlistentry>
327    <term>
328      <emphasis remap='I'>state</emphasis>
329    </term>
330    <listitem>
331      <para>
332Specifies the state of the cursor, may be one of <function>XawisOn</function> or
333<function>XawisOff</function>.
334    </para>
335  </listitem>
336  </varlistentry>
337</variablelist>
338</para>
339<para>
340<!-- .LP -->
341<emphasis remap='I'>X</emphasis> and <emphasis remap='I'>y</emphasis> denote the upper left hand corner of the insert point.
342</para>
343</sect3>
344<sect3 id="Clearing_Portions_of_the_Text_window">
345<title>Clearing Portions of the Text window</title>
346<para>
347<!-- .LP -->
348To clear a portion of the Text window to its background color, the Text
349widget will call <xref linkend='ClearToBackground' xrefstyle='select: title'/>.  The TextSink object already
350defines this function as calling 
351<olink targetdoc='libX11' targetptr='XClearArea'><function>XClearArea</function></olink>
352on the region passed.
353This behavior will be used if you specify
354<function>XtInheritClearToBackground</function> for this method.
355<indexterm><primary>XtInheritClearToBackground</primary></indexterm>
356<indexterm significance="preferred"><primary>TextSink object</primary><secondary>ClearToBackground</secondary></indexterm>
357<funcsynopsis id='ClearToBackground'>
358<funcprototype>
359  <funcdef>void<function> ClearToBackground</function></funcdef>
360  <paramdef>Widget<parameter> w</parameter></paramdef>
361  <paramdef>Positionx,<parameter> y</parameter></paramdef>
362  <paramdef>Dimensionwidth,<parameter> height</parameter></paramdef>
363</funcprototype>
364</funcsynopsis>
365<!-- .FN -->
366<variablelist>
367  <varlistentry>
368    <term>
369      <emphasis remap='I'>w</emphasis>
370    </term>
371    <listitem>
372      <para>
373Specifies the TextSink object.
374      </para>
375    </listitem>
376  </varlistentry>
377  <varlistentry>
378    <term>
379      <emphasis remap='I'>x</emphasis>
380    </term>
381    <listitem>
382      <para>
383Specifies the x location, in pixels, of the Region to clear.
384      </para>
385    </listitem>
386  </varlistentry>
387  <varlistentry>
388    <term>
389      <emphasis remap='I'>y</emphasis>
390    </term>
391    <listitem>
392      <para>
393Specifies the y location, in pixels, of the Region to clear.
394      </para>
395    </listitem>
396  </varlistentry>
397  <varlistentry>
398    <term>
399      <emphasis remap='I'>width</emphasis>
400    </term>
401    <listitem>
402      <para>
403Specifies the width, in pixels, of the Region to clear.
404      </para>
405    </listitem>
406  </varlistentry>
407  <varlistentry>
408    <term>
409      <emphasis remap='I'>height</emphasis>
410    </term>
411    <listitem>
412      <para>
413Specifies the height, in pixels, of the Region to clear.
414    </para>
415  </listitem>
416  </varlistentry>
417</variablelist>
418</para>
419<para>
420<!-- .LP -->
421<emphasis remap='I'>X</emphasis> and <emphasis remap='I'>y</emphasis> denote the upper left hand corner of region to clear.
422</para>
423</sect3>
424<sect3 id="Finding_a_Text_Position_Given_Pixel_Values">
425<title>Finding a Text Position Given Pixel Values</title>
426<para>
427<!-- .LP -->
428To find the text character position that will be rendered at a given x
429location the Text widget uses the function <xref linkend='FindPosition' xrefstyle='select: title'/>:
430<indexterm significance="preferred"><primary>TextSink object</primary><secondary>FindPosition</secondary></indexterm>
431<funcsynopsis id='FindPosition'>
432<funcprototype>
433  <funcdef>void<function> FindPosition</function></funcdef>
434  <paramdef>Widget<parameter> w</parameter></paramdef>
435  <paramdef>XawTextPosition<parameter> fromPos</parameter></paramdef>
436  <paramdef>intfromX,<parameter> width</parameter></paramdef>
437  <paramdef>Boolean<parameter> stopAtWordBreak</parameter></paramdef>
438  <paramdef>XawTextPosition<parameter> *pos_return</parameter></paramdef>
439  <paramdef>int*width_return,<parameter> *height_return</parameter></paramdef>
440</funcprototype>
441</funcsynopsis>
442<!-- .FN -->
443<variablelist>
444  <varlistentry>
445    <term>
446      <emphasis remap='I'>w</emphasis>
447    </term>
448    <listitem>
449      <para>
450Specifies the TextSink object.
451      </para>
452    </listitem>
453  </varlistentry>
454  <varlistentry>
455    <term>
456      <emphasis remap='I'>fromPos</emphasis>
457    </term>
458    <listitem>
459      <para>
460Specifies a reference position, usually the first character in this line.
461This character is always to the left of the desired character location.
462      </para>
463    </listitem>
464  </varlistentry>
465  <varlistentry>
466    <term>
467      <emphasis remap='I'>fromX</emphasis>
468    </term>
469    <listitem>
470      <para>
471Specifies the distance that the left edge of <emphasis remap='I'>fromPos</emphasis> is from the
472left edge of the window.  This is the reference x location for the
473reference position.
474      </para>
475    </listitem>
476  </varlistentry>
477  <varlistentry>
478    <term>
479      <emphasis remap='I'>width</emphasis>
480    </term>
481    <listitem>
482      <para>
483Specifies the distance, in pixels, from the reference position to the
484desired character position.
485      </para>
486    </listitem>
487  </varlistentry>
488  <varlistentry>
489    <term>
490      <emphasis remap='I'>stopAtWordBreak</emphasis>
491    </term>
492    <listitem>
493      <para>
494Specifies whether or not the position that is returned should be forced
495to be on a word boundary.
496      </para>
497    </listitem>
498  </varlistentry>
499  <varlistentry>
500    <term>
501      <emphasis remap='I'>pos_return</emphasis>
502    </term>
503    <listitem>
504      <para>
505Returns the character position that corresponds to the location that has
506been specified, or the work break immediately to the left of the
507position if <emphasis remap='I'>stopAtWordBreak</emphasis> is <function>True</function>.
508      </para>
509    </listitem>
510  </varlistentry>
511  <varlistentry>
512    <term>
513      <emphasis remap='I'>width_return</emphasis>
514    </term>
515    <listitem>
516      <para>
517Returns the actual distance between <emphasis remap='I'>fromPos</emphasis> and <emphasis remap='I'>pos_return</emphasis>.
518      </para>
519    </listitem>
520  </varlistentry>
521  <varlistentry>
522    <term>
523      <emphasis remap='I'>height_return</emphasis>
524    </term>
525    <listitem>
526      <para>
527Returns the maximum height of the text between <emphasis remap='I'>fromPos</emphasis> and
528<emphasis remap='I'>pos_return</emphasis>.
529    </para>
530  </listitem>
531  </varlistentry>
532</variablelist>
533</para>
534<para>
535<!-- .LP -->
536This function need make no attempt to deal with line feeds.  The text
537widget will only call it one line at a time.
538</para>
539<para>
540<!-- .LP -->
541<!-- .sp -->
542Another means of finding a text position is provided by the <xref linkend='Resolve' xrefstyle='select: title'/>
543function:
544<indexterm significance="preferred"><primary>TextSink object</primary><secondary>Resolve</secondary></indexterm>
545<funcsynopsis id='Resolve'>
546<funcprototype>
547  <funcdef>void<function> Resolve</function></funcdef>
548  <paramdef>Widget<parameter> w</parameter></paramdef>
549  <paramdef>XawTextPosition<parameter> fromPos</parameter></paramdef>
550  <paramdef>intfromX,<parameter> width</parameter></paramdef>
551  <paramdef>XawTextPosition<parameter> *pos_return</parameter></paramdef>
552</funcprototype>
553</funcsynopsis>
554<!-- .FN -->
555<variablelist>
556  <varlistentry>
557    <term>
558      <emphasis remap='I'>w</emphasis>
559    </term>
560    <listitem>
561      <para>
562Specifies the TextSink object.
563      </para>
564    </listitem>
565  </varlistentry>
566  <varlistentry>
567    <term>
568      <emphasis remap='I'>fromPos</emphasis>
569    </term>
570    <listitem>
571      <para>
572Specifies a reference position, usually the first character in this line.
573This character is always to the left of the desired character location.
574      </para>
575    </listitem>
576  </varlistentry>
577  <varlistentry>
578    <term>
579      <emphasis remap='I'>fromX</emphasis>
580    </term>
581    <listitem>
582      <para>
583Specifies the distance that the left edge of <emphasis remap='I'>fromPos</emphasis> is from the
584left edge of the window.  This is the reference x location for the
585reference position.
586      </para>
587    </listitem>
588  </varlistentry>
589  <varlistentry>
590    <term>
591      <emphasis remap='I'>width</emphasis>
592    </term>
593    <listitem>
594      <para>
595Specifies the distance, in pixels, from the reference position to the
596desired character position.
597      </para>
598    </listitem>
599  </varlistentry>
600  <varlistentry>
601    <term>
602      <emphasis remap='I'>pos_return</emphasis>
603    </term>
604    <listitem>
605      <para>
606Returns the character position that corresponds to the
607location that has been specified, or the word break immediately to the left
608if <emphasis remap='I'>stopAtWordBreak</emphasis> is <function>True</function>.
609    </para>
610  </listitem>
611  </varlistentry>
612</variablelist>
613</para>
614<para>
615<!-- .LP -->
616This function need make no attempt to deal with line feeds.  The text
617widget will only call it one line at a time.  This is a more convenient
618interface to the <xref linkend='FindPosition' xrefstyle='select: title'/> function, and provides a subset of its
619functionality.
620<indexterm><primary>FindPosition</primary></indexterm>
621</para>
622</sect3>
623<sect3 id="Finding_the_Distance_Between_two_Text_Positions">
624<title>Finding the Distance Between two Text Positions</title>
625<para>
626<!-- .LP -->
627To find the distance in pixels between two text positions on the same
628line use the function <xref linkend='FindDistance' xrefstyle='select: title'/>.
629<indexterm significance="preferred"><primary>TextSink object</primary><secondary>FindDistance</secondary></indexterm>
630<funcsynopsis id='FindDistance'>
631<funcprototype>
632  <funcdef>void<function> FindDistance</function></funcdef>
633  <paramdef>Widget<parameter> w</parameter></paramdef>
634  <paramdef>XawTextPositionfromPos,<parameter> toPos</parameter></paramdef>
635  <paramdef>int<parameter> fromX</parameter></paramdef>
636  <paramdef>XawTextPosition<parameter> *pos_return</parameter></paramdef>
637  <paramdef>int*width_return,<parameter> *height_return</parameter></paramdef>
638</funcprototype>
639</funcsynopsis>
640<!-- .FN -->
641<variablelist>
642  <varlistentry>
643    <term>
644      <emphasis remap='I'>w</emphasis>
645    </term>
646    <listitem>
647      <para>
648Specifies the TextSink object.
649      </para>
650    </listitem>
651  </varlistentry>
652  <varlistentry>
653    <term>
654      <emphasis remap='I'>fromPos</emphasis>
655    </term>
656    <listitem>
657      <para>
658Specifies the text buffer position, in characters, of the first position.
659      </para>
660    </listitem>
661  </varlistentry>
662  <varlistentry>
663    <term>
664      <emphasis remap='I'>fromX</emphasis>
665    </term>
666    <listitem>
667      <para>
668Specifies the distance that the left edge of <emphasis remap='I'>fromPos</emphasis> is from the
669left edge of the window.  This is the reference x location for the
670reference position.
671      </para>
672    </listitem>
673  </varlistentry>
674  <varlistentry>
675    <term>
676      <emphasis remap='I'>toPos</emphasis>
677    </term>
678    <listitem>
679      <para>
680Specifies the text buffer position, in characters, of the second position.
681      </para>
682    </listitem>
683  </varlistentry>
684  <varlistentry>
685    <term>
686      <emphasis remap='I'>resWidth</emphasis>
687    </term>
688    <listitem>
689      <para>
690Return the actual distance between <emphasis remap='I'>fromPos</emphasis>
691and <emphasis remap='I'>pos_return</emphasis>.
692      </para>
693    </listitem>
694  </varlistentry>
695  <varlistentry>
696    <term>
697      <emphasis remap='I'>resPos</emphasis>
698    </term>
699    <listitem>
700      <para>
701Returns the character position that corresponds to the actual character
702position used for <emphasis remap='I'>toPos</emphasis> in the calculations.  This may be
703different than <emphasis remap='I'>toPos</emphasis>, for example if <emphasis remap='I'>fromPos</emphasis> and <emphasis remap='I'>toPos</emphasis>
704are on different lines in the file.
705      </para>
706    </listitem>
707  </varlistentry>
708  <varlistentry>
709    <term>
710      <emphasis remap='I'>height_return</emphasis>
711    </term>
712    <listitem>
713      <para>
714Returns the maximum height of the text between <emphasis remap='I'>fromPos</emphasis> and
715<emphasis remap='I'>pos_return</emphasis>.
716    </para>
717  </listitem>
718  </varlistentry>
719</variablelist>
720</para>
721<para>
722<!-- .LP -->
723This function need make no attempt to deal with line feeds.  The Text
724widget will only call it one line at a time.
725</para>
726</sect3>
727<sect3 id="Finding_the_Size_of_the_Drawing_area">
728<title>Finding the Size of the Drawing area</title>
729<para>
730<!-- .LP -->
731To find the maximum number of lines that will fit into the current Text
732widget, use the function <xref linkend='MaxLines' xrefstyle='select: title'/>.  The TextSink already defines
733this function to compute the maximum number of lines by using the height
734of <function>font</function>.
735<indexterm significance="preferred"><primary>TextSink object</primary><secondary>MaxLines</secondary></indexterm>
736<funcsynopsis id='MaxLines'>
737<funcprototype>
738  <funcdef>int<function> MaxLines</function></funcdef>
739  <paramdef>Widget<parameter> w</parameter></paramdef>
740  <paramdef>Dimension<parameter> height</parameter></paramdef>
741</funcprototype>
742</funcsynopsis>
743<!-- .FN -->
744<variablelist>
745  <varlistentry>
746    <term>
747      <emphasis remap='I'>w</emphasis>
748    </term>
749    <listitem>
750      <para>
751Specifies the TextSink object.
752      </para>
753    </listitem>
754  </varlistentry>
755  <varlistentry>
756    <term>
757      <emphasis remap='I'>height</emphasis>
758    </term>
759    <listitem>
760      <para>
761Specifies the height of the current drawing area.
762    </para>
763  </listitem>
764  </varlistentry>
765</variablelist>
766</para>
767<para>
768<!-- .LP -->
769Returns the maximum number of lines that will fit in <emphasis remap='I'>height</emphasis>.
770</para>
771<para>
772<!-- .LP -->
773<!-- .sp -->
774To find the height required for a given number of text lines, use
775the function <xref linkend='MaxHeight' xrefstyle='select: title'/>.  The TextSink already defines this
776function to compute the maximum height of the window by using the
777height of <function>font</function>.
778<indexterm significance="preferred"><primary>TextSink object</primary><secondary>MaxHeight</secondary></indexterm>
779<funcsynopsis id='MaxHeight'>
780<funcprototype>
781  <funcdef>int<function> MaxHeight</function></funcdef>
782  <paramdef>Widget<parameter> w</parameter></paramdef>
783  <paramdef>int<parameter> lines</parameter></paramdef>
784</funcprototype>
785</funcsynopsis>
786<!-- .FN -->
787<variablelist>
788  <varlistentry>
789    <term>
790      <emphasis remap='I'>w</emphasis>
791    </term>
792    <listitem>
793      <para>
794Specifies the TextSink object.
795      </para>
796    </listitem>
797  </varlistentry>
798  <varlistentry>
799    <term>
800      <emphasis remap='I'>height</emphasis>
801    </term>
802    <listitem>
803      <para>
804Specifies the height of the current drawing area.
805    </para>
806  </listitem>
807  </varlistentry>
808</variablelist>
809</para>
810<para>
811<!-- .LP -->
812Returns the height that will be taken up by the number of lines passed.
813</para>
814</sect3>
815<sect3 id="Setting_the_Tab_Stops">
816<title>Setting the Tab Stops</title>
817<para>
818<!-- .LP -->
819To set the tab stops for a text sink use the <xref linkend='SetTabs' xrefstyle='select: title'/> function.
820The TextSink already defines this function to set the tab x location in
821pixels to be the number of characters times the figure width of
822<function>font</function>.
823<indexterm significance="preferred"><primary>TextSink object</primary><secondary>SetTabs</secondary></indexterm>
824<funcsynopsis id='SetTabs'>
825<funcprototype>
826  <funcdef>void<function> SetTabs</function></funcdef>
827  <paramdef>Widget<parameter> w</parameter></paramdef>
828  <paramdef>inttab_count,<parameter> *tabs</parameter></paramdef>
829</funcprototype>
830</funcsynopsis>
831<!-- .FN -->
832<variablelist>
833  <varlistentry>
834    <term>
835      <emphasis remap='I'>w</emphasis>
836    </term>
837    <listitem>
838      <para>
839Specifies the TextSink object.
840      </para>
841    </listitem>
842  </varlistentry>
843  <varlistentry>
844    <term>
845      <emphasis remap='I'>tab_count</emphasis>
846    </term>
847    <listitem>
848      <para>
849Specifies the number of tabs passed in <emphasis remap='I'>tabs</emphasis>.
850      </para>
851    </listitem>
852  </varlistentry>
853  <varlistentry>
854    <term>
855      <emphasis remap='I'>tabs</emphasis>
856    </term>
857    <listitem>
858      <para>
859Specifies the position, in characters, of the tab stops.
860    </para>
861  </listitem>
862  </varlistentry>
863</variablelist>
864</para>
865<para>
866<!-- .LP -->
867This function is responsible for the converting character positions passed
868to it into whatever internal positions the TextSink uses for tab placement.
869</para>
870</sect3>
871<sect3 id='Getting_the_Insert_Points_Size_and_Location'>
872<title>Getting the Insert Point's Size and Location</title>
873<para>
874<!-- .LP -->
875To get the size and location of the insert point use the
876<xref linkend='GetCursorBounds' xrefstyle='select: title'/> function.
877<indexterm significance="preferred"><primary>TextSink object</primary><secondary>GetCursorBounds</secondary></indexterm>
878<funcsynopsis id='GetCursorBounds'>
879<funcprototype>
880  <funcdef>void<function> GetCursorBounds</function></funcdef>
881  <paramdef>Widget<parameter> w</parameter></paramdef>
882  <paramdef>XRectangle<parameter> *rect_return</parameter></paramdef>
883</funcprototype>
884</funcsynopsis>
885<!-- .FN -->
886<variablelist>
887  <varlistentry>
888    <term>
889      <emphasis remap='I'>w</emphasis>
890    </term>
891    <listitem>
892      <para>
893Specifies the TextSinkObject.
894      </para>
895    </listitem>
896  </varlistentry>
897  <varlistentry>
898    <term>
899      <emphasis remap='I'>rect_return</emphasis>
900    </term>
901    <listitem>
902      <para>
903Returns the location and size of the insert point.
904    </para>
905  </listitem>
906  </varlistentry>
907</variablelist>
908</para>
909<para>
910<!-- .LP -->
911<emphasis remap='I'>Rect</emphasis> will be filled with the current size and location of the
912insert point.
913
914</para>
915</sect3>
916</sect2>
917</sect1>
918