about summary refs log tree commit diff stats
path: root/continuation2.mu
Commit message (Collapse)AuthorAgeFilesLines
* 4262 - literal 'null'Kartik Agaram2018-06-171-3/+3
|
* 4261 - start using literals for 'true' and 'false'Kartik Agaram2018-06-171-1/+1
| | | | | | | | | They uncovered one bug: in edit/003-shortcuts.mu <scroll-down> was returning 0 for an address in one place where I thought it was returning 0 for a boolean. Now we've eliminated this bad interaction between tangling and punning literals.
* 4160 - named marks for delimited continuationsKartik K. Agaram2017-12-151-2/+2
| | | | | Hypothesis: this is needed to build McCarthy's amb operator. https://rosettacode.org/wiki/Amb
* 4159Kartik K. Agaram2017-12-101-2/+2
| | | | | Many continuation examples were failing since commit 4151. Include one of them as a test.
* 4134 - 'input' = 'ingredient'Kartik K. Agaram2017-12-031-1/+1
|
* 4133Kartik K. Agaram2017-11-251-0/+5
|
* 4117 - done with delimited continuationsKartik K. Agaram2017-11-061-2/+7
| | | | | At least this particular implementation of them. Let's play with them now for a while, see if they're fully equivalent to shift/reduce.
* 4103 - continuations no longer cause memory corruptionKartik K. Agaram2017-11-031-0/+27
aces.go?id=2804f000017c0ef6bcaf8d571627fa08784f48ac'>^
87fa305 ^









152f8c9 ^




87fa305 ^


a0c2b1c ^

87fa305 ^
87fa305 ^
3b09c07 ^
f6216bb ^






3b09c07 ^
f6216bb ^

3b09c07 ^
f6216bb ^


3b09c07 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67





                                  

                                                                               
                         
                                                          
                          

                                                                               
                                               
                                                                           





                                                                  

                                                                          

 



                            









                                                          




                                          


                                            

                                                                             
                             
 
 






                                                                             
                

                    
 


                                             
 
package ui

import (
	"github.com/gdamore/tcell"
)

// Drawable is a UI component that can draw. Unless specified, all methods must
// only be called from a single goroutine, the UI goroutine.
type Drawable interface {
	// Called when this renderable should draw itself.
	Draw(ctx *Context)
	// Specifies a function to call when this cell needs to be redrawn. The
	// callback may be called in any goroutine.
	OnInvalidate(callback func(d Drawable))
	// Invalidates the drawable. This can be called from any goroutine.
	Invalidate()
}

type Interactive interface {
	// Returns true if the event was handled by this component
	Event(event tcell.Event) bool
	// Indicates whether or not this control will receive input events
	Focus(focus bool)
}

type Beeper interface {
	OnBeep(func() error)
}

type Simulator interface {
	// Queues up the given input events for simulation
	Simulate(events []tcell.Event)
}

type DrawableInteractive interface {
	Drawable
	Interactive
}

type DrawableInteractiveBeeper interface {
	DrawableInteractive
	Beeper
}

// A drawable which contains other drawables
type Container interface {
	Drawable
	// Return all of the drawables which are children of this one (do not
	// recurse into your grandchildren).
	Children() []Drawable
}

type MouseHandler interface {
	// Handle a mouse event which occurred at the local x and y positions
	MouseEvent(localX int, localY int, event tcell.Event)
}

// A drawable that can be interacted with by the mouse
type Mouseable interface {
	Drawable
	MouseHandler
}

type MouseableDrawableInteractive interface {
	DrawableInteractive
	MouseHandler
}