void wndmgr_close(window_ref wnd) { window_sref to_close = _wndmgr_find(wnd); if(window_stack == to_close) { window_stack = to_close->next; } else { window_sref wnd_before = _wndmgr_find_before(to_close); wnd_before->next = to_close->next; } window_sref sref = window_stack; do { window_stack_tip = sref; } while(sref && (sref = sref->next)); // todo: free memory _wndmgr_log_windows(); lodoovka_redraw(); }
void wndmgr_order_back(window_ref wnd) { window_sref to_order = _wndmgr_find(wnd); if(window_stack == to_order) return; window_sref wnd_before = _wndmgr_find_before(to_order); wnd_before->next = to_order->next; if(window_stack_tip == to_order) { window_stack_tip = wnd_before; } to_order->next = window_stack; window_stack = to_order; _wndmgr_log_windows(); lodoovka_redraw(); }
window_ref wndmgr_add(window_ref wnd) { window_sref swnd = malloc(sizeof(struct StackedWindow)); swnd->wnd = wnd; swnd->next = NULL; if(window_stack_tip) { window_stack_tip->next = swnd; window_stack_tip = swnd; } else { window_stack = window_stack_tip = swnd; } lodoovka_redraw(); _wndmgr_log_windows(); return wnd; }
void wndmgr_order_front(window_ref wnd) { window_sref to_order = _wndmgr_find(wnd); if(window_stack_tip == to_order) return; if(window_stack == to_order) { window_stack = to_order->next; } else { window_sref wnd_before = _wndmgr_find_before(to_order); wnd_before->next = to_order->next; } to_order->next = NULL; window_stack_tip->next = to_order; window_stack_tip = to_order; _wndmgr_log_windows(); lodoovka_redraw(); }
void lodoovka_main() { lodoovka_redraw(); wndmgr_init(); }