From aa5e327ef606167d0bd13ece4e09cc28207fd48a Mon Sep 17 00:00:00 2001 From: Julian Hurst Date: Sun, 11 Sep 2022 02:48:26 +0200 Subject: Add new setsize api to widget and better size support for list This adds a distinction between the list size (list.sz) and the list's frame size (list.frame.sz). This commit also adds the widget::setsize api and implements it for list. --- libtui/widget/widget.ha | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libtui/widget/widget.ha') diff --git a/libtui/widget/widget.ha b/libtui/widget/widget.ha index 6875692..307378d 100644 --- a/libtui/widget/widget.ha +++ b/libtui/widget/widget.ha @@ -13,6 +13,8 @@ export type print = fn(w: *widget) (void | error); // A function that frees the resources associated to the widget. export type finish = fn(w: *widget) void; +export type setsize = fn(w: *widget, sz: tty::ttysize) void; + // An input listener on a widget. The returning value is intended to be used as // a signal that will be returned by [[notify]] in order to trigger certain more // global ui events (terminate the program, change widget focus, etc.). To @@ -53,6 +55,7 @@ export type listener = *fn(w: *widget, r: libtui::key) bool; export type widget = struct { print: nullable *print, finish: nullable *finish, + setsize: nullable *setsize, listeners: []listener, ui: libtui::ttyui, }; -- cgit v1.2.3