public void DrawHeaderHighlight(Cairo.Context cr, Gdk.Rectangle alloc, int bottom_offset) { Cairo.Color gtk_selection_color = GetWidgetColor(GtkColorClass.Background, StateType.Selected); Cairo.Color light_color = gtk_selection_color.ColorShade(1.6); Cairo.Color dark_color = gtk_selection_color.ColorShade(1.3); LinearGradient grad = new LinearGradient(alloc.X, alloc.Y + 2, alloc.X, alloc.Y + alloc.Height - 3 - bottom_offset); grad.AddColorStop(0, light_color); grad.AddColorStop(1, dark_color); cr.Pattern = grad; cr.Rectangle(alloc.X, alloc.Y + 2, alloc.Width - 2, alloc.Height - 2 - bottom_offset); cr.Fill(); }
public void DrawHeaderBackground(Cairo.Context cr, Gdk.Rectangle alloc, int bottom_offset, bool fill) { Cairo.Color gtk_background_color = GetWidgetColor(GtkColorClass.Background, StateType.Normal); Cairo.Color gtk_base_color = GetWidgetColor(GtkColorClass.Base, StateType.Normal); Cairo.Color light_color = gtk_background_color.ColorShade(1.1); Cairo.Color dark_color = gtk_background_color.ColorShade(0.95); CairoCorners corners = CairoCorners.TopLeft | CairoCorners.TopRight; if (fill) { LinearGradient grad = new LinearGradient(alloc.X, alloc.Y, alloc.X, alloc.Y + alloc.Height); grad.AddColorStop(0, light_color); grad.AddColorStop(0.75, dark_color); grad.AddColorStop(0, light_color); cr.Pattern = grad; cr.RoundedRectangle(alloc.X, alloc.Y, alloc.Width, alloc.Height - bottom_offset, BORDER_RADIUS, corners); cr.Fill(); cr.Color = gtk_base_color; cr.Rectangle(alloc.X, alloc.Y + alloc.Height - bottom_offset, alloc.Width, bottom_offset); cr.Fill(); } else { cr.Color = gtk_base_color; cr.RoundedRectangle(alloc.X, alloc.Y, alloc.Width, alloc.Height, BORDER_RADIUS, corners); cr.Fill(); } cr.LineWidth = 1.0; cr.Translate(alloc.X + 0.5, alloc.Y + 0.5); cr.Color = border_color; cr.RoundedRectangle(alloc.X, alloc.Y, alloc.Width - 1, alloc.Height + 4, BORDER_RADIUS, corners); cr.Stroke(); if (fill) { cr.LineWidth = 1; cr.Antialias = Cairo.Antialias.None; cr.MoveTo(alloc.X + 1, alloc.Y + alloc.Height - 1 - bottom_offset); cr.LineTo(alloc.X + alloc.Width - 1, alloc.Y + alloc.Height - 1 - bottom_offset); cr.Stroke(); cr.Antialias = Cairo.Antialias.Default; } }
public void DrawHeaderSeparator(Cairo.Context cr, Gdk.Rectangle alloc, int x, int bottom_offset) { Cairo.Color gtk_background_color = GetWidgetColor(GtkColorClass.Background, StateType.Normal); Cairo.Color dark_color = gtk_background_color.ColorShade(0.80); Cairo.Color light_color = gtk_background_color.ColorShade(1.1); int y_1 = alloc.Y + 3; int y_2 = alloc.Y + alloc.Height - 3 - bottom_offset; cr.LineWidth = 1; cr.Antialias = Cairo.Antialias.None; cr.Color = dark_color; cr.MoveTo(x, y_1); cr.LineTo(x, y_2); cr.Stroke(); cr.Color = light_color; cr.MoveTo(x + 1, y_1); cr.LineTo(x + 1, y_2); cr.Stroke(); cr.Antialias = Cairo.Antialias.Default; }