()
| 378 | } |
| 379 | |
| 380 | func (tvc *TableViewColumn) create() error { |
| 381 | var lvc win.LVCOLUMN |
| 382 | |
| 383 | index := tvc.indexInListView() |
| 384 | |
| 385 | dpi := tvc.tv.DPI() |
| 386 | lvc.Mask = win.LVCF_FMT | win.LVCF_WIDTH | win.LVCF_TEXT | win.LVCF_SUBITEM |
| 387 | lvc.ISubItem = index |
| 388 | lvc.PszText = syscall.StringToUTF16Ptr(tvc.TitleEffective()) |
| 389 | if tvc.width > 0 { |
| 390 | lvc.Cx = int32(IntFrom96DPI(tvc.width, dpi)) |
| 391 | } else { |
| 392 | lvc.Cx = int32(IntFrom96DPI(100, dpi)) |
| 393 | } |
| 394 | |
| 395 | switch tvc.alignment { |
| 396 | case AlignCenter: |
| 397 | lvc.Fmt = 2 |
| 398 | |
| 399 | case AlignFar: |
| 400 | lvc.Fmt = 1 |
| 401 | } |
| 402 | |
| 403 | if -1 == int(tvc.sendMessage(win.LVM_INSERTCOLUMN, uintptr(index), uintptr(unsafe.Pointer(&lvc)))) { |
| 404 | return newError("LVM_INSERTCOLUMN") |
| 405 | } |
| 406 | |
| 407 | tvc.tv.updateLVSizes() |
| 408 | |
| 409 | return nil |
| 410 | } |
| 411 | |
| 412 | func (tvc *TableViewColumn) destroy() error { |
| 413 | width := tvc.Width() |
no test coverage detected