addMIMEObjectHandler       package:RGtkViewers       R Documentation

_R_e_g_i_s_t_e_r _a _h_a_n_d_l_e_r _f_u_n_c_t_i_o_n _f_o_r _a _t_y_p_e _o_f _O_B_J_E_C_T _t_a_g _i_n _a_n _H_T_M_L _d_o_c_u_m_e_n_t.

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_U_s_a_g_e:

     addMIMEObjectHandler(name, handler)

_A_r_g_u_m_e_n_t_s:

    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'. 

_V_a_l_u_e:

     The updated list  of MIME type handlers.

_A_u_t_h_o_r(_s):

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

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://www.omegahat.org/RGtk>, <URL: http://www.gtk.org>

_S_e_e _A_l_s_o:

     'viewHtml' 'embeddedObjectHandler' 'docView'

_E_x_a_m_p_l_e_s:

      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()
                            })

