Properly handled the LVN_GETDISPINFO notificaiton on Windows this time.
This commit is contained in:
parent
df383ada76
commit
da42b979e7
|
@ -104,10 +104,22 @@ func tableGetCell(data unsafe.Pointer, item *C.LVITEMW) {
|
||||||
d := reflect.Indirect(reflect.ValueOf(t.data))
|
d := reflect.Indirect(reflect.ValueOf(t.data))
|
||||||
datum := d.Index(int(item.iItem)).Field(int(item.iSubItem))
|
datum := d.Index(int(item.iItem)).Field(int(item.iSubItem))
|
||||||
printMask(item)
|
printMask(item)
|
||||||
switch {
|
isText := true
|
||||||
case datum.Type() == reflect.TypeOf(ImageIndex(0)):
|
if item.mask & C.LVIF_IMAGE != 0 {
|
||||||
|
if datum.Type() == reflect.TypeOf(ImageIndex(0)) {
|
||||||
item.iImage = C.int(datum.Interface().(ImageIndex))
|
item.iImage = C.int(datum.Interface().(ImageIndex))
|
||||||
case datum.Kind() == reflect.Bool:
|
isText = false
|
||||||
|
}
|
||||||
|
// else let the default behavior work
|
||||||
|
}
|
||||||
|
if item.mask & C.LVIF_INDENT != 0 {
|
||||||
|
// always have an indent of zero
|
||||||
|
item.iIndent = 0
|
||||||
|
}
|
||||||
|
if item.mask & C.LVIF_STATE != 0 {
|
||||||
|
// start by not changing any state
|
||||||
|
item.stateMask = 0
|
||||||
|
if datum.Kind() == reflect.Bool {
|
||||||
item.stateMask = C.LVIS_STATEIMAGEMASK
|
item.stateMask = C.LVIS_STATEIMAGEMASK
|
||||||
// state image index is 1-based
|
// state image index is 1-based
|
||||||
curstate := ((item.state & C.LVIS_STATEIMAGEMASK) >> 12)
|
curstate := ((item.state & C.LVIS_STATEIMAGEMASK) >> 12)
|
||||||
|
@ -130,10 +142,16 @@ printMask(item)
|
||||||
curstate &^= C.checkboxStatePushed
|
curstate &^= C.checkboxStatePushed
|
||||||
}
|
}
|
||||||
item.state = (curstate + 1) << 12
|
item.state = (curstate + 1) << 12
|
||||||
default:
|
isText = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if item.mask & C.LVIF_TEXT != 0 {
|
||||||
|
if isText {
|
||||||
s := fmt.Sprintf("%v", datum)
|
s := fmt.Sprintf("%v", datum)
|
||||||
item.pszText = toUTF16(s)
|
item.pszText = toUTF16(s)
|
||||||
}
|
}
|
||||||
|
// else let the default handler work
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// the column autoresize policy is simple:
|
// the column autoresize policy is simple:
|
||||||
|
|
Loading…
Reference in New Issue