MCPcopy Create free account
hub / github.com/andlabs/ui / CellValue

Method CellValue

examples/table.go:55–109  ·  view source on GitHub ↗
(m *ui.TableModel, row, column int)

Source from the content-addressed store, hash-verified

53var img [2]*ui.Image
54
55func (mh *modelHandler) CellValue(m *ui.TableModel, row, column int) ui.TableValue {
56 if column == 3 {
57 if row == mh.yellowRow {
58 return ui.TableColor{1, 1, 0, 1}
59 }
60 if row == 3 {
61 return ui.TableColor{1, 0, 0, 1}
62 }
63 if row == 11 {
64 return ui.TableColor{0, 0.5, 1, 0.5}
65 }
66 return nil
67 }
68 if column == 4 {
69 if (row % 2) == 1 {
70 return ui.TableColor{0.5, 0, 0.75, 1}
71 }
72 return nil
73 }
74 if column == 5 {
75 if row < 8 {
76 return ui.TableImage{img[0]}
77 }
78 return ui.TableImage{img[1]}
79 }
80 if column == 7 {
81 return ui.TableInt(mh.checkStates[row])
82 }
83 if column == 8 {
84 if row == 0 {
85 return ui.TableInt(0)
86 }
87 if row == 13 {
88 return ui.TableInt(100)
89 }
90 if row == 14 {
91 return ui.TableInt(-1)
92 }
93 return ui.TableInt(50)
94 }
95 switch column {
96 case 0:
97 return ui.TableString(fmt.Sprintf("Row %d", row))
98 case 2:
99 if row == 9 {
100 return ui.TableString(mh.row9Text)
101 }
102 return ui.TableString("Editing this won't change anything")
103 case 1:
104 return ui.TableString("Colors!")
105 case 6:
106 return ui.TableString("Make Yellow")
107 }
108 panic("unreachable")
109}
110
111func (mh *modelHandler) SetCellValue(m *ui.TableModel, row, column int, value ui.TableValue) {
112 if row == 9 && column == 2 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected