ReactOS 0.4.15-dev-7934-g1dc8d80
column.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Task Manager
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Processes List Columns.
5 * COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@reactos.org>
6 * Copyright 2005 Klemens Friedl <frik85@reactos.at>
7 */
8
9#include "precomp.h"
10
12
13#define DECLARE_COLUMN_PRESET(_name, _size, _state) \
14 { IDS_TAB_##_name, IDC_##_name, _size, _state },
15
17 DECLARE_COLUMN_PRESET(IMAGENAME, 105, TRUE)
19 DECLARE_COLUMN_PRESET(USERNAME, 107, FALSE)
20 DECLARE_COLUMN_PRESET(SESSIONID, 70, FALSE)
21 DECLARE_COLUMN_PRESET(CPUUSAGE, 35, TRUE)
22 DECLARE_COLUMN_PRESET(CPUTIME, 70, TRUE)
23 DECLARE_COLUMN_PRESET(MEMORYUSAGE, 70, TRUE)
24 DECLARE_COLUMN_PRESET(PEAKMEMORYUSAGE, 100, FALSE)
25 DECLARE_COLUMN_PRESET(MEMORYUSAGEDELTA, 70, FALSE)
26 DECLARE_COLUMN_PRESET(PAGEFAULTS, 70, FALSE)
27 DECLARE_COLUMN_PRESET(PAGEFAULTSDELTA, 70, FALSE)
28 DECLARE_COLUMN_PRESET(VIRTUALMEMORYSIZE, 70, FALSE)
29 DECLARE_COLUMN_PRESET(PAGEDPOOL, 70, FALSE)
30 DECLARE_COLUMN_PRESET(NONPAGEDPOOL, 70, FALSE)
31 DECLARE_COLUMN_PRESET(BASEPRIORITY, 60, FALSE)
32 DECLARE_COLUMN_PRESET(HANDLECOUNT, 60, FALSE)
33 DECLARE_COLUMN_PRESET(THREADCOUNT, 60, FALSE)
34 DECLARE_COLUMN_PRESET(USEROBJECTS, 60, FALSE)
35 DECLARE_COLUMN_PRESET(GDIOBJECTS, 60, FALSE)
36 DECLARE_COLUMN_PRESET(IOREADS, 70, FALSE)
37 DECLARE_COLUMN_PRESET(IOWRITES, 70, FALSE)
38 DECLARE_COLUMN_PRESET(IOOTHER, 70, FALSE)
39 DECLARE_COLUMN_PRESET(IOREADBYTES, 70, FALSE)
40 DECLARE_COLUMN_PRESET(IOWRITEBYTES, 70, FALSE)
41 DECLARE_COLUMN_PRESET(IOOTHERBYTES, 70, FALSE)
42 DECLARE_COLUMN_PRESET(COMMANDLINE, 450, FALSE)
43};
44
45static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem);
47
48void AddColumns(void)
49{
51 WCHAR szTemp[256];
52 unsigned int n;
53
54 for (n=0; n<COLUMN_NMAX; n++) {
56 LoadStringW(hInst, ColumnPresets[n].dwIdsName, szTemp, _countof(szTemp));
58 }
59 }
60
63
65}
66
67static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem)
68{
70
72 column.pszText = (LPWSTR)lpszColumnHeading;
73 column.fmt = nFormat;
74
75 if (nWidth != -1)
76 {
77 column.mask |= LVCF_WIDTH;
78 column.cx = nWidth;
79 }
80
81 if (nSubItem != -1)
82 {
83 column.mask |= LVCF_SUBITEM;
84 column.iSubItem = nSubItem;
85 }
86
88}
89
91{
92 HDITEM hditem;
93 int i, n;
94 WCHAR text[260];
95 WCHAR szTemp[256];
97
98 /* Reset column data */
99 for (i=0; i<COLUMN_NMAX; i++) {
103 }
104
105 /* Get header order */
108
109 /* Get visible columns */
110 for (i = 0; i < SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0); i++) {
111 memset(&hditem, 0, sizeof(HDITEM));
112
113 hditem.mask = HDI_TEXT|HDI_WIDTH;
114 hditem.pszText = text;
115 hditem.cchTextMax = 260;
116
118
119 for (n = 0; n < COLUMN_NMAX; n++) {
120 LoadStringW(hInst, ColumnPresets[n].dwIdsName, szTemp, _countof(szTemp));
121 if (_wcsicmp(text, szTemp) == 0)
122 {
125 }
126 }
127 }
128}
129
131{
132 int i;
133
135 {
137 {
139 }
140
141 for (i=0; i<COLUMN_NMAX; i++) {
144 }
145
146 AddColumns();
147 }
148}
149
152{
153 unsigned int i;
154
155 switch (message)
156 {
157 case WM_INITDIALOG:
158 for (i=0; i<COLUMN_NMAX; i++) {
160 CheckDlgButton(hDlg, ColumnPresets[i].dwIdcCtrl, BST_CHECKED);
161 }
162 return TRUE;
163
164 case WM_COMMAND:
165 if (LOWORD(wParam) == IDCANCEL)
166 {
167 EndDialog(hDlg, LOWORD(wParam));
168 return TRUE;
169 }
170
171 if (LOWORD(wParam) == IDOK)
172 {
173 for (i=0; i<COLUMN_NMAX; i++)
175
176 EndDialog(hDlg, LOWORD(wParam));
177 return TRUE;
178 }
179
180 break;
181 }
182
183 return 0;
184}
185
187{
188 HDITEM hditem;
189 WCHAR text[260];
190 ULONG Index;
191 ULONG uItems;
192 WCHAR szTemp[256];
193 UINT i;
194
196
197 for (Index=0; Index<uItems; Index++)
198 {
199 memset(&hditem, 0, sizeof(HDITEM));
200
201 hditem.mask = HDI_TEXT;
202 hditem.pszText = text;
203 hditem.cchTextMax = 260;
204
206
207 for (i=0; i<COLUMN_NMAX; i++) {
208 LoadStringW(hInst, ColumnPresets[i].dwIdsName, szTemp, _countof(szTemp));
209 if (_wcsicmp(text, szTemp) == 0)
211 }
212 }
213}
#define IDD_COLUMNS_DIALOG
Definition: resource.h:31
const PresetColumnEntry ColumnPresets[COLUMN_NMAX]
Definition: column.c:16
void SaveColumnSettings(void)
Definition: column.c:90
INT_PTR CALLBACK ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: column.c:151
static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem)
Definition: column.c:67
#define DECLARE_COLUMN_PRESET(_name, _size, _state)
Definition: column.c:13
void AddColumns(void)
Definition: column.c:48
void ProcessPage_OnViewSelectColumns(void)
Definition: column.c:130
UINT ColumnDataHints[COLUMN_NMAX]
Definition: column.c:11
void UpdateColumnDataHints(void)
Definition: column.c:186
#define COLUMN_NMAX
Definition: column.h:37
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CALLBACK
Definition: compat.h:35
const WCHAR * text
Definition: package.c:1799
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
GLdouble n
Definition: glext.h:7729
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HWND hMainWnd
Definition: magnifier.c:32
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
HWND hProcessPageHeaderCtrl
Definition: procpage.c:29
HWND hProcessPageListCtrl
Definition: procpage.c:28
#define HDM_SETORDERARRAY
Definition: commctrl.h:809
#define HDI_TEXT
Definition: commctrl.h:704
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define HDM_GETITEMCOUNT
Definition: commctrl.h:733
#define ListView_DeleteColumn(hwnd, iCol)
Definition: commctrl.h:2639
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define HDI_WIDTH
Definition: commctrl.h:702
#define HDM_GETORDERARRAY
Definition: commctrl.h:806
#define Header_GetItemCount(hwndHD)
Definition: commctrl.h:734
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define LVCF_TEXT
Definition: commctrl.h:2588
#define HDITEM
Definition: commctrl.h:697
#define LVCOLUMN
Definition: commctrl.h:2581
#define HDM_GETITEM
Definition: commctrl.h:749
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define memset(x, y, z)
Definition: compat.h:39
#define _countof(array)
Definition: sndvol32.h:68
int ColumnSizeArray[COLUMN_NMAX]
Definition: taskmgr.h:49
int ColumnOrderArray[COLUMN_NMAX]
Definition: taskmgr.h:48
BOOL Columns[COLUMN_NMAX]
Definition: taskmgr.h:47
Definition: tftpd.h:60
TASKMANAGER_SETTINGS TaskManagerSettings
Definition: taskmgr.c:37
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:831
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4399
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
#define IDOK
Definition: winuser.h:830
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185