MCPcopy
hub / github.com/lxn/walk / WndProc

Method WndProc

tableview.go:2601–2695  ·  view source on GitHub ↗
(hwnd win.HWND, msg uint32, wp, lp uintptr)

Source from the content-addressed store, hash-verified

2599}
2600
2601func (tv *TableView) WndProc(hwnd win.HWND, msg uint32, wp, lp uintptr) uintptr {
2602 switch msg {
2603 case win.WM_NOTIFY:
2604 nmh := (*win.NMHDR)(unsafe.Pointer(lp))
2605 switch nmh.HwndFrom {
2606 case tv.hwndFrozenLV:
2607 return tableViewFrozenLVWndProc(nmh.HwndFrom, msg, wp, lp)
2608
2609 case tv.hwndNormalLV:
2610 return tableViewNormalLVWndProc(nmh.HwndFrom, msg, wp, lp)
2611 }
2612
2613 case win.WM_WINDOWPOSCHANGED:
2614 wp := (*win.WINDOWPOS)(unsafe.Pointer(lp))
2615
2616 if wp.Flags&win.SWP_NOSIZE != 0 {
2617 break
2618 }
2619
2620 if tv.formActivatingHandle == -1 {
2621 if form := tv.Form(); form != nil {
2622 tv.formActivatingHandle = form.Activating().Attach(func() {
2623 if tv.hwndNormalLV == win.GetFocus() {
2624 win.SetFocus(tv.hwndFrozenLV)
2625 }
2626 })
2627 }
2628 }
2629
2630 tv.updateLVSizes()
2631
2632 // FIXME: The InvalidateRect and redrawItems calls below prevent
2633 // painting glitches on resize. Though this seems to work reasonably
2634 // well, in the long run we would like to find the root cause of this
2635 // issue and come up with a better fix.
2636 dpi := uint32(tv.DPI())
2637 var rc win.RECT
2638
2639 vsbWidth := win.GetSystemMetricsForDpi(win.SM_CXVSCROLL, dpi)
2640 rc = win.RECT{wp.Cx - vsbWidth - 1, 0, wp.Cx, wp.Cy}
2641 win.InvalidateRect(tv.hWnd, &rc, true)
2642
2643 hsbHeight := win.GetSystemMetricsForDpi(win.SM_CYHSCROLL, dpi)
2644 rc = win.RECT{0, wp.Cy - hsbHeight - 1, wp.Cx, wp.Cy}
2645 win.InvalidateRect(tv.hWnd, &rc, true)
2646
2647 tv.redrawItems()
2648
2649 case win.WM_TIMER:
2650 if !win.KillTimer(tv.hWnd, wp) {
2651 lastError("KillTimer")
2652 }
2653
2654 switch wp {
2655 case tableViewCurrentIndexChangedTimerId:
2656 if !tv.delayedCurrentIndexChangedCanceled {
2657 tv.currentIndexChangedPublisher.Publish()
2658 tv.currentItemChangedPublisher.Publish()

Callers

nothing calls this directly

Calls 13

updateLVSizesMethod · 0.95
redrawItemsMethod · 0.95
tableViewFrozenLVWndProcFunction · 0.85
tableViewNormalLVWndProcFunction · 0.85
lastErrorFunction · 0.85
ensureWindowLongBitsFunction · 0.85
FormMethod · 0.65
ActivatingMethod · 0.65
SetFocusMethod · 0.65
DPIMethod · 0.65
WndProcMethod · 0.65
AttachMethod · 0.45

Tested by

no test coverage detected