And finished TableModel. There's cgo issues I need to fix; I might as well split out all the cgo code...
This commit is contained in:
parent
76aa5f420a
commit
a5a00c644c
|
@ -13,7 +13,8 @@ package ui
|
||||||
// {
|
// {
|
||||||
// doTableModelSetCellValue(mh, m, row, column, (uiTableValue *) value);
|
// doTableModelSetCellValue(mh, m, row, column, (uiTableValue *) value);
|
||||||
// }
|
// }
|
||||||
// static const uiTableModelHandler pkguiTableModelHandler = {
|
// // TODO why can't this be static?
|
||||||
|
// const uiTableModelHandler pkguiTableModelHandler = {
|
||||||
// .NumColumns = doTableModelNumColumns,
|
// .NumColumns = doTableModelNumColumns,
|
||||||
// .ColumnType = doTableModelColumnType,
|
// .ColumnType = doTableModelColumnType,
|
||||||
// .NumRows = doTableModelNumRows,
|
// .NumRows = doTableModelNumRows,
|
||||||
|
@ -198,3 +199,45 @@ func doTableModelSetCellValue(umh *C.uiTableModelHandler, um *C.uiTableModel, ro
|
||||||
v := tableValueFromLibui(value)
|
v := tableValueFromLibui(value)
|
||||||
mh.SetCellValue(models[um], int(row), int(column), v)
|
mh.SetCellValue(models[um], int(row), int(column), v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewTableModel creates a new TableModel.
|
||||||
|
func NewTableModel(handler TableModelHandler) *TableModel {
|
||||||
|
m := &TableModel{
|
||||||
|
m: C.uiNewTableModel(&C.pkguiTableModelHandler),
|
||||||
|
}
|
||||||
|
modelhandlers[m.m] = handler
|
||||||
|
models[m.m] = m
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free frees m. It is an error to Free any models associated with a
|
||||||
|
// Table.
|
||||||
|
func (m *TableModel) Free() {
|
||||||
|
delete(models, m.m)
|
||||||
|
delete(modelhandlers, m.m)
|
||||||
|
C.uiFreeTableModel(m.m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RowInserted tells any Tables associated with m that a new row
|
||||||
|
// has been added to m at index index. You call this method when
|
||||||
|
// the number of rows in your model has changed; after calling it,
|
||||||
|
// NumRows should returm the new row count.
|
||||||
|
func (m *TableModel) RowInserted(index int) {
|
||||||
|
C.uiTableModelRowInserted(m.m, C.int(index))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RowChanged tells any Tables associated with m that the data in
|
||||||
|
// the row at index has changed. You do not need to call this in
|
||||||
|
// your SetCellValue handlers, but you do need to call this if your
|
||||||
|
// data changes at some other point.
|
||||||
|
func (m *TableModel) RowChanged(index int) {
|
||||||
|
C.uiTableModelRowChanged(m.m, C.int(index))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RowDeleted tells any Tables associated with m that the row at
|
||||||
|
// index index has been deleted. You call this function when the
|
||||||
|
// number of rows in your model has changed; after calling it,
|
||||||
|
// NumRows should returm the new row count.
|
||||||
|
func (m *TableModel) RowDeleted(index int) {
|
||||||
|
C.uiTableModelRowDeleted(m.m, C.int(index))
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue