Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenproclist.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS Task Manager 00003 * 00004 * proclist.c 00005 * 00006 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #include <precomp.h> 00024 00025 00026 INT_PTR CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 00027 00028 WNDPROC OldProcessListWndProc; 00029 00030 00031 INT_PTR CALLBACK 00032 ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 00033 { 00034 HBRUSH hbrBackground; 00035 RECT rcItem; 00036 RECT rcClip; 00037 HDC hDC; 00038 int DcSave; 00039 00040 switch (message) 00041 { 00042 case WM_ERASEBKGND: 00043 00044 /* 00045 * The list control produces a nasty flicker 00046 * when the user is resizing the window because 00047 * it erases the background to white, then 00048 * paints the list items over it. 00049 * 00050 * We will clip the drawing so that it only 00051 * erases the parts of the list control that 00052 * show only the background. 00053 */ 00054 00055 /* 00056 * Get the device context and save it's state 00057 * to be restored after we're done 00058 */ 00059 hDC = (HDC) wParam; 00060 DcSave = SaveDC(hDC); 00061 00062 /* 00063 * Get the background brush 00064 */ 00065 hbrBackground = (HBRUSH)(LONG_PTR) GetClassLongPtrW(hWnd, GCL_HBRBACKGROUND); 00066 00067 /* 00068 * Calculate the clip rect by getting the RECT 00069 * of the first and last items and adding them up. 00070 * 00071 * We also have to get the item's icon RECT and 00072 * subtract it from our clip rect because we don't 00073 * use icons in this list control. 00074 */ 00075 rcClip.left = LVIR_BOUNDS; 00076 SendMessageW(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcClip); 00077 rcItem.left = LVIR_BOUNDS; 00078 SendMessageW(hWnd, LVM_GETITEMRECT, ListView_GetItemCount(hWnd) - 1, (LPARAM)&rcItem); 00079 rcClip.bottom = rcItem.bottom; 00080 rcClip.right = rcItem.right; 00081 rcItem.left = LVIR_ICON; 00082 SendMessageW(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcItem); 00083 rcClip.left = rcItem.right; 00084 00085 /* 00086 * Now exclude the clip rect 00087 */ 00088 ExcludeClipRect(hDC, rcClip.left, rcClip.top, rcClip.right, rcClip.bottom); 00089 00090 /* 00091 * Now erase the background 00092 * 00093 * 00094 * FIXME: Should I erase it myself or 00095 * pass down the updated HDC and let 00096 * the default handler do it? 00097 */ 00098 GetClientRect(hWnd, &rcItem); 00099 FillRect(hDC, &rcItem, hbrBackground); 00100 00101 /* 00102 * Now restore the DC state that we 00103 * saved earlier 00104 */ 00105 RestoreDC(hDC, DcSave); 00106 00107 return TRUE; 00108 } 00109 00110 /* 00111 * We pass on all messages except WM_ERASEBKGND 00112 */ 00113 return CallWindowProcW(OldProcessListWndProc, hWnd, message, wParam, lParam); 00114 } Generated on Mon May 28 2012 04:17:32 for ReactOS by
1.7.6.1
|