Re: Set CSS properties programmatically
- From: Emmanuele Bassi <ebassi gmail com>
- To: Felipe Borges <felipe10borges gmail com>
- Cc: GTK Devel List <gtk-devel-list gnome org>, gtk-app <gtk-app-devel-list gnome org>
- Subject: Re: Set CSS properties programmatically
- Date: Sat, 25 Nov 2017 13:38:12 +0000
Hi Felipe;
You probably wanted to send this email to gtk-devel-list, not gtk-app-devel-list.
Hi,
I have been looking for a clean way of updating my widget's css
properties programmatically at runtime.
Basically I have a css animation which gets its properties from
variables in my C code.
The current (working) approach I came up with is to benefit from the
cascade and generate a whole new css definition for the animation
every time my variable changes and use GtkStyleProvider.load_from_css
(my_new_animation_css_spec). For this to work I need to set the
"animation-name" to have a new and unique value, overwriting the
previous one. This doesn't sound efficient at all.
My desire is to get the "animation" property of my class, and be able
to update only what changes in it. It can already be done for some
properties via GtkStyleContext.get_property.
How would you even do this? You would need to read the current style state and then resubmit it as a whole, because you cannot know how changing your style for your animation will end up in your computed style.
All in all, is there a better way of doing this? Will there ever be?
Not for gtk3, and I’m pretty sure even for gtk4 it would be kind of weird.
Ciao,
Emmanuele.
--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]