From b6d07237b423b690570e105e5f0810d35693b0d0 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 3 Aug 2014 16:28:21 -0400 Subject: Migrated the GTK+ backend to the new Control system. Added controlParent to deal with interface issues; need to apply this to the Windows backend too. --- redo/table_unix.go | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'redo/table_unix.go') diff --git a/redo/table_unix.go b/redo/table_unix.go index 2fd2418..05baa57 100644 --- a/redo/table_unix.go +++ b/redo/table_unix.go @@ -14,10 +14,11 @@ import ( import "C" type table struct { - *scrolledcontrol *tablebase + _widget *C.GtkWidget treeview *C.GtkTreeView + scroller *scroller model *C.goTableModel modelgtk *C.GtkTreeModel @@ -30,15 +31,11 @@ type table struct { func finishNewTable(b *tablebase, ty reflect.Type) Table { widget := C.gtk_tree_view_new() t := &table{ - scrolledcontrol: newScrolledControl(widget, true), + scroller: newScroller(widget, true), tablebase: b, + _widget: widget, treeview: (*C.GtkTreeView)(unsafe.Pointer(widget)), } - t.fgetAuxResizeInfo = func(d *sizing) { - // a Label to the left of a Table should be vertically aligned to the top - // TODO do the same with Area - d.shouldVAlignTop = true - } model := C.newTableModel(unsafe.Pointer(t)) t.model = model t.modelgtk = (*C.GtkTreeModel)(unsafe.Pointer(model)) @@ -96,3 +93,37 @@ func goTableModel_getRowCount(data unsafe.Pointer) C.gint { d := reflect.Indirect(reflect.ValueOf(t.data)) return C.gint(d.Len()) } + +func (t *table) widget() *C.GtkWidget { + return t._widget +} + +func (t *table) setParent(p *controlParent) { + t.scroller.setParent(p) +} + +func (t *table) containerShow() { + basecontainerShow(t) +} + +func (t *table) containerHide() { + basecontainerHide(t) +} + +func (t *table) allocate(x int, y int, width int, height int, d *sizing) []*allocation { + return baseallocate(t, x, y, width, height, d) +} + +func (t *table) preferredSize(d *sizing) (width, height int) { + return basepreferredSize(t, d) +} + +func (t *table) commitResize(c *allocation, d *sizing) { + t.scroller.commitResize(c, d) +} + +func (t *table) getAuxResizeInfo(d *sizing) { + // a Label to the left of a Table should be vertically aligned to the top + // TODO do the same with Area + d.shouldVAlignTop = true +} -- cgit v1.2.3