Overlapping progress bars



Grace Yeung <yeung mrcmry com> wrote something about:

I would like to place three overlapping color bars with difference
lengths in the trough of a progress bar. Is it possible for me to
get the source code to gtk_progress_set_percentage and have my own
version where I can place the percentage bar one after another
without removing the previous one to achieve this? Is there another
way around it? And is it possible at all to have the three different
colors since there's only one place to set the color i.e. style->bg?

I too would like to have a similar capability, and was thinking of hacking together my own GtkProgressBar 
widget to allow multiple regions.

My intention was to basically keep a GSList of values, and their associated colours, and use a basic region 
splitting concept to divide up the bar according to the individual fractional values.  Initially the whole 
region of the bar would be "empty" (a single 100% region set to the default "empty" colour).  A blue bar of 
0.5, would split this "empty" region in half, and colour the first half blue.  A 0.25 red bar would then 
further split the blue bar within which the point falls, replacing the first half of it with a red one.  
Adding a green 0.75 bar would then divide the "empty" bar (within which that point falls), making the first 
half of it green.  I'd have made it optional as to who wins where the same value is given twice; either first 
in wins, or current bar colour gets replaced by new colour.

The general idea is simple enough, and quite trivial to implement using a GtkRGB, or similar.  Or even using 
Gdk drawing functions on a GtkDrawingArea.  It's making it style-friendly which has me stumped, and lacking 
in the time required to dig into the source.  The most difficult part as I can see it, is reproducing the 
non-flat effect introduced by the currently active style on the standard GtkProgressBar's, but in different 
colours.

If anyone has any advice which suggests that it's not as difficult as it seems, I'd be happy to raise it in 
my todo list from it's current basket labeled "generally good and handly but non-critical and non-trivial 
ideas".  If I get a few of them out of that basket and into reality, and assuming no one else has done them 
better by then, I'd be more than willing to see about packaging them up.


Fredderic

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]