[Home] [ToC] [Up] [Prev] [Next]
The browser's document services include functions for examining and modifying the global state of a document through its HTML parse tree, reporting information about the document, and managing the browser's interaction with the rest of the iHTML system. These services are implemented are part of the browser's own glue.
void*
(This is an
opaque type that is defined by the browser's internal
implementation.)
The IHBrowser
is a
handle on the display context for a document. This is typical
a user interface window that the browser is managing, in which
it is displaying an IHDocument.
void*
(This is an
opaque type that is defined by the browser's internal
implementation.)
The IHDocument
is a
handle on a particular HTML document in the system,
representing a particular document scripting context. It is
the interface to examining and displaying HTML trees, and other
document-level operations.
Because integral part of the iHTML architecture is the manipulation of actual HTML parse trees, this document should not be thought of as representing any particular HTML markup. Instead, it is actual the URL from which the markup (and scripts, graphics, etc. associated with it) was retrieved.
IHBrowser
BR_AllocResources(IHGlobalInfo* ii)
(IHGlobalInfo*)
gi
(IHBrowser)
Resources the
browser needs for the interface.
This routine is called when first starting a new document interface. It is used by the browser to allocate any resources it needs specifically for that interface, and for any other setup that needs to be done. This routine should return a non-zero value to indicate success, which will be placed into the give IHGlobalInfo's 'browser' field.
This routine is called AFTER the document has been parsed, e.g. the IHGlobalInfo's modules and objects lists have been filled in.
When called, gi->document is guaranteed to contain the browser document the interface is on.
BR_AllocResources()
.
void BR_FreeResources(IHGlobalInfo* gi,
IHBrowser br)
(IHGlobalInfo*)
gi
(IHBrowser)
br
Frees and cleans up any browser-side resources
that were allocated by a previous call to
BR_AllocResource()
. This function is
called by the iHTML Library prior to deallocating the scripting
interface.
HTMLNode BR_GetDocHTMLTree(IHDocument
doc)
(IHDocument)
doc
(HTMLTree)
The root of the
HTML tree that doc is currently displaying.
Returns a handle on the root of the HTML parse tree that is currently being displayed in the given document.
void BR_Reformat(IHDocument
doc)
(IHDocument)
doc
Examines and re-formats the document's current HTML parse tree. This must be called if any changes are made to it, so that they are correctly reflected in the display. If a document has a document-level scripting interface, this function must be called initially to display it.
void BR_ReportError(IHDocument doc,
const char* str, ...)
(IHDocument)
doc
(const char*)
str
Reports an error condition to the user. str can contain standard printf()-style formatters, and any additional arguments are interpreted as per printf(). The doc argument is used to determine the context the error occurred in; it may be NULL, in which case it is assumed to be a global error, not associated with any particular document.
void BR_SetDocHTMLTree(IHDocument doc,
HTMLNode tree)
(IHDocument)
doc
(HTMLMarkup)
tree
Sets the given HTML parse tree as the text currently being displayed by the document. The document is automatically reformatted and the new text displayed.
Calling this function passes ownership of the parse tree over to the document -- the browser will automatically deallocate it whenver it deallocates the document itself. You can still manipulate internal parts of this tree, however, while it is owned by the document.
Note that this function does not deallocate any tree that is already associated with the document. Thus, if a program wished to create a completely new tree to replace a document's current tree, it must do something like this:
HTMLNode old_tree; old_tree = BR_GetDocHTMLTree(doc); BR_SetDocHTMLTree(new_tree); BR_FreeMarkup(old_tree);
void BR_ShowLink(IHDocument doc,
const char* text)
(IHDocument)
doc
(const char*)
text
Displays information about a hypertext link within the browser, to the user. A NULL 'text' clears any previous link report. This provides access to the browser's mechanism for displaying information to the user about links that, for example, the pointer is over, and is only intended for this type of use. It could be called, for example, in a language that implements client-side imagemaps.
void BR_ShowProgress(IHDocument doc,
const char* text)
(IHDocument)
doc
(const char*)
text
Displays the given text as a running progress report within the browser. This text is shown in an out-of-the-way place; it is not intended to draw the user's attention to important information, but rather as a small status report on the browser's activity. A NULL 'text' clears any previous progress report.
[Home] [ToC] [Up] [Prev] [Next]
Dianne Kyra Hackborn <hackbod@angryredplanet.com> | Last modified: Tue Oct 8 07:56:28 PDT 1996 |