4 * Copyright 2014 David Quintana
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.
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.
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
24 class CMenuFocusManager
:
25 public CComCoClass
<CMenuFocusManager
>,
26 public CComObjectRootEx
<CComMultiThreadModelNoCS
>
29 static DWORD TlsIndex
;
31 static CMenuFocusManager
* GetManager();
34 static CMenuFocusManager
* AcquireManager();
36 static void ReleaseManager(CMenuFocusManager
* obj
);
39 static LRESULT CALLBACK
s_GetMsgHook(INT nCode
, WPARAM wParam
, LPARAM lParam
);
42 CMenuBand
* m_currentBand
;
47 BOOL m_mouseTrackDisabled
;
48 WPARAM m_lastMoveFlags
;
52 #define MAX_RECURSE 20
53 CMenuBand
* m_bandStack
[MAX_RECURSE
];
56 HRESULT
PushToArray(CMenuBand
* item
);
57 HRESULT
PopFromArray(CMenuBand
** pItem
);
58 HRESULT
PeekArray(CMenuBand
** pItem
);
66 DECLARE_NOT_AGGREGATABLE(CMenuFocusManager
)
67 DECLARE_PROTECT_FINAL_CONSTRUCT()
68 BEGIN_COM_MAP(CMenuFocusManager
)
72 LRESULT
GetMsgHook(INT nCode
, WPARAM wParam
, LPARAM lParam
);
73 HRESULT
PlaceHooks(HWND window
);
74 HRESULT
RemoveHooks(HWND window
);
75 HRESULT
UpdateFocus(CMenuBand
* newBand
, HMENU popupToTrack
= NULL
);
76 HRESULT
ActivationChange(HWND newHwnd
);
77 void DisableMouseTrack(HWND enableTo
, BOOL disableThis
);
78 HRESULT
IsTrackedWindow(HWND hWnd
);
81 HRESULT
PushMenu(CMenuBand
* mb
);
82 HRESULT
PopMenu(CMenuBand
* mb
);
83 HRESULT
PushTrackedPopup(CMenuBand
* mb
, HMENU popup
);
84 HRESULT
PopTrackedPopup(CMenuBand
* mb
, HMENU popup
);