Overview

screenshot.png

Style Properties

Name

Default

Description

xspacing

7

Extra spacing applied to the width of a progress bar. (Since 2.11)

yspacing

7

Extra spacing applied to the height of a progress bar. (Since 2.11)

In earlier versions, the value is just hardcoded to 7 instead of being themable.

Geometry

geometry.png

Horizontal progress bars have a minimum height of 20 pixel and a minimum width of 150 pixel. For vertical progress bars the minimum height is 80 pixel and the minimum width is 22 pixel. If these restrictions are meet, the height will be calculated as 2 * ythickness + yspacing + text_height. The width is 2 * xthickness + xspacing + text_width respectively.

Drawing

The progress bar cannot be drawn transparent. This is because the look is cached in a server side pixmap without transparency.

First the trough is drawn over the whole area. It is drawn with a detail of "trough", shadow IN and state NORMAL, the function is BOX.

The bar is drawn after that, padded by the x/ythickness. It is a BOX and the detail is "bar", shadow is OUT and state is PRELIGHT (since GTK+ 2.10 the bar is clipped to its size, so if you want to draw a shadow, you'll need to ignore the clip area).

The colors that are used for the text are fg[NORMAL] and fg[PRELIGHT].

Since 2.10 the cached pixmap is initilized with a FLAT_BOX detail string "trough", shadow NONE and state NORMAL. The interesting thing to note is this FLAT_BOX will not be redrawn every time. So this means that even though the memory is initilized, the new trough/bar will be drawn on top of the old one. (So if you do transparent drawing in the trough it will "accumulate".)

TODO: Open a bug about this (and/or add a comment to bug #513476).

Questions

If you have any question, please ask on IRC or just add the question here (and don't check the "Trivial change" box).

GTK+ API Documentation

http://library.gnome.org/devel/gtk/stable/GtkProgressBar.html

Attic/GnomeArt/Tutorials/GtkThemes/GtkProgressBar (last edited 2013-11-27 14:33:54 by WilliamJonMcCann)