red / REP

Red Enhancement Process
BSD 3-Clause "New" or "Revised" License
10 stars 4 forks source link

Table widget support #159

Open dockimbel opened 8 months ago

dockimbel commented 8 months ago

Backends capabilities

Feature Win32 GTK3 macOS
Unlimited rows ✔️ ? ?
Unlimited columns ? ? ?
Settable column size ✔️ ✔️ ?
User-resizable columns ✔️ ✔️ ?
Fixed column size ✔️ ✔️ ?
Auto-sizeable column to minimum/optimum width ✔️ ✔️ ?
Column overflow selection button ✔️ ? ?
Column content left/center/right alignment ✔️ ✔️ ?
Clickable column headers ✔️ ✔️ ?
Columns optional drag-and-drop reordering ✔️ ✔️ ?
Settable column header background color ❌² ✔️ ?
Settable column header text color ❌² ✔️ ?
Settable global background color ✔️ ✔️ ?
Settable global text color ✔️ ✔️ ?
Settable global font ✔️ ✔️ ?
Settable item's background color ❌ ¹ ✔️ ?
Settable item's text color ❌ ¹ ✔️ ?
Settable item's font ❌ ¹ ✔️ ?
Settable item's text alignment ❌ ¹ ✔️ ?
Setting an image as an item ✔️ ✔️ ?
Setting an image + text as an item ✔️ ❌ ¹ ?
Setting a checkbox as first item in a row ✔️ ✔️ ?
Setting a progress bar as item ❌ ¹ ✔️ ?
Even/odd row coloring ❌ ¹ ✔️ ?
Transparent table background ✔️ ?
Optional grid lines displaying ✔️ ✔️ ?
Keyboard spatial navigation (up/down/selection) ✔️ ? ?
Selectable row ✔️ ✔️ ?
Multiple rows selection ✔️ ✔️ ?
Disable row selection ❌ ¹ ✔️ ?
Change color of row selection ❌ ² ❌ ¹ ?
Click event on individual item ✔️ ✔️ ?
Double-Click event on individual item ✔️ ✔️ ?
Automatic scrollbars ✔️ ❌ ¹ ?
Scrollbars disabling ✔️ ✔️ ?
Per-item infotip ✔️ ✔️ ?
Run-time row insertion/deletion ✔️ ✔️ ?
Run-time column insertion/deletion ✔️ ✔️ ?

¹ Not available by default, but can be implemented with moderate effort. ² Not available by default, and not sure if that can be implemented reliably with moderate effort.

View interfacing

Currently in the prototype implementation in table-view branch, all the header and content items are stored in a 2D block in /data facet:

view make face! [
    type: 'window
    offset: 400x200
    size: 600x600
    pane: reduce [
    make face! [
        type: 'table
        offset: 10x10
        size: 300x300
        data: [
            ["Col1" "Col2"  "Col3"]
            ["A"    "9" "8"]
            ["B"    "789"   "6"]
            ["C"    "0" "-5"]
            ["D"    "1234"  "4"]
            ["E"    "3" "0"]
        ]
        ]
    ]
]

That facet is meant to be reactive, so that any change there would be immediately reflected in the displayed table (not implemented yet).

Though, columns options need a place where to specify their properties. Also, if we want to support per-cell visual properties, we need a simple/efficient way to specify it.

Here is a simple test example on Windows 11 (23H4):