protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
int bar_width = (int)((double)Allocation.Width * buffering_progress);
bool render_bar = false;
if (bar_width > 0 && IsBuffering) {
bar_width -= 2 * Style.XThickness;
render_bar = true;
Gtk.Style.PaintBox (Style, GdkWindow, StateType.Normal, ShadowType.In, evnt.Area, this, null,
Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
if (bar_width > 0) {
Gtk.Style.PaintBox (Style, GdkWindow, StateType.Selected, ShadowType.EtchedOut,
evnt.Area, this, "bar",
Allocation.X + Style.XThickness, Allocation.Y + Style.YThickness,
bar_width, Allocation.Height - 2 * Style.YThickness);
}
}
int width, height;
layout.GetPixelSize (out width, out height);
int x = Allocation.X + ((Allocation.Width - width) / 2);
int y = Allocation.Y + ((Allocation.Height - height) / 2);
Gdk.Rectangle rect = evnt.Area;
if (render_bar) {
width = bar_width + Style.XThickness;
rect = new Gdk.Rectangle (evnt.Area.X, evnt.Area.Y, width, evnt.Area.Height);
Gtk.Style.PaintLayout (Style, GdkWindow, StateType.Selected, true, rect, this, null, x, y, layout);
rect.X += rect.Width;
rect.Width = evnt.Area.Width - rect.Width;
}
Gtk.Style.PaintLayout (Style, GdkWindow, StateType.Normal, false, rect, this, null, x, y, layout);
return true;
}