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 Street, 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 #include <precomp.h> 30 31 void TaskManager_OnOptionsAlwaysOnTop(void) 32 { 33 HMENU hMenu; 34 HMENU hOptionsMenu; 35 36 hMenu = GetMenu(hMainWnd); 37 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX); 38 39 /* 40 * Check or uncheck the always on top menu item 41 * and update main window. 42 */ 43 if ((GetWindowLongPtrW(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0) 44 { 45 CheckMenuItem(hOptionsMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_UNCHECKED); 46 TaskManagerSettings.AlwaysOnTop = FALSE; 47 SetWindowPos(hMainWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); 48 } 49 else 50 { 51 CheckMenuItem(hOptionsMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_CHECKED); 52 TaskManagerSettings.AlwaysOnTop = TRUE; 53 SetWindowPos(hMainWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); 54 } 55 } 56 57 void TaskManager_OnOptionsMinimizeOnUse(void) 58 { 59 HMENU hMenu; 60 HMENU hOptionsMenu; 61 62 hMenu = GetMenu(hMainWnd); 63 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX); 64 65 /* 66 * Check or uncheck the minimize on use menu item. 67 */ 68 if (GetMenuState(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND) & MF_CHECKED) 69 { 70 CheckMenuItem(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_UNCHECKED); 71 TaskManagerSettings.MinimizeOnUse = FALSE; 72 } 73 else 74 { 75 CheckMenuItem(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_CHECKED); 76 TaskManagerSettings.MinimizeOnUse = TRUE; 77 } 78 } 79 80 void TaskManager_OnOptionsHideWhenMinimized(void) 81 { 82 HMENU hMenu; 83 HMENU hOptionsMenu; 84 85 hMenu = GetMenu(hMainWnd); 86 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX); 87 88 /* 89 * Check or uncheck the hide when minimized menu item. 90 */ 91 if (GetMenuState(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND) & MF_CHECKED) 92 { 93 CheckMenuItem(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_UNCHECKED); 94 TaskManagerSettings.HideWhenMinimized = FALSE; 95 } 96 else 97 { 98 CheckMenuItem(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_CHECKED); 99 TaskManagerSettings.HideWhenMinimized = TRUE; 100 } 101 } 102 103 void TaskManager_OnOptionsShow16BitTasks(void) 104 { 105 HMENU hMenu; 106 HMENU hOptionsMenu; 107 108 hMenu = GetMenu(hMainWnd); 109 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX); 110 111 /* 112 * FIXME: Currently this is useless because the 113 * current implementation doesn't list the 16-bit 114 * processes. I believe that would require querying 115 * each ntvdm.exe process for it's children. 116 */ 117 118 /* 119 * Check or uncheck the show 16-bit tasks menu item 120 */ 121 if (GetMenuState(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND) & MF_CHECKED) 122 { 123 CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_UNCHECKED); 124 TaskManagerSettings.Show16BitTasks = FALSE; 125 } 126 else 127 { 128 CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_CHECKED); 129 TaskManagerSettings.Show16BitTasks = TRUE; 130 } 131 132 /* 133 * Refresh the list of processes. 134 */ 135 RefreshProcessPage(); 136 } 137