-
Notifications
You must be signed in to change notification settings - Fork 1
/
white.go
51 lines (39 loc) · 1.19 KB
/
white.go
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
package main
import (
"image"
"9fans.net/go/draw"
"github.com/mjl-/duit"
)
type white struct {
}
var _ duit.UI = &white{}
func (ui *white) Layout(dui *duit.DUI, self *duit.Kid, sizeAvail image.Point, force bool) {
self.R = image.Rect(0, 0, sizeAvail.X, sizeAvail.Y)
}
func (ui *white) Draw(dui *duit.DUI, self *duit.Kid, img *draw.Image, orig image.Point, m draw.Mouse, force bool) {
img.Draw(self.R.Add(orig), dui.Display.White, nil, image.ZP)
}
func (ui *white) Mouse(dui *duit.DUI, self *duit.Kid, m draw.Mouse, origM draw.Mouse, orig image.Point) (r duit.Result) {
r.Hit = ui
return
}
func (ui *white) Key(dui *duit.DUI, self *duit.Kid, k rune, m draw.Mouse, orig image.Point) (r duit.Result) {
r.Hit = ui
return
}
func (ui *white) FirstFocus(dui *duit.DUI, self *duit.Kid) (warp *image.Point) {
p := self.R.Size().Div(2)
return &p
}
func (ui *white) Focus(dui *duit.DUI, self *duit.Kid, o duit.UI) (warp *image.Point) {
if ui != o {
return nil
}
return ui.FirstFocus(dui, self)
}
func (ui *white) Mark(self *duit.Kid, o duit.UI, forLayout bool) (marked bool) {
return self.Mark(o, forLayout)
}
func (ui *white) Print(self *duit.Kid, indent int) {
duit.PrintUI("white", self, indent)
}