1.58 <GtkEventControllerFocus>

Class: <GtkEventControllerFocus>

It derives from <GtkEventController>.

Tracks keyboard focus.

The event controller offers event-controller-focus:enter and event-controller-focus:leave signals, as well as event-controller-focus:is-focus and event-controller-focus:contains-focus properties which are updated to reflect focus changes inside the widget hierarchy that is rooted at the controllers widget.

Properties

Property: event-controller-focus:contains-focus self

#t if focus is contained in the controllers widget.

See event-controller-focus:is-focus for whether the focus is in the widget itself or inside a descendent.

When handling focus events, this property is updated before event-controller-focus:enter or event-controller-focus:leave are emitted.

Its value is a boolean.

It is read only.

Property: event-controller-focus:is-focus self

#t if focus is in the controllers widget itself, as opposed to in a descendent widget.

See also event-controller-focus:contains-focus.

When handling focus events, this property is updated before event-controller-focus:enter or event-controller-focus:leave are emitted.

Its value is a boolean.

It is read only.

Procedures

Method: event-controller-focus:contains-focus? self ⇒ %return
Method: contains-focus? self ⇒ %return

Returns #t if focus is within self or one of its children.

self

Passed: a <GtkEventControllerFocus>.

a <GtkEventControllerFocus>

%return

Returned: a boolean.

#t if focus is within self or one of its children

Method: event-controller-focus:is-focus? self ⇒ %return
Method: is-focus? self ⇒ %return

Returns #t if focus is within self, but not one of its children.

self

Passed: a <GtkEventControllerFocus>.

a <GtkEventControllerFocus>

%return

Returned: a boolean.

#t if focus is within self, but not one of its children

Procedure: event-controller-focus:new ⇒ %return

Creates a new event controller that will handle focus events.

%return

Returned: a <GtkEventController>.

a new <GtkEventControllerFocus>

Signals

Signal: event-controller-focus:enter

Connect a handler with (connect object event-controller-focus:enter handler). It is called as (handler self).

Emitted whenever the focus enters into the widget or one of its descendents.

Note that this means you may not get an ::enter signal even though the widget becomes the focus location, in certain cases (such as when the focus moves from a descendent of the widget to the widget itself). If you are interested in these cases, you can monitor the event-controller-focus:is-focus property for changes.

self

Passed: a <GtkEventControllerFocus>.

Signal: event-controller-focus:leave

Connect a handler with (connect object event-controller-focus:leave handler). It is called as (handler self).

Emitted whenever the focus leaves the widget hierarchy that is rooted at the widget that the controller is attached to.

Note that this means you may not get a ::leave signal even though the focus moves away from the widget, in certain cases (such as when the focus moves from the widget to a descendent). If you are interested in these cases, you can monitor the event-controller-focus:is-focus property for changes.

self

Passed: a <GtkEventControllerFocus>.