Learn R Programming

RGtk2 (version 2.12.17)

classes: Custom GObject classes

Description

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

Usage

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

Arguments

name
The name of the new class
parent
The name of the parent class
abstract
If TRUE, the class should not be instantiable.
method
The name of the method to invoke in the parent
obj
...
Additional arguments. For parentHandler(), arguments to pass to the parent method. For gClass(), arguments specifying the class definition (see Details).
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

Value

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

Details

The bulk of the class definition (everything except the name and the parent) is passed through additional arguments to the gClass function. This information includes: [object Object],[object Object],[object Object],[object Object],[object Object] 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.