Commit a6faf54b authored by Rafał Harabień's avatar Rafał Harabień Committed by Alexandre Julliard

user32: Fix handling of SS_ETCHEDHORZ/SS_ETCHEDVERT static control styles.

Instead of drawing the frame in WM_PAINT use WS_EX_STATICEDGE style that adds the frame outside of the client rect and change control size after creation to make it look like a line. Signed-off-by: 's avatarRafał Harabień <rafalh92@outlook.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b52e0dc6
...@@ -74,8 +74,8 @@ static const pfPaint staticPaintFunc[SS_TYPEMASK+1] = ...@@ -74,8 +74,8 @@ static const pfPaint staticPaintFunc[SS_TYPEMASK+1] =
STATIC_PaintOwnerDrawfn, /* SS_OWNERDRAW */ STATIC_PaintOwnerDrawfn, /* SS_OWNERDRAW */
STATIC_PaintBitmapfn, /* SS_BITMAP */ STATIC_PaintBitmapfn, /* SS_BITMAP */
STATIC_PaintEnhMetafn, /* SS_ENHMETAFILE */ STATIC_PaintEnhMetafn, /* SS_ENHMETAFILE */
STATIC_PaintEtchedfn, /* SS_ETCHEDHORZ */ NULL, /* SS_ETCHEDHORZ */
STATIC_PaintEtchedfn, /* SS_ETCHEDVERT */ NULL, /* SS_ETCHEDVERT */
STATIC_PaintEtchedfn, /* SS_ETCHEDFRAME */ STATIC_PaintEtchedfn, /* SS_ETCHEDFRAME */
}; };
...@@ -410,10 +410,22 @@ LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ...@@ -410,10 +410,22 @@ LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
{ {
CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam; CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
if (full_style & SS_SUNKEN) if (full_style & SS_SUNKEN || style == SS_ETCHEDHORZ || style == SS_ETCHEDVERT)
SetWindowLongW( hwnd, GWL_EXSTYLE, SetWindowLongW( hwnd, GWL_EXSTYLE,
GetWindowLongW( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE ); GetWindowLongW( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE );
if (style == SS_ETCHEDHORZ || style == SS_ETCHEDVERT)
{
RECT rc;
GetClientRect(hwnd, &rc);
if (style == SS_ETCHEDHORZ)
rc.bottom = rc.top;
else
rc.right = rc.left;
AdjustWindowRectEx(&rc, full_style, FALSE, GetWindowLongW(hwnd, GWL_EXSTYLE));
SetWindowPos(hwnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
}
switch (style) { switch (style) {
case SS_ICON: case SS_ICON:
{ {
...@@ -794,16 +806,5 @@ static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style ) ...@@ -794,16 +806,5 @@ static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style )
/* FIXME: sometimes (not always) sends WM_CTLCOLORSTATIC */ /* FIXME: sometimes (not always) sends WM_CTLCOLORSTATIC */
GetClientRect( hwnd, &rc ); GetClientRect( hwnd, &rc );
switch (style & SS_TYPEMASK) DrawEdge (hdc, &rc, EDGE_ETCHED, BF_RECT);
{
case SS_ETCHEDHORZ:
DrawEdge(hdc,&rc,EDGE_ETCHED,BF_TOP|BF_BOTTOM);
break;
case SS_ETCHEDVERT:
DrawEdge(hdc,&rc,EDGE_ETCHED,BF_LEFT|BF_RIGHT);
break;
case SS_ETCHEDFRAME:
DrawEdge (hdc, &rc, EDGE_ETCHED, BF_RECT);
break;
}
} }
...@@ -90,17 +90,17 @@ static void test_updates(int style, int flags) ...@@ -90,17 +90,17 @@ static void test_updates(int style, int flags)
exstyle = GetWindowLongW(hStatic, GWL_EXSTYLE); exstyle = GetWindowLongW(hStatic, GWL_EXSTYLE);
if (style == SS_ETCHEDHORZ || style == SS_ETCHEDVERT || style == SS_SUNKEN) if (style == SS_ETCHEDHORZ || style == SS_ETCHEDVERT || style == SS_SUNKEN)
todo_wine_if(style == SS_ETCHEDHORZ || style == SS_ETCHEDVERT) ok(exstyle == WS_EX_STATICEDGE, "expected WS_EX_STATICEDGE, got %d\n", exstyle); ok(exstyle == WS_EX_STATICEDGE, "expected WS_EX_STATICEDGE, got %d\n", exstyle);
else else
ok(exstyle == 0, "expected 0, got %d\n", exstyle); ok(exstyle == 0, "expected 0, got %d\n", exstyle);
GetClientRect(hStatic, &rcClient); GetClientRect(hStatic, &rcClient);
if (style == SS_ETCHEDVERT) if (style == SS_ETCHEDVERT)
todo_wine ok(rcClient.right == 0, "expected zero width, got %d\n", rcClient.right); ok(rcClient.right == 0, "expected zero width, got %d\n", rcClient.right);
else else
ok(rcClient.right > 0, "expected non-zero width, got %d\n", rcClient.right); ok(rcClient.right > 0, "expected non-zero width, got %d\n", rcClient.right);
if (style == SS_ETCHEDHORZ) if (style == SS_ETCHEDHORZ)
todo_wine ok(rcClient.bottom == 0, "expected zero height, got %d\n", rcClient.bottom); ok(rcClient.bottom == 0, "expected zero height, got %d\n", rcClient.bottom);
else else
ok(rcClient.bottom > 0, "expected non-zero height, got %d\n", rcClient.bottom); ok(rcClient.bottom > 0, "expected non-zero height, got %d\n", rcClient.bottom);
......
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