ReactOS
0.4.16-dev-106-g10b08aa
CMenuFocusManager.h
Go to the documentation of this file.
1
/*
2
* Shell Menu Band
3
*
4
* Copyright 2014 David Quintana
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19
*/
20
#pragma once
21
22
class
CMenuBand
;
23
24
class
CMenuFocusManager
:
25
public
CComCoClass<CMenuFocusManager>,
26
public
CComObjectRootEx<CComMultiThreadModelNoCS>
27
{
28
private
:
29
static
DWORD
TlsIndex
;
30
31
static
CMenuFocusManager
*
GetManager
();
32
33
enum
StackEntryType
34
{
35
NoEntry
,
36
MenuBarEntry
,
37
MenuPopupEntry
,
38
TrackedMenuEntry
39
};
40
41
struct
StackEntry
42
{
43
StackEntryType
type
;
44
CMenuBand
*
mb
;
45
HMENU
hmenu
;
46
HWND
hwnd
;
47
};
48
49
public
:
50
static
CMenuFocusManager
*
AcquireManager
();
51
52
static
void
ReleaseManager
(
CMenuFocusManager
*
obj
);
53
54
private
:
55
static
LRESULT
CALLBACK
s_MsgFilterHook
(
INT
nCode,
WPARAM
wParam
,
LPARAM
lParam
);
56
static
LRESULT
CALLBACK
s_GetMsgHook
(
INT
nCode,
WPARAM
wParam
,
LPARAM
lParam
);
57
58
private
:
59
StackEntry
*
m_current
;
60
StackEntry
*
m_parent
;
61
StackEntry
*
m_menuBar
;
62
63
HHOOK
m_hMsgFilterHook
;
64
HHOOK
m_hGetMsgHook
;
65
DWORD
m_threadId
;
66
67
BOOL
m_mouseTrackDisabled
;
68
69
POINT
m_ptPrev
;
70
71
HWND
m_captureHwnd
;
72
73
HWND
m_hwndUnderMouse
;
74
StackEntry
*
m_entryUnderMouse
;
75
76
HMENU
m_selectedMenu
;
77
INT
m_selectedItem
;
78
DWORD
m_selectedItemFlags
;
79
80
BOOL
m_movedSinceDown
;
81
HWND
m_windowAtDown
;
82
83
HWND
m_PreviousForeground
;
84
85
// TODO: make dynamic
86
#define MAX_RECURSE 20
87
StackEntry
m_bandStack
[
MAX_RECURSE
];
88
int
m_bandCount
;
89
int
m_menuDepth
;
90
91
HRESULT
PushToArray
(
StackEntryType
type
,
CMenuBand
* mb,
HMENU
hmenu
);
92
HRESULT
PopFromArray
(
StackEntryType
* pType,
CMenuBand
** pMb,
HMENU
* pHmenu);
93
94
protected
:
95
CMenuFocusManager
();
96
~CMenuFocusManager
();
97
98
public
:
99
100
DECLARE_NOT_AGGREGATABLE
(
CMenuFocusManager
)
101
DECLARE_PROTECT_FINAL_CONSTRUCT
()
102
BEGIN_COM_MAP
(
CMenuFocusManager
)
103
END_COM_MAP
()
104
105
private:
106
LRESULT
GetMsgHook
(
INT
nCode,
WPARAM
wParam
,
LPARAM
lParam
);
107
LRESULT
MsgFilterHook
(
INT
nCode,
WPARAM
wParam
,
LPARAM
lParam
);
108
HRESULT
PlaceHooks
();
109
HRESULT
RemoveHooks
();
110
HRESULT
UpdateFocus
();
111
HRESULT
IsTrackedWindow
(
HWND
hWnd
,
StackEntry
** pentry =
NULL
);
112
HRESULT
IsTrackedWindowOrParent
(
HWND
hWnd
);
113
114
void
DisableMouseTrack
(
HWND
parent
,
BOOL
disableThis);
115
void
SetMenuCapture
(
HWND
child
);
116
117
LRESULT
ProcessMouseMove
(
MSG
*
msg
);
118
LRESULT
ProcessMouseDown
(
MSG
*
msg
,
BOOL
isLButton);
119
LRESULT
ProcessMouseUp
(
MSG
*
msg
,
BOOL
isLButton);
120
public:
121
HRESULT
PushMenuBar
(
CMenuBand
* mb);
122
HRESULT
PushMenuPopup
(
CMenuBand
* mb);
123
HRESULT
PushTrackedPopup
(
HMENU
popup);
124
HRESULT
PopMenuBar
(
CMenuBand
* mb);
125
HRESULT
PopMenuPopup
(
CMenuBand
* mb);
126
HRESULT
PopTrackedPopup
(
HMENU
popup);
127
};
MAX_RECURSE
#define MAX_RECURSE
Definition:
CMenuFocusManager.h:86
msg
#define msg(x)
Definition:
auth_time.c:54
hWnd
HWND hWnd
Definition:
settings.c:17
CMenuBand
Definition:
CMenuBand.h:41
CMenuFocusManager
Definition:
CMenuFocusManager.h:27
CMenuFocusManager::m_selectedItem
INT m_selectedItem
Definition:
CMenuFocusManager.h:77
CMenuFocusManager::~CMenuFocusManager
~CMenuFocusManager()
Definition:
CMenuFocusManager.cpp:199
CMenuFocusManager::m_captureHwnd
HWND m_captureHwnd
Definition:
CMenuFocusManager.h:71
CMenuFocusManager::AcquireManager
static CMenuFocusManager * AcquireManager()
Definition:
CMenuFocusManager.cpp:97
CMenuFocusManager::m_ptPrev
POINT m_ptPrev
Definition:
CMenuFocusManager.h:69
CMenuFocusManager::m_windowAtDown
HWND m_windowAtDown
Definition:
CMenuFocusManager.h:81
CMenuFocusManager::m_hGetMsgHook
HHOOK m_hGetMsgHook
Definition:
CMenuFocusManager.h:64
CMenuFocusManager::StackEntryType
StackEntryType
Definition:
CMenuFocusManager.h:34
CMenuFocusManager::MenuBarEntry
@ MenuBarEntry
Definition:
CMenuFocusManager.h:36
CMenuFocusManager::MenuPopupEntry
@ MenuPopupEntry
Definition:
CMenuFocusManager.h:37
CMenuFocusManager::TrackedMenuEntry
@ TrackedMenuEntry
Definition:
CMenuFocusManager.h:38
CMenuFocusManager::NoEntry
@ NoEntry
Definition:
CMenuFocusManager.h:35
CMenuFocusManager::PopFromArray
HRESULT PopFromArray(StackEntryType *pType, CMenuBand **pMb, HMENU *pHmenu)
Definition:
CMenuFocusManager.cpp:152
CMenuFocusManager::GetMsgHook
LRESULT GetMsgHook(INT nCode, WPARAM wParam, LPARAM lParam)
Definition:
CMenuFocusManager.cpp:557
CMenuFocusManager::PopMenuPopup
HRESULT PopMenuPopup(CMenuBand *mb)
Definition:
CMenuFocusManager.cpp:969
CMenuFocusManager::ProcessMouseMove
LRESULT ProcessMouseMove(MSG *msg)
Definition:
CMenuFocusManager.cpp:317
CMenuFocusManager::m_entryUnderMouse
StackEntry * m_entryUnderMouse
Definition:
CMenuFocusManager.h:74
CMenuFocusManager::m_selectedMenu
HMENU m_selectedMenu
Definition:
CMenuFocusManager.h:76
CMenuFocusManager::s_MsgFilterHook
static LRESULT CALLBACK s_MsgFilterHook(INT nCode, WPARAM wParam, LPARAM lParam)
Definition:
CMenuFocusManager.cpp:129
CMenuFocusManager::ReleaseManager
static void ReleaseManager(CMenuFocusManager *obj)
Definition:
CMenuFocusManager.cpp:121
CMenuFocusManager::IsTrackedWindow
HRESULT IsTrackedWindow(HWND hWnd, StackEntry **pentry=NULL)
Definition:
CMenuFocusManager.cpp:257
CMenuFocusManager::m_hMsgFilterHook
HHOOK m_hMsgFilterHook
Definition:
CMenuFocusManager.h:63
CMenuFocusManager::MsgFilterHook
LRESULT MsgFilterHook(INT nCode, WPARAM wParam, LPARAM lParam)
Definition:
CMenuFocusManager.cpp:491
CMenuFocusManager::m_menuDepth
int m_menuDepth
Definition:
CMenuFocusManager.h:89
CMenuFocusManager::s_GetMsgHook
static LRESULT CALLBACK s_GetMsgHook(INT nCode, WPARAM wParam, LPARAM lParam)
Definition:
CMenuFocusManager.cpp:134
CMenuFocusManager::IsTrackedWindowOrParent
HRESULT IsTrackedWindowOrParent(HWND hWnd)
Definition:
CMenuFocusManager.cpp:283
CMenuFocusManager::PushTrackedPopup
HRESULT PushTrackedPopup(HMENU popup)
Definition:
CMenuFocusManager.cpp:904
CMenuFocusManager::ProcessMouseUp
LRESULT ProcessMouseUp(MSG *msg, BOOL isLButton)
Definition:
CMenuFocusManager.cpp:456
CMenuFocusManager::PushMenuPopup
HRESULT PushMenuPopup(CMenuBand *mb)
Definition:
CMenuFocusManager.cpp:878
CMenuFocusManager::UpdateFocus
HRESULT UpdateFocus()
Definition:
CMenuFocusManager.cpp:713
CMenuFocusManager::CMenuFocusManager
CMenuFocusManager()
Definition:
CMenuFocusManager.cpp:176
CMenuFocusManager::PlaceHooks
HRESULT PlaceHooks()
Definition:
CMenuFocusManager.cpp:670
CMenuFocusManager::RemoveHooks
HRESULT RemoveHooks()
Definition:
CMenuFocusManager.cpp:695
CMenuFocusManager::PushToArray
HRESULT PushToArray(StackEntryType type, CMenuBand *mb, HMENU hmenu)
Definition:
CMenuFocusManager.cpp:139
CMenuFocusManager::SetMenuCapture
void SetMenuCapture(HWND child)
Definition:
CMenuFocusManager.cpp:237
CMenuFocusManager::GetManager
static CMenuFocusManager * GetManager()
Definition:
CMenuFocusManager.cpp:91
CMenuFocusManager::DisableMouseTrack
void DisableMouseTrack(HWND parent, BOOL disableThis)
Definition:
CMenuFocusManager.cpp:204
CMenuFocusManager::ProcessMouseDown
LRESULT ProcessMouseDown(MSG *msg, BOOL isLButton)
Definition:
CMenuFocusManager.cpp:399
CMenuFocusManager::m_current
StackEntry * m_current
Definition:
CMenuFocusManager.h:59
CMenuFocusManager::PopTrackedPopup
HRESULT PopTrackedPopup(HMENU popup)
Definition:
CMenuFocusManager.cpp:1016
CMenuFocusManager::m_parent
StackEntry * m_parent
Definition:
CMenuFocusManager.h:60
CMenuFocusManager::m_threadId
DWORD m_threadId
Definition:
CMenuFocusManager.h:65
CMenuFocusManager::PopMenuBar
HRESULT PopMenuBar(CMenuBand *mb)
Definition:
CMenuFocusManager.cpp:924
CMenuFocusManager::m_PreviousForeground
HWND m_PreviousForeground
Definition:
CMenuFocusManager.h:83
CMenuFocusManager::m_menuBar
StackEntry * m_menuBar
Definition:
CMenuFocusManager.h:61
CMenuFocusManager::TlsIndex
static DWORD TlsIndex
Definition:
CMenuFocusManager.h:29
CMenuFocusManager::m_selectedItemFlags
DWORD m_selectedItemFlags
Definition:
CMenuFocusManager.h:78
CMenuFocusManager::m_bandCount
int m_bandCount
Definition:
CMenuFocusManager.h:88
CMenuFocusManager::m_hwndUnderMouse
HWND m_hwndUnderMouse
Definition:
CMenuFocusManager.h:73
CMenuFocusManager::PushMenuBar
HRESULT PushMenuBar(CMenuBand *mb)
Definition:
CMenuFocusManager.cpp:862
CMenuFocusManager::m_bandStack
StackEntry m_bandStack[MAX_RECURSE]
Definition:
CMenuFocusManager.h:87
CMenuFocusManager::m_mouseTrackDisabled
BOOL m_mouseTrackDisabled
Definition:
CMenuFocusManager.h:67
CMenuFocusManager::m_movedSinceDown
BOOL m_movedSinceDown
Definition:
CMenuFocusManager.h:80
wParam
WPARAM wParam
Definition:
combotst.c:138
lParam
LPARAM lParam
Definition:
combotst.c:139
NULL
#define NULL
Definition:
types.h:112
CALLBACK
#define CALLBACK
Definition:
compat.h:35
parent
r parent
Definition:
btrfs.c:3010
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
type
GLuint GLuint GLsizei GLenum type
Definition:
gl.h:1545
HRESULT
Definition:
mshtmhst.idl:286
void
Definition:
nsiface.idl:2307
BEGIN_COM_MAP
#define BEGIN_COM_MAP(x)
Definition:
atlcom.h:581
DECLARE_PROTECT_FINAL_CONSTRUCT
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition:
atlcom.h:679
DECLARE_NOT_AGGREGATABLE
#define DECLARE_NOT_AGGREGATABLE(x)
Definition:
atlcom.h:651
END_COM_MAP
#define END_COM_MAP()
Definition:
atlcom.h:592
HMENU
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition:
ordinal.c:63
child
static HWND child
Definition:
cursoricon.c:298
CMenuFocusManager::StackEntry
Definition:
CMenuFocusManager.h:42
CMenuFocusManager::StackEntry::type
StackEntryType type
Definition:
CMenuFocusManager.h:43
CMenuFocusManager::StackEntry::hwnd
HWND hwnd
Definition:
CMenuFocusManager.h:46
CMenuFocusManager::StackEntry::mb
CMenuBand * mb
Definition:
CMenuFocusManager.h:44
CMenuFocusManager::StackEntry::hmenu
HMENU hmenu
Definition:
CMenuFocusManager.h:45
obj
Definition:
usrmarshal.c:1272
tagPOINT
Definition:
polytest.cpp:47
MSG
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition:
twain.h:1829
INT
int32_t INT
Definition:
typedefs.h:58
hmenu
static HMENU hmenu
Definition:
win.c:66
LPARAM
LONG_PTR LPARAM
Definition:
windef.h:208
LRESULT
LONG_PTR LRESULT
Definition:
windef.h:209
WPARAM
UINT_PTR WPARAM
Definition:
windef.h:207
dll
win32
shell32
shellmenu
CMenuFocusManager.h
Generated on Tue Oct 8 2024 06:08:28 for ReactOS by
1.9.6