diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-01 21:21:42 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-01 21:21:42 -0400 |
| commit | f7749f3678a92aa8a43d7afb8be3f357dcf94ff3 (patch) | |
| tree | 6f845397b765450a888d22f38e6911c7ded0da48 | |
| parent | 09c1d78126e8083f93f6cb861ae4a445ac6cc1c6 (diff) | |
Added Table.preferredSize() on Windows.
| -rw-r--r-- | redo/table_windows.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/redo/table_windows.go b/redo/table_windows.go index 97c2ce5..7dfbc56 100644 --- a/redo/table_windows.go +++ b/redo/table_windows.go @@ -30,6 +30,7 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table { for i := 0; i < ty.NumField(); i++ { C.tableAppendColumn(t.hwnd, C.int(i), toUTF16(ty.Field(i).Name)) } + t.fpreferredSize = t.tablepreferredSize return t } @@ -42,6 +43,16 @@ func (t *table) Unlock() { C.tableUpdate(t.hwnd, C.int(reflect.Indirect(reflect.ValueOf(t.data)).Len())) } +const ( + // from C++ Template 05 in http://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx as this is the best I can do for now... (TODO see if I can reliably get item width/height from text size) + tableWidth = 183 + tableHeight = 50 +) + +func (t *table) tablepreferredSize(d *sizing) (width, height int) { + return fromdlgunitsX(tableWidth, d), fromdlgunitsY(tableHeight, d) +} + //export tableGetCellText func tableGetCellText(data unsafe.Pointer, row C.int, col C.int, str *C.LPWSTR) { t := (*table)(data) |
