HTML Widget Convenience Functions

Note: All these functions expect to be called on a Widget that has already been realized. Do not attempt to call them on an unrealized widget.

char *HTMLGetText(Widget w, int pretty)
Returns what you would get if you selected the complete window, and then pasted it. The pretty parameter tells whether you want normal(0), fancy(1), or postscript(2) text.
char *HTMLGetTextAndSelection(Widget w, char **startp, char **endp, char **insertp)
Anticipated to be used by editor writers. Returns pointers to the start and end of any currently selected text, as well as a pointer to Wherever the last mouse click with button 1 occurred (which is where the insert point would be on edited text)
char **HTMLGetHRefs (Widget w, int *num_hrefs)
Returns an array of all the HREF text of all the anchors in the document, and places the number of returned hrefs in the int pointer passed.
int HTMLPositionToId(Widget w, int x, int y)
Returns a unique element ID for the element nearest the position passed.
int HTMLIdToPosition(Widget w, int element_id, int *x, int *y)
Returns the current x and y coordinates of the element corresponding to the ID passed. The actual return value is the page number the element occurs on.
int HTMLAnchorToPosition(Widget w, char *name, int *x, int *y)
Tries to find an anchor with a NAME matching the one passed. If found it returns the page and x and y coordinates. If not found it returns -1
void HTMLRetestAnchors(Widget w, visitTestProc testFunc)
Force the widget to retest the visited status of all the anchors. The previouslyVisitedTestFunction resource can be temporarily overridden by the test function passed in.
void HTMLClearSelection (Widget w)
Force a clearing of the current selection.
void HTMLSetSelection (Widget w, ElementRef *start, ElementRef *end)
Set the current selection to text specified by start and end.
void HTMLSetText (Widget w, char *text, char *header_text, char *footer_text)
Force the setting of any part of the document text. Pointers that are passed in NULL leave that piece of text unchanged.
int HTMLSearchText (Widget w, char *pattern, ElementRef *m_start, ElementRef *m_end, int backward, int caseless)
Search the text for a given pattern, specifying start, and returning end positions. Search can be caseless and in either direction.

Return to main HTML Widget documentation page.