/
policy_float_top.go
49 lines (40 loc) · 1.04 KB
/
policy_float_top.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
package frame
type floatTopPolicy struct {
Frame *Frame
}
func newFloatTopPolicy(frame *Frame) *floatTopPolicy {
return &floatTopPolicy{
Frame: frame,
}
}
// proactive action!
// note: most frame objects don't exist, make changes based on the frame config
func (policy *floatTopPolicy) onInit() {
policy.Frame.Config.startRow = 1
policy.Frame.startIdx = 1
offset, err := GetCursorRow()
if err != nil {
return
}
policy.Frame.rowAdvancements = offset - 1
}
// reactive action!
func (policy *floatTopPolicy) onResize(adjustment int) {}
// reactive policy!
func (policy *floatTopPolicy) onTrail() {}
// reactive action!
// update any positions based on external data and redraw
// func (policy *floatTopPolicy) onUpdate() {
// if policy.Frame.topRow != 1 {
// policy.Frame.move(policy.Frame.topRow - 1)
// }
// }
// proactive policy!
// func (policy *floatTopPolicy) onClose() {}
// proactive action!
func (policy *floatTopPolicy) allowedMotion(rows int) int {
return 0
}
func (policy *floatTopPolicy) isAllowedTrail() bool {
return false
}