ReactOS
0.4.16-dev-240-gdb5fa3b
optnmenu.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: Menu item handlers for the options menu.
5
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@reactos.org>
6
*/
7
8
#include "
precomp.h
"
9
10
void
TaskManager_OnOptionsAlwaysOnTop
(
void
)
11
{
12
HMENU
hMenu;
13
HMENU
hOptionsMenu;
14
15
hMenu =
GetMenu
(
hMainWnd
);
16
hOptionsMenu =
GetSubMenu
(hMenu,
OPTIONS_MENU_INDEX
);
17
18
/*
19
* Check or uncheck the always on top menu item
20
* and update main window.
21
*/
22
if
((
GetWindowLongPtrW
(
hMainWnd
,
GWL_EXSTYLE
) &
WS_EX_TOPMOST
) != 0)
23
{
24
CheckMenuItem
(hOptionsMenu,
ID_OPTIONS_ALWAYSONTOP
,
MF_BYCOMMAND
|
MF_UNCHECKED
);
25
TaskManagerSettings
.
AlwaysOnTop
=
FALSE
;
26
SetWindowPos
(
hMainWnd
,
HWND_NOTOPMOST
, 0, 0, 0, 0,
SWP_NOMOVE
|
SWP_NOSIZE
);
27
}
28
else
29
{
30
CheckMenuItem
(hOptionsMenu,
ID_OPTIONS_ALWAYSONTOP
,
MF_BYCOMMAND
|
MF_CHECKED
);
31
TaskManagerSettings
.
AlwaysOnTop
=
TRUE
;
32
SetWindowPos
(
hMainWnd
,
HWND_TOPMOST
, 0, 0, 0, 0,
SWP_NOMOVE
|
SWP_NOSIZE
);
33
}
34
}
35
36
void
TaskManager_OnOptionsMinimizeOnUse
(
void
)
37
{
38
HMENU
hMenu;
39
HMENU
hOptionsMenu;
40
41
hMenu =
GetMenu
(
hMainWnd
);
42
hOptionsMenu =
GetSubMenu
(hMenu,
OPTIONS_MENU_INDEX
);
43
44
/*
45
* Check or uncheck the minimize on use menu item.
46
*/
47
if
(
GetMenuState
(hOptionsMenu,
ID_OPTIONS_MINIMIZEONUSE
,
MF_BYCOMMAND
) &
MF_CHECKED
)
48
{
49
CheckMenuItem
(hOptionsMenu,
ID_OPTIONS_MINIMIZEONUSE
,
MF_BYCOMMAND
|
MF_UNCHECKED
);
50
TaskManagerSettings
.
MinimizeOnUse
=
FALSE
;
51
}
52
else
53
{
54
CheckMenuItem
(hOptionsMenu,
ID_OPTIONS_MINIMIZEONUSE
,
MF_BYCOMMAND
|
MF_CHECKED
);
55
TaskManagerSettings
.
MinimizeOnUse
=
TRUE
;
56
}
57
}
58
59
void
TaskManager_OnOptionsHideWhenMinimized
(
void
)
60
{
61
HMENU
hMenu;
62
HMENU
hOptionsMenu;
63
64
hMenu =
GetMenu
(
hMainWnd
);
65
hOptionsMenu =
GetSubMenu
(hMenu,
OPTIONS_MENU_INDEX
);
66
67
/*
68
* Check or uncheck the hide when minimized menu item.
69
*/
70
if
(
GetMenuState
(hOptionsMenu,
ID_OPTIONS_HIDEWHENMINIMIZED
,
MF_BYCOMMAND
) &
MF_CHECKED
)
71
{
72
CheckMenuItem
(hOptionsMenu,
ID_OPTIONS_HIDEWHENMINIMIZED
,
MF_BYCOMMAND
|
MF_UNCHECKED
);
73
TaskManagerSettings
.
HideWhenMinimized
=
FALSE
;
74
}
75
else
76
{
77
CheckMenuItem
(hOptionsMenu,
ID_OPTIONS_HIDEWHENMINIMIZED
,
MF_BYCOMMAND
|
MF_CHECKED
);
78
TaskManagerSettings
.
HideWhenMinimized
=
TRUE
;
79
}
80
}
81
82
void
TaskManager_OnOptionsShow16BitTasks
(
void
)
83
{
84
HMENU
hMenu;
85
HMENU
hOptionsMenu;
86
87
hMenu =
GetMenu
(
hMainWnd
);
88
hOptionsMenu =
GetSubMenu
(hMenu,
OPTIONS_MENU_INDEX
);
89
90
/*
91
* FIXME: Currently this is useless because the
92
* current implementation doesn't list the 16-bit
93
* processes. I believe that would require querying
94
* each ntvdm.exe process for it's children.
95
*/
96
97
/*
98
* Check or uncheck the show 16-bit tasks menu item
99
*/
100
if
(
GetMenuState
(hOptionsMenu,
ID_OPTIONS_SHOW16BITTASKS
,
MF_BYCOMMAND
) &
MF_CHECKED
)
101
{
102
CheckMenuItem
(hOptionsMenu,
ID_OPTIONS_SHOW16BITTASKS
,
MF_BYCOMMAND
|
MF_UNCHECKED
);
103
TaskManagerSettings
.
Show16BitTasks
=
FALSE
;
104
}
105
else
106
{
107
CheckMenuItem
(hOptionsMenu,
ID_OPTIONS_SHOW16BITTASKS
,
MF_BYCOMMAND
|
MF_CHECKED
);
108
TaskManagerSettings
.
Show16BitTasks
=
TRUE
;
109
}
110
111
/*
112
* Refresh the list of processes.
113
*/
114
RefreshProcessPage
();
115
}
ID_OPTIONS_ALWAYSONTOP
#define ID_OPTIONS_ALWAYSONTOP
Definition:
resource.h:143
ID_OPTIONS_MINIMIZEONUSE
#define ID_OPTIONS_MINIMIZEONUSE
Definition:
resource.h:144
ID_OPTIONS_SHOW16BITTASKS
#define ID_OPTIONS_SHOW16BITTASKS
Definition:
resource.h:163
ID_OPTIONS_HIDEWHENMINIMIZED
#define ID_OPTIONS_HIDEWHENMINIMIZED
Definition:
resource.h:145
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
hMainWnd
HWND hMainWnd
Definition:
magnifier.c:32
HMENU
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition:
ordinal.c:63
TaskManager_OnOptionsAlwaysOnTop
void TaskManager_OnOptionsAlwaysOnTop(void)
Definition:
optnmenu.c:10
TaskManager_OnOptionsHideWhenMinimized
void TaskManager_OnOptionsHideWhenMinimized(void)
Definition:
optnmenu.c:59
TaskManager_OnOptionsShow16BitTasks
void TaskManager_OnOptionsShow16BitTasks(void)
Definition:
optnmenu.c:82
TaskManager_OnOptionsMinimizeOnUse
void TaskManager_OnOptionsMinimizeOnUse(void)
Definition:
optnmenu.c:36
OPTIONS_MENU_INDEX
#define OPTIONS_MENU_INDEX
Definition:
optnmenu.h:10
WS_EX_TOPMOST
#define WS_EX_TOPMOST
Definition:
pedump.c:647
RefreshProcessPage
void RefreshProcessPage(void)
Definition:
procpage.c:448
TASKMANAGER_SETTINGS::Show16BitTasks
BOOL Show16BitTasks
Definition:
taskmgr.h:37
TASKMANAGER_SETTINGS::AlwaysOnTop
BOOL AlwaysOnTop
Definition:
taskmgr.h:34
TASKMANAGER_SETTINGS::HideWhenMinimized
BOOL HideWhenMinimized
Definition:
taskmgr.h:36
TASKMANAGER_SETTINGS::MinimizeOnUse
BOOL MinimizeOnUse
Definition:
taskmgr.h:35
TaskManagerSettings
TASKMANAGER_SETTINGS TaskManagerSettings
Definition:
taskmgr.c:37
precomp.h
MF_BYCOMMAND
#define MF_BYCOMMAND
Definition:
winuser.h:202
GetWindowLongPtrW
#define GetWindowLongPtrW
Definition:
winuser.h:4832
GetMenuState
UINT WINAPI GetMenuState(_In_ HMENU, _In_ UINT, _In_ UINT)
HWND_TOPMOST
#define HWND_TOPMOST
Definition:
winuser.h:1211
SetWindowPos
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
SWP_NOMOVE
#define SWP_NOMOVE
Definition:
winuser.h:1247
MF_CHECKED
#define MF_CHECKED
Definition:
winuser.h:132
SWP_NOSIZE
#define SWP_NOSIZE
Definition:
winuser.h:1248
MF_UNCHECKED
#define MF_UNCHECKED
Definition:
winuser.h:204
CheckMenuItem
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
GetSubMenu
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
HWND_NOTOPMOST
#define HWND_NOTOPMOST
Definition:
winuser.h:1209
GetMenu
HMENU WINAPI GetMenu(_In_ HWND)
GWL_EXSTYLE
#define GWL_EXSTYLE
Definition:
winuser.h:854
base
applications
taskmgr
optnmenu.c
Generated on Tue Nov 5 2024 06:02:30 for ReactOS by
1.9.6