Author: dquintana
Date: Thu Feb 27 11:56:28 2014
New Revision: 62347
URL:
http://svn.reactos.org/svn/reactos?rev=62347&view=rev
Log:
[RSHELL]
* Improve hot-tracking behaviour.
CORE-7881
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuBand.h
branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
branches/shell-experiments/base/shell/rshell/CMenuToolbars.h
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] Thu Feb 27
11:56:28 2014
@@ -54,8 +54,7 @@
m_subMenuChild(NULL),
m_useBigIcons(FALSE),
m_hotBar(NULL),
- m_hotItem(-1),
- m_popupItem(-1)
+ m_hotItem(-1)
{
m_focusManager = CMenuFocusManager::AcquireManager();
}
@@ -625,12 +624,10 @@
HRESULT CMenuBand::_OnHotItemChanged(CMenuToolbarBase * tb, INT id)
{
- if (m_hotBar && m_hotBar != tb)
- m_hotBar->ChangeHotItem(-1);
m_hotBar = tb;
m_hotItem = id;
- if (m_staticToolbar) m_staticToolbar->InvalidateDraw();
- if (m_SFToolbar) m_SFToolbar->InvalidateDraw();
+ if (m_staticToolbar) m_staticToolbar->OnHotItemChanged(tb, id);
+ if (m_SFToolbar) m_SFToolbar->OnHotItemChanged(tb, id);
return S_OK;
}
@@ -717,7 +714,7 @@
return S_OK;
}
-HRESULT CMenuBand::_OnPopupSubMenu(INT popupItem, IMenuPopup * popup, POINTL * pAt, RECTL
* pExclude)
+HRESULT CMenuBand::_OnPopupSubMenu(IMenuPopup * popup, POINTL * pAt, RECTL * pExclude,
CMenuToolbarBase * toolbar, INT item)
{
if (m_subMenuChild)
{
@@ -725,7 +722,8 @@
if (FAILED(hr))
return hr;
}
- m_popupItem = popupItem;
+ if (m_staticToolbar) m_staticToolbar->OnPopupItemChanged(toolbar, item);
+ if (m_SFToolbar) m_SFToolbar->OnPopupItemChanged(toolbar, item);
m_subMenuChild = popup;
if (popup)
{
@@ -733,8 +731,6 @@
popup->Popup(pAt, pExclude, MPPF_RIGHT);
}
- if (m_staticToolbar) m_staticToolbar->InvalidateDraw();
- if (m_SFToolbar) m_SFToolbar->InvalidateDraw();
return S_OK;
}
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] Thu Feb 27
11:56:28 2014
@@ -60,7 +60,6 @@
CMenuToolbarBase * m_hotBar;
INT m_hotItem;
- INT m_popupItem;
public:
CMenuBand();
@@ -176,7 +175,7 @@
HRESULT _GetTopLevelWindow(HWND*topLevel);
HRESULT _OnHotItemChanged(CMenuToolbarBase * tb, INT id);
HRESULT _MenuItemHotTrack(DWORD changeType);
- HRESULT _OnPopupSubMenu(INT popupItem, IMenuPopup * popup, POINTL * pAt, RECTL *
pExclude);
+ HRESULT _OnPopupSubMenu(IMenuPopup * popup, POINTL * pAt, RECTL * pExclude,
CMenuToolbarBase * toolbar, INT item);
BOOL UseBigIcons()
{
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] Thu Feb 27
11:56:28 2014
@@ -55,6 +55,7 @@
COLORREF clrText;
COLORREF clrTextHighlight;
SIZE tbs;
+ bool isHot, isPopup;
*theResult = 0;
switch (uMsg)
@@ -112,8 +113,10 @@
rc = cdraw->nmcd.rc;
hdc = cdraw->nmcd.hdc;
- if (((INT) cdraw->nmcd.dwItemSpec == m_hotItem ||
- (m_hotItem < 0 && (INT) cdraw->nmcd.dwItemSpec ==
m_popupItem)))
+ isHot = m_hotBar == this && m_hotItem == (INT)
cdraw->nmcd.dwItemSpec;
+ isPopup = m_popupBar == this && m_popupItem == (INT)
cdraw->nmcd.dwItemSpec;
+
+ if (isHot || (m_hotItem < 0 && isPopup))
{
cdraw->nmcd.uItemState = CDIS_HOT;
}
@@ -168,11 +171,11 @@
m_menuBand(menuBand),
m_hwndToolbar(NULL),
m_dwMenuFlags(0),
- m_hotItem(-1),
- m_popupItem(-1),
m_SubclassOld(NULL),
m_hasIdealSize(FALSE),
- m_usePager(usePager)
+ m_usePager(usePager),
+ m_hotItem(-1),
+ m_popupItem(-1)
{
m_marlett = CreateFont(
0, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET,
@@ -370,7 +373,7 @@
{
KillTimer(hWnd, TIMERID_HOTTRACK);
- m_menuBand->_OnPopupSubMenu(-1, NULL, NULL, NULL);
+ m_menuBand->_OnPopupSubMenu(NULL, NULL, NULL, NULL, -1);
if (HasSubMenu(m_hotItem) == S_OK)
{
@@ -404,7 +407,23 @@
return S_OK;
}
-HRESULT CMenuToolbarBase::PopupSubMenu(UINT itemId, UINT index, IShellMenu*
childShellMenu)
+HRESULT CMenuToolbarBase::OnHotItemChanged(CMenuToolbarBase * toolbar, INT item)
+{
+ m_hotBar = toolbar;
+ m_hotItem = item;
+ InvalidateDraw();
+ return S_OK;
+}
+
+HRESULT CMenuToolbarBase::OnPopupItemChanged(CMenuToolbarBase * toolbar, INT item)
+{
+ m_popupBar = toolbar;
+ m_popupItem = item;
+ InvalidateDraw();
+ return S_OK;
+}
+
+HRESULT CMenuToolbarBase::PopupSubMenu(UINT uItem, UINT index, IShellMenu*
childShellMenu)
{
IBandSite* pBandSite;
IDeskBar* pDeskBar;
@@ -469,8 +488,7 @@
if (FAILED(hr))
return hr;
- m_popupItem = itemId;
- m_menuBand->_OnPopupSubMenu(itemId, popup, &pt, &rcl);
+ m_menuBand->_OnPopupSubMenu(popup, &pt, &rcl, this, m_popupItem);
return S_OK;
}
@@ -746,7 +764,7 @@
return m_menuBand->_CallCBWithItemId(wParam, SMC_EXEC, 0, 0);
}
-HRESULT CMenuStaticToolbar::PopupItem(UINT uItem)
+HRESULT CMenuStaticToolbar::PopupItem(INT uItem)
{
TBBUTTONINFO info = { 0 };
info.cbSize = sizeof(TBBUTTONINFO);
@@ -777,7 +795,7 @@
}
}
-HRESULT CMenuStaticToolbar::HasSubMenu(UINT uItem)
+HRESULT CMenuStaticToolbar::HasSubMenu(INT uItem)
{
TBBUTTONINFO info = { 0 };
info.cbSize = sizeof(TBBUTTONINFO);
@@ -909,7 +927,7 @@
return hr;
}
-LPITEMIDLIST CMenuSFToolbar::GetPidlFromId(UINT uItem, INT* pIndex)
+LPITEMIDLIST CMenuSFToolbar::GetPidlFromId(INT uItem, INT* pIndex)
{
TBBUTTONINFO info = { 0 };
info.cbSize = sizeof(TBBUTTONINFO);
@@ -955,7 +973,7 @@
return m_menuBand->_CallCBWithItemPidl(GetPidlFromId(wParam), SMC_SFEXEC, 0, 0);
}
-HRESULT CMenuSFToolbar::PopupItem(UINT uItem)
+HRESULT CMenuSFToolbar::PopupItem(INT uItem)
{
HRESULT hr;
UINT uId;
@@ -1005,7 +1023,7 @@
return PopupSubMenu(uItem, index, shellMenu);
}
-HRESULT CMenuSFToolbar::HasSubMenu(UINT uItem)
+HRESULT CMenuSFToolbar::HasSubMenu(INT uItem)
{
HRESULT hr;
LPCITEMIDLIST pidl = GetPidlFromId(uItem);
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuToolbars.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.h [iso-8859-1] Thu Feb 27
11:56:28 2014
@@ -33,12 +33,14 @@
CMenuBand * m_menuBand;
HWND m_hwndToolbar;
DWORD m_dwMenuFlags;
- INT m_hotItem;
- INT m_popupItem;
WNDPROC m_SubclassOld;
BOOL m_hasIdealSize;
SIZE m_idealSize;
BOOL m_usePager;
+ CMenuToolbarBase * m_hotBar;
+ INT m_hotItem;
+ CMenuToolbarBase * m_popupBar;
+ INT m_popupItem;
private:
static LRESULT CALLBACK s_SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
lParam);
@@ -55,10 +57,8 @@
HRESULT OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT
*theResult);
- virtual HRESULT FillToolbar() = 0;
- virtual HRESULT PopupItem(UINT uItem) = 0;
- virtual HRESULT HasSubMenu(UINT uItem) = 0;
- virtual HRESULT OnContextMenu(NMMOUSE * rclick) = 0;
+ HRESULT OnHotItemChanged(CMenuToolbarBase * toolbar, INT item);
+ HRESULT OnPopupItemChanged(CMenuToolbarBase * toolbar, INT item);
HRESULT PopupSubMenu(UINT itemId, UINT index, IShellMenu* childShellMenu);
HRESULT PopupSubMenu(UINT index, HMENU menu);
@@ -71,6 +71,11 @@
HRESULT SetPosSize(int x, int y, int cx, int cy);
void InvalidateDraw();
+
+ virtual HRESULT FillToolbar() = 0;
+ virtual HRESULT PopupItem(INT uItem) = 0;
+ virtual HRESULT HasSubMenu(INT uItem) = 0;
+ virtual HRESULT OnContextMenu(NMMOUSE * rclick) = 0;
protected:
virtual HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult);
@@ -94,8 +99,8 @@
HRESULT GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags);
virtual HRESULT FillToolbar();
- virtual HRESULT PopupItem(UINT uItem);
- virtual HRESULT HasSubMenu(UINT uItem);
+ virtual HRESULT PopupItem(INT uItem);
+ virtual HRESULT HasSubMenu(INT uItem);
virtual HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult);
virtual HRESULT OnContextMenu(NMMOUSE * rclick);
@@ -117,11 +122,11 @@
HRESULT GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void
**ppv);
virtual HRESULT FillToolbar();
- virtual HRESULT PopupItem(UINT uItem);
- virtual HRESULT HasSubMenu(UINT uItem);
+ virtual HRESULT PopupItem(INT uItem);
+ virtual HRESULT HasSubMenu(INT uItem);
virtual HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult);
virtual HRESULT OnContextMenu(NMMOUSE * rclick);
private:
- LPITEMIDLIST GetPidlFromId(UINT uItem, INT* pIndex = NULL);
+ LPITEMIDLIST GetPidlFromId(INT uItem, INT* pIndex = NULL);
};