-
Notifications
You must be signed in to change notification settings - Fork 2
/
enum.go
50 lines (40 loc) · 1.1 KB
/
enum.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
package grid
// TextAlign is an enum used to set the text alignment within a cell
type TextAlign int
const (
// Left align text within a cell
Left TextAlign = iota
// Right align text within a cell
Right
)
func (ta TextAlign) String() string {
return [...]string{"Left", "Right"}[ta]
}
// Overflow is an enum used to set the text overflow behavior within a cell
type Overflow int
const (
// Hide text that extends beyond the width of a cell
Hidden Overflow = iota
// Wrap text onto the next line when the text width exceeds the width of the cell
Wrap
// Wrap text onto the next line when the text width exceeds the width of the cell
// but only break on words
WrapWord
)
func (to Overflow) String() string {
return [...]string{"Hidden", "Wrap", "WrapWord"}[to]
}
// Breakpoint is an enum used to set the visibility of cells are various terminal sizes
type Breakpoint int
const (
Small Breakpoint = iota
Medium
Large
XLarge
)
func (bp Breakpoint) String() string {
return [...]string{"Small", "Medium", "Large", "XLarge"}[bp]
}
func (bp Breakpoint) Size() int {
return [...]int{50, 100, 200, 400}[bp]
}