Skip to content

Commit 118869f

Browse files
Splitwirezlearn-more
authored andcommitted
[UXTHEME] Implement the rest of DrawNCPreview
1 parent 8ea93d2 commit 118869f

File tree

4 files changed

+246
-56
lines changed

4 files changed

+246
-56
lines changed

dll/cpl/desk/theme.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,8 @@ DrawThemePreview(IN HDC hdcMem, IN PCOLOR_SCHEME scheme, IN PTHEME_SELECTION pSe
997997
FillRect(hdcMem, prcWindow, hbrBack);
998998
DeleteObject(hbrBack);
999999

1000-
InflateRect(prcWindow, -10, -10);
1000+
InflateRect(prcWindow, -8, -8);
1001+
prcWindow->bottom -= 12;
10011002

10021003
hres = DrawNCPreview(hdcMem,
10031004
DNCP_DRAW_ALL,

dll/win32/uxtheme/ncscrollbar.c

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static BOOL SCROLL_IsVertical(HWND hwnd, INT nBar)
3535
}
3636
}
3737

38-
static LONG SCROLL_getObjectId(INT nBar)
38+
LONG SCROLL_getObjectId(INT nBar)
3939
{
4040
switch(nBar)
4141
{
@@ -273,53 +273,62 @@ static void SCROLL_DrawMovingThumb(PWND_DATA pwndData, PDRAW_CONTEXT pcontext, S
273273

274274

275275
void
276-
ThemeDrawScrollBar(PDRAW_CONTEXT pcontext, INT nBar, POINT* pt)
276+
ThemeDrawScrollBarEx(PDRAW_CONTEXT pcontext, INT nBar, PSCROLLBARINFO psbi, POINT* pt)
277277
{
278278
SCROLLINFO si;
279-
SCROLLBARINFO sbi;
280279
BOOL vertical;
281280
enum SCROLL_HITTEST htHot = SCROLL_NOWHERE;
282281
PWND_DATA pwndData;
283282

284-
if (((nBar == SB_VERT) && !(pcontext->wi.dwStyle & WS_VSCROLL)) ||
285-
((nBar == SB_HORZ) && !(pcontext->wi.dwStyle & WS_HSCROLL))) return;
286-
287283
if (!(pwndData = ThemeGetWndData(pcontext->hWnd)))
288284
return;
289285

290286
if (pwndData->SCROLL_TrackingWin)
291287
return;
292288

293289
/* Retrieve scrollbar info */
294-
sbi.cbSize = sizeof(sbi);
295290
si.cbSize = sizeof(si);
296291
si.fMask = SIF_ALL ;
297292
GetScrollInfo(pcontext->hWnd, nBar, &si);
298-
GetScrollBarInfo(pcontext->hWnd, SCROLL_getObjectId(nBar), &sbi);
299293
vertical = SCROLL_IsVertical(pcontext->hWnd, nBar);
300-
if(sbi.rgstate[SCROLL_TOP_ARROW] & STATE_SYSTEM_UNAVAILABLE &&
301-
sbi.rgstate[SCROLL_BOTTOM_ARROW] & STATE_SYSTEM_UNAVAILABLE )
294+
if(psbi->rgstate[SCROLL_TOP_ARROW] & STATE_SYSTEM_UNAVAILABLE &&
295+
psbi->rgstate[SCROLL_BOTTOM_ARROW] & STATE_SYSTEM_UNAVAILABLE )
302296
{
303-
sbi.xyThumbTop = 0;
297+
psbi->xyThumbTop = 0;
304298
}
305299

306300
/* The scrollbar rect is in screen coordinates */
307-
OffsetRect(&sbi.rcScrollBar, -pcontext->wi.rcWindow.left, -pcontext->wi.rcWindow.top);
301+
OffsetRect(&psbi->rcScrollBar, -pcontext->wi.rcWindow.left, -pcontext->wi.rcWindow.top);
308302

309303
if(pt)
310304
{
311305
ScreenToWindow(pcontext->hWnd, pt);
312-
htHot = SCROLL_HitTest(pcontext->hWnd, &sbi, vertical, *pt, FALSE);
306+
htHot = SCROLL_HitTest(pcontext->hWnd, psbi, vertical, *pt, FALSE);
313307
}
314308

315309
/* do not draw if the scrollbar rectangle is empty */
316-
if(IsRectEmpty(&sbi.rcScrollBar)) return;
310+
if(IsRectEmpty(&psbi->rcScrollBar)) return;
317311

318312
/* Draw the scrollbar */
319-
SCROLL_DrawArrows( pcontext, &sbi, vertical, 0, htHot );
320-
SCROLL_DrawInterior( pcontext, &sbi, sbi.xyThumbTop, vertical, 0, htHot );
313+
SCROLL_DrawArrows( pcontext, psbi, vertical, 0, htHot );
314+
SCROLL_DrawInterior( pcontext, psbi, psbi->xyThumbTop, vertical, 0, htHot );
321315
}
322316

317+
void
318+
ThemeDrawScrollBar(PDRAW_CONTEXT pcontext, INT nBar, POINT* pt)
319+
{
320+
SCROLLBARINFO sbi;
321+
322+
if (((nBar == SB_VERT) && !(pcontext->wi.dwStyle & WS_VSCROLL)) ||
323+
((nBar == SB_HORZ) && !(pcontext->wi.dwStyle & WS_HSCROLL)))
324+
{
325+
return;
326+
}
327+
328+
sbi.cbSize = sizeof(sbi);
329+
GetScrollBarInfo(pcontext->hWnd, SCROLL_getObjectId(nBar), &sbi);
330+
ThemeDrawScrollBarEx(pcontext, nBar, &sbi, pt);
331+
}
323332

324333

325334
/***********************************************************************

0 commit comments

Comments
 (0)