[Win32] Support separate header-line and grid-line colors for Table and Tree

Abierto
#3,790 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
18/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java
Área
desktop-dev

Línea de trabajo

The work sits in SWT's Win32 Table and Tree classes: Tree.wmNotifyHeader() draws header separators with COLOR_3DFACE, and Table uses the display-level tableHeaderLinePixel setting. Start by reading how each widget paints its header and body lines, then settle the public API direction with maintainers before writing code. Done would mean per-widget header and grid colors that reset to native behavior and redraw on change, on Windows first.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Is your feature request related to a problem? Please describe.

Table and Tree do not offer a consistent public API for configuring header separator and body grid-line colors. This makes it difficult to provide suitable line colors in dark themes.

The difference is particularly visible on Windows: Tree column header separators are much brighter than the equivalent separators in Table. In the Win32 implementation, Tree.wmNotifyHeader() draws the header separators using COLOR_3DFACE, whereas Table uses the internal display-level tableHeaderLinePixel setting when one is configured. That setting is not a public per-widget API and does not control Table's body grid.

For the body grid, Table uses the native Windows list-view grid, while Tree draws lines using DrawEdge. Neither widget exposes a dedicated public grid-line color setter.

This was investigated with SWT 3.134.0.v20260515-1429. The header difference is also visible in Eclipse IDE.

Describe the solution you'd like

Provide a consistent way to configure the following colors independently for both Table and Tree:

  • Header-line color, covering the vertical column-header separators and the horizontal separator below the header.
  • Grid-line color, covering horizontal and vertical lines in the body.

Ideally these would be per-widget settings, with the existing native behavior retained when no custom color is set. Resetting a color should restore that behavior, and changing a color should redraw the relevant area. Table's existing internal display-level header-line setting should remain compatible; the precedence between it and a new per-widget setting would need to be defined.

Separate colors would allow grids to be more subtle than header separators, or account for different header and body backgrounds. E4 CSS support would be a separate contribution in Platform UI.

I'd appreciate feedback on the API direction and the cross-platform requirements. Table and Tree have different rendering paths on Windows, so the implementations may need to be developed separately even if the API is consistent.

I’m prepared to work on a PR, starting with the Windows implementation. I only have access to Windows, so I would need help reviewing and visually verifying GTK/macOS behavior. Would a Windows-first contribution be acceptable, or should all platforms be covered together?

Describe alternatives you've considered

Painting grid lines in application code is possible, but it does not address the native header separators. Table's existing internal header-line setting is display-wide and does not provide independent body grid coloring.

A Win32 proof of concept now covers both Table and Tree. It uses temporary per-widget data keys to provide independent header-line and grid-line colors; these are experimental settings, not a proposed public API. For Table, the native grid is disabled when a custom grid color is supplied and replacement lines are drawn during SWT's post-paint stage. The prototype also extends SWT's existing background-painting workaround to suppress Explorer-theme column separators, which otherwise remain visible beside the custom grid lines.

A standalone SWT example displays Tree and Table side by side with the same sample data. The prototype was exercised with selection, column resizing/reordering, horizontal and vertical scrolling, and changing the grid color independently of the header color. With no custom per-widget colors supplied, the patched jar produced an identical screenshot to unmodified SWT in this example.

This demonstrates the Windows rendering approach for both widgets. Public API design, complete regression coverage and GTK/macOS support remain to be discussed.

Additional context

Related: https://github.com/eclipse-platform/eclipse.platform.swt/issues/386. That issue discusses Table's existing internal header-line color setting; Tree does not use it.

Eclipse's Windows dark-theme CSS also explicitly disables Tree/Table grid lines (Bug 567933): https://github.com/eclipse-platform/eclipse.platform.ui/commit/80547958cf77fd84c98725ea2fa981b9d22719ed

This is separate from SWT's color support: applications can override visibility, but still need appropriate line colors. This request does not propose changing Eclipse's default grid visibility.

The proof of concept has only been tested on Windows; GTK/macOS behavior and cross-platform API requirements still need discussion.

Standalone SWT comparison

Both screenshots use the same dark backgrounds, sample data and existing display-wide Table header-line setting. Grid visibility is explicitly enabled; no E4 CSS is involved.

Stock SWT (Tree left, Table right):

Stock SWT: bright Tree header and native grids beside the muted Table header

Win32 prototype: header lines #60666A and grid lines #414649, configured independently for both widgets:

Win32 prototype: matching muted headers and subtler grids for Tree and Table
Lenguaje dominante
Java
Estrellas
202
Forks
206
Merge medio
1 d 22 h
PR fusionados (30 d)
102

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de eclipse-platform/eclipse.platform.swt

Todos los issues de eclipse-platform/eclipse.platform.swt

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.