/
tablePlate.go
73 lines (59 loc) · 1.3 KB
/
tablePlate.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package GoFunctionCounterSlide
import (
"github.com/rivo/tview"
"strconv"
)
type tablePlate struct {
emptyCell *tview.TableCell
data []string
}
func newTablePlate(data []string) *tablePlate {
return &tablePlate{
emptyCell: tview.NewTableCell(""),
data: data,
}
}
func (self *tablePlate) GetCell(row, column int) *tview.TableCell {
if row == -1 || column == -1 {
return tview.NewTableCell("")
}
switch row {
case 0:
switch column {
case 0:
return tview.NewTableCell("*").SetSelectable(false)
case 1:
return tview.NewTableCell("Go Function").SetSelectable(false)
}
default:
switch column {
case 0:
return tview.NewTableCell(strconv.Itoa(row)).SetSelectable(false)
case 1:
index := row - 1
count := len(self.data)
if index < count {
return tview.NewTableCell(self.data[row-1])
}
}
}
return self.emptyCell
}
func (self *tablePlate) GetRowCount() int {
return len(self.data) + 1
}
func (self *tablePlate) GetColumnCount() int {
return 2
}
func (self *tablePlate) SetCell(row, column int, cell *tview.TableCell) {
}
func (self *tablePlate) RemoveRow(row int) {
}
func (self *tablePlate) RemoveColumn(column int) {
}
func (self *tablePlate) InsertRow(row int) {
}
func (self *tablePlate) InsertColumn(column int) {
}
func (self *tablePlate) Clear() {
}