[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-devel
Subject:    Re: Set CSS properties programmatically
From:       Emmanuele Bassi <ebassi () gmail ! com>
Date:       2017-11-25 13:38:12
Message-ID: CALnHYQG1O+H7NLPeP7e2_uQOndMypsgWmYWZ8D8K3jyBehq8JA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Felipe;

You probably wanted to send this email to gtk-devel-list, not
gtk-app-devel-list.

On Sat, 25 Nov 2017 at 12:41, Felipe Borges <felipe10borges@gmail.com>
wrote:

> 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.
-- 
https://www.bassi.io
[@] ebassi [@gmail.com]

[Attachment #5 (text/html)]

<div><div dir="auto">Hi Felipe;</div><div dir="auto"><br></div><div dir="auto">You \
probably wanted to send this email to gtk-devel-list, not \
gtk-app-devel-list.</div><br><div class="gmail_quote"><div dir="auto">On Sat, 25 Nov \
2017 at 12:41, Felipe Borges &lt;<a \
href="mailto:felipe10borges@gmail.com">felipe10borges@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br> <br>
I have been looking for a clean way of updating my widget&#39;s css<br>
properties programmatically at runtime.<br>
<br>
Basically I have a css animation which gets its properties from<br>
variables in my C code.<br>
<br>
The current (working) approach I came up with is to benefit from the<br>
cascade and generate a whole new css definition for the animation<br>
every time my variable changes and use GtkStyleProvider.load_from_css<br>
(my_new_animation_css_spec). For this to work I need to set the<br>
&quot;animation-name&quot; to have a new and unique value, overwriting the<br>
previous one. This doesn&#39;t sound efficient at all.<br>
<br>
My desire is to get the &quot;animation&quot; property of my class, and be able<br>
to update only what changes in it. It can already be done for some<br>
properties via GtkStyleContext.get_property.<br>
</blockquote><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> All in all, is \
there a better way of doing this? Will there ever be?<br> </blockquote><div \
dir="auto"><br></div><div dir="auto">Not for gtk3, and I'm pretty sure even for gtk4 \
it would be kind of weird.</div><div dir="auto"><br></div><div \
dir="auto">Ciao,</div><div dir="auto">  Emmanuele.</div></div></div><div dir="ltr">-- \
<br></div><div class="gmail_signature" data-smartmail="gmail_signature"><a \
href="https://www.bassi.io" target="_blank">https://www.bassi.io</a><br>[@] ebassi \
[@<a href="http://gmail.com" target="_blank">gmail.com</a>]</div>



_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic