diff options
| author | Jeff Carr <[email protected]> | 2019-05-08 16:50:52 -0700 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2019-05-08 16:50:52 -0700 |
| commit | f754cd70303a52ca504c506db70d67f8611ef865 (patch) | |
| tree | dec1e61e56c35efe99fbcc4eb66dd109657bb63b /table.go | |
| parent | 9ef3b54c01a6a468953bdd325a2e8a7cbf2c0512 (diff) | |
Cleaned out the cell width type init from the data init
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'table.go')
| -rw-r--r-- | table.go | 65 |
1 files changed, 6 insertions, 59 deletions
@@ -11,6 +11,11 @@ import _ "github.com/andlabs/ui/winmanifest" var img [2]*ui.Image +/* + img[0] = ui.NewImage(16, 16) + img[1] = ui.NewImage(16, 16) +*/ + type cellData struct { index int value ui.TableValue @@ -32,31 +37,12 @@ type rowData struct { type tableData struct { rowcount int // This is the number of 'rows' which really means data elements not what the human sees + rowWidth int // This is how wide each row is rows []rowData // This is all the table data by row generatedColumnTypes []ui.TableValue // generate this dynamically libUIevent func(*tableData, *ui.TableModel, int, int, ui.TableValue) } -func initBTcolor(mh *tableData, intBG int) { - img[0] = ui.NewImage(16, 16) - img[1] = ui.NewImage(16, 16) - - mh.generatedColumnTypes = append(mh.generatedColumnTypes, ui.TableColor{}) - - for i := 0; i < mh.rowcount; i++ { - log.Println("i=",i) - - // alternate background of each row light and dark - if (i % 2) == 1 { - mh.rows[i].cells[intBG].value = ui.TableColor{0.5, 0.5, 0.5, .7} - mh.rows[i].cells[intBG].name = "BG" - } else { - mh.rows[i].cells[intBG].value = ui.TableColor{0.1, 0.1, 0.1, .1} - mh.rows[i].cells[intBG].name = "BG" - } - } -} - func initRowBTcolor(mh *tableData, row int, intBG int) { // alternate background of each row light and dark if (row % 2) == 1 { @@ -68,39 +54,12 @@ func initRowBTcolor(mh *tableData, row int, intBG int) { } } -func initButtonColumn(mh *tableData, buttonID int, junk string) { - mh.generatedColumnTypes = append(mh.generatedColumnTypes, ui.TableString("")) - - for i := 0; i < mh.rowcount; i++ { - // set the button text for Column ? - mh.rows[i].cells[buttonID].value = ui.TableString(fmt.Sprintf("%s %d", junk, i)) - mh.rows[i].cells[buttonID].name = "BUTTON" - } -} - func initRowButtonColumn(mh *tableData, row int, buttonID int, junk string) { // set the button text for Column ? mh.rows[row].cells[buttonID].value = ui.TableString(fmt.Sprintf("%s %d", junk, row)) mh.rows[row].cells[buttonID].name = "BUTTON" } -func initTextColorColumn(mh *tableData, stringID int, colorID int, junk string, color ui.TableColor) { - mh.generatedColumnTypes = append(mh.generatedColumnTypes, ui.TableString("")) - mh.generatedColumnTypes = append(mh.generatedColumnTypes, ui.TableColor{}) - - for i := 0; i < mh.rowcount; i++ { - log.Println("i=",i) - - // text for Column ? - mh.rows[i].cells[stringID].value = ui.TableString(fmt.Sprintf("%s %d", junk, i)) - mh.rows[i].cells[stringID].name = "EDIT" - - // text color for Column ? - mh.rows[i].cells[colorID].value = color - mh.rows[i].cells[colorID].name = "COLOR" - } -} - func initRowTextColorColumn(mh *tableData, row int, stringID int, colorID int, junk string, color ui.TableColor) { // text for Column ? mh.rows[row].cells[stringID].value = ui.TableString(fmt.Sprintf("%s %d", junk, row)) @@ -111,18 +70,6 @@ func initRowTextColorColumn(mh *tableData, row int, stringID int, colorID int, j mh.rows[row].cells[colorID].name = "COLOR" } -func initTextColumn(mh *tableData, stringID int, junk string) { - mh.generatedColumnTypes = append(mh.generatedColumnTypes, ui.TableString("")) - - for i := 0; i < mh.rowcount; i++ { - log.Println("i=",i) - - // text for Column ? - mh.rows[i].cells[stringID].value = ui.TableString(fmt.Sprintf("%s %d", junk, i)) - mh.rows[i].cells[stringID].name = "EDIT" - } -} - func initRowTextColumn(mh *tableData, row int, stringID int, junk string) { mh.rows[row].cells[stringID].value = ui.TableString(fmt.Sprintf("%s %d", junk, row)) mh.rows[row].cells[stringID].name = "EDIT" |
