Specifications
Athena Widget Set libXaw 1.0.7
5.11.2.5. Finding the Distance Between twoText Positions
To find the distance in pixels between twotextpositions on the same line use the function Find-
Distance.
void FindDistance(w, fromPos, fromX, toPos, width_return, pos_return, height_return)
Widget w;
XawTextPosition fromPos, toPos;
int fromX;
XawTextPosition *pos_return;
int *width_return, *height_return;
w Specifies the TextSink object.
fromPos Specifies the text buffer position, in characters, of the first position.
fromX Specifies the distance that the left edge of fromPos is from the left edge of the
window. This is the reference x location for the reference position.
toPos Specifies the text buffer position, in characters, of the second position.
resWidth Return the actual distance between fromPos and pos_return.
resPos Returns the character position that corresponds to the actual character position
used for toPos in the calculations. This may be different than toPos,for example
if fromPos and toPos are on different lines in the file.
height_return Returns the maximum height of the text between fromPos and pos_return.
This function need makenoattempt to deal with line feeds. The Textwidget will only call it one
line at a time.
5.11.2.6. Finding the Size of the Drawing area
To find the maximum number of lines that will fit into the current Textwidget, use the function
MaxLines.The TextSink already defines this function to compute the maximum number of lines
by using the height of font.
int MaxLines(w, height)
Widget w;
Dimension height;
w Specifies the TextSink object.
height Specifies the height of the current drawing area.
Returns the maximum number of lines that will fit in height.
To find the height required for a givennumber of text lines, use the function MaxHeight.The
Te x tSink already defines this function to compute the maximum height of the windowbyusing
the height of font.
int MaxHeight(w, lines)
Widget w;
int lines;
w Specifies the TextSink object.
height Specifies the height of the current drawing area.
Returns the height that will be taken up by the number of lines passed.
5.11.2.7. Setting the Tab Stops
To set the tab stops for a text sink use the SetTabs function. The Te x tSink already defines this
function to set the tab x location in pixels to be the number of characters times the figure width of
font.
106