quartz: Fix run/pause/stop in filtergraph.
[wine/multimedia.git] / programs / taskmgr / proclist.c
blob07151c04de9f7eed57d37713abd14fff9ac783dd
1 /*
2 * ReactOS Task Manager
4 * proclist.c
6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library 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 GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
24 #include <windows.h>
25 #include <commctrl.h>
26 #include <stdlib.h>
27 #include <memory.h>
28 #include <tchar.h>
29 #include <stdio.h>
30 #include <winnt.h>
32 #include "taskmgr.h"
33 #include "perfdata.h"
36 WNDPROC OldProcessListWndProc;
39 LRESULT CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
41 HBRUSH hbrBackground;
42 RECT rcItem;
43 RECT rcClip;
44 HDC hDC;
45 int DcSave;
47 switch (message)
49 case WM_ERASEBKGND:
52 * The list control produces a nasty flicker
53 * when the user is resizing the window because
54 * it erases the background to white, then
55 * paints the list items over it.
57 * We will clip the drawing so that it only
58 * erases the parts of the list control that
59 * show only the background.
63 * Get the device context and save it's state
64 * to be restored after we're done
66 hDC = (HDC) wParam;
67 DcSave = SaveDC(hDC);
70 * Get the background brush
72 hbrBackground = (HBRUSH) GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND);
75 * Calculate the clip rect by getting the RECT
76 * of the first and last items and adding them up.
78 * We also have to get the item's icon RECT and
79 * subtract it from our clip rect because we don't
80 * use icons in this list control.
82 rcClip.left = LVIR_BOUNDS;
83 SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM) &rcClip);
84 rcItem.left = LVIR_BOUNDS;
85 SendMessage(hWnd, LVM_GETITEMRECT, ListView_GetItemCount(hWnd) - 1, (LPARAM) &rcItem);
87 rcClip.bottom = rcItem.bottom;
88 rcItem.left = LVIR_ICON;
89 SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM) &rcItem);
90 rcClip.left = rcItem.right;
93 * Now exclude the clip rect
95 ExcludeClipRect(hDC, rcClip.left, rcClip.top, rcClip.right, rcClip.bottom);
98 * Now erase the background
101 * FIXME: Should I erase it myself or
102 * pass down the updated HDC and let
103 * the default handler do it?
105 GetClientRect(hWnd, &rcItem);
106 FillRect(hDC, &rcItem, hbrBackground);
109 * Now restore the DC state that we
110 * saved earlier
112 RestoreDC(hDC, DcSave);
114 return TRUE;
118 * We pass on all messages except WM_ERASEBKGND
120 return CallWindowProc(OldProcessListWndProc, hWnd, message, wParam, lParam);