Commit 8c8701be authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

user32: Allow scrollbar control to store scroll info in subclassed window.

parent a090314c
......@@ -50,6 +50,14 @@ typedef struct
SCROLLBAR_INFO vert;
} WINSCROLLBAR_INFO, *LPWINSCROLLBAR_INFO;
typedef struct
{
DWORD magic;
SCROLLBAR_INFO info;
} SCROLLBAR_WNDDATA;
#define SCROLLBAR_MAGIC 0x5c6011ba
/* Minimum size of the rectangle between the arrows */
#define SCROLL_MIN_RECT 4
......@@ -118,7 +126,7 @@ const struct builtin_class_descr SCROLL_builtin_class =
scrollbarW, /* name */
CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */
WINPROC_SCROLLBAR, /* proc */
sizeof(SCROLLBAR_INFO), /* extra */
sizeof(SCROLLBAR_WNDDATA), /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
};
......@@ -159,8 +167,13 @@ static SCROLLBAR_INFO *SCROLL_GetInternalInfo( HWND hwnd, INT nBar, BOOL alloc )
if (wndPtr->pScroll) infoPtr = &((LPWINSCROLLBAR_INFO)wndPtr->pScroll)->vert;
break;
case SB_CTL:
if (get_class_winproc( wndPtr->class ) == BUILTIN_WINPROC( WINPROC_SCROLLBAR ))
infoPtr = (SCROLLBAR_INFO *)wndPtr->wExtra;
if (wndPtr->cbWndExtra >= sizeof(SCROLLBAR_WNDDATA))
{
SCROLLBAR_WNDDATA *data = (SCROLLBAR_WNDDATA*)wndPtr->wExtra;
if (data->magic == SCROLLBAR_MAGIC)
infoPtr = &data->info;
}
if (!infoPtr) WARN("window is not a scrollbar control\n");
break;
case SB_BOTH:
WARN("with SB_BOTH\n");
......@@ -1131,18 +1144,28 @@ void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt )
*/
static void SCROLL_CreateScrollBar(HWND hwnd, LPCREATESTRUCTW lpCreate)
{
LPSCROLLBAR_INFO info = SCROLL_GetInternalInfo(hwnd, SB_CTL, TRUE);
if (!info) return;
LPSCROLLBAR_INFO info = NULL;
WND *win;
TRACE("hwnd=%p lpCreate=%p\n", hwnd, lpCreate);
win = WIN_GetPtr(hwnd);
if (win->cbWndExtra >= sizeof(SCROLLBAR_WNDDATA))
{
SCROLLBAR_WNDDATA *data = (SCROLLBAR_WNDDATA*)win->wExtra;
data->magic = SCROLLBAR_MAGIC;
info = &data->info;
}
else WARN("Not enough extra data\n");
WIN_ReleasePtr(win);
if (!info) return;
if (lpCreate->style & WS_DISABLED)
{
info->flags = ESB_DISABLE_BOTH;
TRACE("Created WS_DISABLED scrollbar\n");
}
if (lpCreate->style & (SBS_SIZEGRIP | SBS_SIZEBOX))
{
if (lpCreate->style & SBS_SIZEBOXTOPLEFTALIGN)
......
......@@ -640,7 +640,6 @@ static void test_subclass(void)
memset(&scroll_info, 0xcc, sizeof(scroll_info));
scroll_info.cbSize = sizeof(scroll_info);
res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
todo_wine
ok(res == 1, "SBM_GETSCROLLBARINFO returned %lu\n", res);
DestroyWindow(hwnd);
......
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