MCPcopy Create free account
hub / github.com/NetHack/NetHack / onMSNH_HScroll

Function onMSNH_HScroll

outdated/sys/wince/mhmsgwnd.c:392–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

390
391#ifndef MSG_WRAP_TEXT
392void
393onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
394{
395 PNHMessageWindow data;
396 SCROLLINFO si;
397 int xInc;
398
399 /* get window data */
400 data = (PNHMessageWindow) GetWindowLong(hWnd, GWL_USERDATA);
401
402 ZeroMemory(&si, sizeof(si));
403 si.cbSize = sizeof(si);
404 si.fMask = SIF_PAGE;
405 GetScrollInfo(hWnd, SB_HORZ, &si);
406
407 switch (LOWORD(wParam)) {
408 // User clicked shaft left of the scroll box.
409
410 case SB_PAGEUP:
411 xInc = -(int) si.nPage;
412 break;
413
414 // User clicked shaft right of the scroll box.
415
416 case SB_PAGEDOWN:
417 xInc = si.nPage;
418 break;
419
420 // User clicked the left arrow.
421
422 case SB_LINEUP:
423 xInc = -1;
424 break;
425
426 // User clicked the right arrow.
427
428 case SB_LINEDOWN:
429 xInc = 1;
430 break;
431
432 // User dragged the scroll box.
433
434 case SB_THUMBTRACK:
435 xInc = HIWORD(wParam) - data->xPos;
436 break;
437
438 default:
439 xInc = 0;
440 }
441
442 // If applying the horizontal scrolling increment does not
443 // take the scrolling position out of the scrolling range,
444 // increment the scrolling position, adjust the position
445 // of the scroll box, and update the window.
446
447 if (xInc = max(-data->xPos, min(xInc, data->xMax - data->xPos))) {
448 data->xPos += xInc;
449 ScrollWindowEx(hWnd, -data->xChar * xInc, 0, (CONST RECT *) NULL,

Callers 1

NHMessageWndProcFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected