From 00e908e2ae1b851ef1b88f351bf0551bdd76c6fe Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Mon, 8 Aug 2022 22:04:02 +0200 Subject: widgets: add dialog interface Implement an interface for aerc's dialog implementation. Provide dialogs the ability to set their own height and width of their drawing context. Signed-off-by: Koni Marti Acked-by: Robin Jarry --- widgets/dialog.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 widgets/dialog.go (limited to 'widgets/dialog.go') diff --git a/widgets/dialog.go b/widgets/dialog.go new file mode 100644 index 00000000..1af4456a --- /dev/null +++ b/widgets/dialog.go @@ -0,0 +1,24 @@ +package widgets + +import ( + "git.sr.ht/~rjarry/aerc/lib/ui" +) + +type Dialog interface { + ui.DrawableInteractive + ContextHeight() (func(int) int, func(int) int) +} + +type dialog struct { + ui.DrawableInteractive + y func(int) int + h func(int) int +} + +func (d *dialog) ContextHeight() (func(int) int, func(int) int) { + return d.y, d.h +} + +func NewDialog(d ui.DrawableInteractive, y func(int) int, h func(int) int) Dialog { + return &dialog{DrawableInteractive: d, y: y, h: h} +} -- cgit