Arbitrary widgets superimposed onto GtkProgressBar



Hi!

I am trying to implement something similar to the GNOME splash screen.
There, icons appear at the bottom of the image, as different parts of the
desktop are loaded.

In a similar vein, I would like to create a screen where a set of labels
and their corresponding icons are already present at the bottom, and a
progress bar appears behind the set as the process progresses. Please see
the animated GIF that illustrates this behaviour available here:
http://idefix.go-nix.ca/nix/example.gif

I have implemented this by adding a GtkHBox to a GtkEventBox that I have
set ( ..., "app-paintable", TRUE, "visible-window", TRUE, ...). I handle
the expose event, and imitate the actions of a GtkProgressBar:

gtk_paint_box (widget->style, widget->window, GTK_STATE_PRELIGHT,
GTK_SHADOW_OUT, &rc, widget, "bar", rc.x, rc.y, rc.width, rc.height) ;

Above, "widget" is the GtkEventBox.

This seems to work well enough in some cases, but it's theme-dependent.
That is, there are themes where, instead of getting the nice, shimmering
GtkProgressBar style, I get naught but an ugly GTK_SHADOW_OUT box.

In an attempt to solve this problem, I tried to create my own GtkContainer
subclass that overlaps a GtkProgressBar and the GtkHBox with the widgets.
Unfortunately, GtkProgressBar creates its own child window, so my widgets
will always appear behind it :o(

In a second attempt, I tried to treat the GtkProgressBar as a container
(which it's not), by setting it as the GtkHBox's parent. GTK+ refuses to
do this.

Is there a way to render into a pixmap a real GtkProgressBar, whose
allocation width and height is the same as that of the GtkHBox ? If I can
do that, I can make the GtkHBox app-paintable, and render the picture of
the progress bar in the GtkHBox's background.

TIA for all your help!






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