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

</para>
</sect3>
</sect2>
</sect1>