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
;
48 #define MAX_RECURSE 20
49 CMenuBand
* m_bandStack
[MAX_RECURSE
];
52 HRESULT
PushToArray(CMenuBand
* item
);
53 HRESULT
PopFromArray(CMenuBand
** pItem
);
54 HRESULT
PeekArray(CMenuBand
** pItem
);
62 DECLARE_NOT_AGGREGATABLE(CMenuFocusManager
)
63 DECLARE_PROTECT_FINAL_CONSTRUCT()
64 BEGIN_COM_MAP(CMenuFocusManager
)
67 LRESULT
GetMsgHook(INT nCode
, WPARAM wParam
, LPARAM lParam
);
68 HRESULT
PlaceHooks(HWND window
);
69 HRESULT
RemoveHooks(HWND window
);
70 HRESULT
UpdateFocus(CMenuBand
* newBand
);
73 HRESULT
PushMenu(CMenuBand
* mb
);
74 HRESULT
PopMenu(CMenuBand
* mb
);