| 1 | /* @title: Pinned status bar */ |
| 2 | #pragma once |
| 3 | #include <compiler.h> |
| 4 | #include <console/report.h> |
| 5 | #include <console/term.h> |
| 6 | #include <stdarg.h> |
| 7 | #include <stddef.h> |
| 8 | #include <time/time.h> |
| 9 | |
| 10 | /* This is the only place that moves the cursor. DECSTBM (CSI top;bottom r) |
| 11 | * shrinks the region that scrolls, and CUP (CSI row; col H) addresses the row |
| 12 | * left outside it, so the bar stays pinned while log output scrolls above it. |
| 13 | * |
| 14 | * We borrow the line writer for report.h to build the text */ |
| 15 | void status_bar_open(void); |
| 16 | void status_bar_close(void); |
| 17 | __printf_like(1, 2) void status_bar_set(const char *fmt, ...); |
| 18 | |
| 19 | /* [####----] 34/120 (28%) <detail...>, painted onto the bar */ |
| 20 | __printf_like(3, 4) void status_bar_progress(size_t done, size_t total, |
| 21 | const char *detail_fmt, ...); |
| 22 | |
| 23 | __printf_like(5, 6) void status_bar_progress_timed(size_t done, size_t total, |
| 24 | time_ms_t test_started_ms, |
| 25 | time_ms_t total_started_ms, |
| 26 | const char *detail_fmt, ...); |
| 27 | |
| 28 | /* Hand the whole screen back: drop the scroll region, forget the bar */ |
| 29 | void status_bar_reset(void); |
| 30 | |