dollar.GtkObject {RGtk} | R Documentation |
These accessor functions find the
appropriate method for a Gtk object
based on its class hierarchy information.
This allows one to invoke a method
such as show
on a Gtk object without having to remember
for which parent class it was defined
(e.g. GtkWidget).
So w$Show
will find the method.
The function exploits the naming convention
used in Gtk and the R-Gtk interface
to find S functions of the form
gtk<Type>FunctionName
,
and it searches for the most appropriate
function given the object's class.
obj$name "$.GtkObject"(obj, name) "$.GtkType"(obj, name) "$.GdkEvent"(obj, name)
obj |
the GtkObject whose classes are to be used to find the method of interest. |
name |
the shortened name of the method of interest. This is combined with the appropriate class of Gtk object to produce the full name. |
This searches for an appropriate S function by
combining the name of the function
with each of the elements in the class
vector of obj
.
This can be expensive. A more classical
OOP mechanism would be more efficient
and will likely be implemented in the future.
The return value is a function
which has access to the obj
value so that it can call the real S function
with that object as the first argument.
One typically invokes the function
directly, as in
w$Show()
and it is not intended that one assigns the
result of the $
operation for later use.
In the future, the RGtk interface may use a more traditional object oriented class mechanism provided by the http://www.omegahat.org/OOP in which case the dispatching will be done internally from the definitions of the Gtk class rather than using this ``home-made'' mechanism.
Duncan Temple Lang <duncan@research.bell-labs.com>
Information on the package is available from http://www.omegahat.org/RGtk.
Information on Gtk is available from http://www.gtk.org.
[[.GtkObject
.getAutoMethodByName
.getAutoElementByName
gtkInit() w <- gtkButton("My button", show = FALSE) w$Show() w$Hide() w$Destroy()