addMIMEObjectHandler {RGtkViewers}R Documentation

Register a handler function for a type of OBJECT tag in an HTML document.

Description

This allows one to register a handler function that is responsible for processing OBJECT nodes in an HTML document that have the specified type. This function is called with the GtkHTML widget and the HTMLEmbedded widgets as arguments and it is responsible for processing the contents of the OBJECT, adding any GUI component to the HTMLEmbedded object, and returning an S object that might be used by other plugins within the document.

Usage

addMIMEObjectHandler(name, handler)

Arguments

name a string giving the exact name of the MIME type as it is used in the type attribute of an OBJECT node.
handler the S function that is to be used to process an OBJECT node with this MIME type. This is a function that should accept 3 arguments: the GtkHTML widget in which the processing is occurring, the GtkHTMLEmbedded object being processed, and an optional 3rd argument which is the environment in which to perform any evaluations, etc. when processing the object. The default for this third argument should be globalenv.

Value

The updated list of MIME type handlers.

Author(s)

Duncan Temple Lang <duncan@research.bell-labs.com>

References

http://www.omegahat.org/RGtk, http://www.gtk.org

See Also

viewHtml embeddedObjectHandler docView

Examples

 addMIMEObjectHandler("app/x-R-histogram",
                       function(w, obj, envir = globalenv()) {
                          w = gtkDrawingArea()
                          asGtkDevice(w)
                          obj$Add(w)

                          tmp = obj$GetParameter("data")
                          v = eval(parse(text = tmp), envir = envir)
                          if(is.vector(v))
                            hist(v)
                          dev.cur()
                       })

[Package RGtkViewers version 0.7 Index]