-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhr.go
55 lines (44 loc) · 1.26 KB
/
hr.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
52
53
54
55
package goey
import (
"bitbucket.org/rj/goey/base"
)
var (
hrKind = base.NewKind("bitbucket.org/rj/goey.HR")
)
// HR describes a widget that is a horizontal separator.
type HR struct {
}
// Kind returns the concrete type for use in the Widget interface.
// Users should not need to use this method directly.
func (*HR) Kind() *base.Kind {
return &hrKind
}
// Mount creates a horizontal rule control in the GUI.
// The newly created widget will be a child of the widget specified by parent.
func (w *HR) Mount(parent base.Control) (base.Element, error) {
// Forward to the platform-dependant code
return w.mount(parent)
}
func (*hrElement) Kind() *base.Kind {
return &hrKind
}
func (w *hrElement) Props() base.Widget {
return &HR{}
}
func (*hrElement) Layout(bc base.Constraints) base.Size {
if bc.HasBoundedWidth() {
return bc.Constrain(base.Size{bc.Max.Width, 13 * DIP})
}
return bc.Constrain(base.Size{13 * DIP, 13 * DIP})
}
func (w *hrElement) MinIntrinsicHeight(width base.Length) base.Length {
return 13 * DIP
}
func (w *hrElement) MinIntrinsicWidth(height base.Length) base.Length {
return 13 * DIP
}
func (w *hrElement) UpdateProps(data base.Widget) error {
// This widget does not have any properties, so there cannot be anything
// to update.
return nil
}