diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-14 09:20:20 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-14 09:20:20 -0400 |
| commit | d384df97d0538ac46de936c10a4d4d8b91005b17 (patch) | |
| tree | 60766d286aa6e167c994d66f53e3523b974333e4 /redo/table_windows.go | |
| parent | 697b3cc1b0694db8b788175f6b377f5bcb15d5a2 (diff) | |
Implemented table column autoresize on Windows. Also fixed Windows/Mac OS X build.
Diffstat (limited to 'redo/table_windows.go')
| -rw-r--r-- | redo/table_windows.go | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/redo/table_windows.go b/redo/table_windows.go index 4e6a0e2..93ff9c1 100644 --- a/redo/table_windows.go +++ b/redo/table_windows.go @@ -60,21 +60,22 @@ func tableGetCellText(data unsafe.Pointer, row C.int, col C.int, str *C.LPWSTR) *str = toUTF16(s) } +// the column autoresize policy is simple: +// on every table.commitResize() call, if the columns have not been resized by the user, autoresize +func (t *table) autoresize() { + t.RLock() + defer t.RUnlock() + if !t.noautosize { + C.tableAutosizeColumns(t._hwnd, t.colcount) + } +} + //export tableStopColumnAutosize func tableStopColumnAutosize(data unsafe.Pointer) { t := (*table)(data) t.noautosize = true } -//export tableAutosizeColumns -func tableAutosizeColumns(data unsafe.Pointer) C.BOOL { - t := (*table)(data) - if t.noautosize { - return C.FALSE - } - return C.TRUE -} - //export tableColumnCount func tableColumnCount(data unsafe.Pointer) C.int { t := (*table)(data) @@ -106,6 +107,9 @@ func (t *table) preferredSize(d *sizing) (width, height int) { func (t *table) commitResize(a *allocation, d *sizing) { basecommitResize(t, a, d) + t.RLock() + defer t.RUnlock() + t.autoresize() } func (t *table) getAuxResizeInfo(d *sizing) { |
