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

Method WndProc

scrollview.go:168–225  ·  view source on GitHub ↗
(hwnd win.HWND, msg uint32, wParam, lParam uintptr)

Source from the content-addressed store, hash-verified

166}
167
168func (sv *ScrollView) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr {
169 if sv.composite != nil {
170 avoidBGArtifacts := func() {
171 if sv.hasComplexBackground() {
172 sv.composite.Invalidate()
173 }
174 }
175
176 switch msg {
177 case win.WM_HSCROLL:
178 sv.composite.SetXPixels(sv.scroll(win.SB_HORZ, win.LOWORD(uint32(wParam))))
179 if wParam == win.SB_ENDSCROLL {
180 avoidBGArtifacts()
181 }
182
183 case win.WM_VSCROLL:
184 sv.composite.SetYPixels(sv.scroll(win.SB_VERT, win.LOWORD(uint32(wParam))))
185 if wParam == win.SB_ENDSCROLL {
186 avoidBGArtifacts()
187 }
188
189 case win.WM_MOUSEWHEEL:
190 if win.GetWindowLong(sv.hWnd, win.GWL_STYLE)&win.WS_VSCROLL == 0 {
191 break
192 }
193
194 var cmd uint16
195 if delta := int16(win.HIWORD(uint32(wParam))); delta < 0 {
196 cmd = win.SB_LINEDOWN
197 } else {
198 cmd = win.SB_LINEUP
199 }
200
201 sv.composite.SetYPixels(sv.scroll(win.SB_VERT, cmd))
202 avoidBGArtifacts()
203
204 return 0
205
206 case win.WM_COMMAND, win.WM_NOTIFY:
207 sv.composite.WndProc(hwnd, msg, wParam, lParam)
208
209 case win.WM_WINDOWPOSCHANGED:
210 wp := (*win.WINDOWPOS)(unsafe.Pointer(lParam))
211
212 if wp.Flags&win.SWP_NOSIZE != 0 {
213 break
214 }
215
216 sv.updateScrollBars()
217
218 if h, v := sv.Scrollbars(); !h || !v {
219 sv.RequestLayout()
220 }
221 }
222 }
223
224 return sv.WidgetBase.WndProc(hwnd, msg, wParam, lParam)
225}

Callers

nothing calls this directly

Calls 9

scrollMethod · 0.95
updateScrollBarsMethod · 0.95
ScrollbarsMethod · 0.95
hasComplexBackgroundMethod · 0.80
InvalidateMethod · 0.65
SetXPixelsMethod · 0.65
SetYPixelsMethod · 0.65
WndProcMethod · 0.65
RequestLayoutMethod · 0.65

Tested by

no test coverage detected