Gtk.StyleContext.prototype.notify_state_change

function notify_state_change(window:Gdk.Window, region_id:gpointer, state:Gtk.StateType, state_value:Boolean):void {
    // Gjs wrapper for gtk_style_context_notify_state_change()
}

Notifies a state change on context, so if the current style makes use of transition animations, one will be started so all rendered elements under region_id are animated for state state being set to value state_value.

The window parameter is used in order to invalidate the rendered area as the animation runs, so make sure it is the same window that is being rendered on by the gtk_render_*() functions.

If region_id is null, all rendered elements using context will be affected by this state transition.

As a practical example, a Gtk.Button notifying a state transition on the prelight state: <programlisting> gtk_style_context_notify_state_change (context, gtk_widget_get_window (widget), NULL, GTK_STATE_PRELIGHT, button->in_button); </programlisting>

Can be handled in the CSS file like this: <programlisting> GtkButton { background-color: &num;f00 }

GtkButton:hover { background-color: &num;fff; transition: 200ms linear } </programlisting>

This combination will animate the button background from red to white if a pointer enters the button, and back to red if the pointer leaves the button.

Note that state is used when finding the transition parameters, which is why the style places the transition under the :hover pseudo-class.

Since 3.0

window

a Gdk.Window

region_id

animatable region to notify on, or null. See Gtk.push_animatable_region

state

state to trigger transition for

state_value

true if state is the state we are changing to, false if we are changing away from it