Added Table.preferredSize() on Windows.
This commit is contained in:
parent
09c1d78126
commit
f7749f3678
|
@ -30,6 +30,7 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table {
|
||||||
for i := 0; i < ty.NumField(); i++ {
|
for i := 0; i < ty.NumField(); i++ {
|
||||||
C.tableAppendColumn(t.hwnd, C.int(i), toUTF16(ty.Field(i).Name))
|
C.tableAppendColumn(t.hwnd, C.int(i), toUTF16(ty.Field(i).Name))
|
||||||
}
|
}
|
||||||
|
t.fpreferredSize = t.tablepreferredSize
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +43,16 @@ func (t *table) Unlock() {
|
||||||
C.tableUpdate(t.hwnd, C.int(reflect.Indirect(reflect.ValueOf(t.data)).Len()))
|
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
|
//export tableGetCellText
|
||||||
func tableGetCellText(data unsafe.Pointer, row C.int, col C.int, str *C.LPWSTR) {
|
func tableGetCellText(data unsafe.Pointer, row C.int, col C.int, str *C.LPWSTR) {
|
||||||
t := (*table)(data)
|
t := (*table)(data)
|
||||||
|
|
Loading…
Reference in New Issue