From 3b09c07e7a75feed8a9086b0a9003c2cf3ffea59 Mon Sep 17 00:00:00 2001 From: Jeffas Date: Thu, 11 Jul 2019 23:15:15 +0100 Subject: Add clickable tabs This introduces a new interface `Clickable`. I'd imagine this would be implemented for most widgets eventually and would allow for programs run in the terminal to also have their mouse events forwarded to them. For the tabs it was relatively simple to check that the position of the click is within the boxes for the tabs. For other components I'd imagine that some state representing their currently drawn bounding box would be useful. --- lib/ui/interfaces.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/ui/interfaces.go') diff --git a/lib/ui/interfaces.go b/lib/ui/interfaces.go index 0cdffc1e..9008ea72 100644 --- a/lib/ui/interfaces.go +++ b/lib/ui/interfaces.go @@ -40,3 +40,10 @@ type Container interface { // recurse into your grandchildren). Children() []Drawable } + +// A drawable that can be clicked +type Clickable interface { + Drawable + + MouseEvent(event tcell.Event) +} -- cgit