Top | ![]() |
![]() |
![]() |
![]() |
GtkEventControllerKey is an event controller meant for situations where you need access to key events.
GtkEventController *
gtk_event_controller_key_new (void
);
Creates a new event controller that will handle key events.
void gtk_event_controller_key_set_im_context (GtkEventControllerKey *controller
,GtkIMContext *im_context
);
Sets the input method context of the key controller
.
GtkIMContext *
gtk_event_controller_key_get_im_context
(GtkEventControllerKey *controller
);
Gets the input method context of the key controller
.
gboolean gtk_event_controller_key_forward (GtkEventControllerKey *controller
,GtkWidget *widget
);
Forwards the current event of this controller
to a widget
.
This function can only be used in handlers for the “key-pressed”, “key-released” or “modifiers” signals.
guint
gtk_event_controller_key_get_group (GtkEventControllerKey *controller
);
Gets the key group of the current event of this controller
.
See gdk_event_get_key_group()
.
GtkWidget *
gtk_event_controller_key_get_focus_origin
(GtkEventControllerKey *controller
);
Returns the widget that was holding focus before.
This function can only be used in handlers for the “focus-in” and “focus-out” signals.
GtkWidget *
gtk_event_controller_key_get_focus_target
(GtkEventControllerKey *controller
);
Returns the widget that will be holding focus afterwards.
This function can only be used in handlers for the “focus-in” and “focus-out” signals.
“contains-focus”
property“contains-focus” gboolean
Whether focus is in a descendant of the controllers widget. See “is-focus”.
When handling focus events, this property is updated before “focus-in” or “focus-out” are emitted.
Flags: Read
Default value: FALSE
“is-focus”
property“is-focus” gboolean
Whether focus is in the controllers widget itself, as opposed to in a descendent widget. See “contains-focus”.
When handling focus events, this property is updated before “focus-in” or “focus-out” are emitted.
Flags: Read
Default value: FALSE
“focus-in”
signalvoid user_function (GtkEventControllerKey *controller, GdkCrossingMode mode, GdkNotifyType detail, gpointer user_data)
This signal is emitted whenever the widget controlled
by the controller
or one of its descendants) is given
the keyboard focus.
controller |
the object which received the signal. |
|
mode |
crossing mode indicating what caused this change |
|
detail |
detail indication where the focus is coming from |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“focus-out”
signalvoid user_function (GtkEventControllerKey *controller, GdkCrossingMode mode, GdkNotifyType detail, gpointer user_data)
This signal is emitted whenever the widget controlled
by the controller
(or one of its descendants) loses
the keyboard focus.
controller |
the object which received the signal. |
|
mode |
crossing mode indicating what caused this change |
|
detail |
detail indication where the focus is going |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“im-update”
signalvoid user_function (GtkEventControllerKey *controller, gpointer user_data)
This signal is emitted whenever the input method context filters away a
keypress and prevents the controller
receiving it. See
gtk_event_controller_key_set_im_context()
and
gtk_im_context_filter_keypress()
.
controller |
the object which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“key-pressed”
signalgboolean user_function (GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer user_data)
This signal is emitted whenever a key is pressed.
controller |
the object which received the signal. |
|
keyval |
the pressed key. |
|
keycode |
the raw code of the pressed key. |
|
state |
the bitmask, representing the state of modifier keys and pointer buttons. See GdkModifierType. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“key-released”
signalvoid user_function (GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer user_data)
This signal is emitted whenever a key is released.
controller |
the object which received the signal. |
|
keyval |
the released key. |
|
keycode |
the raw code of the released key. |
|
state |
the bitmask, representing the state of modifier keys and pointer buttons. See GdkModifierType. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“modifiers”
signalgboolean user_function (GtkEventControllerKey *controller, GdkModifierType keyval, gpointer user_data)
This signal is emitted whenever the state of modifier keys and pointer buttons change.
controller |
the object which received the signal. |
|
keyval |
the released key. |
|
state |
the bitmask, representing the new state of modifier keys and pointer buttons. See GdkModifierType. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last