GtkEventControllerFocus — Event controller for focus
GtkEventController * | gtk_event_controller_focus_new () |
gboolean | gtk_event_controller_focus_contains_focus () |
gboolean | gtk_event_controller_focus_is_focus () |
gboolean | contains-focus | Read |
gboolean | is-focus | Read |
GObject ╰── GtkEventController ╰── GtkEventControllerFocus
#include <gtk/gtk.h>
GtkEventControllerFocus is an event controller meant for situations where you need to know where the focus is.
GtkEventController *
gtk_event_controller_focus_new (void
);
Creates a new event controller that will handle focus events.
a new GtkEventControllerFocus
gboolean
gtk_event_controller_focus_contains_focus
(GtkEventControllerFocus *self
);
Returns the value of the GtkEventControllerFocus:contains-focus property.
self |
TRUE
if focus is within self
or one of its children
gboolean
gtk_event_controller_focus_is_focus (GtkEventControllerFocus *self
);
Returns the value of the GtkEventControllerFocus:is-focus property.
self |
TRUE
if focus is within self
but not one of its children
typedef struct _GtkEventControllerFocus GtkEventControllerFocus;
“contains-focus”
property“contains-focus” gboolean
Whether focus is contain in the controllers widget. See See “is-focus” for whether the focus is in the widget itself or inside a descendent.
When handling focus events, this property is updated before “enter” or “leave” are emitted.
Owner: GtkEventControllerFocus
Flags: Read
Default value: FALSE
“is-focus”
property“is-focus” gboolean
Whether focus is in the controllers widget itself, opposed to in a descendent widget. See also “contains-focus”.
When handling focus events, this property is updated before “enter” or “leave” are emitted.
Owner: GtkEventControllerFocus
Flags: Read
Default value: FALSE
“enter”
signalvoid user_function (GtkEventControllerFocus *controller, gpointer user_data)
This signal is 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 “is-focus” property for changes.
controller | the object which received the signal | |
user_data | user data set when the signal handler was connected. |
Flags: Run Last
“leave”
signalvoid user_function (GtkEventControllerFocus *controller, gpointer user_data)
This signal is 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 “is-focus” property for changes.
controller | the object which received the signal | |
user_data | user data set when the signal handler was connected. |
Flags: Run Last
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/GtkEventControllerFocus.html