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

Đang mở
#3,790 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
18/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
desktop-dev

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Java
Star
202
Fork
206
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
109

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của eclipse-platform/eclipse.platform.swt

Tất cả issue của eclipse-platform/eclipse.platform.swt

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.