Release 1.2-rc6.
[wine/gsoc-2012-control.git] / programs / taskmgr / optnmenu.c
blob726531f2ee50f671c1074f1ca959d0f8a848a276
1 /*
2 * ReactOS Task Manager
4 * optnmenu.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
24 * options.c
26 * Menu item handlers for the options menu.
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>
37 #include "taskmgr.h"
39 void TaskManager_OnOptionsAlwaysOnTop(void)
41 HMENU hMenu;
42 HMENU hOptionsMenu;
44 hMenu = GetMenu(hMainWnd);
45 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
48 * Check or uncheck the always on top menu item
49 * and update main window.
51 if ((GetWindowLong(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0)
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);
57 else
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);
65 void TaskManager_OnOptionsMinimizeOnUse(void)
67 HMENU hMenu;
68 HMENU hOptionsMenu;
70 hMenu = GetMenu(hMainWnd);
71 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
74 * Check or uncheck the minimize on use menu item.
76 if (GetMenuState(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND) & MF_CHECKED)
78 CheckMenuItem(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_UNCHECKED);
79 TaskManagerSettings.MinimizeOnUse = FALSE;
81 else
83 CheckMenuItem(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_CHECKED);
84 TaskManagerSettings.MinimizeOnUse = TRUE;
88 void TaskManager_OnOptionsHideWhenMinimized(void)
90 HMENU hMenu;
91 HMENU hOptionsMenu;
93 hMenu = GetMenu(hMainWnd);
94 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
97 * Check or uncheck the hide when minimized menu item.
99 if (GetMenuState(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND) & MF_CHECKED)
101 CheckMenuItem(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_UNCHECKED);
102 TaskManagerSettings.HideWhenMinimized = FALSE;
104 else
106 CheckMenuItem(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_CHECKED);
107 TaskManagerSettings.HideWhenMinimized = TRUE;
111 void TaskManager_OnOptionsShow16BitTasks(void)
113 HMENU hMenu;
114 HMENU hOptionsMenu;
116 hMenu = GetMenu(hMainWnd);
117 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
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.
127 * Check or uncheck the show 16-bit tasks menu item
129 if (GetMenuState(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND) & MF_CHECKED)
131 CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_UNCHECKED);
132 TaskManagerSettings.Show16BitTasks = FALSE;
134 else
136 CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_CHECKED);
137 TaskManagerSettings.Show16BitTasks = TRUE;
141 * Refresh the list of processes.
143 RefreshProcessPage();