GUI round 11 (#2): collapse the two wide KPI cards when the window is too narrow

When the window is narrowed past the width needed to fit all seven KPI cards at
their minimum size, the two wide cards (SHA-256 Hashrate, Est. power) are hidden
so the five miner-count cards fill the row; they return when there is room again.
The five count cards still floor the window's minimum width (unchanged).

Adds a resize event to the wx-rs bridge (WxEV_SIZE -> WxEventKind::Sized, p1 =
client width) and a wxbr_sizer_show helper to hide/restore a sizer child and
reclaim its space. The main panel binds it; App::on_resize toggles the two cards
on a state change only (no per-drag relayout thrash). Bridge + Rust changes
mirrored into patches 0002 (widgets.rs) and 0003 (widgets_bridge.cpp) per
ADR 0003.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
This commit is contained in:
2026-09-18 17:39:56 -06:00
co-authored by Claude Opus 4.8
parent fc7c665166
commit 6b4961d7bc
5 changed files with 109 additions and 2 deletions
@@ -66,6 +66,7 @@ enum WxWidgetEventKind {
WxEV_SYS_COLOUR = 13,
WxEV_DEFERRED = 14,
WxEV_DVLC_HEADER_RIGHT_CLICK = 15,
WxEV_SIZE = 16, // p1 = new client width, p2 = new client height
};
// A list store that carries an optional per-row foreground colour plus an
@@ -404,6 +405,23 @@ void wxbr_sizer_detach(void* sizer, void* win) {
((wxSizer*)sizer)->Detach((wxWindow*)win);
}
// Show or hide a sizer-managed child window AND reclaim (or restore) its space
// on the next Layout(). Used to collapse the wide KPI cards when the window is
// too narrow (round 11 #2).
void wxbr_sizer_show(void* sizer, void* win, int show) {
((wxSizer*)sizer)->Show((wxWindow*)win, show != 0);
}
// Emit WxEV_SIZE (p1 = new client width, p2 = height) whenever this window is
// resized. e.Skip() keeps the normal sizer layout running (round 11 #2).
void wxbr_bind_size(void* win) {
((wxWindow*)win)->Bind(wxEVT_SIZE, [](wxSizeEvent& e) {
if (g_widget_event) g_widget_event(WxEV_SIZE, (long)e.GetSize().GetWidth(),
(long)e.GetSize().GetHeight());
e.Skip();
});
}
void wxbr_fit(void* win) { ((wxWindow*)win)->Fit(); }
void wxbr_set_min_size(void* win, int w, int h) {