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.
26 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
38 #include "ProcessPage.h"
43 LRESULT CALLBACK
ProcessListWndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
);
45 LONG OldProcessListWndProc
;
48 LRESULT CALLBACK
ProcessListWndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
61 // The list control produces a nasty flicker
62 // when the user is resizing the window because
63 // it erases the background to white, then
64 // paints the list items over it.
66 // We will clip the drawing so that it only
67 // erases the parts of the list control that
68 // show only the background.
72 // Get the device context and save it's state
73 // to be restored after we're done
79 // Get the background brush
81 hbrBackground
= (HBRUSH
) GetClassLong(hWnd
, GCL_HBRBACKGROUND
);
84 // Calculate the clip rect by getting the RECT
85 // of the first and last items and adding them up.
87 // We also have to get the item's icon RECT and
88 // subtract it from our clip rect because we don't
89 // use icons in this list control.
91 ListView_GetItemRect(hWnd
, 0, &rcClip
, LVIR_BOUNDS
);
92 ListView_GetItemRect(hWnd
, ListView_GetItemCount(hWnd
) - 1, &rcItem
, LVIR_BOUNDS
);
93 rcClip
.bottom
= rcItem
.bottom
;
94 ListView_GetItemRect(hWnd
, 0, &rcItem
, LVIR_ICON
);
95 rcClip
.left
= rcItem
.right
;
98 // Now exclude the clip rect
100 ExcludeClipRect(hDC
, rcClip
.left
, rcClip
.top
, rcClip
.right
, rcClip
.bottom
);
103 // Now erase the background
106 // FIXME: Should I erase it myself or
107 // pass down the updated HDC and let
108 // the default handler do it?
110 GetClientRect(hWnd
, &rcItem
);
111 FillRect(hDC
, &rcItem
, hbrBackground
);
114 // Now restore the DC state that we
117 RestoreDC(hDC
, DcSave
);
123 // We pass on all messages except WM_ERASEBKGND
125 return CallWindowProc((WNDPROC
)OldProcessListWndProc
, hWnd
, message
, wParam
, lParam
);