Commit b5abd534 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

user32: Call SCROLL_DrawScrollBar() to draw arrows in SCROLL_HandleScrollEvent().

So that SCROLL_DrawScrollBar() can eventually be hooked by a themed scroll bar drawing function and use a single function to draw scroll bars, instead of hooking multiple scroll bar drawing functions that draw different parts. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 5541cf32
...@@ -179,8 +179,21 @@ extern BOOL NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down ) DECLSPEC_HIDDEN; ...@@ -179,8 +179,21 @@ extern BOOL NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down ) DECLSPEC_HIDDEN;
extern void NC_GetSysPopupPos( HWND hwnd, RECT* rect ) DECLSPEC_HIDDEN; extern void NC_GetSysPopupPos( HWND hwnd, RECT* rect ) DECLSPEC_HIDDEN;
/* scrollbar */ /* scrollbar */
/* Scroll-bar hit testing */
enum SCROLL_HITTEST
{
SCROLL_NOWHERE, /* Outside the scroll bar */
SCROLL_TOP_ARROW, /* Top or left arrow */
SCROLL_TOP_RECT, /* Rectangle between the top arrow and the thumb */
SCROLL_THUMB, /* Thumb rectangle */
SCROLL_BOTTOM_RECT, /* Rectangle between the thumb and the bottom arrow */
SCROLL_BOTTOM_ARROW /* Bottom or right arrow */
};
extern void SCROLL_DrawNCScrollBar( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical ) DECLSPEC_HIDDEN; extern void SCROLL_DrawNCScrollBar( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical ) DECLSPEC_HIDDEN;
extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, BOOL arrows, BOOL interior ) DECLSPEC_HIDDEN; extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, enum SCROLL_HITTEST hit_test,
BOOL arrows, BOOL interior ) DECLSPEC_HIDDEN;
extern void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt ) DECLSPEC_HIDDEN; extern void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt ) DECLSPEC_HIDDEN;
/* combo box */ /* combo box */
......
...@@ -74,17 +74,6 @@ typedef struct ...@@ -74,17 +74,6 @@ typedef struct
/* Scroll timer id */ /* Scroll timer id */
#define SCROLL_TIMER 0 #define SCROLL_TIMER 0
/* Scroll-bar hit testing */
enum SCROLL_HITTEST
{
SCROLL_NOWHERE, /* Outside the scroll bar */
SCROLL_TOP_ARROW, /* Top or left arrow */
SCROLL_TOP_RECT, /* Rectangle between the top arrow and the thumb */
SCROLL_THUMB, /* Thumb rectangle */
SCROLL_BOTTOM_RECT, /* Rectangle between the thumb and the bottom arrow */
SCROLL_BOTTOM_ARROW /* Bottom or right arrow */
};
/* What to do after SCROLL_SetScrollInfo() */ /* What to do after SCROLL_SetScrollInfo() */
#define SA_SSI_HIDE 0x0001 #define SA_SSI_HIDE 0x0001
#define SA_SSI_SHOW 0x0002 #define SA_SSI_SHOW 0x0002
...@@ -583,8 +572,8 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, INT nBar, ...@@ -583,8 +572,8 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, INT nBar,
* *
* Redraw the whole scrollbar. * Redraw the whole scrollbar.
*/ */
void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, enum SCROLL_HITTEST hit_test, BOOL arrows,
BOOL arrows, BOOL interior ) BOOL interior )
{ {
INT arrowSize, thumbSize, thumbPos; INT arrowSize, thumbSize, thumbPos;
RECT rect; RECT rect;
...@@ -611,8 +600,8 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, ...@@ -611,8 +600,8 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
{ {
if( vertical == SCROLL_trackVertical && GetCapture() == hwnd ) if( vertical == SCROLL_trackVertical && GetCapture() == hwnd )
SCROLL_DrawArrows( hdc, infoPtr, &rect, arrowSize, vertical, SCROLL_DrawArrows( hdc, infoPtr, &rect, arrowSize, vertical,
(SCROLL_trackHitTest == SCROLL_TOP_ARROW), hit_test == SCROLL_trackHitTest && hit_test == SCROLL_TOP_ARROW,
(SCROLL_trackHitTest == SCROLL_BOTTOM_ARROW) ); hit_test == SCROLL_trackHitTest && hit_test == SCROLL_BOTTOM_ARROW );
else else
SCROLL_DrawArrows( hdc, infoPtr, &rect, arrowSize, vertical, SCROLL_DrawArrows( hdc, infoPtr, &rect, arrowSize, vertical,
FALSE, FALSE ); FALSE, FALSE );
...@@ -649,9 +638,9 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, ...@@ -649,9 +638,9 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
void SCROLL_DrawNCScrollBar( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical ) void SCROLL_DrawNCScrollBar( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical )
{ {
if (draw_horizontal) if (draw_horizontal)
SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, TRUE, TRUE ); SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, SCROLL_trackHitTest, TRUE, TRUE );
if (draw_vertical) if (draw_vertical)
SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, TRUE, TRUE ); SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, SCROLL_trackHitTest, TRUE, TRUE );
} }
/*********************************************************************** /***********************************************************************
...@@ -684,7 +673,7 @@ static void SCROLL_RefreshScrollBar( HWND hwnd, INT nBar, ...@@ -684,7 +673,7 @@ static void SCROLL_RefreshScrollBar( HWND hwnd, INT nBar,
DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) ); DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
if (!hdc) return; if (!hdc) return;
SCROLL_DrawScrollBar( hwnd, hdc, nBar, arrows, interior ); SCROLL_DrawScrollBar( hwnd, hdc, nBar, SCROLL_trackHitTest, arrows, interior );
ReleaseDC( hwnd, hdc ); ReleaseDC( hwnd, hdc );
} }
...@@ -831,8 +820,7 @@ static void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt) ...@@ -831,8 +820,7 @@ static void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt)
break; break;
case SCROLL_TOP_ARROW: case SCROLL_TOP_ARROW:
SCROLL_DrawArrows( hdc, infoPtr, &rect, arrowSize, vertical, SCROLL_DrawScrollBar( hwnd, hdc, nBar, hittest, TRUE, FALSE );
(hittest == SCROLL_trackHitTest), FALSE );
if (hittest == SCROLL_trackHitTest) if (hittest == SCROLL_trackHitTest)
{ {
if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER)) if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
...@@ -929,8 +917,7 @@ static void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt) ...@@ -929,8 +917,7 @@ static void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt)
break; break;
case SCROLL_BOTTOM_ARROW: case SCROLL_BOTTOM_ARROW:
SCROLL_DrawArrows( hdc, infoPtr, &rect, arrowSize, vertical, SCROLL_DrawScrollBar( hwnd, hdc, nBar, hittest, TRUE, FALSE );
FALSE, (hittest == SCROLL_trackHitTest) );
if (hittest == SCROLL_trackHitTest) if (hittest == SCROLL_trackHitTest)
{ {
if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER)) if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
...@@ -1430,7 +1417,7 @@ LRESULT ScrollBarWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM ...@@ -1430,7 +1417,7 @@ LRESULT ScrollBarWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM
FillRect( hdc, &rc, GetSysColorBrush(COLOR_SCROLLBAR) ); FillRect( hdc, &rc, GetSysColorBrush(COLOR_SCROLLBAR) );
} }
else else
SCROLL_DrawScrollBar( hwnd, hdc, SB_CTL, TRUE, TRUE ); SCROLL_DrawScrollBar( hwnd, hdc, SB_CTL, SCROLL_trackHitTest, TRUE, TRUE );
if (!wParam) EndPaint(hwnd, &ps); if (!wParam) EndPaint(hwnd, &ps);
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment