1 /*
2 * ReactOS Task Manager
3 *
4 * optnmenu.c
5 *
6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
7 *
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.
12 *
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.
17 *
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
21 */
22
23 /*
24 * options.c
25 *
26 * Menu item handlers for the options menu.
27 */
28
29 #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
30 #include <windows.h>
31 #include <commctrl.h>
32 #include <stdlib.h>
33 #include <memory.h>
34 #include <tchar.h>
35 #include <stdio.h>
36
37 #include "taskmgr.h"
38
39 void TaskManager_OnOptionsAlwaysOnTop(void)
40 {
41 HMENU hMenu;
42 HMENU hOptionsMenu;
43
44 hMenu = GetMenu(hMainWnd);
45 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
46
47 /*
48 * Check or uncheck the always on top menu item
49 * and update main window.
50 */
51 if ((GetWindowLong(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0)
52 {
53 CheckMenuItem(hOptionsMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_UNCHECKED);
54 TaskManagerSettings.AlwaysOnTop = FALSE;
55 SetWindowPos(hMainWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
56 }
57 else
58 {
59 CheckMenuItem(hOptionsMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_CHECKED);
60 TaskManagerSettings.AlwaysOnTop = TRUE;
61 SetWindowPos(hMainWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
62 }
63 }
64
65 void TaskManager_OnOptionsMinimizeOnUse(void)
66 {
67 HMENU hMenu;
68 HMENU hOptionsMenu;
69
70 hMenu = GetMenu(hMainWnd);
71 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
72
73 /*
74 * Check or uncheck the minimize on use menu item.
75 */
76 if (GetMenuState(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND) & MF_CHECKED)
77 {
78 CheckMenuItem(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_UNCHECKED);
79 TaskManagerSettings.MinimizeOnUse = FALSE;
80 }
81 else
82 {
83 CheckMenuItem(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_CHECKED);
84 TaskManagerSettings.MinimizeOnUse = TRUE;
85 }
86 }
87
88 void TaskManager_OnOptionsHideWhenMinimized(void)
89 {
90 HMENU hMenu;
91 HMENU hOptionsMenu;
92
93 hMenu = GetMenu(hMainWnd);
94 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
95
96 /*
97 * Check or uncheck the hide when minimized menu item.
98 */
99 if (GetMenuState(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND) & MF_CHECKED)
100 {
101 CheckMenuItem(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_UNCHECKED);
102 TaskManagerSettings.HideWhenMinimized = FALSE;
103 }
104 else
105 {
106 CheckMenuItem(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_CHECKED);
107 TaskManagerSettings.HideWhenMinimized = TRUE;
108 }
109 }
110
111 void TaskManager_OnOptionsShow16BitTasks(void)
112 {
113 HMENU hMenu;
114 HMENU hOptionsMenu;
115
116 hMenu = GetMenu(hMainWnd);
117 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
118
119 /*
120 * FIXME: Currently this is useless because the
121 * current implementation doesn't list the 16-bit
122 * processes. I believe that would require querying
123 * each ntvdm.exe process for it's children.
124 */
125
126 /*
127 * Check or uncheck the show 16-bit tasks menu item
128 */
129 if (GetMenuState(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND) & MF_CHECKED)
130 {
131 CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_UNCHECKED);
132 TaskManagerSettings.Show16BitTasks = FALSE;
133 }
134 else
135 {
136 CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_CHECKED);
137 TaskManagerSettings.Show16BitTasks = TRUE;
138 }
139
140 /*
141 * Refresh the list of processes.
142 */
143 RefreshProcessPage();
144 }
145
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.