Can't one change the way the engine renders these things using css files (this 
seems to be what http://markmail.org/message/zirxleljlithtiel is suggesting)? 

Otherwise, the gtk C code draws the progress bar using code like:

  gtk_style_context_save (context);
  gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH);

  gtk_render_background (context, cr, 0, 0, width, height);
  gtk_render_frame (context, cr, 0, 0, width, height);

  gtk_style_context_get_padding (context, state, &padding);

  gtk_style_context_restore (context);

so to change the way it's drawn (without changing the way the engine interprets 
gtk_render_background calls) would mean a pretty major re-write; in which case 
I think just just creating a new progress bar widget using a drawing_area and 
Cairomm drawing calls is probably the best bet.

Tom


________________________________________
From: Yann LEYDIER [[email protected]]
Sent: 27 August 2011 13:00
To: Thomas Harty
Cc: [email protected]
Subject: Re: Progress bar colours

As far as I know this is the work of the engine and I know no way to
access its routines…

However, if you are familiar with the internal principles of Gtk, you
might be able to derivate the ProgressBar class and overload the method
that redraws the widget, but this is beyond my knowledge.

yann

On 27/08/11 13:55, Thomas Harty wrote:
> Thank you for your reply. Can't the programme just change the relevant 
> aspects of the theme, to change the way the progress bar is drawn under 
> certain circumstances?
>
> Tom
> ________________________________________
> From: [email protected] [[email protected]] on behalf 
> of Yann LEYDIER [[email protected]]
> Sent: 27 August 2011 12:33
> To: [email protected]
> Subject: Re: Progress bar colours
>
> Hi !
>
> Depending on your Gtk theme, progress bars can be animated pixbufs, so I
> doubt you can change the color programmatically.
>
> If I had to do this, I would create a custom widget containing a drawing
> area…
>
> yann
>
> On 27/08/11 13:28, Thomas Harty wrote:
>> Hi,
>>
>> I want to use a progress bar to display temperatures and it'd be very
>> useful to be able to make bar change colour to indicate any problems.
>> I've done some reading and the best references (e.g.
>> http://www.mail-archive.com/[email protected]/msg13767.html and
>> http://markmail.org/message/zirxleljlithtiel) I could find suggest that
>> it should be possible to change the colour of the bar using
>> override_background_color with the state flag PRELIGHT and to change the
>> color of the trough using override_background_color with the state flag
>> NORMAL. However, when I do this, I find that the
>> override_background_color with prelight does nothing and with the normal
>> flag, it changes the colour of both the slider and the trough.
>>
>> Some of the comments I've seen make it seem as thought this should be
>> done using style files, but I couldn't find anything explaining how.
>>
>> Any light that anyone could throw on this would be appreciated.
>>
>> Tom
>>
>>
>> _______________________________________________
>> gtkmm-list mailing list
>> [email protected]
>> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
> _______________________________________________
> gtkmm-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gtkmm-list

_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to