Compare commits

...
1 Commits
Author SHA1 Message Date
noahandClaude Opus 4.8 a81fef3c7d GUI round 8: Errors column hover tooltip (full message list)
Item 12 (tooltip half): hovering an Errors cell now shows the full list of the
miner's error/event messages ("[Severity] text (component)", most severe first)
as a tooltip; the cell itself keeps the compact red summary.

wxDataViewCtrl has no per-cell tooltip API, and wx mouse-motion events are not
delivered to wx handlers on the native GTK control, so this uses GtkTreeView's
native "query-tooltip" signal directly (guarded by __WXGTK__): a per-cell
tooltip map (row, model column) -> text on the AttrListStore, populated from
Rust via a new dvlc_set_cell_tooltip bridge fn, and looked up by the signal
handler using dv->GTKColumnToWX(gcol)->GetModelColumn(). The map is populated on
every platform (a no-op where nothing reads it) so the non-GTK platform round
can wire its own tooltip surface later.

Local wx-rs bridge compile + full cargo check clean; patches 0002/0003
regenerated + validated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
2026-09-17 17:37:18 -06:00
5 changed files with 124 additions and 4 deletions
+4
View File
@@ -694,6 +694,10 @@ impl App {
_ => continue,
};
t.dvlc_set_cell(disp, ci, &encoded);
// The Errors cell gets the full message list as a hover tooltip.
if matches!(c, Column::Error) {
t.dvlc_set_cell_tooltip(disp, ci, &r.errors.join("\n"));
}
}
}
if let Some(row) = top {
+9 -1
View File
@@ -10,7 +10,7 @@
+pub use widgets::*;
--- a/src/widgets.rs
+++ b/src/widgets.rs
@@ -0,0 +1,720 @@
@@ -0,0 +1,728 @@
+// widgets.rs — alkane-toolkit extension: Rust bindings for the widget bridge
+// in cpp_src/widgets_bridge.cpp. Handles are opaque pointers owned by the
+// wxWidgets object tree (parents own children; nothing to free in Rust).
@@ -71,6 +71,7 @@
+ pub fn wxbr_dvlc_clear(win: *mut c_void);
+ pub fn wxbr_dvlc_row_count(win: *mut c_void) -> c_int;
+ pub fn wxbr_dvlc_set_cell(win: *mut c_void, row: usize, col: usize, value: *const c_char);
+ pub fn wxbr_dvlc_set_cell_tooltip(win: *mut c_void, row: usize, col: usize, text: *const c_char);
+ pub fn wxbr_dvlc_get_cell(win: *mut c_void, row: usize, col: usize, buf: *mut c_char, cap: c_int) -> c_int;
+ pub fn wxbr_dvlc_col_count(win: *mut c_void) -> c_int;
+ pub fn wxbr_dvlc_autosize_col(win: *mut c_void, pos: c_int);
@@ -495,6 +496,13 @@
+ unsafe { notsafe::wxbr_dvlc_set_cell(self.0, row, col, c.as_ptr()) }
+ }
+
+ /// Set the hover tooltip for one cell (empty clears it). GTK only; a no-op
+ /// on other platforms until they gain per-cell tooltip support.
+ pub fn dvlc_set_cell_tooltip(&self, row: usize, col: usize, text: &str) {
+ let c = CString::new(text).unwrap_or_default();
+ unsafe { notsafe::wxbr_dvlc_set_cell_tooltip(self.0, row, col, c.as_ptr()) }
+ }
+
+ pub fn dvlc_get_cell(&self, row: usize, col: usize) -> Option<String> {
+ let mut buf = vec![0i8; 4096];
+ let n = unsafe {
+52 -2
View File
@@ -1,6 +1,6 @@
--- a/cpp_src/widgets_bridge.cpp
+++ b/cpp_src/widgets_bridge.cpp
@@ -0,0 +1,1009 @@
@@ -0,0 +1,1059 @@
+// widgets_bridge.cpp — alkane-toolkit extension to wx-rs
+// Adds the widget/event surface the toolkit UI needs on top of the upstream
+// render-callback bridge (which is kept untouched).
@@ -80,6 +80,9 @@
+ public:
+ std::vector<wxColour> row_fg;
+ wxColour zebra; // odd-row background; unset (=off) unless the app sets it
+ // Per-cell hover tooltip text, keyed by (row, model column). Used for the
+ // Errors column's full-message tooltip (see the GTK query-tooltip handler).
+ std::map<std::pair<unsigned, unsigned>, wxString> cell_tip;
+ bool GetAttrByRow(unsigned int row, unsigned int col,
+ wxDataViewItemAttr& attr) const override {
+ (void)col;
@@ -462,6 +465,36 @@
+ return static_cast<AttrListStore*>(((wxDataViewCtrl*)win)->GetModel());
+}
+
+#ifdef __WXGTK__
+// GtkTreeView "query-tooltip" handler: show the per-cell tooltip stored for the
+// (row, model column) under the pointer (used by the Errors column). wx does
+// not surface per-cell tooltips on wxDataViewCtrl, and mouse-motion events are
+// not delivered to wx handlers on the native GTK control, so this hooks the
+// native signal directly.
+static gboolean dvlc_query_tooltip(GtkWidget* tv, gint x, gint y, gboolean keyboard,
+ GtkTooltip* tooltip, gpointer user_data) {
+ (void)keyboard;
+ wxDataViewCtrl* dv = static_cast<wxDataViewCtrl*>(user_data);
+ gint bx = 0, by = 0;
+ gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(tv), x, y, &bx, &by);
+ GtkTreePath* path = nullptr;
+ GtkTreeViewColumn* gcol = nullptr;
+ if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), bx, by, &path, &gcol, nullptr, nullptr))
+ return FALSE;
+ gint* idx = gtk_tree_path_get_indices(path);
+ int row = idx ? idx[0] : -1;
+ gtk_tree_path_free(path);
+ if (row < 0 || !gcol) return FALSE;
+ wxDataViewColumn* wxcol = dv->GTKColumnToWX(gcol);
+ if (!wxcol) return FALSE;
+ AttrListStore* store = static_cast<AttrListStore*>(dv->GetModel());
+ auto it = store->cell_tip.find({(unsigned)row, wxcol->GetModelColumn()});
+ if (it == store->cell_tip.end() || it->second.IsEmpty()) return FALSE;
+ gtk_tooltip_set_text(tooltip, it->second.utf8_str());
+ return TRUE;
+}
+#endif
+
+void* wxbr_dvlc(void* parent) {
+ // Multi-select (ctrl/shift-click) + row lines. Selection replaces the old
+ // checkbox column. A custom AttrListStore backs it so rows can be coloured by
@@ -507,7 +540,12 @@
+ // inapplicable on GTK.)
+ {
+ GtkWidget* tv = dv->GtkGetTreeView();
+ if (tv) gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(tv), TRUE);
+ if (tv) {
+ gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(tv), TRUE);
+ // Per-cell hover tooltips (Errors column) via the native signal.
+ gtk_widget_set_has_tooltip(tv, TRUE);
+ g_signal_connect(tv, "query-tooltip", G_CALLBACK(dvlc_query_tooltip), dv);
+ }
+ }
+#else
+ // Non-GTK fallback: track a drag anchor and extend the selection to the row
@@ -625,6 +663,18 @@
+ AttrListStore* store = dvlc_store(win);
+ store->DeleteAllItems();
+ store->row_fg.clear();
+ store->cell_tip.clear();
+}
+
+// Set (or clear, with an empty string) the hover tooltip for one cell,
+// addressed by (row, model column). Used for the Errors column's full text.
+void wxbr_dvlc_set_cell_tooltip(void* win, unsigned row, unsigned col, const char* text) {
+ AttrListStore* store = dvlc_store(win);
+ if (text && text[0]) {
+ store->cell_tip[{row, col}] = wxString::FromUTF8(text);
+ } else {
+ store->cell_tip.erase({row, col});
+ }
+}
+
+// Set (or clear, when r<0) a row's text colour; used to paint rows by status.
@@ -77,6 +77,9 @@ class AttrListStore : public wxDataViewListStore {
public:
std::vector<wxColour> row_fg;
wxColour zebra; // odd-row background; unset (=off) unless the app sets it
// Per-cell hover tooltip text, keyed by (row, model column). Used for the
// Errors column's full-message tooltip (see the GTK query-tooltip handler).
std::map<std::pair<unsigned, unsigned>, wxString> cell_tip;
bool GetAttrByRow(unsigned int row, unsigned int col,
wxDataViewItemAttr& attr) const override {
(void)col;
@@ -459,6 +462,36 @@ static AttrListStore* dvlc_store(void* win) {
return static_cast<AttrListStore*>(((wxDataViewCtrl*)win)->GetModel());
}
#ifdef __WXGTK__
// GtkTreeView "query-tooltip" handler: show the per-cell tooltip stored for the
// (row, model column) under the pointer (used by the Errors column). wx does
// not surface per-cell tooltips on wxDataViewCtrl, and mouse-motion events are
// not delivered to wx handlers on the native GTK control, so this hooks the
// native signal directly.
static gboolean dvlc_query_tooltip(GtkWidget* tv, gint x, gint y, gboolean keyboard,
GtkTooltip* tooltip, gpointer user_data) {
(void)keyboard;
wxDataViewCtrl* dv = static_cast<wxDataViewCtrl*>(user_data);
gint bx = 0, by = 0;
gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(tv), x, y, &bx, &by);
GtkTreePath* path = nullptr;
GtkTreeViewColumn* gcol = nullptr;
if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), bx, by, &path, &gcol, nullptr, nullptr))
return FALSE;
gint* idx = gtk_tree_path_get_indices(path);
int row = idx ? idx[0] : -1;
gtk_tree_path_free(path);
if (row < 0 || !gcol) return FALSE;
wxDataViewColumn* wxcol = dv->GTKColumnToWX(gcol);
if (!wxcol) return FALSE;
AttrListStore* store = static_cast<AttrListStore*>(dv->GetModel());
auto it = store->cell_tip.find({(unsigned)row, wxcol->GetModelColumn()});
if (it == store->cell_tip.end() || it->second.IsEmpty()) return FALSE;
gtk_tooltip_set_text(tooltip, it->second.utf8_str());
return TRUE;
}
#endif
void* wxbr_dvlc(void* parent) {
// Multi-select (ctrl/shift-click) + row lines. Selection replaces the old
// checkbox column. A custom AttrListStore backs it so rows can be coloured by
@@ -504,7 +537,12 @@ void* wxbr_dvlc(void* parent) {
// inapplicable on GTK.)
{
GtkWidget* tv = dv->GtkGetTreeView();
if (tv) gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(tv), TRUE);
if (tv) {
gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(tv), TRUE);
// Per-cell hover tooltips (Errors column) via the native signal.
gtk_widget_set_has_tooltip(tv, TRUE);
g_signal_connect(tv, "query-tooltip", G_CALLBACK(dvlc_query_tooltip), dv);
}
}
#else
// Non-GTK fallback: track a drag anchor and extend the selection to the row
@@ -622,6 +660,18 @@ void wxbr_dvlc_clear(void* win) {
AttrListStore* store = dvlc_store(win);
store->DeleteAllItems();
store->row_fg.clear();
store->cell_tip.clear();
}
// Set (or clear, with an empty string) the hover tooltip for one cell,
// addressed by (row, model column). Used for the Errors column's full text.
void wxbr_dvlc_set_cell_tooltip(void* win, unsigned row, unsigned col, const char* text) {
AttrListStore* store = dvlc_store(win);
if (text && text[0]) {
store->cell_tip[{row, col}] = wxString::FromUTF8(text);
} else {
store->cell_tip.erase({row, col});
}
}
// Set (or clear, when r<0) a row's text colour; used to paint rows by status.
+8
View File
@@ -58,6 +58,7 @@ mod notsafe {
pub fn wxbr_dvlc_clear(win: *mut c_void);
pub fn wxbr_dvlc_row_count(win: *mut c_void) -> c_int;
pub fn wxbr_dvlc_set_cell(win: *mut c_void, row: usize, col: usize, value: *const c_char);
pub fn wxbr_dvlc_set_cell_tooltip(win: *mut c_void, row: usize, col: usize, text: *const c_char);
pub fn wxbr_dvlc_get_cell(win: *mut c_void, row: usize, col: usize, buf: *mut c_char, cap: c_int) -> c_int;
pub fn wxbr_dvlc_col_count(win: *mut c_void) -> c_int;
pub fn wxbr_dvlc_autosize_col(win: *mut c_void, pos: c_int);
@@ -482,6 +483,13 @@ impl Widget {
unsafe { notsafe::wxbr_dvlc_set_cell(self.0, row, col, c.as_ptr()) }
}
/// Set the hover tooltip for one cell (empty clears it). GTK only; a no-op
/// on other platforms until they gain per-cell tooltip support.
pub fn dvlc_set_cell_tooltip(&self, row: usize, col: usize, text: &str) {
let c = CString::new(text).unwrap_or_default();
unsafe { notsafe::wxbr_dvlc_set_cell_tooltip(self.0, row, col, c.as_ptr()) }
}
pub fn dvlc_get_cell(&self, row: usize, col: usize) -> Option<String> {
let mut buf = vec![0i8; 4096];
let n = unsafe {