GtkActivatable: GtkActivatable

Description Methods and Functions Hierarchy Implementations Detailed Description Structures Properties Author(s) References

Description

An interface for activatable widgets

Methods and Functions

gtkActivatableDoSetRelatedAction(object, action)
gtkActivatableGetRelatedAction(object)
gtkActivatableGetUseActionAppearance(object)
gtkActivatableSyncActionProperties(object, action = NULL)
gtkActivatableSetRelatedAction(object, action)
gtkActivatableSetUseActionAppearance(object, use.appearance)

Hierarchy

1
2
GInterface
   +----GtkActivatable

Implementations

GtkActivatable is implemented by GtkButton, GtkCheckButton, GtkCheckMenuItem, GtkColorButton, GtkFontButton, GtkImageMenuItem, GtkLinkButton, GtkMenuItem, GtkMenuToolButton, GtkOptionMenu, GtkRadioButton, GtkRadioMenuItem, GtkRadioToolButton, GtkRecentChooserMenu, GtkScaleButton, GtkSeparatorMenuItem, GtkSeparatorToolItem, GtkTearoffMenuItem, GtkToggleButton, GtkToggleToolButton, GtkToolButton, GtkToolItem and GtkVolumeButton.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
             }
           }
           ## ...
         }
       ))

Structures

GtkActivatable

undocumented

Properties

related-action [GtkAction : * : Read / Write]

The action that this activatable will activate and receive updates from for various states and possibly appearance. PLEASE NOTE: GtkActivatable implementors need to handle the this property and call gtkActivatableDoSetRelatedAction when it changes. Since 2.16

use-action-appearance [logical : Read / Write]

Whether this activatable should reset its layout and appearance when setting the related action or when the action changes appearance.

See the GtkAction documentation directly to find which properties should be ignored by the GtkActivatable when this property is FALSE. PLEASE NOTE: GtkActivatable implementors need to handle this property and call gtkActivatableSyncActionProperties on the activatable widget when it changes. Default value: TRUE Since 2.16

Author(s)

Derived by RGtkGen from GTK+ documentation

References

https://developer.gnome.org/gtk2/stable/GtkActivatable.html


RGtk2 documentation built on Oct. 14, 2021, 5:08 p.m.

Related to GtkActivatable in RGtk2...