private void PaintHeaderCell(Rectangle area, int ci, bool dragging, ref bool have_drawn_separator) { if (ci < 0 || column_cache.Length <= ci) { return; } if (ci == ActiveColumn && HasFocus && HeaderFocused) { Theme.DrawColumnHeaderFocus(cairo_context, area); } if (dragging) { Theme.DrawColumnHighlight(cairo_context, area, CairoExtensions.ColorShade(Theme.Colors.GetWidgetColor(GtkColorClass.Dark, StateType.Normal), 0.9)); Cairo.Color stroke_color = CairoExtensions.ColorShade(Theme.Colors.GetWidgetColor( GtkColorClass.Base, StateType.Normal), 0.0); stroke_color.A = 0.3; cairo_context.Color = stroke_color; cairo_context.MoveTo(area.X + 0.5, area.Y + 1.0); cairo_context.LineTo(area.X + 0.5, area.Bottom); cairo_context.MoveTo(area.Right - 0.5, area.Y + 1.0); cairo_context.LineTo(area.Right - 0.5, area.Bottom); cairo_context.Stroke(); } ColumnCell cell = column_cache[ci].Column.HeaderCell; if (cell != null) { cairo_context.Save(); cairo_context.Translate(area.X, area.Y); cell_context.Area = area; cell_context.State = StateType.Normal; cell.Render(cell_context, area.Width, area.Height); cairo_context.Restore(); } if (!dragging && ci < column_cache.Length - 1 && (have_drawn_separator || column_cache[ci].MaxWidth != column_cache[ci].MinWidth)) { have_drawn_separator = true; Theme.DrawHeaderSeparator(cairo_context, area, area.Right); } }
private void PaintHeaderCell(Cairo.Context cr, Rectangle area, int ci, bool dragging) { if (ci < 0 || column_cache.Length <= ci) { return; } var column_flags = new RegionFlags(); if (ci == sort_column_index) { column_flags |= RegionFlags.Sorted; } if (ci == 0) { column_flags |= RegionFlags.First; } if (ci == (column_cache.Length - 1)) { column_flags |= RegionFlags.Last; } // First column should be odd, but ci starts at 0 if ((ci + 1) % 2 == 0) { column_flags |= RegionFlags.Even; } else { column_flags |= RegionFlags.Odd; } StyleContext.Save(); // RegionFlags.Last is not applied, see https://bugzilla.gnome.org/show_bug.cgi?id=731463 StyleContext.AddRegion("column-header", column_flags); StyleContext.AddClass("button"); if (dragging) { // This is not applied in Adwaita, see https://bugzilla.gnome.org/show_bug.cgi?id=731663 StyleContext.AddClass("dnd"); } StyleContext.RenderBackground(cr, area.X, area.Y, area.Width, area.Height); StyleContext.RenderFrame(cr, area.X, area.Y, area.Width, area.Height); if (ci == ActiveColumn && HasFocus && HeaderFocused) { var border = StyleContext.GetBorder(StyleContext.State); var f_x = area.X + border.Left; var f_y = area.Y + border.Top; var f_width = area.Width - border.Left - border.Right; var f_height = area.Height - border.Top - border.Bottom; StyleContext.RenderFocus(cr, f_x, f_y, f_width, f_height); } ColumnCell cell = column_cache[ci].Column.HeaderCell; if (cell != null) { cr.Save(); cr.Translate(area.X, area.Y); cell_context.Area = area; cell_context.Selected = false; cell.Render(cell_context, area.Width, area.Height); cr.Restore(); } StyleContext.Restore(); }