mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[RSHELL]
* Begin work in improving the behaviour of the horizontal mode menuband. There's still a lot of work to do, and some things are temporarily worse than before, but in other places it has improved already. CORE-7586 svn path=/branches/shell-experiments/; revision=62520
This commit is contained in:
parent
fb26c9bcd8
commit
eaec85cafe
5 changed files with 115 additions and 30 deletions
|
@ -680,6 +680,7 @@ HRESULT CMenuBand::_TrackSubMenuUsingTrackPopupMenu(HMENU popup, INT x, INT y, R
|
||||||
UINT flags = TPM_VERPOSANIMATION | TPM_VERTICAL | TPM_LEFTALIGN;
|
UINT flags = TPM_VERPOSANIMATION | TPM_VERTICAL | TPM_LEFTALIGN;
|
||||||
|
|
||||||
m_trackingPopup = TRUE;
|
m_trackingPopup = TRUE;
|
||||||
|
m_focusManager->PushTrackedPopup(this, popup);
|
||||||
if (m_menuOwner)
|
if (m_menuOwner)
|
||||||
{
|
{
|
||||||
::TrackPopupMenuEx(popup, flags, x, y, m_menuOwner, ¶ms);
|
::TrackPopupMenuEx(popup, flags, x, y, m_menuOwner, ¶ms);
|
||||||
|
@ -689,6 +690,7 @@ HRESULT CMenuBand::_TrackSubMenuUsingTrackPopupMenu(HMENU popup, INT x, INT y, R
|
||||||
::TrackPopupMenuEx(popup, flags, x, y, m_topLevelWindow, ¶ms);
|
::TrackPopupMenuEx(popup, flags, x, y, m_topLevelWindow, ¶ms);
|
||||||
}
|
}
|
||||||
m_trackingPopup = FALSE;
|
m_trackingPopup = FALSE;
|
||||||
|
m_focusManager->PopTrackedPopup(this, popup);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -716,7 +718,52 @@ HRESULT CMenuBand::_MenuItemHotTrack(DWORD changeType)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if (changeType == VK_DOWN)
|
if (!(m_dwFlags & SMINIT_VERTICAL))
|
||||||
|
{
|
||||||
|
if (changeType == MPOS_SELECTRIGHT)
|
||||||
|
{
|
||||||
|
SendMessageW(m_menuOwner, WM_CANCELMODE, 0, 0);
|
||||||
|
if (m_SFToolbar && (m_hotBar == m_SFToolbar || m_hotBar == NULL))
|
||||||
|
{
|
||||||
|
DbgPrint("SF Toolbars in Horizontal menus is not implemented.\n");
|
||||||
|
return S_FALSE;
|
||||||
|
}
|
||||||
|
else if (m_staticToolbar && m_hotBar == m_staticToolbar)
|
||||||
|
{
|
||||||
|
hr = m_staticToolbar->ChangeHotItem(VK_DOWN);
|
||||||
|
if (hr == S_FALSE)
|
||||||
|
{
|
||||||
|
if (m_SFToolbar)
|
||||||
|
return m_SFToolbar->ChangeHotItem(VK_HOME);
|
||||||
|
else
|
||||||
|
return m_staticToolbar->ChangeHotItem(VK_HOME);
|
||||||
|
}
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (changeType == MPOS_SELECTLEFT)
|
||||||
|
{
|
||||||
|
SendMessageW(m_menuOwner, WM_CANCELMODE, 0, 0);
|
||||||
|
if (m_staticToolbar && (m_hotBar == m_staticToolbar || m_hotBar == NULL))
|
||||||
|
{
|
||||||
|
hr = m_staticToolbar->ChangeHotItem(VK_UP);
|
||||||
|
if (hr == S_FALSE)
|
||||||
|
{
|
||||||
|
if (m_SFToolbar)
|
||||||
|
return m_SFToolbar->ChangeHotItem(VK_END);
|
||||||
|
else
|
||||||
|
return m_staticToolbar->ChangeHotItem(VK_END);
|
||||||
|
}
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
else if (m_SFToolbar && m_hotBar == m_SFToolbar)
|
||||||
|
{
|
||||||
|
DbgPrint("SF Toolbars in Horizontal menus is not implemented.\n");
|
||||||
|
return S_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (changeType == VK_DOWN)
|
||||||
{
|
{
|
||||||
if (m_SFToolbar && (m_hotBar == m_SFToolbar || m_hotBar == NULL))
|
if (m_SFToolbar && (m_hotBar == m_SFToolbar || m_hotBar == NULL))
|
||||||
{
|
{
|
||||||
|
|
|
@ -345,7 +345,7 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::Popup(POINTL *ppt, RECTL *prcExclude, MP
|
||||||
y = rcWorkArea.bottom - cy;
|
y = rcWorkArea.bottom - cy;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetWindowPos(HWND_TOPMOST, x, y, cx, cy, SWP_SHOWWINDOW);
|
this->SetWindowPos(HWND_TOPMOST, x, y, cx, cy, SWP_SHOWWINDOW | SWP_NOACTIVATE);
|
||||||
|
|
||||||
m_ShowFlags = dwFlags;
|
m_ShowFlags = dwFlags;
|
||||||
m_Shown = true;
|
m_Shown = true;
|
||||||
|
@ -636,6 +636,11 @@ LRESULT CMenuDeskBar::_OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT CMenuDeskBar::_OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
|
{
|
||||||
|
return MA_NOACTIVATE;
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT CMenuDeskBar::_OnAppActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
LRESULT CMenuDeskBar::_OnAppActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
{
|
{
|
||||||
if (wParam == 0)
|
if (wParam == 0)
|
||||||
|
|
|
@ -65,6 +65,7 @@ public:
|
||||||
MESSAGE_HANDLER(WM_PAINT, _OnPaint)
|
MESSAGE_HANDLER(WM_PAINT, _OnPaint)
|
||||||
MESSAGE_HANDLER(WM_ACTIVATE, _OnActivate)
|
MESSAGE_HANDLER(WM_ACTIVATE, _OnActivate)
|
||||||
MESSAGE_HANDLER(WM_ACTIVATEAPP, _OnAppActivate)
|
MESSAGE_HANDLER(WM_ACTIVATEAPP, _OnAppActivate)
|
||||||
|
MESSAGE_HANDLER(WM_MOUSEACTIVATE, _OnMouseActivate)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
BEGIN_COM_MAP(CMenuDeskBar)
|
BEGIN_COM_MAP(CMenuDeskBar)
|
||||||
|
@ -128,6 +129,7 @@ private:
|
||||||
LRESULT _OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT _OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
LRESULT _OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT _OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
LRESULT _OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT _OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
LRESULT _OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
LRESULT _OnAppActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT _OnAppActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
|
||||||
BOOL _IsSubMenuParent(HWND hwnd);
|
BOOL _IsSubMenuParent(HWND hwnd);
|
||||||
|
|
|
@ -207,6 +207,20 @@ LRESULT CMenuFocusManager::GetMsgHook(INT nCode, WPARAM wParam, LPARAM lParam)
|
||||||
ActivationChange(msg->hwnd);
|
ActivationChange(msg->hwnd);
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
break;
|
break;
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
{
|
||||||
|
POINT pt = { GET_X_LPARAM(pos), GET_Y_LPARAM(pos) };
|
||||||
|
|
||||||
|
HWND window = WindowFromPoint(pt);
|
||||||
|
|
||||||
|
if (IsTrackedWindow(window) != S_OK)
|
||||||
|
{
|
||||||
|
DisableMouseTrack(NULL, FALSE);
|
||||||
|
m_currentBand->_MenuItemHotTrack(MPOS_FULLCANCEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
if (m_lastMoveFlags != wParam || m_lastMovePos != pos)
|
if (m_lastMoveFlags != wParam || m_lastMovePos != pos)
|
||||||
{
|
{
|
||||||
|
@ -229,6 +243,8 @@ LRESULT CMenuFocusManager::GetMsgHook(INT nCode, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
|
//if (!m_currentMenu)
|
||||||
|
{
|
||||||
DisableMouseTrack(m_currentFocus, TRUE);
|
DisableMouseTrack(m_currentFocus, TRUE);
|
||||||
switch (msg->wParam)
|
switch (msg->wParam)
|
||||||
{
|
{
|
||||||
|
@ -250,13 +266,7 @@ LRESULT CMenuFocusManager::GetMsgHook(INT nCode, WPARAM wParam, LPARAM lParam)
|
||||||
m_currentBand->_MenuItemHotTrack(VK_DOWN);
|
m_currentBand->_MenuItemHotTrack(VK_DOWN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case WM_CHAR:
|
|
||||||
//if (msg->wParam >= 'a' && msg->wParam <= 'z')
|
|
||||||
//{
|
|
||||||
// callNext = FALSE;
|
|
||||||
// PostMessage(m_currentFocus, WM_SYSCHAR, wParam, lParam);
|
|
||||||
//}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +321,7 @@ HRESULT CMenuFocusManager::ActivationChange(HWND newHwnd)
|
||||||
return UpdateFocus(newBand);
|
return UpdateFocus(newBand);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CMenuFocusManager::UpdateFocus(CMenuBand * newBand)
|
HRESULT CMenuFocusManager::UpdateFocus(CMenuBand * newBand, HMENU popupToTrack)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
HWND newFocus;
|
HWND newFocus;
|
||||||
|
@ -323,6 +333,7 @@ HRESULT CMenuFocusManager::UpdateFocus(CMenuBand * newBand)
|
||||||
hr = RemoveHooks(m_currentFocus);
|
hr = RemoveHooks(m_currentFocus);
|
||||||
m_currentFocus = NULL;
|
m_currentFocus = NULL;
|
||||||
m_currentBand = NULL;
|
m_currentBand = NULL;
|
||||||
|
m_currentMenu = NULL;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,6 +355,7 @@ HRESULT CMenuFocusManager::UpdateFocus(CMenuBand * newBand)
|
||||||
|
|
||||||
m_currentFocus = newFocus;
|
m_currentFocus = newFocus;
|
||||||
m_currentBand = newBand;
|
m_currentBand = newBand;
|
||||||
|
m_currentMenu = popupToTrack;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -394,3 +406,19 @@ HRESULT CMenuFocusManager::PopMenu(CMenuBand * mb)
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT CMenuFocusManager::PushTrackedPopup(CMenuBand * mb, HMENU popup)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = PushToArray(mb);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
return UpdateFocus(mb, popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CMenuFocusManager::PopTrackedPopup(CMenuBand * mb, HMENU popup)
|
||||||
|
{
|
||||||
|
return PopMenu(mb);
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ private:
|
||||||
private:
|
private:
|
||||||
CMenuBand * m_currentBand;
|
CMenuBand * m_currentBand;
|
||||||
HWND m_currentFocus;
|
HWND m_currentFocus;
|
||||||
|
HMENU m_currentMenu;
|
||||||
HHOOK m_hHook;
|
HHOOK m_hHook;
|
||||||
DWORD m_threadId;
|
DWORD m_threadId;
|
||||||
BOOL m_mouseTrackDisabled;
|
BOOL m_mouseTrackDisabled;
|
||||||
|
@ -71,7 +72,7 @@ private:
|
||||||
LRESULT GetMsgHook(INT nCode, WPARAM wParam, LPARAM lParam);
|
LRESULT GetMsgHook(INT nCode, WPARAM wParam, LPARAM lParam);
|
||||||
HRESULT PlaceHooks(HWND window);
|
HRESULT PlaceHooks(HWND window);
|
||||||
HRESULT RemoveHooks(HWND window);
|
HRESULT RemoveHooks(HWND window);
|
||||||
HRESULT UpdateFocus(CMenuBand * newBand);
|
HRESULT UpdateFocus(CMenuBand * newBand, HMENU popupToTrack = NULL);
|
||||||
HRESULT ActivationChange(HWND newHwnd);
|
HRESULT ActivationChange(HWND newHwnd);
|
||||||
void DisableMouseTrack(HWND enableTo, BOOL disableThis);
|
void DisableMouseTrack(HWND enableTo, BOOL disableThis);
|
||||||
HRESULT IsTrackedWindow(HWND hWnd);
|
HRESULT IsTrackedWindow(HWND hWnd);
|
||||||
|
@ -79,4 +80,6 @@ private:
|
||||||
public:
|
public:
|
||||||
HRESULT PushMenu(CMenuBand * mb);
|
HRESULT PushMenu(CMenuBand * mb);
|
||||||
HRESULT PopMenu(CMenuBand * mb);
|
HRESULT PopMenu(CMenuBand * mb);
|
||||||
|
HRESULT PushTrackedPopup(CMenuBand * mb, HMENU popup);
|
||||||
|
HRESULT PopTrackedPopup(CMenuBand * mb, HMENU popup);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue