use saudade::Rect;
pub const MENU_H: i32 = 20;
pub const TOOLBAR_H: i32 = 28;
pub const LIST_W: i32 = 196;
pub const PAD: i32 = 6;
pub fn menu(b: Rect) -> Rect {
Rect::new(b.x, b.y, b.w, MENU_H)
}
pub fn toolbar(b: Rect) -> Rect {
Rect::new(b.x, b.y + MENU_H, b.w, TOOLBAR_H)
}
fn content_y(b: Rect) -> i32 {
b.y + MENU_H + TOOLBAR_H + PAD
}
fn content_h(b: Rect) -> i32 {
(b.h - MENU_H - TOOLBAR_H - 2 * PAD).max(0)
}
fn list_w(b: Rect) -> i32 {
LIST_W.min((b.w - 3 * PAD - 120).max(0))
}
pub fn list(b: Rect) -> Rect {
Rect::new(b.x + PAD, content_y(b), list_w(b), content_h(b))
}
pub fn detail(b: Rect) -> Rect {
let x = b.x + 2 * PAD + list_w(b);
let w = (b.right() - x - PAD).max(0);
Rect::new(x, content_y(b), w, content_h(b))
}