diff options
| author | Julian Hurst <ark@mansus.space> | 2022-09-11 02:48:26 +0200 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2023-09-07 00:09:06 +0200 |
| commit | aa5e327ef606167d0bd13ece4e09cc28207fd48a (patch) | |
| tree | 344862299515eff91ded41e2e8df58bb754a06e1 /libtui/widget/widget.ha | |
| parent | f98e057376e779057f5dd5901b1c08d87f49d71c (diff) | |
| download | hare-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.ha | 3 |
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, }; |
