Cast time_t to long for printing.
[wine] / controls / static.c
1 /*
2  * Static control
3  *
4  * Copyright  David W. Metcalfe, 1993
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include <stdarg.h>
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wingdi.h"
26 #include "wine/winuser16.h"
27 #include "wownt32.h"
28 #include "cursoricon.h"
29 #include "controls.h"
30 #include "user.h"
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(static);
34
35 static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style );
36 static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style );
37 static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style );
38 static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style );
39 static void STATIC_PaintBitmapfn( HWND hwnd, HDC hdc, DWORD style );
40 static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style );
41 static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
42 static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
43
44 static COLORREF color_windowframe, color_background, color_window;
45
46 /* offsets for GetWindowLong for static private information */
47 #define HFONT_GWL_OFFSET    0
48 #define HICON_GWL_OFFSET    (sizeof(HFONT))
49 #define STATIC_EXTRA_BYTES  (HICON_GWL_OFFSET + sizeof(HICON))
50
51 typedef void (*pfPaint)( HWND hwnd, HDC hdc, DWORD style );
52
53 static pfPaint staticPaintFunc[SS_TYPEMASK+1] =
54 {
55     STATIC_PaintTextfn,      /* SS_LEFT */
56     STATIC_PaintTextfn,      /* SS_CENTER */
57     STATIC_PaintTextfn,      /* SS_RIGHT */
58     STATIC_PaintIconfn,      /* SS_ICON */
59     STATIC_PaintRectfn,      /* SS_BLACKRECT */
60     STATIC_PaintRectfn,      /* SS_GRAYRECT */
61     STATIC_PaintRectfn,      /* SS_WHITERECT */
62     STATIC_PaintRectfn,      /* SS_BLACKFRAME */
63     STATIC_PaintRectfn,      /* SS_GRAYFRAME */
64     STATIC_PaintRectfn,      /* SS_WHITEFRAME */
65     NULL,                    /* SS_USERITEM */
66     STATIC_PaintTextfn,      /* SS_SIMPLE */
67     STATIC_PaintTextfn,      /* SS_LEFTNOWORDWRAP */
68     STATIC_PaintOwnerDrawfn, /* SS_OWNERDRAW */
69     STATIC_PaintBitmapfn,    /* SS_BITMAP */
70     NULL,                    /* SS_ENHMETAFILE */
71     STATIC_PaintEtchedfn,    /* SS_ETCHEDHORIZ */
72     STATIC_PaintEtchedfn,    /* SS_ETCHEDVERT */
73     STATIC_PaintEtchedfn,    /* SS_ETCHEDFRAME */
74 };
75
76
77 /*********************************************************************
78  * static class descriptor
79  */
80 const struct builtin_class_descr STATIC_builtin_class =
81 {
82     "Static",            /* name */
83     CS_GLOBALCLASS | CS_DBLCLKS | CS_PARENTDC, /* style  */
84     StaticWndProcA,      /* procA */
85     StaticWndProcW,      /* procW */
86     STATIC_EXTRA_BYTES,  /* extra */
87     IDC_ARROW,           /* cursor */
88     0                    /* brush */
89 };
90
91
92 /***********************************************************************
93  *           STATIC_SetIcon
94  *
95  * Set the icon for an SS_ICON control.
96  */
97 static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style )
98 {
99     HICON prevIcon;
100     CURSORICONINFO *info = hicon?(CURSORICONINFO *) GlobalLock16(HICON_16(hicon)):NULL;
101
102     if ((style & SS_TYPEMASK) != SS_ICON) return 0;
103     if (hicon && !info) {
104         ERR("huh? hicon!=0, but info=0???\n");
105         return 0;
106     }
107     prevIcon = (HICON)SetWindowLongA( hwnd, HICON_GWL_OFFSET, (LONG)hicon );
108     if (hicon)
109     {
110         SetWindowPos( hwnd, 0, 0, 0, info->nWidth, info->nHeight,
111                         SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
112         GlobalUnlock16(HICON_16(hicon));
113     }
114     return prevIcon;
115 }
116
117 /***********************************************************************
118  *           STATIC_SetBitmap
119  *
120  * Set the bitmap for an SS_BITMAP control.
121  */
122 static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap, DWORD style )
123 {
124     HBITMAP hOldBitmap;
125
126     if ((style & SS_TYPEMASK) != SS_BITMAP) return 0;
127     if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) {
128         ERR("huh? hBitmap!=0, but not bitmap\n");
129         return 0;
130     }
131     hOldBitmap = (HBITMAP)SetWindowLongA( hwnd, HICON_GWL_OFFSET, (LONG)hBitmap );
132     if (hBitmap)
133     {
134         BITMAP bm;
135         GetObjectW(hBitmap, sizeof(bm), &bm);
136         SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight,
137                       SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
138     }
139     return hOldBitmap;
140 }
141
142 /***********************************************************************
143  *           STATIC_LoadIconA
144  *
145  * Load the icon for an SS_ICON control.
146  */
147 static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name )
148 {
149     HINSTANCE hInstance = (HINSTANCE)GetWindowLongA( hwnd, GWL_HINSTANCE );
150     HICON hicon = LoadIconA( hInstance, name );
151     if (!hicon) hicon = LoadIconA( 0, name );
152     return hicon;
153 }
154
155 /***********************************************************************
156  *           STATIC_LoadIconW
157  *
158  * Load the icon for an SS_ICON control.
159  */
160 static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name )
161 {
162     HINSTANCE hInstance = (HINSTANCE)GetWindowLongA( hwnd, GWL_HINSTANCE );
163     HICON hicon = LoadIconW( hInstance, name );
164     if (!hicon) hicon = LoadIconW( 0, name );
165     return hicon;
166 }
167
168 /***********************************************************************
169  *           STATIC_LoadBitmapA
170  *
171  * Load the bitmap for an SS_BITMAP control.
172  */
173 static HBITMAP STATIC_LoadBitmapA( HWND hwnd, LPCSTR name )
174 {
175     HINSTANCE hInstance = (HINSTANCE)GetWindowLongA( hwnd, GWL_HINSTANCE );
176     HBITMAP hbitmap = LoadBitmapA( hInstance, name );
177     if (!hbitmap)  /* Try OEM icon (FIXME: is this right?) */
178         hbitmap = LoadBitmapA( 0, name );
179     return hbitmap;
180 }
181
182 /***********************************************************************
183  *           STATIC_LoadBitmapW
184  *
185  * Load the bitmap for an SS_BITMAP control.
186  */
187 static HBITMAP STATIC_LoadBitmapW( HWND hwnd, LPCWSTR name )
188 {
189     HINSTANCE hInstance = (HINSTANCE)GetWindowLongA( hwnd, GWL_HINSTANCE );
190     HBITMAP hbitmap = LoadBitmapW( hInstance, name );
191     if (!hbitmap)  /* Try OEM icon (FIXME: is this right?) */
192         hbitmap = LoadBitmapW( 0, name );
193     return hbitmap;
194 }
195
196 /***********************************************************************
197  *           STATIC_TryPaintFcn
198  *
199  * Try to immediately paint the control.
200  */
201 static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style)
202 {
203     LONG style = full_style & SS_TYPEMASK;
204     RECT rc;
205
206     GetClientRect( hwnd, &rc );
207     if (!IsRectEmpty(&rc) && IsWindowVisible(hwnd) && staticPaintFunc[style])
208     {
209         HDC hdc;
210         hdc = GetDC( hwnd );
211         (staticPaintFunc[style])( hwnd, hdc, full_style );
212         ReleaseDC( hwnd, hdc );
213     }
214 }
215
216 /***********************************************************************
217  *           StaticWndProc_common
218  */
219 static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
220                                      LPARAM lParam, BOOL unicode )
221 {
222     LRESULT lResult = 0;
223     LONG full_style = GetWindowLongA( hwnd, GWL_STYLE );
224     LONG style = full_style & SS_TYPEMASK;
225
226     switch (uMsg)
227     {
228     case WM_CREATE:
229         if (style < 0L || style > SS_TYPEMASK)
230         {
231             ERR("Unknown style 0x%02lx\n", style );
232             return -1;
233         }
234         /* initialise colours */
235         color_windowframe  = GetSysColor(COLOR_WINDOWFRAME);
236         color_background   = GetSysColor(COLOR_BACKGROUND);
237         color_window       = GetSysColor(COLOR_WINDOW);
238         break;
239
240     case WM_NCDESTROY:
241         if (style == SS_ICON) {
242 /*
243  * FIXME
244  *           DestroyIcon32( STATIC_SetIcon( wndPtr, 0 ) );
245  *
246  * We don't want to do this yet because DestroyIcon32 is broken. If the icon
247  * had already been loaded by the application the last thing we want to do is
248  * GlobalFree16 the handle.
249  */
250             break;
251         }
252         else return unicode ? DefWindowProcW(hwnd, uMsg, wParam, lParam) :
253                               DefWindowProcA(hwnd, uMsg, wParam, lParam);
254
255     case WM_PAINT:
256         {
257             PAINTSTRUCT ps;
258             HDC hdc = wParam ? (HDC)wParam : BeginPaint(hwnd, &ps);
259             if (staticPaintFunc[style])
260                 (staticPaintFunc[style])( hwnd, hdc, full_style );
261             if (!wParam) EndPaint(hwnd, &ps);
262         }
263         break;
264
265     case WM_ENABLE:
266         InvalidateRect(hwnd, NULL, TRUE);
267         break;
268
269     case WM_SYSCOLORCHANGE:
270         color_windowframe  = GetSysColor(COLOR_WINDOWFRAME);
271         color_background   = GetSysColor(COLOR_BACKGROUND);
272         color_window       = GetSysColor(COLOR_WINDOW);
273         InvalidateRect(hwnd, NULL, TRUE);
274         break;
275
276     case WM_NCCREATE:
277         if ((TWEAK_WineLook > WIN31_LOOK) && (full_style & SS_SUNKEN))
278             SetWindowLongA( hwnd, GWL_EXSTYLE,
279                             GetWindowLongA( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE );
280
281         if(unicode)
282             lParam = (LPARAM)(((LPCREATESTRUCTW)lParam)->lpszName);
283         else
284             lParam = (LPARAM)(((LPCREATESTRUCTA)lParam)->lpszName);
285         /* fall through */
286     case WM_SETTEXT:
287         switch (style) {
288         case SS_ICON:
289         {
290             HICON hIcon;
291             if(unicode)
292                 hIcon = STATIC_LoadIconW(hwnd, (LPCWSTR)lParam);
293             else
294                 hIcon = STATIC_LoadIconA(hwnd, (LPCSTR)lParam);
295             /* FIXME : should we also return the previous hIcon here ??? */
296             STATIC_SetIcon(hwnd, hIcon, style);
297             break;
298         }
299         case SS_BITMAP:
300         {
301             HBITMAP hBitmap;
302             if(unicode)
303                 hBitmap = STATIC_LoadBitmapW(hwnd, (LPCWSTR)lParam);
304             else
305                 hBitmap = STATIC_LoadBitmapA(hwnd, (LPCSTR)lParam);
306             STATIC_SetBitmap(hwnd, hBitmap, style);
307             break;
308         }
309         case SS_LEFT:
310         case SS_CENTER:
311         case SS_RIGHT:
312         case SS_SIMPLE:
313         case SS_LEFTNOWORDWRAP:
314         {
315             if (HIWORD(lParam))
316             {
317                 if(unicode)
318                     lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam );
319                 else
320                     lResult = DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
321             }
322             if (uMsg == WM_SETTEXT)
323                 STATIC_TryPaintFcn( hwnd, full_style );
324             break;
325         }
326         default:
327             if (HIWORD(lParam))
328             {
329                 if(unicode)
330                     lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam );
331                 else
332                     lResult = DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
333             }
334             if(uMsg == WM_SETTEXT)
335                 InvalidateRect(hwnd, NULL, TRUE);
336         }
337         return 1; /* success. FIXME: check text length */
338
339     case WM_SETFONT:
340         if ((style == SS_ICON) || (style == SS_BITMAP)) return 0;
341         SetWindowLongA( hwnd, HFONT_GWL_OFFSET, wParam );
342         if (LOWORD(lParam))
343             InvalidateRect( hwnd, NULL, TRUE );
344         break;
345
346     case WM_GETFONT:
347         return GetWindowLongA( hwnd, HFONT_GWL_OFFSET );
348
349     case WM_NCHITTEST:
350         if (full_style & SS_NOTIFY)
351            return HTCLIENT;
352         else
353            return HTTRANSPARENT;
354
355     case WM_GETDLGCODE:
356         return DLGC_STATIC;
357
358     case WM_LBUTTONDOWN:
359     case WM_NCLBUTTONDOWN:
360         if (full_style & SS_NOTIFY)
361             SendMessageW( GetParent(hwnd), WM_COMMAND,
362                           MAKEWPARAM( GetWindowLongW(hwnd,GWL_ID), STN_CLICKED ), (LPARAM)hwnd);
363         return 0;
364
365     case WM_LBUTTONDBLCLK:
366     case WM_NCLBUTTONDBLCLK:
367         if (full_style & SS_NOTIFY)
368             SendMessageW( GetParent(hwnd), WM_COMMAND,
369                           MAKEWPARAM( GetWindowLongW(hwnd,GWL_ID), STN_DBLCLK ), (LPARAM)hwnd);
370         return 0;
371
372     case STM_GETIMAGE:
373     case STM_GETICON16:
374     case STM_GETICON:
375         return GetWindowLongA( hwnd, HICON_GWL_OFFSET );
376
377     case STM_SETIMAGE:
378         switch(wParam) {
379         case IMAGE_BITMAP:
380             lResult = (LRESULT)STATIC_SetBitmap( hwnd, (HBITMAP)lParam, style );
381             break;
382         case IMAGE_ICON:
383             lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)lParam, style );
384             break;
385         default:
386             FIXME("STM_SETIMAGE: Unhandled type %x\n", wParam);
387             break;
388         }
389         InvalidateRect( hwnd, NULL, TRUE );
390         break;
391
392     case STM_SETICON16:
393     case STM_SETICON:
394         lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)wParam, style );
395         InvalidateRect( hwnd, NULL, TRUE );
396         break;
397
398     default:
399         return unicode ? DefWindowProcW(hwnd, uMsg, wParam, lParam) :
400                          DefWindowProcA(hwnd, uMsg, wParam, lParam);
401     }
402     return lResult;
403 }
404
405 /***********************************************************************
406  *           StaticWndProcA
407  */
408 static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
409 {
410     if (!IsWindow( hWnd )) return 0;
411     return StaticWndProc_common(hWnd, uMsg, wParam, lParam, FALSE);
412 }
413
414 /***********************************************************************
415  *           StaticWndProcW
416  */
417 static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
418 {
419     if (!IsWindow( hWnd )) return 0;
420     return StaticWndProc_common(hWnd, uMsg, wParam, lParam, TRUE);
421 }
422
423 static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style )
424 {
425   DRAWITEMSTRUCT dis;
426   LONG id = GetWindowLongA( hwnd, GWL_ID );
427
428   dis.CtlType    = ODT_STATIC;
429   dis.CtlID      = id;
430   dis.itemID     = 0;
431   dis.itemAction = ODA_DRAWENTIRE;
432   dis.itemState  = 0;
433   dis.hwndItem   = hwnd;
434   dis.hDC        = hdc;
435   dis.itemData   = 0;
436   GetClientRect( hwnd, &dis.rcItem );
437
438   SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd );
439   SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
440 }
441
442 static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
443 {
444     RECT rc;
445     HBRUSH hBrush;
446     HFONT hFont;
447     WORD wFormat;
448     INT len;
449     WCHAR *text;
450
451     GetClientRect( hwnd, &rc);
452
453     switch (style & SS_TYPEMASK)
454     {
455     case SS_LEFT:
456         wFormat = DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_NOCLIP;
457         break;
458
459     case SS_CENTER:
460         wFormat = DT_CENTER | DT_EXPANDTABS | DT_WORDBREAK | DT_NOCLIP;
461         break;
462
463     case SS_RIGHT:
464         wFormat = DT_RIGHT | DT_EXPANDTABS | DT_WORDBREAK | DT_NOCLIP;
465         break;
466
467     case SS_SIMPLE:
468         wFormat = DT_LEFT | DT_SINGLELINE | DT_VCENTER | DT_NOCLIP;
469         break;
470
471     case SS_LEFTNOWORDWRAP:
472         wFormat = DT_LEFT | DT_EXPANDTABS | DT_VCENTER;
473         break;
474
475     default:
476         return;
477     }
478
479     if (style & SS_NOPREFIX)
480         wFormat |= DT_NOPREFIX;
481
482     if ((hFont = (HFONT)GetWindowLongA( hwnd, HFONT_GWL_OFFSET ))) SelectObject( hdc, hFont );
483
484     if ((style & SS_NOPREFIX) || ((style & SS_TYPEMASK) != SS_SIMPLE))
485     {
486         hBrush = (HBRUSH)SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC,
487                                        (WPARAM)hdc, (LPARAM)hwnd );
488         if (!hBrush) /* did the app forget to call defwindowproc ? */
489             hBrush = (HBRUSH)DefWindowProcW(GetParent(hwnd), WM_CTLCOLORSTATIC,
490                                             (WPARAM)hdc, (LPARAM)hwnd);
491         FillRect( hdc, &rc, hBrush );
492     }
493     if (!IsWindowEnabled(hwnd)) SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
494
495     if (!(len = SendMessageW( hwnd, WM_GETTEXTLENGTH, 0, 0 ))) return;
496     if (!(text = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) return;
497     SendMessageW( hwnd, WM_GETTEXT, len + 1, (LPARAM)text );
498     DrawTextW( hdc, text, -1, &rc, wFormat );
499     HeapFree( GetProcessHeap(), 0, text );
500 }
501
502 static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style )
503 {
504     RECT rc;
505     HBRUSH hBrush;
506
507     GetClientRect( hwnd, &rc);
508
509     switch (style & SS_TYPEMASK)
510     {
511     case SS_BLACKRECT:
512         hBrush = CreateSolidBrush(color_windowframe);
513         FillRect( hdc, &rc, hBrush );
514         break;
515     case SS_GRAYRECT:
516         hBrush = CreateSolidBrush(color_background);
517         FillRect( hdc, &rc, hBrush );
518         break;
519     case SS_WHITERECT:
520         hBrush = CreateSolidBrush(color_window);
521         FillRect( hdc, &rc, hBrush );
522         break;
523     case SS_BLACKFRAME:
524         hBrush = CreateSolidBrush(color_windowframe);
525         FrameRect( hdc, &rc, hBrush );
526         break;
527     case SS_GRAYFRAME:
528         hBrush = CreateSolidBrush(color_background);
529         FrameRect( hdc, &rc, hBrush );
530         break;
531     case SS_WHITEFRAME:
532         hBrush = CreateSolidBrush(color_window);
533         FrameRect( hdc, &rc, hBrush );
534         break;
535     default:
536         return;
537     }
538     DeleteObject( hBrush );
539 }
540
541
542 static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style )
543 {
544     RECT rc;
545     HBRUSH hbrush;
546     HICON hIcon;
547
548     GetClientRect( hwnd, &rc );
549     hbrush = (HBRUSH)SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC,
550                                    (WPARAM)hdc, (LPARAM)hwnd );
551     FillRect( hdc, &rc, hbrush );
552     if ((hIcon = (HICON)GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
553         DrawIcon( hdc, rc.left, rc.top, hIcon );
554 }
555
556 static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style )
557 {
558     RECT rc;
559     HBRUSH hbrush;
560     HDC hMemDC;
561     HBITMAP hBitmap, oldbitmap;
562
563     GetClientRect( hwnd, &rc );
564     hbrush = (HBRUSH)SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC,
565                                    (WPARAM)hdc, (LPARAM)hwnd );
566     FillRect( hdc, &rc, hbrush );
567
568     if ((hBitmap = (HBITMAP)GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
569     {
570         BITMAP bm;
571         SIZE sz;
572
573         if(GetObjectType(hBitmap) != OBJ_BITMAP) return;
574         if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
575         GetObjectW(hBitmap, sizeof(bm), &bm);
576         GetBitmapDimensionEx(hBitmap, &sz);
577         oldbitmap = SelectObject(hMemDC, hBitmap);
578         BitBlt(hdc, sz.cx, sz.cy, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
579                SRCCOPY);
580         SelectObject(hMemDC, oldbitmap);
581         DeleteDC(hMemDC);
582     }
583 }
584
585
586 static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style )
587 {
588     RECT rc;
589
590     if (TWEAK_WineLook == WIN31_LOOK)
591         return;
592
593     GetClientRect( hwnd, &rc );
594     switch (style & SS_TYPEMASK)
595     {
596         case SS_ETCHEDHORZ:
597             DrawEdge(hdc,&rc,EDGE_ETCHED,BF_TOP|BF_BOTTOM);
598             break;
599         case SS_ETCHEDVERT:
600             DrawEdge(hdc,&rc,EDGE_ETCHED,BF_LEFT|BF_RIGHT);
601             break;
602         case SS_ETCHEDFRAME:
603             DrawEdge (hdc, &rc, EDGE_ETCHED, BF_RECT);
604             break;
605     }
606 }