Sunday, 9 November 2014

Progress Bar

The standard progress bar in gtk+ is usually fine for displaying progress, say on a dialog box and of course it's drawn nicely to your current theme.

However there can be two problems with it, the first is that the busy animation is just dreadful. When you set the progress bar to that mode it animates a rectangle bouncing from side to side. There's something very reminiscent of Windows 95 in that, and it's not a very nice thing to look at.

The second problem is that it always seem to obey the minimum size specified on the theme, and so a programmer can't choose how small to make the progressbar.

So the only answer was to make a custom gtk control for progress and busy animations.

Here it is as a progress bar and a busy bar in various sizes and types.



In Data Forms Action the progress bar and busy bar are used when opening a page and refreshing the data sources on it for the first time. Therefore the progress bar has to show the progress as connections or queries finish, but also display a busy bar whilst the connections or queries are in progress, so the progress bar I developed here allows you to switch between the two.

For the visual effect I've borrowed quite shamelessly from Mac OS X and used a barberpole animation as well as rounded corners.