ReactOS 0.4.15-dev-7958-gcd0bb1a
scrollbar.c File Reference
#include <win32k.h>
Include dependency graph for scrollbar.c:

Go to the source code of this file.

Macros

#define SCROLL_NOWHERE   0x00 /* Outside the scrollbar */
 
#define SCROLL_TOP_ARROW   0x01 /* Top or left arrow */
 
#define SCROLL_TOP_RECT   0x02 /* Rectangle between the top arrow and the thumb */
 
#define SCROLL_THUMB   0x03 /* Thumb rectangle */
 
#define SCROLL_BOTTOM_RECT   0x04 /* Rectangle between the thumb and the bottom arrow */
 
#define SCROLL_BOTTOM_ARROW   0x05 /* Bottom or right arrow */
 
#define SCROLL_FIRST_DELAY   200 /* Delay (in ms) before first repetition when holding the button down */
 
#define SCROLL_REPEAT_DELAY   50 /* Delay (in ms) between scroll repetitions */
 
#define SCROLL_TIMER   0 /* Scroll timer id */
 
#define SCROLL_MIN_RECT   4
 
#define SCROLL_MIN_THUMB   6
 
#define SCROLL_ARROW_THUMB_OVERLAP   0
 
#define MINTRACKTHUMB   8 /* Minimum size of the rectangle between the arrows */
 
#define SA_SSI_HIDE   0x0001
 
#define SA_SSI_SHOW   0x0002
 
#define SA_SSI_REFRESH   0x0004
 
#define SA_SSI_REPAINT_ARROWS   0x0008
 
#define SBRG_SCROLLBAR   0 /* The scrollbar itself */
 
#define SBRG_TOPRIGHTBTN   1 /* The top or right button */
 
#define SBRG_PAGEUPRIGHT   2 /* The page up or page right region */
 
#define SBRG_SCROLLBOX   3 /* The scroll box */
 
#define SBRG_PAGEDOWNLEFT   4 /* The page down or page left region */
 
#define SBRG_BOTTOMLEFTBTN   5 /* The bottom or left button */
 
#define CHANGERGSTATE(item, status)
 

Functions

 DBG_DEFAULT_CHANNEL (UserScrollbar)
 
BOOL APIENTRY IntEnableScrollBar (BOOL Horz, PSCROLLBARINFO Info, UINT wArrows)
 
static void IntRefeshScrollInterior (PWND pWnd, INT nBar, PSCROLLBARINFO psbi)
 
static void mirror_rect (const RECT *window_rect, RECT *rect)
 
PSBDATA FASTCALL IntGetSBData (PWND pwnd, INT Bar)
 
BOOL FASTCALL IntGetScrollBarRect (PWND Wnd, INT nBar, RECTL *lprect)
 
BOOL FASTCALL IntCalculateThumb (PWND Wnd, LONG idObject, PSCROLLBARINFO psbi, PSBDATA pSBData)
 
static BOOL FASTCALL co_IntGetScrollInfo (PWND Window, INT nBar, PSBDATA pSBData, LPSCROLLINFO lpsi)
 
BOOL FASTCALL NEWco_IntGetScrollInfo (PWND pWnd, INT nBar, PSBDATA pSBData, LPSCROLLINFO lpsi)
 
static DWORD FASTCALL co_IntSetScrollInfo (PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
 
BOOL FASTCALL co_IntGetScrollBarInfo (PWND Window, LONG idObject, PSCROLLBARINFO psbi)
 
BOOL FASTCALL co_IntSetScrollBarInfo (PWND Window, LONG idObject, PSETSCROLLBARINFO psbi)
 
BOOL FASTCALL co_IntCreateScrollBars (PWND Window)
 
BOOL FASTCALL IntDestroyScrollBars (PWND Window)
 
DWORD FASTCALL co_UserShowScrollBar (PWND Wnd, int nBar, BOOL fShowH, BOOL fShowV)
 
static void IntDrawScrollInterior (PWND pWnd, HDC hDC, INT nBar, BOOL Vertical, PSCROLLBARINFO ScrollBarInfo)
 
static VOID FASTCALL IntDrawScrollArrows (HDC hDC, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical)
 
static LONG FASTCALL IntScrollGetObjectId (INT SBType)
 
void IntDrawScrollBar (PWND Wnd, HDC DC, INT Bar)
 
LRESULT APIENTRY ScrollBarWndProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
BOOL APIENTRY NtUserGetScrollBarInfo (HWND hWnd, LONG idObject, PSCROLLBARINFO psbi)
 
BOOL APIENTRY NtUserSBGetParms (HWND hWnd, int fnBar, PSBDATA pSBData, LPSCROLLINFO lpsi)
 
BOOL APIENTRY NtUserEnableScrollBar (HWND hWnd, UINT wSBflags, UINT wArrows)
 
DWORD APIENTRY NtUserSetScrollInfo (HWND hWnd, int fnBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
 
DWORD APIENTRY NtUserShowScrollBar (HWND hWnd, int nBar, DWORD bShow)
 
BOOL APIENTRY NtUserSetScrollBarInfo (HWND hWnd, LONG idObject, SETSCROLLBARINFO *info)
 

Macro Definition Documentation

◆ CHANGERGSTATE

#define CHANGERGSTATE (   item,
  status 
)
Value:
if(Info->rgstate[(item)] != (status)) \
Chg = TRUE; \
Info->rgstate[(item)] = (status);
#define TRUE
Definition: types.h:120
static ATOM item
Definition: dde.c:856
Definition: ps.c:97
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690

Definition at line 49 of file scrollbar.c.

◆ MINTRACKTHUMB

#define MINTRACKTHUMB   8 /* Minimum size of the rectangle between the arrows */

Definition at line 34 of file scrollbar.c.

◆ SA_SSI_HIDE

#define SA_SSI_HIDE   0x0001

Definition at line 37 of file scrollbar.c.

◆ SA_SSI_REFRESH

#define SA_SSI_REFRESH   0x0004

Definition at line 39 of file scrollbar.c.

◆ SA_SSI_REPAINT_ARROWS

#define SA_SSI_REPAINT_ARROWS   0x0008

Definition at line 40 of file scrollbar.c.

◆ SA_SSI_SHOW

#define SA_SSI_SHOW   0x0002

Definition at line 38 of file scrollbar.c.

◆ SBRG_BOTTOMLEFTBTN

#define SBRG_BOTTOMLEFTBTN   5 /* The bottom or left button */

Definition at line 47 of file scrollbar.c.

◆ SBRG_PAGEDOWNLEFT

#define SBRG_PAGEDOWNLEFT   4 /* The page down or page left region */

Definition at line 46 of file scrollbar.c.

◆ SBRG_PAGEUPRIGHT

#define SBRG_PAGEUPRIGHT   2 /* The page up or page right region */

Definition at line 44 of file scrollbar.c.

◆ SBRG_SCROLLBAR

#define SBRG_SCROLLBAR   0 /* The scrollbar itself */

Definition at line 42 of file scrollbar.c.

◆ SBRG_SCROLLBOX

#define SBRG_SCROLLBOX   3 /* The scroll box */

Definition at line 45 of file scrollbar.c.

◆ SBRG_TOPRIGHTBTN

#define SBRG_TOPRIGHTBTN   1 /* The top or right button */

Definition at line 43 of file scrollbar.c.

◆ SCROLL_ARROW_THUMB_OVERLAP

#define SCROLL_ARROW_THUMB_OVERLAP   0

Definition at line 32 of file scrollbar.c.

◆ SCROLL_BOTTOM_ARROW

#define SCROLL_BOTTOM_ARROW   0x05 /* Bottom or right arrow */

Definition at line 18 of file scrollbar.c.

◆ SCROLL_BOTTOM_RECT

#define SCROLL_BOTTOM_RECT   0x04 /* Rectangle between the thumb and the bottom arrow */

Definition at line 17 of file scrollbar.c.

◆ SCROLL_FIRST_DELAY

#define SCROLL_FIRST_DELAY   200 /* Delay (in ms) before first repetition when holding the button down */

Definition at line 20 of file scrollbar.c.

◆ SCROLL_MIN_RECT

#define SCROLL_MIN_RECT   4

Definition at line 26 of file scrollbar.c.

◆ SCROLL_MIN_THUMB

#define SCROLL_MIN_THUMB   6

Definition at line 29 of file scrollbar.c.

◆ SCROLL_NOWHERE

#define SCROLL_NOWHERE   0x00 /* Outside the scrollbar */

Definition at line 13 of file scrollbar.c.

◆ SCROLL_REPEAT_DELAY

#define SCROLL_REPEAT_DELAY   50 /* Delay (in ms) between scroll repetitions */

Definition at line 21 of file scrollbar.c.

◆ SCROLL_THUMB

#define SCROLL_THUMB   0x03 /* Thumb rectangle */

Definition at line 16 of file scrollbar.c.

◆ SCROLL_TIMER

#define SCROLL_TIMER   0 /* Scroll timer id */

Definition at line 23 of file scrollbar.c.

◆ SCROLL_TOP_ARROW

#define SCROLL_TOP_ARROW   0x01 /* Top or left arrow */

Definition at line 14 of file scrollbar.c.

◆ SCROLL_TOP_RECT

#define SCROLL_TOP_RECT   0x02 /* Rectangle between the top arrow and the thumb */

Definition at line 15 of file scrollbar.c.

Function Documentation

◆ co_IntCreateScrollBars()

BOOL FASTCALL co_IntCreateScrollBars ( PWND  Window)

Definition at line 748 of file scrollbar.c.

749{
750 PSCROLLBARINFO psbi;
751 PSBDATA pSBData;
752 ULONG Size, s;
753 INT i;
754
756
757 if (Window->pSBInfo && Window->pSBInfoex)
758 return TRUE; // No need to create it anymore
759
760 // Allocate memory for all scrollbars (HORZ, VERT, CONTROL)
761 Size = 3 * (sizeof(SBINFOEX));
763 {
764 ERR("Unable to allocate memory for scrollbar information for window %p\n", UserHMGetHandle(Window));
765 return FALSE;
766 }
767
768 RtlZeroMemory(Window->pSBInfoex, Size);
769
770 if(!(Window->pSBInfo = DesktopHeapAlloc(Window->head.rpdesk, sizeof(SBINFO))))
771 {
772 ERR("Unable to allocate memory for scrollbar information for window %p\n", UserHMGetHandle(Window));
773 return FALSE;
774 }
775
776 RtlZeroMemory(Window->pSBInfo, sizeof(SBINFO));
777 Window->pSBInfo->Vert.posMax = 100;
778 Window->pSBInfo->Horz.posMax = 100;
779
780 co_WinPosGetNonClientSize(Window, &Window->rcWindow, &Window->rcClient);
781
782 for(s = SB_HORZ; s <= SB_VERT; s++)
783 {
785 psbi->cbSize = sizeof(SCROLLBARINFO);
786 for (i = 0; i < CCHILDREN_SCROLLBAR + 1; i++)
787 psbi->rgstate[i] = 0;
788
789 pSBData = IntGetSBData(Window, s);
790
792 IntCalculateThumb(Window, s, psbi, pSBData);
793 }
794
795 return TRUE;
796}
#define ERR(fmt,...)
Definition: debug.h:110
#define FALSE
Definition: types.h:117
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
GLdouble s
Definition: gl.h:2039
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
struct _SBINFOEX SBINFOEX
PSBDATA FASTCALL IntGetSBData(PWND pwnd, INT Bar)
Definition: scrollbar.c:77
BOOL FASTCALL IntCalculateThumb(PWND Wnd, LONG idObject, PSCROLLBARINFO psbi, PSBDATA pSBData)
Definition: scrollbar.c:166
BOOL FASTCALL IntGetScrollBarRect(PWND Wnd, INT nBar, RECTL *lprect)
Definition: scrollbar.c:104
LRESULT FASTCALL co_WinPosGetNonClientSize(PWND Window, RECT *WindowRect, RECT *ClientRect)
Definition: winpos.c:2366
#define IntGetScrollbarInfoFromWindow(Window, i)
Definition: scroll.h:33
Definition: window.c:28
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3754
int32_t INT
Definition: typedefs.h:58
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:14
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:204
#define TAG_SBARINFO
Definition: tags.h:9
#define SB_VERT
Definition: winuser.h:553
#define CCHILDREN_SCROLLBAR
Definition: winuser.h:3745
struct tagSCROLLBARINFO SCROLLBARINFO
#define SB_HORZ
Definition: winuser.h:552

Referenced by co_IntGetScrollBarInfo(), co_IntSetScrollBarInfo(), co_IntSetScrollInfo(), NtUserEnableScrollBar(), and NtUserSetScrollBarInfo().

◆ co_IntGetScrollBarInfo()

BOOL FASTCALL co_IntGetScrollBarInfo ( PWND  Window,
LONG  idObject,
PSCROLLBARINFO  psbi 
)

Definition at line 666 of file scrollbar.c.

667{
668 INT Bar;
669 PSCROLLBARINFO sbi;
670 PSBDATA pSBData;
672
673 Bar = SBOBJ_TO_SBID(idObject);
674
675 if(!SBID_IS_VALID(Bar))
676 {
678 ERR("Trying to get scrollinfo for unknown scrollbar type %d\n", Bar);
679 return FALSE;
680 }
681
683 {
684 ERR("Failed to create scrollbars for window\n");
685 return FALSE;
686 }
687
689 pSBData = IntGetSBData(Window, Bar);
690
692 IntCalculateThumb(Window, Bar, sbi, pSBData);
693
694 // Scrollbar state
695 psbi->rgstate[0] = 0;
696 if ((Bar == SB_HORZ && !(Window->style & WS_HSCROLL))
697 || (Bar == SB_VERT && !(Window->style & WS_VSCROLL)))
699 if (pSBData->posMin >= pSBData->posMax - max(pSBData->page - 1, 0))
700 {
701 if (!(psbi->rgstate[0] & STATE_SYSTEM_INVISIBLE))
703 else
705 }
706 if (Bar == SB_CTL && !(Window->style & WS_DISABLED))
708
709 RtlCopyMemory(psbi, sbi, sizeof(SCROLLBARINFO));
710
711 return TRUE;
712}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
void Bar(void)
Definition: terminate.cpp:70
BOOL FASTCALL co_IntCreateScrollBars(PWND Window)
Definition: scrollbar.c:748
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_DISABLED
Definition: pedump.c:621
#define WS_HSCROLL
Definition: pedump.c:628
#define SBID_IS_VALID(id)
Definition: scroll.h:40
#define SBOBJ_TO_SBID(Obj)
Definition: scroll.h:39
INT posMax
Definition: ntuser.h:506
INT posMin
Definition: ntuser.h:505
INT page
Definition: ntuser.h:507
#define max(a, b)
Definition: svc.c:63
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
#define STATE_SYSTEM_INVISIBLE
Definition: winuser.h:2877
#define STATE_SYSTEM_OFFSCREEN
Definition: winuser.h:2878
#define STATE_SYSTEM_UNAVAILABLE
Definition: winuser.h:2862
#define SB_CTL
Definition: winuser.h:554

Referenced by IntDrawScrollBar(), IntIsScrollBarVisible(), IntRefeshScrollInterior(), and NtUserGetScrollBarInfo().

◆ co_IntGetScrollInfo()

static BOOL FASTCALL co_IntGetScrollInfo ( PWND  Window,
INT  nBar,
PSBDATA  pSBData,
LPSCROLLINFO  lpsi 
)
static

Definition at line 264 of file scrollbar.c.

265{
266 UINT Mask;
267 LPSCROLLINFO psi;
268
270
271 lpsi->fMask &= ~SIF_THEMED; // Remove Theme bit
272 if(!SBID_IS_VALID(nBar))
273 {
275 ERR("Trying to get scrollinfo for unknown scrollbar type %d\n", nBar);
276 return FALSE;
277 }
278
279 if (!Window->pSBInfo)
280 {
281 ERR("IntGetScrollInfo No window scrollbar info\n");
282 return FALSE;
283 }
284
286
287 if (lpsi->fMask == SIF_ALL)
289 else
290 Mask = lpsi->fMask;
291
292 if (0 != (Mask & SIF_PAGE))
293 lpsi->nPage = psi->nPage;
294
295 if (0 != (Mask & SIF_POS))
296 lpsi->nPos = psi->nPos;
297
298 if (0 != (Mask & SIF_RANGE))
299 {
300 lpsi->nMin = psi->nMin;
301 lpsi->nMax = psi->nMax;
302 }
303
304 if (0 != (Mask & SIF_TRACKPOS))
305 lpsi->nTrackPos = psi->nTrackPos;
306
307 return TRUE;
308}
unsigned int Mask
Definition: fpcontrol.c:82
unsigned int UINT
Definition: ndis.h:50
#define IntGetScrollInfoFromWindow(Window, i)
Definition: scroll.h:36
#define SIF_RANGE
Definition: winuser.h:1235
#define SIF_PAGE
Definition: winuser.h:1233
#define SIF_TRACKPOS
Definition: winuser.h:1237
#define SIF_ALL
Definition: winuser.h:1232
#define SIF_POS
Definition: winuser.h:1234

Referenced by NtUserSBGetParms().

◆ co_IntSetScrollBarInfo()

BOOL FASTCALL co_IntSetScrollBarInfo ( PWND  Window,
LONG  idObject,
PSETSCROLLBARINFO  psbi 
)

Definition at line 715 of file scrollbar.c.

716{
717 INT Bar;
718 PSCROLLBARINFO sbi;
719 LPSCROLLINFO psi;
721
722 Bar = SBOBJ_TO_SBID(idObject);
723
724 if(!SBID_IS_VALID(Bar))
725 {
727 ERR("Trying to get scrollinfo for unknown scrollbar type %d\n", Bar);
728 return FALSE;
729 }
730
732 {
733 ERR("Failed to create scrollbars for window\n");
734 return FALSE;
735 }
736
739
740 psi->nTrackPos = psbi->nTrackPos;
741 sbi->reserved = psbi->reserved;
742 RtlCopyMemory(&sbi->rgstate, &psbi->rgstate, sizeof(psbi->rgstate));
743
744 return TRUE;
745}
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: ntuser.h:3621

◆ co_IntSetScrollInfo()

static DWORD FASTCALL co_IntSetScrollInfo ( PWND  Window,
INT  nBar,
LPCSCROLLINFO  lpsi,
BOOL  bRedraw 
)
static

Definition at line 455 of file scrollbar.c.

456{
457 // Update the scrollbar state and set action flags according to
458 // what has to be done graphics wise.
459
461 PSCROLLBARINFO psbi;
462 UINT new_flags;
463 INT action = 0;
464 PSBDATA pSBData;
465 DWORD OldPos = 0;
466 BOOL bChangeParams = FALSE; // Don't show/hide scrollbar if params don't change
467 UINT MaxPage;
468 int MaxPos;
469 BOOL bVisible;
470
472
473 if(!SBID_IS_VALID(nBar))
474 {
476 ERR("Trying to set scrollinfo for unknown scrollbar type %d\n", nBar);
477 return FALSE;
478 }
479
481 return FALSE;
482
483 if (lpsi->cbSize != sizeof(SCROLLINFO) &&
484 lpsi->cbSize != (sizeof(SCROLLINFO) - sizeof(lpsi->nTrackPos)))
485 {
487 return 0;
488 }
490 {
492 return 0;
493 }
494
497 pSBData = IntGetSBData(Window, nBar);
498
499 if (lpsi->fMask & SIF_THEMED && !(Info->fMask & SIF_THEMED))
500 Info->fMask |= SIF_THEMED;
501
502 // Set the page size
503 if (lpsi->fMask & SIF_PAGE)
504 {
505 if (Info->nPage != lpsi->nPage)
506 {
507 Info->nPage = lpsi->nPage;
508 pSBData->page = lpsi->nPage;
509 bChangeParams = TRUE;
510 }
511 }
512
513 // Set the scroll pos
514 if (lpsi->fMask & SIF_POS)
515 {
516 OldPos = Info->nPos;
517 if (Info->nPos != lpsi->nPos)
518 {
519 Info->nPos = lpsi->nPos;
520 pSBData->pos = lpsi->nPos;
521 }
522 }
523
524 // Set the scroll range
525 if (lpsi->fMask & SIF_RANGE)
526 {
527 if (lpsi->nMin > lpsi->nMax)
528 {
529 Info->nMin = lpsi->nMin;
530 Info->nMax = lpsi->nMin;
531 pSBData->posMin = lpsi->nMin;
532 pSBData->posMax = lpsi->nMin;
533 bChangeParams = TRUE;
534 }
535 else if (Info->nMin != lpsi->nMin || Info->nMax != lpsi->nMax)
536 {
537 Info->nMin = lpsi->nMin;
538 Info->nMax = lpsi->nMax;
539 pSBData->posMin = lpsi->nMin;
540 pSBData->posMax = lpsi->nMax;
541 bChangeParams = TRUE;
542 }
543 }
544
545 // Make sure the page size is valid
546 MaxPage = abs(Info->nMax - Info->nMin) + 1;
547 if (Info->nPage > MaxPage)
548 pSBData->page = Info->nPage = MaxPage;
549
550 // Make sure the pos is inside the range
551 MaxPos = Info->nMax + 1 - (int)max(Info->nPage, 1);
552 ASSERT(MaxPos >= Info->nMin);
553 if (Info->nPos < Info->nMin)
554 pSBData->pos = Info->nPos = Info->nMin;
555 else if (Info->nPos > MaxPos)
556 pSBData->pos = Info->nPos = MaxPos;
557
558 // Don't change the scrollbar state if SetScrollInfo is just called with SIF_DISABLENOSCROLL
559 if (!(lpsi->fMask & SIF_ALL))
560 return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos;
561
562 // Check if the scrollbar should be hidden or disabled
564 {
565 new_flags = Window->pSBInfo->WSBflags;
566 if (Info->nMin + (int)max(Info->nPage, 1) > Info->nMax)
567 {
568 // Hide or disable scrollbar
569 if (lpsi->fMask & SIF_DISABLENOSCROLL)
570 {
571 new_flags = ESB_DISABLE_BOTH;
572 bChangeParams = TRUE;
573 }
574 else if ((nBar != SB_CTL) && bChangeParams)
575 {
577 }
578 }
579 else if ((lpsi->fMask & ~SIF_THEMED) != SIF_PAGE)
580 { // Show and enable scrollbar only if no page only changed
581 if ((nBar != SB_CTL) && bChangeParams)
582 {
583 new_flags = ESB_ENABLE_BOTH;
585 }
586 else if (nBar == SB_CTL)
587 {
588 new_flags = ESB_ENABLE_BOTH;
589 }
590 }
591
592 if (Window->pSBInfo->WSBflags != new_flags) // Check arrow flags
593 {
594 Window->pSBInfo->WSBflags = new_flags;
596 }
597 }
598
599 if (action & SA_SSI_HIDE)
600 {
602 }
603 else
604 {
605 if (action & SA_SSI_SHOW)
607 return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos; // SetWindowPos() already did the painting
608
609 switch (nBar)
610 {
611 case SB_HORZ:
612 bVisible = (Window->style & WS_HSCROLL);
613 break;
614 case SB_VERT:
615 bVisible = (Window->style & WS_VSCROLL);
616 break;
617 case SB_CTL:
618 bVisible = (Window->style & WS_VISIBLE);
619 break;
620 default:
621 bVisible = FALSE;
622 break;
623 }
624
625 if (bRedraw && bVisible)
626 {
627 if (!(Info->fMask & SIF_THEMED)) // Not Using Themes
628 {
630 {
631 // Redraw the entire bar
633 UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left;
634 UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left;
635 UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top;
636 UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top;
638 }
639 else
640 {
641 // Redraw only the interior part of the bar
642 IntRefeshScrollInterior(Window, nBar, psbi);
643 }
644 }
645 else // Using Themes
646 {
648 UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left;
649 UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left;
650 UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top;
651 UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top;
652 if (bChangeParams || (OldPos != pSBData->pos))
654 }
655 }
656 }
657
658 if (bChangeParams && (nBar == SB_HORZ || nBar == SB_VERT) && (lpsi->fMask & SIF_DISABLENOSCROLL))
659 IntEnableScrollBar(nBar == SB_HORZ, psbi, Window->pSBInfo->WSBflags);
660
661 // Return current position
662 return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos;
663}
const WCHAR * action
Definition: action.c:7479
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ASSERT(a)
Definition: mode.c:44
#define SA_SSI_SHOW
Definition: scrollbar.c:38
static void IntRefeshScrollInterior(PWND pWnd, INT nBar, PSCROLLBARINFO psbi)
Definition: scrollbar.c:1057
#define SA_SSI_REPAINT_ARROWS
Definition: scrollbar.c:40
BOOL APIENTRY IntEnableScrollBar(BOOL Horz, PSCROLLBARINFO Info, UINT wArrows)
Definition: scrollbar.c:813
#define SA_SSI_HIDE
Definition: scrollbar.c:37
DWORD FASTCALL co_UserShowScrollBar(PWND Wnd, int nBar, BOOL fShowH, BOOL fShowV)
Definition: scrollbar.c:852
#define WS_VISIBLE
Definition: pedump.c:620
INT pos
Definition: ntuser.h:508
static int UpdateRect(TreeListData *pData, unsigned uItem, unsigned uSub)
Definition: treelist.c:1529
#define SIF_PREVIOUSPOS
Definition: undocuser.h:89
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:888
#define SIF_THEMED
Definition: winuser.h:1238
#define ESB_DISABLE_BOTH
Definition: winuser.h:556
#define SIF_DISABLENOSCROLL
Definition: winuser.h:1236
#define RDW_FRAME
Definition: winuser.h:1212
#define ESB_ENABLE_BOTH
Definition: winuser.h:563
#define RDW_INVALIDATE
Definition: winuser.h:1214

Referenced by NtUserSetScrollInfo().

◆ co_UserShowScrollBar()

DWORD FASTCALL co_UserShowScrollBar ( PWND  Wnd,
int  nBar,
BOOL  fShowH,
BOOL  fShowV 
)

Definition at line 852 of file scrollbar.c.

853{
854 ULONG old_style, set_bits = 0, clear_bits = 0;
855
856 ASSERT_REFS_CO(Wnd);
857
858 switch(nBar)
859 {
860 case SB_CTL:
861 {
862 //IntUpdateSBInfo(Wnd, SB_CTL); // Is this needed? Was tested w/o!
863 co_WinPosShowWindow(Wnd, fShowH ? SW_SHOW : SW_HIDE);
864 return TRUE;
865 }
866 case SB_BOTH:
867 case SB_HORZ:
868 if (fShowH) set_bits |= WS_HSCROLL;
869 else clear_bits |= WS_HSCROLL;
870 if( nBar == SB_HORZ ) break;
871 // Fall through
872 case SB_VERT:
873 if (fShowV) set_bits |= WS_VSCROLL;
874 else clear_bits |= WS_VSCROLL;
875 break;
876 default:
878 return FALSE; // Nothing to do
879 }
880
881 old_style = IntSetStyle(Wnd, set_bits, clear_bits);
882 if ((old_style & clear_bits) != 0 || (old_style & set_bits) != set_bits)
883 {
885 //if (Wnd->style & WS_HSCROLL) IntUpdateSBInfo(Wnd, SB_HORZ);
886 //if (Wnd->style & WS_VSCROLL) IntUpdateSBInfo(Wnd, SB_VERT);
887
888 // Frame has been changed, let the window redraw itself
889 co_WinPosSetWindowPos(Wnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE
891 return TRUE;
892 }
893 return FALSE; // no frame changes
894}
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1786
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2566
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:143
#define SW_HIDE
Definition: winuser.h:768
#define SWP_NOACTIVATE
Definition: winuser.h:1242
#define SWP_FRAMECHANGED
Definition: winuser.h:1240
#define SWP_NOMOVE
Definition: winuser.h:1244
#define SWP_NOSIZE
Definition: winuser.h:1245
#define SB_BOTH
Definition: winuser.h:555
#define SW_SHOW
Definition: winuser.h:775
#define SWP_NOZORDER
Definition: winuser.h:1247

Referenced by co_IntSetScrollInfo(), co_UserCreateWindowEx(), and NtUserShowScrollBar().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserScrollbar  )

◆ IntCalculateThumb()

BOOL FASTCALL IntCalculateThumb ( PWND  Wnd,
LONG  idObject,
PSCROLLBARINFO  psbi,
PSBDATA  pSBData 
)

Definition at line 166 of file scrollbar.c.

167{
168 INT Thumb, ThumbBox, ThumbPos, cxy, mx;
169 RECTL ClientRect;
170
171 switch(idObject)
172 {
173 case SB_HORZ:
175 cxy = psbi->rcScrollBar.right - psbi->rcScrollBar.left;
176 break;
177 case SB_VERT:
179 cxy = psbi->rcScrollBar.bottom - psbi->rcScrollBar.top;
180 break;
181 case SB_CTL:
182 IntGetClientRect(Wnd, &ClientRect);
183 if(Wnd->style & SBS_VERT)
184 {
186 cxy = ClientRect.bottom - ClientRect.top;
187 }
188 else
189 {
191 cxy = ClientRect.right - ClientRect.left;
192 }
193 break;
194 default:
195 return FALSE;
196 }
197
198 ThumbPos = Thumb;
199 // Calculate Thumb
200 if(cxy <= (2 * Thumb))
201 {
202 Thumb = cxy / 2;
203 psbi->xyThumbTop = 0;
204 psbi->xyThumbBottom = 0;
205 ThumbPos = Thumb;
206 }
209 pSBData->posMin >= (int)(pSBData->posMax - max(pSBData->page - 1, 0)))
210 {
211 // Nothing to scroll
212 psbi->xyThumbTop = 0;
213 psbi->xyThumbBottom = 0;
214 }
215 else
216 {
217 ThumbBox = pSBData->page ? MINTRACKTHUMB : UserGetSystemMetrics(SM_CXHTHUMB);
218 cxy -= (2 * Thumb);
219 if(cxy >= ThumbBox)
220 {
221 if(pSBData->page)
222 ThumbBox = max(EngMulDiv(cxy, pSBData->page, pSBData->posMax - pSBData->posMin + 1), ThumbBox);
223
224 if(cxy > ThumbBox)
225 {
226 mx = pSBData->posMax - max(pSBData->page - 1, 0);
227 if(pSBData->posMin < mx)
228 ThumbPos = Thumb + EngMulDiv(cxy - ThumbBox, pSBData->pos - pSBData->posMin, mx - pSBData->posMin);
229 else
230 ThumbPos = Thumb + ThumbBox;
231 }
232
233 psbi->xyThumbTop = ThumbPos;
234 psbi->xyThumbBottom = ThumbPos + ThumbBox;
235 }
236 else
237 {
238 psbi->xyThumbTop = 0;
239 psbi->xyThumbBottom = 0;
240 }
241 }
242 psbi->dxyLineButton = Thumb;
243
244 return TRUE;
245}
#define SBRG_BOTTOMLEFTBTN
Definition: scrollbar.c:47
#define MINTRACKTHUMB
Definition: scrollbar.c:34
#define SBRG_TOPRIGHTBTN
Definition: scrollbar.c:43
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
DWORD style
Definition: ntuser.h:706
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:213
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:92
ENGAPI INT APIENTRY EngMulDiv(_In_ INT a, _In_ INT b, _In_ INT c)
Definition: math.c:26
#define SM_CXHTHUMB
Definition: winuser.h:971
#define SM_CYVSCROLL
Definition: winuser.h:981
#define SBS_VERT
Definition: winuser.h:334
#define SM_CXHSCROLL
Definition: winuser.h:982

Referenced by co_IntCreateScrollBars(), and co_IntGetScrollBarInfo().

◆ IntDestroyScrollBars()

BOOL FASTCALL IntDestroyScrollBars ( PWND  Window)

Definition at line 799 of file scrollbar.c.

800{
801 if (Window->pSBInfo && Window->pSBInfoex)
802 {
803 DesktopHeapFree(Window->head.rpdesk, Window->pSBInfo);
804 Window->pSBInfo = NULL;
806 Window->pSBInfoex = NULL;
807 return TRUE;
808 }
809 return FALSE;
810}
#define NULL
Definition: types.h:112
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:215

Referenced by co_UserFreeWindow().

◆ IntDrawScrollArrows()

static VOID FASTCALL IntDrawScrollArrows ( HDC  hDC,
PSCROLLBARINFO  ScrollBarInfo,
BOOL  Vertical 
)
static

Definition at line 1009 of file scrollbar.c.

1010{
1011 RECT RectLT, RectRB;
1012 INT ScrollDirFlagLT, ScrollDirFlagRB;
1013
1014 RectLT = RectRB = ScrollBarInfo->rcScrollBar;
1015 if (Vertical)
1016 {
1017 ScrollDirFlagLT = DFCS_SCROLLUP;
1018 ScrollDirFlagRB = DFCS_SCROLLDOWN;
1019 RectLT.bottom = RectLT.top + ScrollBarInfo->dxyLineButton;
1020 RectRB.top = RectRB.bottom - ScrollBarInfo->dxyLineButton;
1021 }
1022 else
1023 {
1024 ScrollDirFlagLT = DFCS_SCROLLLEFT;
1025 ScrollDirFlagRB = DFCS_SCROLLRIGHT;
1026 RectLT.right = RectLT.left + ScrollBarInfo->dxyLineButton;
1027 RectRB.left = RectRB.right - ScrollBarInfo->dxyLineButton;
1028 }
1029
1030 if (ScrollBarInfo->rgstate[SCROLL_TOP_ARROW] & STATE_SYSTEM_PRESSED)
1031 ScrollDirFlagLT |= DFCS_PUSHED | DFCS_FLAT;
1032
1034 ScrollDirFlagLT |= DFCS_INACTIVE;
1035
1036 if (ScrollBarInfo->rgstate[SCROLL_BOTTOM_ARROW] & STATE_SYSTEM_PRESSED)
1037 ScrollDirFlagRB |= DFCS_PUSHED | DFCS_FLAT;
1038
1040 ScrollDirFlagRB |= DFCS_INACTIVE;
1041
1042 DrawFrameControl(hDC, &RectLT, DFC_SCROLL, ScrollDirFlagLT);
1043 DrawFrameControl(hDC, &RectRB, DFC_SCROLL, ScrollDirFlagRB);
1044}
static HDC hDC
Definition: 3dtext.c:33
#define SCROLL_BOTTOM_ARROW
Definition: scrollbar.c:18
#define SCROLL_TOP_ARROW
Definition: scrollbar.c:14
#define STATE_SYSTEM_PRESSED
Definition: winuser.h:2865
#define DFC_SCROLL
Definition: winuser.h:475
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_FLAT
Definition: winuser.h:510
#define DFCS_INACTIVE
Definition: winuser.h:502
#define DFCS_SCROLLUP
Definition: winuser.h:489
#define DFCS_SCROLLLEFT
Definition: winuser.h:491
#define DFCS_SCROLLRIGHT
Definition: winuser.h:492
#define DFCS_SCROLLDOWN
Definition: winuser.h:490
#define DFCS_PUSHED
Definition: winuser.h:503

Referenced by IntDrawScrollBar(), and IntUpdateScrollArrows().

◆ IntDrawScrollBar()

void IntDrawScrollBar ( PWND  Wnd,
HDC  DC,
INT  Bar 
)

Definition at line 1072 of file scrollbar.c.

1073{
1074 PTHREADINFO pti;
1076 BOOL Vertical;
1077
1079
1080 // Get scrollbar info
1081 switch (Bar)
1082 {
1083 case SB_HORZ:
1084 Vertical = FALSE;
1085 break;
1086
1087 case SB_VERT:
1088 Vertical = TRUE;
1089 break;
1090
1091 case SB_CTL:
1092 Vertical = (Wnd->style & SBS_VERT) != 0;
1093 break;
1094
1095 default:
1096 return;
1097 }
1098
1100 return;
1101
1102 if (RECTL_bIsEmptyRect(&Info.rcScrollBar))
1103 return;
1104
1105 // Draw arrows
1106 if (Info.dxyLineButton)
1107 IntDrawScrollArrows(DC, &Info, Vertical);
1108
1109 // Draw interior
1110 IntDrawScrollInterior(Wnd, DC, Bar, Vertical, &Info);
1111
1112 // If scrollbar has focus, reposition the caret
1113 if (Wnd == pti->MessageQueue->spwndFocus && Bar == SB_CTL)
1114 {
1115 if (Vertical)
1116 co_IntSetCaretPos(Info.rcScrollBar.top + 1, Info.dxyLineButton + 1);
1117 else
1118 co_IntSetCaretPos(Info.dxyLineButton + 1, Info.rcScrollBar.top + 1);
1119 }
1120}
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
static VOID FASTCALL IntDrawScrollArrows(HDC hDC, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical)
Definition: scrollbar.c:1009
BOOL FASTCALL co_IntGetScrollBarInfo(PWND Window, LONG idObject, PSCROLLBARINFO psbi)
Definition: scrollbar.c:666
static void IntDrawScrollInterior(PWND pWnd, HDC hDC, INT nBar, BOOL Vertical, PSCROLLBARINFO ScrollBarInfo)
Definition: scrollbar.c:897
static LONG FASTCALL IntScrollGetObjectId(INT SBType)
Definition: scrollbar.c:1047
Definition: polytest.cpp:41
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
BOOL FASTCALL co_IntSetCaretPos(int X, int Y)
Definition: caret.c:193

Referenced by NC_DoNCPaint(), SCROLL_RefreshScrollBar(), and ScrollBarWndProc_common().

◆ IntDrawScrollInterior()

static void IntDrawScrollInterior ( PWND  pWnd,
HDC  hDC,
INT  nBar,
BOOL  Vertical,
PSCROLLBARINFO  ScrollBarInfo 
)
static

Definition at line 897 of file scrollbar.c.

898{
899 INT ThumbSize = ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop;
900 INT ThumbTop = ScrollBarInfo->xyThumbTop;
901 RECT Rect;
902 HBRUSH hSaveBrush, hBrush;
903 BOOL TopSelected = FALSE, BottomSelected = FALSE;
904
905 if (ScrollBarInfo->rgstate[SCROLL_TOP_RECT] & STATE_SYSTEM_PRESSED)
906 TopSelected = TRUE;
907 if (ScrollBarInfo->rgstate[SCROLL_BOTTOM_RECT] & STATE_SYSTEM_PRESSED)
908 BottomSelected = TRUE;
909
910 // Only scrollbar controls send WM_CTLCOLORSCROLLBAR.
911 // The window-owned scrollbars need to call DefWndControlColor
912 // to correctly setup default scrollbar colors
913 if (nBar == SB_CTL)
914 {
916 if (!hBrush)
918 }
919 else
920 {
922 }
923
924 hSaveBrush = NtGdiSelectBrush(hDC, hBrush);
925
926 // Calculate the scroll rectangle
927 if (Vertical)
928 {
929 Rect.top = ScrollBarInfo->rcScrollBar.top + ScrollBarInfo->dxyLineButton;
930 Rect.bottom = ScrollBarInfo->rcScrollBar.bottom - ScrollBarInfo->dxyLineButton;
931 Rect.left = ScrollBarInfo->rcScrollBar.left;
932 Rect.right = ScrollBarInfo->rcScrollBar.right;
933 }
934 else
935 {
936 Rect.top = ScrollBarInfo->rcScrollBar.top;
937 Rect.bottom = ScrollBarInfo->rcScrollBar.bottom;
938 Rect.left = ScrollBarInfo->rcScrollBar.left + ScrollBarInfo->dxyLineButton;
939 Rect.right = ScrollBarInfo->rcScrollBar.right - ScrollBarInfo->dxyLineButton;
940 }
941
942 // Draw scroll rectangles and thumb
943 if (!ScrollBarInfo->xyThumbBottom)
944 {
945 NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right - Rect.left,
946 Rect.bottom - Rect.top, PATCOPY);
947
948 // Cleanup and return
949 NtGdiSelectBrush(hDC, hSaveBrush);
950 return;
951 }
952
953 ThumbTop -= ScrollBarInfo->dxyLineButton;
954
955 if (ScrollBarInfo->dxyLineButton)
956 {
957 if (Vertical)
958 {
959 if (ThumbSize)
960 {
961 NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right - Rect.left,
962 ThumbTop, TopSelected ? BLACKNESS : PATCOPY);
963 Rect.top += ThumbTop;
964 NtGdiPatBlt(hDC, Rect.left, Rect.top + ThumbSize, Rect.right - Rect.left,
965 Rect.bottom - Rect.top - ThumbSize, BottomSelected ? BLACKNESS : PATCOPY);
966 Rect.bottom = Rect.top + ThumbSize;
967 }
968 else
969 {
970 if (ThumbTop)
971 {
972 NtGdiPatBlt(hDC, Rect.left, ScrollBarInfo->dxyLineButton,
973 Rect.right - Rect.left, Rect.bottom - Rect.top, PATCOPY);
974 }
975 }
976 }
977 else
978 {
979 if (ThumbSize)
980 {
981 NtGdiPatBlt(hDC, Rect.left, Rect.top, ThumbTop,
982 Rect.bottom - Rect.top, TopSelected ? BLACKNESS : PATCOPY);
983 Rect.left += ThumbTop;
984 NtGdiPatBlt(hDC, Rect.left + ThumbSize, Rect.top,
985 Rect.right - Rect.left - ThumbSize, Rect.bottom - Rect.top,
986 BottomSelected ? BLACKNESS : PATCOPY);
987 Rect.right = Rect.left + ThumbSize;
988 }
989 else
990 {
991 if (ThumbTop)
992 {
993 NtGdiPatBlt(hDC, ScrollBarInfo->dxyLineButton, Rect.top,
994 Rect.right - Rect.left, Rect.bottom - Rect.top, PATCOPY);
995 }
996 }
997 }
998 }
999
1000 // Draw thumb
1001 if (ThumbSize)
1003
1004 // Cleanup
1005 NtGdiSelectBrush(hDC, hSaveBrush);
1006}
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiPatBlt(_In_ HDC hdcDest, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_ DWORD dwRop)
Definition: bitblt.c:984
HBRUSH FASTCALL DefWndControlColor(HDC hDC, UINT ctlType)
Definition: defwnd.c:32
#define SCROLL_BOTTOM_RECT
Definition: scrollbar.c:17
#define SCROLL_TOP_RECT
Definition: scrollbar.c:15
HBRUSH FASTCALL GetControlBrush(PWND pwnd, HDC hdc, UINT ctlType)
Definition: misc.c:180
#define BLACKNESS
Definition: wingdi.h:323
#define PATCOPY
Definition: wingdi.h:335
#define CTLCOLOR_SCROLLBAR
Definition: winuser.h:956
#define COLOR_SCROLLBAR
Definition: winuser.h:912
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1771
#define BF_MIDDLE
Definition: winuser.h:468
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define BF_RECT
Definition: winuser.h:462
#define EDGE_RAISED
Definition: winuser.h:450

Referenced by IntDrawScrollBar(), IntRefeshScrollInterior(), IntScrollDrawMovingThumb(), and IntScrollHandleScrollEvent().

◆ IntEnableScrollBar()

BOOL APIENTRY IntEnableScrollBar ( BOOL  Horz,
PSCROLLBARINFO  Info,
UINT  wArrows 
)

Definition at line 813 of file scrollbar.c.

814{
815 BOOL Chg = FALSE;
816 switch(wArrows)
817 {
818 case ESB_DISABLE_BOTH:
821 break;
822 case ESB_DISABLE_RTDN:
823 if(Horz)
824 {
826 }
827 else
828 {
830 }
831 break;
832 case ESB_DISABLE_LTUP:
833 if(Horz)
834 {
836 }
837 else
838 {
840 }
841 break;
842 case ESB_ENABLE_BOTH:
845 break;
846 }
847 return Chg;
848}
#define CHANGERGSTATE(item, status)
Definition: scrollbar.c:49
#define ESB_DISABLE_RTDN
Definition: winuser.h:561
#define ESB_DISABLE_LTUP
Definition: winuser.h:559

Referenced by co_IntSetScrollInfo(), and NtUserEnableScrollBar().

◆ IntGetSBData()

PSBDATA FASTCALL IntGetSBData ( PWND  pwnd,
INT  Bar 
)

Definition at line 77 of file scrollbar.c.

78{
79 PSBWND pSBWnd;
80 PSBINFO pSBInfo;
81
82 pSBInfo = pwnd->pSBInfo;
83 switch (Bar)
84 {
85 case SB_HORZ:
86 return &pSBInfo->Horz;
87 case SB_VERT:
88 return &pSBInfo->Vert;
89 case SB_CTL:
90 if (pwnd->cbwndExtra < (sizeof(SBWND)-sizeof(WND)))
91 {
92 ERR("IntGetSBData Wrong Extra bytes for CTL Scrollbar\n");
93 return 0;
94 }
95 pSBWnd = (PSBWND)pwnd;
96 return (PSBDATA)&pSBWnd->SBCalc;
97 default:
98 ERR("IntGetSBData Bad Bar\n");
99 }
100 return NULL;
101}
struct _SBWND * PSBWND
Definition: ntuser.h:772
SBCALC SBCalc
Definition: ntuser.h:776
Definition: ntuser.h:694
PSBINFO pSBInfo
Definition: ntuser.h:726
ULONG cbwndExtra
Definition: ntuser.h:738
SBDATA Vert
Definition: ntuser.h:515
SBDATA Horz
Definition: ntuser.h:514

Referenced by co_IntCreateScrollBars(), co_IntGetScrollBarInfo(), co_IntSetScrollInfo(), GetScrollPos(), GetScrollRange(), IntScrollGetThumbVal(), and RealGetScrollInfo().

◆ IntGetScrollBarRect()

BOOL FASTCALL IntGetScrollBarRect ( PWND  Wnd,
INT  nBar,
RECTL lprect 
)

Definition at line 104 of file scrollbar.c.

105{
106 BOOL vertical;
107 *lprect = Wnd->rcClient;
108
109 RECTL_vOffsetRect(lprect, -Wnd->rcWindow.left, -Wnd->rcWindow.top);
110 if (Wnd->ExStyle & WS_EX_LAYOUTRTL)
111 mirror_rect(&Wnd->rcWindow, lprect);
112
113 switch (nBar)
114 {
115 case SB_HORZ:
116 lprect->top = lprect->bottom;
118 if (Wnd->style & WS_BORDER)
119 {
120 lprect->left--;
121 lprect->right++;
122 }
123 else if (Wnd->style & WS_VSCROLL)
124 {
125 lprect->right++;
126 }
127 vertical = FALSE;
128 break;
129
130 case SB_VERT:
132 {
133 lprect->right = lprect->left;
135 }
136 else
137 {
138 lprect->left = lprect->right;
140 }
141 if (Wnd->style & WS_BORDER)
142 {
143 lprect->top--;
144 lprect->bottom++;
145 }
146 else if (Wnd->style & WS_HSCROLL)
147 {
148 lprect->bottom++;
149 }
150 vertical = TRUE;
151 break;
152
153 case SB_CTL:
154 IntGetClientRect(Wnd, lprect);
155 vertical = !!(Wnd->style & SBS_VERT);
156 break;
157
158 default:
159 return FALSE;
160 }
161
162 return vertical;
163}
static void mirror_rect(const RECT *window_rect, RECT *rect)
Definition: scrollbar.c:68
#define WS_BORDER
Definition: pedump.c:625
DWORD ExStyle
Definition: ntuser.h:704
RECT rcClient
Definition: ntuser.h:717
RECT rcWindow
Definition: ntuser.h:716
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define SM_CXVSCROLL
Definition: winuser.h:961
#define SM_CYHSCROLL
Definition: winuser.h:962
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392

Referenced by co_IntCreateScrollBars(), and co_IntGetScrollBarInfo().

◆ IntRefeshScrollInterior()

static void IntRefeshScrollInterior ( PWND  pWnd,
INT  nBar,
PSCROLLBARINFO  psbi 
)
static

Definition at line 1057 of file scrollbar.c.

1058{
1059 HDC hdc;
1060 BOOL Vertical = ((nBar == SB_CTL) ? ((pWnd->style & SBS_VERT) != 0) : (nBar == SB_VERT));
1061
1062 hdc = UserGetDCEx(pWnd, NULL, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
1063 if (hdc)
1064 {
1066 IntDrawScrollInterior(pWnd, hdc, nBar, Vertical, psbi);
1067 UserReleaseDC(pWnd, hdc, FALSE);
1068 }
1069}
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
#define DCX_CACHE
Definition: winuser.h:2114
#define DCX_WINDOW
Definition: winuser.h:2113

Referenced by co_IntSetScrollInfo().

◆ IntScrollGetObjectId()

static LONG FASTCALL IntScrollGetObjectId ( INT  SBType)
static

Definition at line 1047 of file scrollbar.c.

1048{
1049 if (SBType == SB_VERT)
1050 return OBJID_VSCROLL;
1051 if (SBType == SB_HORZ)
1052 return OBJID_HSCROLL;
1053 return OBJID_CLIENT;
1054}
#define OBJID_VSCROLL
Definition: winable.h:20
#define OBJID_HSCROLL
Definition: winable.h:21
#define OBJID_CLIENT
Definition: winable.h:19

Referenced by IntDrawScrollBar(), IntGetScrollBarInfo(), IntRefeshScrollInterior(), IntScrollHandleScrollEvent(), and IntUpdateScrollArrows().

◆ mirror_rect()

static void mirror_rect ( const RECT window_rect,
RECT rect 
)
inlinestatic

Definition at line 68 of file scrollbar.c.

69{
70 int width = window_rect->right - window_rect->left;
71 int tmp = rect->left;
72 rect->left = width - rect->right;
73 rect->right = width - tmp;
74}
GLint GLint GLsizei width
Definition: gl.h:1546
& rect
Definition: startmenu.cpp:1413

Referenced by IntGetScrollBarRect(), and IntScrollGetScrollBarRect().

◆ NEWco_IntGetScrollInfo()

BOOL FASTCALL NEWco_IntGetScrollInfo ( PWND  pWnd,
INT  nBar,
PSBDATA  pSBData,
LPSCROLLINFO  lpsi 
)

Definition at line 311 of file scrollbar.c.

316{
317 UINT Mask;
318 PSBTRACK pSBTrack = pWnd->head.pti->pSBTrack;
319
320 lpsi->fMask &= ~SIF_THEMED; // Remove Theme bit
321 if (!SBID_IS_VALID(nBar))
322 {
324 ERR("Trying to get scrollinfo for unknown scrollbar type %d\n", nBar);
325 return FALSE;
326 }
327
328 if (!pWnd->pSBInfo || !pSBTrack) return FALSE;
329
330 Mask = lpsi->fMask;
331
332 if (0 != (Mask & SIF_PAGE))
333 lpsi->nPage = pSBData->page;
334
335 if (0 != (Mask & SIF_POS))
336 lpsi->nPos = pSBData->pos;
337
338 if (0 != (Mask & SIF_RANGE))
339 {
340 lpsi->nMin = pSBData->posMin;
341 lpsi->nMax = pSBData->posMax;
342 }
343
344 if (0 != (Mask & SIF_TRACKPOS))
345 {
346 if (pSBTrack && pSBTrack->nBar == nBar && pSBTrack->spwndTrack == pWnd)
347 lpsi->nTrackPos = pSBTrack->posNew;
348 else
349 lpsi->nTrackPos = pSBData->pos;
350 }
351 return (Mask & SIF_ALL) !=0;
352}
THRDESKHEAD head
Definition: ntuser.h:695
INT nBar
Definition: scroll.h:22
INT posNew
Definition: scroll.h:21
PWND spwndTrack
Definition: scroll.h:11

◆ NtUserEnableScrollBar()

BOOL APIENTRY NtUserEnableScrollBar ( HWND  hWnd,
UINT  wSBflags,
UINT  wArrows 
)

Definition at line 1242 of file scrollbar.c.

1246{
1247 UINT OrigArrows;
1248 PWND Window = NULL;
1249 PSCROLLBARINFO InfoV = NULL, InfoH = NULL;
1250 BOOL Chg = FALSE;
1251 BOOL Ret = FALSE;
1253
1254 TRACE("Enter NtUserEnableScrollBar\n");
1256
1258 goto Cleanup; // Return FALSE
1259
1260 UserRefObjectCo(Window, &Ref);
1261
1263 goto Cleanup; // Return FALSE
1264
1265 OrigArrows = Window->pSBInfo->WSBflags;
1266 Window->pSBInfo->WSBflags = wArrows;
1267
1268 if (wSBflags == SB_CTL)
1269 {
1270 if ((wArrows == ESB_DISABLE_BOTH || wArrows == ESB_ENABLE_BOTH))
1271 IntEnableWindow(hWnd, (wArrows == ESB_ENABLE_BOTH));
1272
1273 Ret = TRUE;
1274 goto Cleanup;
1275 }
1276
1277 if(wSBflags != SB_BOTH && !SBID_IS_VALID(wSBflags))
1278 {
1280 ERR("Trying to set scrollinfo for unknown scrollbar type %u\n", wSBflags);
1281 goto Cleanup; // Return FALSE
1282 }
1283
1284 switch(wSBflags)
1285 {
1286 case SB_BOTH:
1288 // Fall through
1289 case SB_HORZ:
1291 break;
1292 case SB_VERT:
1294 break;
1295 default:
1296 goto Cleanup; // Return FALSE
1297 }
1298
1299 if(InfoV)
1300 Chg = IntEnableScrollBar(FALSE, InfoV, wArrows);
1301
1302 if(InfoH)
1303 Chg = (IntEnableScrollBar(TRUE, InfoH, wArrows) || Chg);
1304
1305 ERR("FIXME: EnableScrollBar wSBflags %u wArrows %u Chg %d\n", wSBflags, wArrows, Chg);
1306// Done in user32:
1307// SCROLL_RefreshScrollBar(hwnd, nBar, TRUE, TRUE);
1308
1309 Ret = Chg;
1310 goto Cleanup; // FIXME
1311
1312 if (OrigArrows == wArrows)
1313 {
1314 Ret = FALSE;
1315 goto Cleanup;
1316 }
1317
1318 Ret = TRUE;
1319
1320Cleanup:
1321 if (Window)
1323
1324 TRACE("Leave NtUserEnableScrollBar, ret=%i\n", Ret);
1325 UserLeave();
1326 return Ret;
1327}
HWND hWnd
Definition: settings.c:17
static const WCHAR Cleanup[]
Definition: register.c:80
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:251
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:242
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define TRACE(s)
Definition: solgame.cpp:4
Definition: object.h:4
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:122
#define UserIsMessageWindow(pWnd)
Definition: desktop.h:197
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
BOOL FASTCALL IntEnableWindow(HWND hWnd, BOOL bEnable)
Definition: window.c:220

Referenced by EnableScrollBar(), and ResetUserApiHook().

◆ NtUserGetScrollBarInfo()

BOOL APIENTRY NtUserGetScrollBarInfo ( HWND  hWnd,
LONG  idObject,
PSCROLLBARINFO  psbi 
)

Definition at line 1142 of file scrollbar.c.

1143{
1145 SCROLLBARINFO sbi;
1146 PWND Window;
1147 BOOL Ret = FALSE;
1149
1150 TRACE("Enter NtUserGetScrollBarInfo\n");
1152
1153 Status = MmCopyFromCaller(&sbi, psbi, sizeof(SCROLLBARINFO));
1154 if(!NT_SUCCESS(Status) || (sbi.cbSize != sizeof(SCROLLBARINFO)))
1155 {
1157 goto Exit; // Return FALSE
1158 }
1159
1161 goto Exit; // Return FALSE
1162
1163 UserRefObjectCo(Window, &Ref);
1164 Ret = co_IntGetScrollBarInfo(Window, idObject, &sbi);
1166
1167 Status = MmCopyToCaller(psbi, &sbi, sizeof(SCROLLBARINFO));
1168 if(!NT_SUCCESS(Status))
1169 {
1171 Ret = FALSE;
1172 }
1173
1174Exit:
1175 TRACE("Leave NtUserGetScrollBarInfo, ret=%i\n", Ret);
1176 UserLeave();
1177 return Ret;
1178}
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
#define MmCopyFromCaller
Definition: polytest.cpp:29
static void Exit(void)
Definition: sock.c:1330
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31

Referenced by GetScrollBarInfo(), IntGetScrollBarInfo(), and ScrollBarWndProc_common().

◆ NtUserSBGetParms()

BOOL APIENTRY NtUserSBGetParms ( HWND  hWnd,
int  fnBar,
PSBDATA  pSBData,
LPSCROLLINFO  lpsi 
)

Definition at line 1182 of file scrollbar.c.

1187{
1188 PWND Window;
1189 SCROLLINFO psi;
1190 BOOL Ret = FALSE;
1191 SBDATA SBDataSafe;
1193
1194 TRACE("Enter NtUserGetScrollInfo\n");
1196
1197 _SEH2_TRY
1198 {
1199 RtlCopyMemory(&psi, lpsi, sizeof(SCROLLINFO));
1200 if (pSBData)
1201 RtlCopyMemory(&SBDataSafe, pSBData, sizeof(SBDATA));
1202 }
1204 {
1205 ERR("NtUserGetScrollInfo Failed size\n");
1207 _SEH2_YIELD(goto Exit); // Return FALSE
1208 }
1209 _SEH2_END
1210
1212 {
1213 ERR("NtUserGetScrollInfo Bad window\n");
1214 goto Exit; // Return FALSE
1215 }
1216
1217 UserRefObjectCo(Window, &Ref);
1218 Ret = co_IntGetScrollInfo(Window, fnBar, &SBDataSafe, &psi);
1220
1221 _SEH2_TRY
1222 {
1223 RtlCopyMemory(lpsi, &psi, sizeof(SCROLLINFO));
1224 }
1226 {
1227 ERR("NtUserGetScrollInfo Failed copy to user\n");
1229 Ret = FALSE;
1230 _SEH2_YIELD(goto Exit);
1231 }
1232 _SEH2_END
1233
1234Exit:
1235 TRACE("Leave NtUserGetScrollInfo, ret=%i\n", Ret);
1236 UserLeave();
1237 return Ret;
1238}
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static BOOL FASTCALL co_IntGetScrollInfo(PWND Window, INT nBar, PSBDATA pSBData, LPSCROLLINFO lpsi)
Definition: scrollbar.c:264
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:235
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:162

Referenced by RealGetScrollInfo(), and ScrollBarWndProc_common().

◆ NtUserSetScrollBarInfo()

BOOL APIENTRY NtUserSetScrollBarInfo ( HWND  hWnd,
LONG  idObject,
SETSCROLLBARINFO info 
)

Definition at line 1397 of file scrollbar.c.

1401{
1402 PWND Window = NULL;
1403 SETSCROLLBARINFO Safeinfo;
1404 PSCROLLBARINFO sbi;
1405 LPSCROLLINFO psi;
1407 LONG Obj;
1408 BOOL Ret = FALSE;
1410
1411 TRACE("Enter NtUserSetScrollBarInfo\n");
1413
1415 goto Cleanup; // Return FALSE
1416
1417 UserRefObjectCo(Window, &Ref);
1418
1419 Obj = SBOBJ_TO_SBID(idObject);
1420 if(!SBID_IS_VALID(Obj))
1421 {
1423 ERR("Trying to set scrollinfo for unknown scrollbar type %d\n", Obj);
1424 goto Cleanup; // Return FALSE
1425 }
1426
1428 goto Cleanup; // Return FALSE
1429
1430 Status = MmCopyFromCaller(&Safeinfo, info, sizeof(SETSCROLLBARINFO));
1431 if(!NT_SUCCESS(Status))
1432 {
1434 goto Cleanup; // Return FALSE
1435 }
1436
1439
1440 psi->nTrackPos = Safeinfo.nTrackPos;
1441 sbi->reserved = Safeinfo.reserved;
1442 RtlCopyMemory(&sbi->rgstate, &Safeinfo.rgstate, sizeof(Safeinfo.rgstate));
1443
1444 Ret = TRUE;
1445
1446Cleanup:
1447 if (Window)
1449
1450 TRACE("Leave NtUserSetScrollBarInfo, ret=%i\n", Ret);
1451 UserLeave();
1452 return Ret;
1453}
long LONG
Definition: pedump.c:60

Referenced by IntScrollHandleScrollEvent(), and IntUpdateScrollArrows().

◆ NtUserSetScrollInfo()

DWORD APIENTRY NtUserSetScrollInfo ( HWND  hWnd,
int  fnBar,
LPCSCROLLINFO  lpsi,
BOOL  bRedraw 
)

Definition at line 1331 of file scrollbar.c.

1336{
1337 PWND Window = NULL;
1339 SCROLLINFO ScrollInfo;
1340 DWORD Ret = 0;
1342
1343 TRACE("Enter NtUserSetScrollInfo\n");
1345
1347 goto Cleanup; // Return 0
1348
1349 UserRefObjectCo(Window, &Ref);
1350
1351 Status = MmCopyFromCaller(&ScrollInfo, lpsi, sizeof(SCROLLINFO) - sizeof(ScrollInfo.nTrackPos));
1352 if(!NT_SUCCESS(Status))
1353 {
1355 goto Cleanup; // Return 0
1356 }
1357
1358 Ret = co_IntSetScrollInfo(Window, fnBar, &ScrollInfo, bRedraw);
1359
1360Cleanup:
1361 if (Window)
1363
1364 TRACE("Leave NtUserSetScrollInfo, ret=%lu\n", Ret);
1365 UserLeave();
1366 return Ret;
1367}
static DWORD FASTCALL co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
Definition: scrollbar.c:455

Referenced by IntScrollCreateScrollBar(), IntSetScrollInfo(), and RealSetScrollInfo().

◆ NtUserShowScrollBar()

DWORD APIENTRY NtUserShowScrollBar ( HWND  hWnd,
int  nBar,
DWORD  bShow 
)

Definition at line 1370 of file scrollbar.c.

1371{
1372 PWND Window;
1373 DWORD ret = 0;
1375
1376 TRACE("Enter NtUserShowScrollBar\n");
1378
1380 if (Window)
1381 {
1382 UserRefObjectCo(Window, &Ref);
1383 ret = co_UserShowScrollBar(Window, nBar, (nBar == SB_VERT) ? 0 : bShow,
1384 (nBar == SB_HORZ) ? 0 : bShow);
1386 }
1387
1388 TRACE("Leave NtUserShowScrollBar, ret=%lu\n", ret);
1389 UserLeave();
1390 return ret;
1391}
int ret

Referenced by ShowScrollBar().

◆ ScrollBarWndProc()

LRESULT APIENTRY ScrollBarWndProc ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1123 of file scrollbar.c.

1124{
1125 LRESULT lResult = 0;
1126 PWND pWnd;
1127 pWnd = UserGetWindowObject(hWnd);
1128 if (!pWnd) return 0;
1129
1130 switch(Msg)
1131 {
1132 case WM_ENABLE:
1133 if (pWnd->pSBInfo)
1135 break;
1136 }
1137 return lResult;
1138}
struct @1632 Msg[]
WPARAM wParam
Definition: combotst.c:138
INT WSBflags
Definition: ntuser.h:513
LONG_PTR LRESULT
Definition: windef.h:209
#define WM_ENABLE
Definition: winuser.h:1615

Referenced by NtUserMessageCall().