protected override bool OnDrawn(Cairo.Context cr)
{
if (!CairoHelper.ShouldDrawWindow(cr, Window))
{
return(base.OnDrawn(cr));
}
if (reflect)
{
cr.PushGroup();
}
cr.Operator = Operator.Over;
cr.Translate(h_padding, 0);
cr.Rectangle(0, 0, Allocation.Width - h_padding, Math.Max(2 * bar_height,
bar_height + bar_label_spacing + layout_height));
cr.Clip();
using (var bar = RenderBar(Allocation.Width - 2 * h_padding, bar_height)) {
cr.Save();
cr.SetSource(bar);
cr.Paint();
cr.Restore();
if (reflect)
{
cr.Save();
cr.Rectangle(0, bar_height, Allocation.Width - h_padding, bar_height);
cr.Clip();
Matrix matrix = new Matrix();
matrix.InitScale(1, -1);
matrix.Translate(0, -(2 * bar_height) + 1);
cr.Transform(matrix);
cr.SetSource(bar);
using (var mask = new LinearGradient(0, 0, 0, bar_height)) {
mask.AddColorStop(0.25, new Color(0, 0, 0, 0));
mask.AddColorStop(0.5, new Color(0, 0, 0, 0.125));
mask.AddColorStop(0.75, new Color(0, 0, 0, 0.4));
mask.AddColorStop(1.0, new Color(0, 0, 0, 0.7));
cr.Mask(mask);
}
cr.Restore();
cr.PopGroupToSource();
cr.Paint();
}
if (show_labels)
{
cr.Translate((reflect ? 0 : -h_padding) + (Allocation.Width - layout_width) / 2,
bar_height + bar_label_spacing);
RenderLabels(cr);
}
}
return(true);
}