classes                package:RGtk2                R Documentation

_C_u_s_t_o_m _G_O_b_j_e_c_t _c_l_a_s_s_e_s

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

     Highly experimental support for constructing new 'GObject' classes
     entirely from with R.

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

       gClass(name, parent = "GObject", class_def = NULL, abstract = FALSE)
       parentHandler(method, obj = NULL, ...)
       assignProp(obj, pspec, value)
       getProp(obj, pspec)
       registerVirtuals(virtuals)
       unregisterVirtuals(virtuals)

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

    name: The name of the new class

  parent: The name of the parent class

class_def: A list that defines the new class - please see the details
          section

abstract: If 'TRUE', the class should not be instantiable.

  method: The name of the method to invoke in the parent

     obj: A 'GObject'

     ...: The additional arguments to the parent method

   pspec: A 'GParamSpec' describing the property

   value: The value to set on the property

virtuals: An environment containing lists where each list contains the
          names of the virtual methods for the class matching the name
          of the list

     .

_D_e_t_a_i_l_s:

     The bulk of the class definition (everything except the name and
     the parent)  is contained in the 'class_def' parameter. This
     includes:

     _M_e_t_h_o_d_s R functions that override virtuals methods in a 'GObject'
          class. Functions overriding methods in the same class are
          grouped together in a list and  are named according to the
          virtual they override. Each list is a member of the
          'class_def' list and bears the name of the corresponding
          class.

     _S_i_g_n_a_l_s Signals that are emitted by the class, in addition to
          those of the superclasses. Each signal definition is a list
          containing the  following elements: signal name, vector of
          type names of signal arguments, type name of signal return
          value, and a vector of values from the  'GSignalFlags'
          enumeration. The list of signal definitions has the name
          '.signals' in the 'class_def' list.

     _P_r_o_p_e_r_t_i_e_s Properties defined by the class. This is a list of
          lists, each corresponding to a 'GParamSpec', as created by
          'gParamSpec'. The list is named '.props' in the 'class_def'
          list. The property values are stored in a private
          environment. To override that behavior or to be notified
          (first) upon property changes, simply override the
          'set_property' and  'get_property' virtuals in the 'GObject'
          class. To override the implementation of properties defined
          by an ancestor class, specify their names in a separate
          vector named '.prop_overrides'. If you override the setting
          or getting of properties, you can use 'assignProp' or
          'getProp' to conveniently directly assign or get the  value
          of a property to or from the low-level data structure,
          respectively.  These functions differ from the normal
          property accessor mechanism in that  they bypass the property
          system, thus avoiding recursion. They should only be used
          when overriding property handling.

     _I_n_i_t_i_a_l_i_z_e_r Upon instance creation, the function named
          '.initialize' (in 'class_def') will be called with the
          instance as the only argument.

     _N_e_w _m_e_m_b_e_r_s It is possible to define new public, protected, and
          private fields and methods inside an R class, using the
          '.public', '.protected', and '.private' keys, respectively.
          The encapsulation works much the same as Java. Any protected
          and public functions may be overriden in a class derived from
          the defining class. All public fields are immutable. All
          function bindings are locked except for private ones. This
          means private functions can be replaced.

     The above may seem complicated, and it is. Please see the
     alphaSliderClass  for an example. Also note that the 'local'
     function is convenient for defining static namespaces on the fly.
     For calling parent virtuals, use 'parentHandler'.

     'assignProp' and 'getProp' are low-level functions; they should
     not be used in place of the conventional 'GObject' property
     mechanism, except in the case mentioned above.

     'registerVirtuals' and 'unregisterVirtuals' are meant for use by 
     packages that bind C GObject classes to R using the RGtk2 system.
     An example of such a package is rggobi.

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

     For 'gClass', the 'GType' of the new class. For 'getProp', the
     value of the property.

_N_o_t_e:

     This functionality is not for casual users. If you don't know what
     you're doing you will break things. Otherwise, have fun.

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

     Michael Lawrence

