2024-03-11 15:10:18 +01:00
|
|
|
|
2025-09-16 15:03:51 +02:00
|
|
|
let ui_statusbar_default_h: i32 = 33;
|
2025-10-15 18:39:55 +02:00
|
|
|
let ui_statusbar_last_tab: i32 = 0;
|
2024-03-11 15:10:18 +01:00
|
|
|
|
2025-10-15 18:39:55 +02:00
|
|
|
function ui_statusbar_init() {}
|
2024-03-11 15:10:18 +01:00
|
|
|
|
2025-09-16 15:03:51 +02:00
|
|
|
function ui_statusbar_width(): i32 {
|
2025-09-19 21:24:11 +02:00
|
|
|
return iron_window_width() - config_raw.layout[layout_size_t.SIDEBAR_W];
|
2024-03-11 15:10:18 +01:00
|
|
|
}
|
|
|
|
|
|
2025-09-16 15:03:51 +02:00
|
|
|
function ui_statusbar_render_ui() {
|
2024-03-11 15:10:18 +01:00
|
|
|
let statush: i32 = config_raw.layout[layout_size_t.STATUS_H];
|
|
|
|
|
|
2025-09-19 21:24:11 +02:00
|
|
|
if (ui_window(ui_base_hwnds[tab_area_t.STATUS], 0, iron_window_height() - statush, ui_statusbar_width(), statush)) {
|
2024-03-11 15:10:18 +01:00
|
|
|
ui._y += 2;
|
|
|
|
|
|
|
|
|
|
// Border
|
2025-03-02 21:07:17 +01:00
|
|
|
draw_set_color(ui.ops.theme.SEPARATOR_COL);
|
2025-03-02 19:44:26 +01:00
|
|
|
draw_filled_rect(0, 0, 1, ui._window_h);
|
|
|
|
|
draw_filled_rect(ui._window_w - 1, 0, 1, ui._window_h);
|
2024-03-11 15:10:18 +01:00
|
|
|
|
|
|
|
|
// Draw tabs
|
2024-05-03 21:29:39 +02:00
|
|
|
let hwnd_draws: tab_draw_t[] = ui_base_hwnd_tabs[tab_area_t.STATUS];
|
2025-10-15 18:39:55 +02:00
|
|
|
let htab: ui_handle_t = ui_base_htabs[tab_area_t.STATUS];
|
2024-05-03 21:29:39 +02:00
|
|
|
for (let i: i32 = 0; i < hwnd_draws.length; ++i) {
|
|
|
|
|
let draw: tab_draw_t = hwnd_draws[i];
|
|
|
|
|
draw.f(htab);
|
2024-03-20 16:13:54 +01:00
|
|
|
}
|
2024-03-11 15:10:18 +01:00
|
|
|
|
2025-09-23 21:44:39 +02:00
|
|
|
if (ui_base_htabs[tab_area_t.STATUS].i < hwnd_draws.length) {
|
|
|
|
|
ui_statusbar_last_tab = ui_base_htabs[tab_area_t.STATUS].i;
|
2025-09-20 11:03:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!config_raw.touch_ui) {
|
|
|
|
|
let minimized: bool = config_raw.layout[layout_size_t.STATUS_H] <= (ui_statusbar_default_h * config_raw.window_scale);
|
|
|
|
|
if (ui_tab(ui_base_htabs[tab_area_t.STATUS], minimized ? "<" : ">", false, -2)) {
|
2025-10-15 18:39:55 +02:00
|
|
|
ui_base_htabs[tab_area_t.STATUS].i = ui_statusbar_last_tab;
|
2025-09-20 11:03:59 +02:00
|
|
|
config_raw.layout_tabs[tab_area_t.STATUS] = ui_statusbar_last_tab;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-16 15:03:51 +02:00
|
|
|
let minimized: bool = statush <= ui_statusbar_default_h * config_raw.window_scale;
|
2025-09-23 21:44:39 +02:00
|
|
|
if (htab.changed && (htab.i == context_raw.last_status_position || minimized)) {
|
2024-03-11 15:10:18 +01:00
|
|
|
ui_base_toggle_browser();
|
|
|
|
|
}
|
2025-09-23 21:44:39 +02:00
|
|
|
context_raw.last_status_position = htab.i;
|
2024-03-11 15:10:18 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-16 15:03:51 +02:00
|
|
|
function ui_statusbar_draw_version_tab(htab: ui_handle_t) {
|
2024-03-11 15:10:18 +01:00
|
|
|
// Version label
|
|
|
|
|
if (!config_raw.touch_ui) {
|
|
|
|
|
ui.enabled = false;
|
2024-09-03 15:52:05 +02:00
|
|
|
ui_tab(ui_base_htabs[tab_area_t.STATUS], manifest_version);
|
2024-03-11 15:10:18 +01:00
|
|
|
ui.enabled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|