Author: dquintana
Date: Fri Mar 21 10:13:18 2014
New Revision: 62539
URL:
http://svn.reactos.org/svn/reactos?rev=62539&view=rev
Log:
[RSHELL]
* Improve behaviour when hovering and clicking on the menubar. It's still somewhat
glitchy though.
CORE-7586
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuBand.h
branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Fri Mar 21
10:13:18 2014
@@ -56,6 +56,9 @@
m_site(NULL),
m_psmc(NULL),
m_subMenuChild(NULL),
+ m_subMenuParent(NULL),
+ m_childBand(NULL),
+ m_parentBand(NULL),
m_hmenu(NULL),
m_menuOwner(NULL),
m_useBigIcons(FALSE),
@@ -351,6 +354,10 @@
hr = _CallCB(SMC_INITMENU, 0, 0);
if (FAILED_UNEXPECTEDLY(hr))
return hr;
+ }
+ else if (m_parentBand)
+ {
+ m_parentBand->SetClient(NULL);
}
if (fShow)
@@ -488,6 +495,17 @@
{
m_childBand = child;
return S_OK;
+}
+
+HRESULT CMenuBand::_SetParentBand(CMenuBand * parent)
+{
+ m_parentBand = parent;
+ return S_OK;
+}
+
+HRESULT CMenuBand::_IsPopup()
+{
+ return m_subMenuParent ? S_OK : S_FALSE;
}
HRESULT STDMETHODCALLTYPE CMenuBand::SetClient(IUnknown *punkClient)
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuBand.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuBand.h [iso-8859-1] Fri Mar 21
10:13:18 2014
@@ -48,6 +48,7 @@
CComPtr<IMenuPopup> m_subMenuChild;
CComPtr<IMenuPopup> m_subMenuParent;
CComPtr<CMenuBand> m_childBand;
+ CComPtr<CMenuBand> m_parentBand;
UINT m_uId;
UINT m_uIdAncestor;
@@ -180,6 +181,8 @@
HRESULT _OnPopupSubMenu(IMenuPopup * popup, POINTL * pAt, RECTL * pExclude,
CMenuToolbarBase * toolbar, INT item);
HRESULT _DisableMouseTrack(BOOL bDisable);
HRESULT _SetChildBand(CMenuBand * child);
+ HRESULT _SetParentBand(CMenuBand * parent);
+ HRESULT _IsPopup();
BOOL UseBigIcons()
{
Modified: branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1] Fri
Mar 21 10:13:18 2014
@@ -188,7 +188,9 @@
return hr;
if (hwnd == hWnd)
- return S_OK;
+ {
+ return band->_IsPopup();
+ }
}
return S_FALSE;
@@ -232,10 +234,10 @@
if (m_currentMenu)
SendMessage(m_currentFocus, WM_CANCELMODE, 0, 0);
else
- m_currentBand->_MenuItemHotTrack(MPOS_SELECTLEFT);
+ m_currentBand->_MenuItemHotTrack(MPOS_CANCELLEVEL);
DbgPrint("Active popup cancelled, notifying of change...\n");
PostMessage(hwndToolbar, WM_USER_CHANGETRACKEDITEM, iHitTestResult,
iHitTestResult);
- return TRUE;
+ return FALSE;
}
}
@@ -447,6 +449,7 @@
if (mbParent)
{
mbParent->_SetChildBand(mb);
+ mb->_SetParentBand(mbParent);
}
return UpdateFocus(mb);
@@ -456,6 +459,11 @@
{
CMenuBand * mbc;
HRESULT hr;
+
+ if (m_currentBand)
+ {
+ m_currentBand->_SetParentBand(NULL);
+ }
HWND newFocus;
hr = mb->_GetTopLevelWindow(&newFocus);
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1] Fri Mar 21
10:13:18 2014
@@ -1050,6 +1050,12 @@
HRESULT CMenuStaticToolbar::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{
HRESULT hr;
+
+ if (m_isTracking)
+ {
+ return S_FALSE;
+ }
+
hr = CMenuToolbarBase::OnCommand(wParam, lParam, theResult);
if (FAILED_UNEXPECTEDLY(hr))
return hr;
@@ -1057,7 +1063,6 @@
// in case the clicked item has a submenu, we do not need to execute the item
if (hr == S_FALSE)
{
- DbgPrint("CMenuToolbarBase::OnCommand told us to cancel.\n");
return hr;
}