aboutsummaryrefslogtreecommitdiff
path: root/libtui/widget/widget.ha
diff options
context:
space:
mode:
authorJulian Hurst <ark@mansus.space>2022-09-11 02:48:26 +0200
committerJulian Hurst <ark@mansus.space>2023-09-07 00:09:06 +0200
commitaa5e327ef606167d0bd13ece4e09cc28207fd48a (patch)
tree344862299515eff91ded41e2e8df58bb754a06e1 /libtui/widget/widget.ha
parentf98e057376e779057f5dd5901b1c08d87f49d71c (diff)
downloadhare-libtui-aa5e327ef606167d0bd13ece4e09cc28207fd48a.tar.gz
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.
Diffstat (limited to 'libtui/widget/widget.ha')
-rw-r--r--libtui/widget/widget.ha3
1 files changed, 3 insertions, 0 deletions
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,
};