mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 20:19:26 +00:00
[BROWSEUI]
* Allow the static items in the Favorites menu to be received by the shell browse window. * Handle the Organize Favorites menu item by opening either the USER favorites, or the COMMON version of the folder. [RSHELL] * Send the proper HWND together with the HMENU, when sending callbacks. svn path=/branches/shell-experiments/; revision=65111
This commit is contained in:
parent
5ee771bbc6
commit
2e0e5f7174
8 changed files with 64 additions and 13 deletions
|
@ -2929,7 +2929,7 @@ HandleTrayContextMenu:
|
|||
{
|
||||
/* TODO: Implement properly */
|
||||
|
||||
LPCWSTR strSite = L"http://www.reactos.org/";
|
||||
LPCWSTR strSite = L"https://www.reactos.org/";
|
||||
|
||||
/* TODO: Make localizable */
|
||||
LPCWSTR strCaption = L"Sorry";
|
||||
|
|
|
@ -738,17 +738,13 @@ HRESULT CMenuBand::_CallCB(UINT uMsg, WPARAM wParam, LPARAM lParam, UINT id, LPI
|
|||
if (!m_psmc)
|
||||
return S_FALSE;
|
||||
|
||||
HWND hwnd;
|
||||
GetWindow(&hwnd);
|
||||
|
||||
SMDATA smData = { 0 };
|
||||
smData.punk = static_cast<IShellMenu2*>(this);
|
||||
smData.uId = id;
|
||||
smData.uIdParent = m_uId;
|
||||
smData.uIdAncestor = m_uIdAncestor;
|
||||
smData.pidlItem = pidl;
|
||||
smData.hwnd = hwnd;
|
||||
if (m_hmenu)
|
||||
smData.hwnd = m_menuOwner ? m_menuOwner : m_topLevelWindow;
|
||||
smData.hmenu = m_hmenu;
|
||||
smData.pvUserData = NULL;
|
||||
if (m_SFToolbar)
|
||||
|
|
|
@ -1111,7 +1111,8 @@ HRESULT CMenuToolbarBase::PopupItem(INT iItem, BOOL keyInitiated)
|
|||
|
||||
CMenuStaticToolbar::CMenuStaticToolbar(CMenuBand *menuBand) :
|
||||
CMenuToolbarBase(menuBand, FALSE),
|
||||
m_hmenu(NULL)
|
||||
m_hmenu(NULL),
|
||||
m_hwndMenu(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1127,7 +1128,7 @@ HRESULT CMenuStaticToolbar::GetMenu(
|
|||
if (phmenu)
|
||||
*phmenu = m_hmenu;
|
||||
if (phwnd)
|
||||
*phwnd = NULL;
|
||||
*phwnd = m_hwndMenu;
|
||||
if (pdwFlags)
|
||||
*pdwFlags = m_dwMenuFlags;
|
||||
|
||||
|
@ -1140,6 +1141,7 @@ HRESULT CMenuStaticToolbar::SetMenu(
|
|||
DWORD dwFlags)
|
||||
{
|
||||
m_hmenu = hmenu;
|
||||
m_hwndMenu = hwnd;
|
||||
m_dwMenuFlags = dwFlags;
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -137,6 +137,7 @@ class CMenuStaticToolbar :
|
|||
{
|
||||
private:
|
||||
HMENU m_hmenu;
|
||||
HWND m_hwndMenu;
|
||||
|
||||
public:
|
||||
CMenuStaticToolbar(CMenuBand *menuBand);
|
||||
|
|
|
@ -68,8 +68,6 @@
|
|||
#endif
|
||||
|
||||
#define shell32_hInstance 0
|
||||
#define SMC_EXEC 4
|
||||
extern "C" INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex, UINT bSimulateDoc);
|
||||
|
||||
extern "C" HRESULT WINAPI CStartMenu_Constructor(REFIID riid, void **ppv);
|
||||
extern "C" HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv);
|
||||
|
|
|
@ -646,6 +646,9 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::CallbackSM(LPSMDATA psmd, UINT uMsg, WP
|
|||
return GetObject(psmd, *reinterpret_cast<IID *>(wParam), reinterpret_cast<void **>(lParam));
|
||||
case SMC_GETSFOBJECT:
|
||||
break;
|
||||
case SMC_EXEC:
|
||||
PostMessageW(psmd->hwnd, WM_COMMAND, psmd->uId, 0);
|
||||
break;
|
||||
case SMC_SFEXEC:
|
||||
SHInvokeDefaultCommand(psmd->hwnd, psmd->psf, psmd->pidlItem);
|
||||
break;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <shellapi.h>
|
||||
#include <htiframe.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
extern "C"
|
||||
BOOL WINAPI Shell_GetImageLists(
|
||||
|
@ -633,6 +634,7 @@ public:
|
|||
LRESULT OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||
LRESULT OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||
LRESULT OnIsThisLegal(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||
LRESULT OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||
LRESULT OnToggleStatusBarVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||
LRESULT OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||
LRESULT OnToggleToolbarBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||
|
@ -672,6 +674,7 @@ public:
|
|||
COMMAND_ID_HANDLER(IDM_GOTO_FORWARD, OnGoForward)
|
||||
COMMAND_ID_HANDLER(IDM_GOTO_UPONELEVEL, OnGoUpLevel)
|
||||
COMMAND_ID_HANDLER(IDM_GOTO_HOMEPAGE, OnGoHome)
|
||||
COMMAND_ID_HANDLER(IDM_FAVORITES_ORGANIZEFAVORITES, OnOrganizeFavorites)
|
||||
COMMAND_ID_HANDLER(IDM_HELP_ISTHISCOPYLEGAL, OnIsThisLegal)
|
||||
COMMAND_ID_HANDLER(IDM_VIEW_STATUSBAR, OnToggleStatusBarVisible)
|
||||
COMMAND_ID_HANDLER(IDM_TOOLBARS_LOCKTOOLBARS, OnToggleToolbarLock)
|
||||
|
@ -1871,7 +1874,7 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU h
|
|||
hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
|
||||
if (FAILED_UNEXPECTEDLY(hResult))
|
||||
return hResult;
|
||||
hResult = shellMenu->SetMenu(hmenuShared, NULL, SMSET_DONTOWN);
|
||||
hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN);
|
||||
if (FAILED_UNEXPECTEDLY(hResult))
|
||||
return hResult;
|
||||
fCurrentMenuBar = hmenuShared;
|
||||
|
@ -3252,9 +3255,54 @@ LRESULT CShellBrowser::OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO
|
|||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CShellBrowser::OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
||||
{
|
||||
CComPtr<IShellFolder> psfDesktop;
|
||||
LPITEMIDLIST pidlFavs;
|
||||
HRESULT hr;
|
||||
hr = SHGetSpecialFolderLocation(m_hWnd, CSIDL_FAVORITES, &pidlFavs);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
hr = SHGetSpecialFolderLocation(m_hWnd, CSIDL_COMMON_FAVORITES, &pidlFavs);
|
||||
if (FAILED(hr))
|
||||
return 0;
|
||||
}
|
||||
|
||||
hr = SHGetDesktopFolder(&psfDesktop);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return 0;
|
||||
|
||||
hr = SHInvokeDefaultCommand(m_hWnd, psfDesktop, pidlFavs);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CShellBrowser::OnIsThisLegal(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
||||
{
|
||||
ShellExecute(m_hWnd, NULL, L"https://reactos.org/user-faq", NULL, NULL, SW_SHOWNORMAL);
|
||||
/* TODO: Implement properly */
|
||||
|
||||
LPCWSTR strSite = L"https://www.reactos.org/user-faq";
|
||||
|
||||
/* TODO: Make localizable */
|
||||
LPCWSTR strCaption = L"Sorry";
|
||||
LPCWSTR strMessage = L"ReactOS could not browse to '%s' (error %d). Please make sure there is a web browser installed.";
|
||||
WCHAR tmpMessage[512];
|
||||
|
||||
/* TODO: Read from the registry */
|
||||
LPCWSTR strVerb = NULL; /* default */
|
||||
LPCWSTR strPath = strSite;
|
||||
LPCWSTR strParams = NULL;
|
||||
|
||||
/* The return value is defined as HINSTANCE for backwards compatibility only, the cast is needed */
|
||||
int result = (int) ShellExecuteW(m_hWnd, strVerb, strPath, strParams, NULL, SW_SHOWNORMAL);
|
||||
if (result <= 32)
|
||||
{
|
||||
StringCchPrintfW(tmpMessage, 512, strMessage, strSite, result);
|
||||
MessageBoxExW(m_hWnd, tmpMessage, strCaption, MB_OK, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -532,6 +532,9 @@ BOOL WINAPI SHDesktopMessageLoop(HANDLE);
|
|||
/* Utility functions */
|
||||
#include <stdio.h>
|
||||
|
||||
#define SMC_EXEC 4
|
||||
extern "C" INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex, UINT bSimulateDoc);
|
||||
|
||||
static inline ULONG
|
||||
Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue