Learn R Programming

RGtk2 (version 2.20.27)

GtkActivatable: GtkActivatable

Description

An interface for activatable widgets

Arguments

Hierarchy

GInterface +----GtkActivatable

Detailed Description

Activatable widgets can be connected to a GtkAction and reflects the state of its action. A GtkActivatable can also provide feedback through its action, as they are responsible for activating their related actions. Implementing GtkActivatable When extending a class that is already GtkActivatable; it is only necessary to implement the GtkActivatable->syncActionProperties() and GtkActivatable->update() methods and chain up to the parent implementation, however when introducing a new GtkActivatable class; the "related-action" and "use-action-appearance" properties need to be handled by the implementor. Handling these properties is mostly a matter of installing the action pointer and boolean flag on your instance, and calling gtkActivatableDoSetRelatedAction and gtkActivatableSyncActionProperties at the appropriate times.

A class fragment implementing GtkActivatable gClass("FooBar", "GtkButton", .prop_overrides=c("related-action", "use-action-appearance"), GObject=list( dispose=function(object) { object$doSetRelatedAction(NULL) }, set_property=function(object, id, value, pspec) { if (pspec$name == "related-action") { assignProp(object, pspec, value) object$doSetRelatedAction(value) } else if (pspec$name == "use-action-appearance") { if (value != getProp(pspec)) { assignProp(object, pspec, value) object$syncActionProperties(object$"related-action") } } else { warning("invalid property: ", pspec$name) } } ), GtkActivatable=list( sync_action_properties=function(activatable, action) { if (is.null(action)) { return() } activatable$visible <- action$visible activatable$sensitive <- action$sensitive ## ... if (activatable$use_action_appearance) { if (!is.null(action$stock_id)) { activatable$label <- action$stock_id } else { activatable$label <- action$label } activatable$use_stock <- !is.null(action$stock_id) } ## ... }, update=function(activatable, action, property_name) { if (property_name == "visible") { activatable$visible <- action$visible } else if (property_name == "sensitive") { activatable$sensitive <- action$sensitive } ## ... if (activatable$use_action_appearance) { if (property_name == "stock-id") { activatable$label <- action$stock_id activatable$use_stock <- !is.null(action$stock_id) } else if (property_name == "label") { activatable$label <- action$label } } ## ... } ))

References

http://library.gnome.org/devel//gtk/GtkActivatable.html