CtkEventController: CTK+ 3 Reference Manual

## CtkEventController CtkEventController — Self-contained handler of series of events |

## Functions

CtkPropagationPhase | ctk_event_controller_get_propagation_phase ()
void | ctk_event_controller_set_propagation_phase ()
gboolean | ctk_event_controller_handle_event ()
CtkWidget * | ctk_event_controller_get_widget ()
void | ctk_event_controller_reset ()

## Properties

CtkPropagationPhase | propagation-phase | Read / Write
CtkWidget * | widget | Read / Write / Construct Only

## Types and Values

| CtkEventController
enum | CtkPropagationPhase

## Object Hierarchy

        GObject
        ╰── CtkEventController
            ├── CtkEventControllerKey
            ├── CtkEventControllerMotion
            ├── CtkEventControllerScroll
            ├── CtkGesture
            ╰── CtkPadController

## Includes

    #include <ctk/ctk.h>

## Description

CtkEventController is a base, low-level implementation for event controllers. Those react to a series of CdkEvents, and possibly trigger actions as a consequence of those.

## Functions

### ctk_event_controller_get_propagation_phase ()

    CtkPropagationPhase
    ctk_event_controller_get_propagation_phase
                                   (CtkEventController *controller);

Gets the propagation phase at which `controller` handles events.

#### Parameters

controller | a CtkEventController |

#### Returns

the propagation phase

Since: 3.14

### ctk_event_controller_set_propagation_phase ()

    void
    ctk_event_controller_set_propagation_phase
                                   (CtkEventController *controller,
                                    CtkPropagationPhase phase);

Sets the propagation phase at which a controller handles events.

If `phase` is `CTK_PHASE_NONE`, no automatic event handling will be performed, but other additional gesture maintenance will. In that phase, the events can be managed by calling `ctk_event_controller_handle_event()`.

#### Parameters

controller | a CtkEventController |
phase | a propagation phase |

Since: 3.14

### ctk_event_controller_handle_event ()

    gboolean
    ctk_event_controller_handle_event (CtkEventController *controller,
                                       const CdkEvent *event);

Feeds an events into `controller` , so it can be interpreted and the controller actions triggered.

#### Parameters

controller | a CtkEventController |
event | a CdkEvent |

#### Returns

`TRUE` if the event was potentially useful to trigger the controller action

Since: 3.14

### ctk_event_controller_get_widget ()

    CtkWidget *
    ctk_event_controller_get_widget (CtkEventController *controller);

Returns the CtkWidget this controller relates to.

#### Parameters

controller | a CtkEventController |

#### Returns

a CtkWidget.

[transfer none]

Since: 3.14

### ctk_event_controller_reset ()

    void
    ctk_event_controller_reset (CtkEventController *controller);

Resets the `controller` to a clean state. Every interaction the controller did through “handle-event” will be dropped at this point.

#### Parameters

controller | a CtkEventController |

Since: 3.14

## Types and Values

### CtkEventController

    typedef struct _CtkEventController CtkEventController;

### enum CtkPropagationPhase

Describes the stage at which events are fed into a CtkEventController.

#### Members

CTK_PHASE_NONE | Events are not delivered automatically. Those can be manually fed through `ctk_event_controller_handle_event()`. This should only be used when full control about when, or whether the controller handles the event is needed. |
CTK_PHASE_CAPTURE | Events are delivered in the capture phase. The capture phase happens before the bubble phase, runs from the toplevel down to the event widget. This option should only be used on containers that might possibly handle events before their children do. |
CTK_PHASE_BUBBLE | Events are delivered in the bubble phase. The bubble phase happens after the capture phase, and before the default handlers are run. This phase runs from the event widget, up to the toplevel. |
CTK_PHASE_TARGET | Events are delivered in the default widget event handlers, note that widget implementations must chain up on button, motion, touch and grab broken handlers for controllers in this phase to be run. |

Since: 3.14

## Property Details

### The `“propagation-phase”` property

      “propagation-phase”        CtkPropagationPhase

The propagation phase at which this controller will handle events.

Owner: CtkEventController

Flags: Read / Write

Default value: CTK_PHASE_BUBBLE

Since: 3.14

### The `“widget”` property

      “widget”                   CtkWidget *

The widget receiving the CdkEvents that the controller will handle.

Owner: CtkEventController

Flags: Read / Write / Construct Only

Since: 3.14

## See Also

CtkGesture