ReactOS  0.4.14-dev-342-gdc047f9
scroll.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagSBTRACK
 

Macros

#define IntGetScrollbarInfoFromWindow(Window, i)   ((PSCROLLBARINFO)(&((Window)->pSBInfoex + i)->ScrollBarInfo))
 
#define IntGetScrollInfoFromWindow(Window, i)   ((LPSCROLLINFO)(&((Window)->pSBInfoex + i)->ScrollInfo))
 
#define SBOBJ_TO_SBID(Obj)   ((Obj) - OBJID_HSCROLL)
 
#define SBID_IS_VALID(id)   (id == SB_HORZ || id == SB_VERT || id == SB_CTL)
 

Typedefs

typedef struct tagSBTRACK SBTRACK
 
typedef struct tagSBTRACKPSBTRACK
 

Functions

typedef VOID (NEAR NTAPI *PFN_SCROLLBAR)(PWND
 
BOOL FASTCALL co_IntCreateScrollBars (PWND)
 
BOOL FASTCALL IntDestroyScrollBars (PWND)
 
DWORD FASTCALL co_UserShowScrollBar (PWND, int, BOOL, BOOL)
 
BOOL FASTCALL co_IntGetScrollBarInfo (PWND, LONG, PSCROLLBARINFO)
 
BOOL FASTCALL co_IntSetScrollBarInfo (PWND, LONG, PSETSCROLLBARINFO)
 
void IntDrawScrollBar (PWND, HDC, INT)
 
BOOL FASTCALL IntScrollWindow (PWND, int, int, CONST RECT *, CONST RECT *)
 
DWORD FASTCALL IntScrollWindowEx (PWND, INT, INT, const RECT *, const RECT *, HRGN, LPRECT, UINT)
 

Variables

typedef UINT
 
typedef WPARAM
 
typedef LPARAM
 
typedef PSBCALC
 

Macro Definition Documentation

◆ IntGetScrollbarInfoFromWindow

#define IntGetScrollbarInfoFromWindow (   Window,
  i 
)    ((PSCROLLBARINFO)(&((Window)->pSBInfoex + i)->ScrollBarInfo))

Definition at line 33 of file scroll.h.

◆ IntGetScrollInfoFromWindow

#define IntGetScrollInfoFromWindow (   Window,
  i 
)    ((LPSCROLLINFO)(&((Window)->pSBInfoex + i)->ScrollInfo))

Definition at line 36 of file scroll.h.

◆ SBID_IS_VALID

#define SBID_IS_VALID (   id)    (id == SB_HORZ || id == SB_VERT || id == SB_CTL)

Definition at line 40 of file scroll.h.

◆ SBOBJ_TO_SBID

#define SBOBJ_TO_SBID (   Obj)    ((Obj) - OBJID_HSCROLL)

Definition at line 39 of file scroll.h.

Typedef Documentation

◆ PSBTRACK

◆ SBTRACK

Function Documentation

◆ co_IntCreateScrollBars()

BOOL FASTCALL co_IntCreateScrollBars ( PWND  )

Definition at line 750 of file scrollbar.c.

751 {
752  PSCROLLBARINFO psbi;
753  PSBDATA pSBData;
754  ULONG Size, s;
755  INT i;
756 
758 
759  if (Window->pSBInfo && Window->pSBInfoex)
760  {
761  /* No need to create it anymore */
762  return TRUE;
763  }
764 
765  /* Allocate memory for all scrollbars (HORZ, VERT, CONTROL) */
766  Size = 3 * (sizeof(SBINFOEX));
768  {
769  ERR("Unable to allocate memory for scrollbar information for window %p\n", Window->head.h);
770  return FALSE;
771  }
772 
773  RtlZeroMemory(Window->pSBInfoex, Size);
774 
775  if(!(Window->pSBInfo = DesktopHeapAlloc( Window->head.rpdesk, sizeof(SBINFO))))
776  {
777  ERR("Unable to allocate memory for scrollbar information for window %p\n", Window->head.h);
778  return FALSE;
779  }
780 
781  RtlZeroMemory(Window->pSBInfo, sizeof(SBINFO));
782  Window->pSBInfo->Vert.posMax = 100;
783  Window->pSBInfo->Horz.posMax = 100;
784 
786  &Window->rcWindow,
787  &Window->rcClient);
788 
789  for(s = SB_HORZ; s <= SB_VERT; s++)
790  {
792  psbi->cbSize = sizeof(SCROLLBARINFO);
793  for (i = 0; i < CCHILDREN_SCROLLBAR + 1; i++)
794  psbi->rgstate[i] = 0;
795 
796  pSBData = IntGetSBData(Window, s);
797 
799  IntCalculateThumb(Window, s, psbi, pSBData);
800  }
801 
802  return TRUE;
803 }
BOOL FASTCALL IntGetScrollBarRect(PWND Wnd, INT nBar, RECTL *lprect)
Definition: scrollbar.c:107
PSBDATA FASTCALL IntGetSBData(PWND pwnd, INT Bar)
Definition: scrollbar.c:80
#define TRUE
Definition: types.h:120
#define SB_VERT
Definition: winuser.h:553
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
#define SB_HORZ
Definition: winuser.h:552
#define CCHILDREN_SCROLLBAR
Definition: winuser.h:3719
int32_t INT
Definition: typedefs.h:56
#define TAG_SBARINFO
Definition: tags.h:9
#define IntGetScrollbarInfoFromWindow(Window, i)
Definition: scroll.h:33
Definition: window.c:29
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
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:230
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3728
BOOL FASTCALL IntCalculateThumb(PWND Wnd, LONG idObject, PSCROLLBARINFO psbi, PSBDATA pSBData)
Definition: scrollbar.c:169
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
GLdouble s
Definition: gl.h:2039
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define ERR(fmt,...)
Definition: debug.h:109
struct tagSCROLLBARINFO SCROLLBARINFO
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
struct _SBINFOEX SBINFOEX
LRESULT FASTCALL co_WinPosGetNonClientSize(PWND Window, RECT *WindowRect, RECT *ClientRect)
Definition: winpos.c:2265

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

◆ co_IntGetScrollBarInfo()

BOOL FASTCALL co_IntGetScrollBarInfo ( PWND  ,
LONG  ,
PSCROLLBARINFO   
)

Definition at line 668 of file scrollbar.c.

669 {
670  INT Bar;
671  PSCROLLBARINFO sbi;
672  PSBDATA pSBData;
674 
675  Bar = SBOBJ_TO_SBID(idObject);
676 
677  if(!SBID_IS_VALID(Bar))
678  {
680  ERR("Trying to get scrollinfo for unknown scrollbar type %d\n", Bar);
681  return FALSE;
682  }
683 
685  {
686  ERR("Failed to create scrollbars for window.\n");
687  return FALSE;
688  }
689 
691  pSBData = IntGetSBData(Window, Bar);
692 
693  IntGetScrollBarRect(Window, Bar, &(sbi->rcScrollBar));
694  IntCalculateThumb(Window, Bar, sbi, pSBData);
695 
696  /* Scroll bar state */
697  psbi->rgstate[0] = 0;
698  if ((Bar == SB_HORZ && !(Window->style & WS_HSCROLL))
699  || (Bar == SB_VERT && !(Window->style & WS_VSCROLL)))
700  psbi->rgstate[0] |= STATE_SYSTEM_INVISIBLE;
701  if (pSBData->posMin >= pSBData->posMax - max(pSBData->page - 1, 0))
702  {
703  if (!(psbi->rgstate[0] & STATE_SYSTEM_INVISIBLE))
704  psbi->rgstate[0] |= STATE_SYSTEM_UNAVAILABLE;
705  else
706  psbi->rgstate[0] |= STATE_SYSTEM_OFFSCREEN;
707  }
708  if (Bar == SB_CTL && !(Window->style & WS_DISABLED))
709  psbi->rgstate[0] |= STATE_SYSTEM_UNAVAILABLE;
710 
711  RtlCopyMemory(psbi, sbi, sizeof(SCROLLBARINFO));
712 
713  return TRUE;
714 }
BOOL FASTCALL IntGetScrollBarRect(PWND Wnd, INT nBar, RECTL *lprect)
Definition: scrollbar.c:107
PSBDATA FASTCALL IntGetSBData(PWND pwnd, INT Bar)
Definition: scrollbar.c:80
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define WS_DISABLED
Definition: pedump.c:621
#define max(a, b)
Definition: svc.c:63
#define STATE_SYSTEM_UNAVAILABLE
Definition: winuser.h:2836
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATE_SYSTEM_OFFSCREEN
Definition: winuser.h:2852
#define SB_CTL
Definition: winuser.h:554
#define SB_VERT
Definition: winuser.h:553
INT page
Definition: ntuser.h:475
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
#define SB_HORZ
Definition: winuser.h:552
#define SBOBJ_TO_SBID(Obj)
Definition: scroll.h:39
int32_t INT
Definition: typedefs.h:56
#define IntGetScrollbarInfoFromWindow(Window, i)
Definition: scroll.h:33
Definition: window.c:29
BOOL FASTCALL co_IntCreateScrollBars(PWND Window)
Definition: scrollbar.c:750
BOOL FASTCALL IntCalculateThumb(PWND Wnd, LONG idObject, PSCROLLBARINFO psbi, PSBDATA pSBData)
Definition: scrollbar.c:169
#define WS_HSCROLL
Definition: pedump.c:628
INT posMin
Definition: ntuser.h:473
#define ERR(fmt,...)
Definition: debug.h:109
#define WS_VSCROLL
Definition: pedump.c:627
#define SBID_IS_VALID(id)
Definition: scroll.h:40
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define STATE_SYSTEM_INVISIBLE
Definition: winuser.h:2851
INT posMax
Definition: ntuser.h:474

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

◆ co_IntSetScrollBarInfo()

BOOL FASTCALL co_IntSetScrollBarInfo ( PWND  ,
LONG  ,
PSETSCROLLBARINFO   
)

Definition at line 717 of file scrollbar.c.

718 {
719  INT Bar;
720  PSCROLLBARINFO sbi;
721  LPSCROLLINFO psi;
723 
724  Bar = SBOBJ_TO_SBID(idObject);
725 
726  if(!SBID_IS_VALID(Bar))
727  {
729  ERR("Trying to get scrollinfo for unknown scrollbar type %d\n", Bar);
730  return FALSE;
731  }
732 
734  {
735  ERR("Failed to create scrollbars for window.\n");
736  return FALSE;
737  }
738 
741 
742  psi->nTrackPos = psbi->nTrackPos;
743  sbi->reserved = psbi->reserved;
744  RtlCopyMemory(&sbi->rgstate, &psbi->rgstate, sizeof(psbi->rgstate));
745 
746  return TRUE;
747 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
#define SBOBJ_TO_SBID(Obj)
Definition: scroll.h:39
int32_t INT
Definition: typedefs.h:56
#define IntGetScrollbarInfoFromWindow(Window, i)
Definition: scroll.h:33
Definition: window.c:29
BOOL FASTCALL co_IntCreateScrollBars(PWND Window)
Definition: scrollbar.c:750
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3728
#define ERR(fmt,...)
Definition: debug.h:109
#define IntGetScrollInfoFromWindow(Window, i)
Definition: scroll.h:36
#define SBID_IS_VALID(id)
Definition: scroll.h:40
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ co_UserShowScrollBar()

DWORD FASTCALL co_UserShowScrollBar ( PWND  ,
int  ,
BOOL  ,
BOOL   
)

Definition at line 859 of file scrollbar.c.

860 {
861  ULONG old_style, set_bits = 0, clear_bits = 0;
862 
863  ASSERT_REFS_CO(Wnd);
864 
865  switch(nBar)
866  {
867  case SB_CTL:
868  {
869  //IntUpdateSBInfo(Wnd, SB_CTL); // Is this needed? Was tested w/o!
870 
871  co_WinPosShowWindow(Wnd, fShowH ? SW_SHOW : SW_HIDE);
872  return TRUE;
873  }
874  case SB_BOTH:
875  case SB_HORZ:
876  if (fShowH) set_bits |= WS_HSCROLL;
877  else clear_bits |= WS_HSCROLL;
878  if( nBar == SB_HORZ ) break;
879  /* Fall through */
880  case SB_VERT:
881  if (fShowV) set_bits |= WS_VSCROLL;
882  else clear_bits |= WS_VSCROLL;
883  break;
884  default:
886  return FALSE; /* Nothing to do! */
887  }
888 
889  old_style = IntSetStyle( Wnd, set_bits, clear_bits );
890  if ((old_style & clear_bits) != 0 || (old_style & set_bits) != set_bits)
891  {
893  //if (Wnd->style & WS_HSCROLL) IntUpdateSBInfo(Wnd, SB_HORZ);
894  //if (Wnd->style & WS_VSCROLL) IntUpdateSBInfo(Wnd, SB_VERT);
896  /* Frame has been changed, let the window redraw itself */
897  co_WinPosSetWindowPos( Wnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE
899  return TRUE;
900  }
901  return FALSE; /* no frame changes */
902 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
#define SB_CTL
Definition: winuser.h:554
#define SB_VERT
Definition: winuser.h:553
#define SW_HIDE
Definition: winuser.h:762
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
#define SB_HORZ
Definition: winuser.h:552
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1720
#define SWP_NOZORDER
Definition: winuser.h:1232
#define SW_SHOW
Definition: winuser.h:769
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2464
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define WS_HSCROLL
Definition: pedump.c:628
#define SWP_FRAMECHANGED
Definition: winuser.h:1225
#define SB_BOTH
Definition: winuser.h:555
#define SWP_NOSIZE
Definition: winuser.h:1230
#define WS_VSCROLL
Definition: pedump.c:627
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:124
unsigned int ULONG
Definition: retypes.h:1
#define SWP_NOMOVE
Definition: winuser.h:1229
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

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

◆ IntDestroyScrollBars()

BOOL FASTCALL IntDestroyScrollBars ( PWND  )

Definition at line 806 of file scrollbar.c.

807 {
808  if (Window->pSBInfo && Window->pSBInfoex)
809  {
810  DesktopHeapFree(Window->head.rpdesk, Window->pSBInfo);
811  Window->pSBInfo = NULL;
813  Window->pSBInfoex = NULL;
814  return TRUE;
815  }
816  return FALSE;
817 }
#define TRUE
Definition: types.h:120
#define TAG_SBARINFO
Definition: tags.h:9
Definition: window.c:29
smooth NULL
Definition: ftsmooth.c:416
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:239
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by co_UserFreeWindow().

◆ IntDrawScrollBar()

void IntDrawScrollBar ( PWND  ,
HDC  ,
INT   
)

Definition at line 1073 of file scrollbar.c.

1074 {
1075  //PSBWND pSBWnd;
1076  //INT ThumbSize;
1077  PTHREADINFO pti;
1079  BOOL Vertical;
1080 
1082 
1083  /*
1084  * Get scroll bar info.
1085  */
1086  switch (Bar)
1087  {
1088  case SB_HORZ:
1089  Vertical = FALSE;
1090  break;
1091 
1092  case SB_VERT:
1093  Vertical = TRUE;
1094  break;
1095 
1096  case SB_CTL:
1097  Vertical = (Wnd->style & SBS_VERT) != 0;
1098  break;
1099 
1100  default:
1101  return;
1102  }
1103 
1105  {
1106  return;
1107  }
1108 
1109  if (RECTL_bIsEmptyRect(&Info.rcScrollBar))
1110  {
1111  return;
1112  }
1113 
1114  //ThumbSize = pSBWnd->pSBCalc->pxThumbBottom - pSBWnd->pSBCalc->pxThumbTop;
1115 
1116  /*
1117  * Draw the arrows.
1118  */
1119  if (Info.dxyLineButton)
1120  {
1121  IntDrawScrollArrows(DC, &Info, Vertical);
1122  }
1123 
1124  /*
1125  * Draw the interior.
1126  */
1127  IntDrawScrollInterior(Wnd, DC, Bar, Vertical, &Info);
1128 
1129  /*
1130  * If scroll bar has focus, reposition the caret.
1131  */
1132  if ( Wnd == pti->MessageQueue->spwndFocus && Bar == SB_CTL )
1133  {
1134  if (Vertical)
1135  {
1136  co_IntSetCaretPos(Info.rcScrollBar.top + 1, Info.dxyLineButton + 1);
1137  }
1138  else
1139  {
1140  co_IntSetCaretPos(Info.dxyLineButton + 1, Info.rcScrollBar.top + 1);
1141  }
1142  }
1143 }
BOOL FASTCALL co_IntGetScrollBarInfo(PWND Window, LONG idObject, PSCROLLBARINFO psbi)
Definition: scrollbar.c:668
static void IntDrawScrollInterior(PWND pWnd, HDC hDC, INT nBar, BOOL Vertical, PSCROLLBARINFO ScrollBarInfo)
Definition: scrollbar.c:905
#define TRUE
Definition: types.h:120
#define SB_CTL
Definition: winuser.h:554
#define SB_VERT
Definition: winuser.h:553
#define SB_HORZ
Definition: winuser.h:552
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
struct TraceInfo Info
unsigned int BOOL
Definition: ntddk_ex.h:94
static LONG FASTCALL IntScrollGetObjectId(INT SBType)
Definition: scrollbar.c:1063
#define SBS_VERT
Definition: winuser.h:334
Definition: polytest.cpp:40
BOOL FASTCALL co_IntSetCaretPos(int X, int Y)
Definition: caret.c:205
static VOID FASTCALL IntDrawScrollArrows(HDC hDC, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical)
Definition: scrollbar.c:1020
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44

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

◆ IntScrollWindow()

BOOL FASTCALL IntScrollWindow ( PWND  ,
int  ,
int  ,
CONST RECT ,
CONST RECT  
)

Definition at line 454 of file scrollex.c.

459 {
460  return IntScrollWindowEx( pWnd, dx, dy, lpRect, prcClip, 0, NULL,
462 }
#define ERROR(name)
Definition: error_private.h:53
GLint dy
Definition: linetemp.h:97
#define SW_ERASE
Definition: winuser.h:2555
smooth NULL
Definition: ftsmooth.c:416
DWORD FASTCALL IntScrollWindowEx(PWND Window, INT dx, INT dy, const RECT *prcScroll, const RECT *prcClip, HRGN hrgnUpdate, LPRECT prcUpdate, UINT flags)
Definition: scrollex.c:228
#define SW_SCROLLWNDDCE
Definition: undocuser.h:90
#define SW_INVALIDATE
Definition: winuser.h:2554
#define SW_SCROLLCHILDREN
Definition: winuser.h:2553
GLint dx
Definition: linetemp.h:97

Referenced by MENU_EnsureMenuItemVisible().

◆ IntScrollWindowEx()

DWORD FASTCALL IntScrollWindowEx ( PWND  ,
INT  ,
INT  ,
const RECT ,
const RECT ,
HRGN  ,
LPRECT  ,
UINT   
)

Definition at line 228 of file scrollex.c.

237 {
238  INT Result;
239  RECTL rcScroll, rcClip, rcCaret;
240  PWND CaretWnd;
241  HDC hDC;
242  PREGION RgnUpdate = NULL, RgnTemp, RgnWinupd = NULL;
243  HWND hwndCaret;
244  DWORD dcxflags = 0;
245  int rdw_flags;
246  USER_REFERENCE_ENTRY CaretRef;
247 
249  {
250  return ERROR;
251  }
252 
253  IntGetClientRect(Window, &rcClip);
254 
255  if (prcScroll)
256  RECTL_bIntersectRect(&rcScroll, &rcClip, prcScroll);
257  else
258  rcScroll = rcClip;
259 
260  if (prcClip)
261  RECTL_bIntersectRect(&rcClip, &rcClip, prcClip);
262 
263  if (rcClip.right <= rcClip.left || rcClip.bottom <= rcClip.top ||
264  (dx == 0 && dy == 0))
265  {
266  return NULLREGION;
267  }
268 
269  /* We must use a copy of the region, as we can't hold an exclusive lock
270  * on it while doing callouts to user-mode */
271  RgnUpdate = IntSysCreateRectpRgn(0, 0, 0, 0);
272  if(!RgnUpdate)
273  {
275  return ERROR;
276  }
277 
278  if (hrgnUpdate)
279  {
280  RgnTemp = REGION_LockRgn(hrgnUpdate);
281  if (!RgnTemp)
282  {
284  Result = ERROR;
285  goto Cleanup;
286  }
287  IntGdiCombineRgn(RgnUpdate, RgnTemp, NULL, RGN_COPY);
288  REGION_UnlockRgn(RgnTemp);
289  }
290 
291  /* ScrollWindow uses the window DC, ScrollWindowEx doesn't */
292  if (flags & SW_SCROLLWNDDCE)
293  {
294  dcxflags = DCX_USESTYLE;
295 
296  if (!(Window->pcls->style & (CS_OWNDC|CS_CLASSDC)))
297  dcxflags |= DCX_CACHE; // AH??? wine~ If not Powned or with Class go Cheap!
298 
299  if (flags & SW_SCROLLCHILDREN && Window->style & WS_CLIPCHILDREN)
300  dcxflags |= DCX_CACHE|DCX_NOCLIPCHILDREN;
301  }
302  else
303  {
304  /* So in this case ScrollWindowEx uses Cache DC. */
305  dcxflags = DCX_CACHE|DCX_USESTYLE;
306  if (flags & SW_SCROLLCHILDREN) dcxflags |= DCX_NOCLIPCHILDREN;
307  }
308 
309  hDC = UserGetDCEx(Window, 0, dcxflags);
310  if (!hDC)
311  {
312  /* FIXME: SetLastError? */
313  Result = ERROR;
314  goto Cleanup;
315  }
316 
318 
319  rcCaret = rcScroll;
320  hwndCaret = co_IntFixCaret(Window, &rcCaret, flags);
321 
323  dx,
324  dy,
325  &rcScroll,
326  &rcClip,
327  NULL,
328  RgnUpdate,
329  prcUpdate);
330 
332 
333  /*
334  * Take into account the fact that some damage may have occurred during
335  * the scroll. Keep a copy in hrgnWinupd to be added to hrngUpdate at the end.
336  */
337 
338  RgnTemp = IntSysCreateRectpRgn(0, 0, 0, 0);
339  if (!RgnTemp)
340  {
342  Result = ERROR;
343  goto Cleanup;
344  }
345 
346  if (co_IntGetUpdateRgn(Window, RgnTemp, FALSE) != NULLREGION)
347  {
348  PREGION RgnClip = IntSysCreateRectpRgnIndirect(&rcClip);
349  if (RgnClip)
350  {
351  if (hrgnUpdate)
352  {
353  RgnWinupd = IntSysCreateRectpRgn(0, 0, 0, 0);
354  // FIXME: What to do if RgnWinupd == NULL??
355  IntGdiCombineRgn( RgnWinupd, RgnTemp, 0, RGN_COPY);
356  }
357 
358  REGION_bOffsetRgn(RgnTemp, dx, dy);
359 
360  IntGdiCombineRgn(RgnTemp, RgnTemp, RgnClip, RGN_AND);
361 
362  if (hrgnUpdate)
363  IntGdiCombineRgn( RgnWinupd, RgnWinupd, RgnTemp, RGN_OR );
364 
365  co_UserRedrawWindow(Window, NULL, RgnTemp, rdw_flags );
366 
367  REGION_Delete(RgnClip);
368  }
369  }
370  REGION_Delete(RgnTemp);
371 
372  if (flags & SW_SCROLLCHILDREN)
373  {
374  PWND Child;
375  RECTL rcChild;
376  POINT ClientOrigin;
377  USER_REFERENCE_ENTRY WndRef;
378  RECTL rcDummy;
379  LPARAM lParam;
380 
381  IntGetClientOrigin(Window, &ClientOrigin);
382 
383  for (Child = Window->spwndChild; Child; Child = Child->spwndNext)
384  {
385  rcChild = Child->rcWindow;
386  RECTL_vOffsetRect(&rcChild, -ClientOrigin.x, -ClientOrigin.y);
387 
388  if (!prcScroll || RECTL_bIntersectRect(&rcDummy, &rcChild, &rcScroll))
389  {
390  UserRefObjectCo(Child, &WndRef);
391 
392  if (UserIsDesktopWindow(Window->spwndParent))
393  lParam = MAKELONG(Child->rcClient.left, Child->rcClient.top);
394  else
395  lParam = MAKELONG(rcChild.left + dx, rcChild.top + dy);
396 
397  /* wine sends WM_POSCHANGING, WM_POSCHANGED messages */
398  /* windows sometimes a WM_MOVE */
400 
402  }
403  }
404  }
405 
406  if (flags & (SW_INVALIDATE | SW_ERASE))
407  {
409  NULL,
410  RgnUpdate,
411  rdw_flags | /* HACK */
413  }
414 
415  if (hwndCaret && (CaretWnd = UserGetWindowObject(hwndCaret)))
416  {
417  UserRefObjectCo(CaretWnd, &CaretRef);
418 
419  co_IntSetCaretPos(rcCaret.left + dx, rcCaret.top + dy);
420  co_UserShowCaret(CaretWnd);
421 
422  UserDerefObjectCo(CaretWnd);
423  }
424 
425  if (hrgnUpdate && (Result != ERROR))
426  {
427  /* Give everything back to the caller */
428  RgnTemp = REGION_LockRgn(hrgnUpdate);
429  /* The handle should still be valid */
430  ASSERT(RgnTemp);
431  if (RgnWinupd)
432  IntGdiCombineRgn(RgnTemp, RgnUpdate, RgnWinupd, RGN_OR);
433  else
434  IntGdiCombineRgn(RgnTemp, RgnUpdate, NULL, RGN_COPY);
435  REGION_UnlockRgn(RgnTemp);
436  }
437 
438 Cleanup:
439  if (RgnWinupd)
440  {
441  REGION_Delete(RgnWinupd);
442  }
443 
444  if (RgnUpdate)
445  {
446  REGION_Delete(RgnUpdate);
447  }
448 
449  return Result;
450 }
#define RDW_NOCHILDREN
Definition: winuser.h:1208
long y
Definition: polytest.cpp:48
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
long x
Definition: polytest.cpp:48
#define ERROR(name)
Definition: error_private.h:53
GLint dy
Definition: linetemp.h:97
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
static HDC
Definition: imagelist.c:92
#define NULLREGION
Definition: wingdi.h:360
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
long bottom
Definition: polytest.cpp:53
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define WM_MOVE
Definition: winuser.h:1592
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2727
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
#define CS_OWNDC
Definition: winuser.h:650
INT FASTCALL co_IntGetUpdateRgn(PWND Window, PREGION Rgn, BOOL bErase)
Definition: scrollex.c:63
#define WS_CLIPCHILDREN
Definition: pedump.c:619
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
int32_t INT
Definition: typedefs.h:56
#define RGN_AND
Definition: wingdi.h:355
long right
Definition: polytest.cpp:53
Definition: window.c:29
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2426
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
BOOL FASTCALL IntIsWindowDrawable(PWND Wnd)
Definition: painting.c:849
long top
Definition: polytest.cpp:53
#define SW_ERASE
Definition: winuser.h:2555
BOOL FASTCALL IntGetClientOrigin(PWND Window OPTIONAL, LPPOINT Point)
Definition: winpos.c:70
Definition: object.h:3
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define RGN_OR
Definition: wingdi.h:358
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG_PTR LPARAM
Definition: windef.h:208
#define DCX_NOCLIPCHILDREN
Definition: dce.h:40
Definition: region.h:7
#define SW_SCROLLWNDDCE
Definition: undocuser.h:90
long left
Definition: polytest.cpp:53
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2506
#define IntSysCreateRectpRgnIndirect(prc)
Definition: region.h:93
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define RDW_ERASE
Definition: winuser.h:1197
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOL FASTCALL co_IntSetCaretPos(int X, int Y)
Definition: caret.c:205
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL)
Definition: caret.c:269
static const WCHAR Cleanup[]
Definition: register.c:80
#define SW_INVALIDATE
Definition: winuser.h:2554
#define RGN_COPY
Definition: wingdi.h:356
#define CS_CLASSDC
Definition: winuser.h:645
static HWND FASTCALL co_IntFixCaret(PWND Window, RECTL *lprc, UINT flags)
Definition: scrollex.c:15
Definition: ntuser.h:657
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
static HDC hDC
Definition: 3dtext.c:33
#define DCX_CACHE
Definition: winuser.h:2096
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:876
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
static INT FASTCALL UserScrollDC(HDC hDC, INT dx, INT dy, const RECTL *prcScroll, const RECTL *prcClip, HRGN hrgnUpdate, PREGION RgnUpdate, RECTL *prcUpdate)
Definition: scrollex.c:100
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define SW_SCROLLCHILDREN
Definition: winuser.h:2553
GLint dx
Definition: linetemp.h:97
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE Child
Definition: acpixf.h:728
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2468
LPARAM lParam
Definition: combotst.c:139
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define RDW_INVALIDATE
Definition: winuser.h:1200

Referenced by IntScrollWindow(), and NtUserScrollWindowEx().

◆ VOID()

typedef VOID ( NEAR NTAPI PFN_SCROLLBAR)

Variable Documentation

◆ LPARAM

typedef LPARAM

Definition at line 3 of file scroll.h.

◆ PSBCALC

typedef PSBCALC

Definition at line 3 of file scroll.h.

◆ UINT

typedef UINT

Definition at line 3 of file scroll.h.

◆ WPARAM

typedef WPARAM

Definition at line 3 of file scroll.h.