6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
39 LRESULT CALLBACK
ProcessListWndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
);
41 LONG OldProcessListWndProc
;
44 LRESULT CALLBACK
ProcessListWndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
57 // The list control produces a nasty flicker
58 // when the user is resizing the window because
59 // it erases the background to white, then
60 // paints the list items over it.
62 // We will clip the drawing so that it only
63 // erases the parts of the list control that
64 // show only the background.
68 // Get the device context and save it's state
69 // to be restored after we're done
75 // Get the background brush
77 hbrBackground
= (HBRUSH
) GetClassLong(hWnd
, GCL_HBRBACKGROUND
);
80 // Calculate the clip rect by getting the RECT
81 // of the first and last items and adding them up.
83 // We also have to get the item's icon RECT and
84 // subtract it from our clip rect because we don't
85 // use icons in this list control.
87 ListView_GetItemRect(hWnd
, 0, &rcClip
, LVIR_BOUNDS
);
88 ListView_GetItemRect(hWnd
, ListView_GetItemCount(hWnd
) - 1, &rcItem
, LVIR_BOUNDS
);
89 rcClip
.bottom
= rcItem
.bottom
;
90 ListView_GetItemRect(hWnd
, 0, &rcItem
, LVIR_ICON
);
91 rcClip
.left
= rcItem
.right
;
94 // Now exclude the clip rect
96 ExcludeClipRect(hDC
, rcClip
.left
, rcClip
.top
, rcClip
.right
, rcClip
.bottom
);
99 // Now erase the background
102 // FIXME: Should I erase it myself or
103 // pass down the updated HDC and let
104 // the default handler do it?
106 GetClientRect(hWnd
, &rcItem
);
107 FillRect(hDC
, &rcItem
, hbrBackground
);
110 // Now restore the DC state that we
113 RestoreDC(hDC
, DcSave
);
119 // We pass on all messages except WM_ERASEBKGND
121 return CallWindowProc((WNDPROC
)OldProcessListWndProc
, hWnd
, message
, wParam
, lParam
);