mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 22:43:01 +00:00
[BROWSEUI]
- CShellBrowser: Implement the Explrer bar menu. Implement checking if a band is already loaded. Destroy all bands while destroying the browser window. Misc changes. - Part of the work submitted by Sylvain Deverre. CORE-10838 svn path=/trunk/; revision=71473
This commit is contained in:
parent
1764bca67a
commit
60b1d9b8d4
3 changed files with 296 additions and 49 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include <wingdi.h>
|
#include <wingdi.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <tlogstg.h>
|
#include <tlogstg.h>
|
||||||
|
#include <shellapi.h>
|
||||||
#include <shlobj_undoc.h>
|
#include <shlobj_undoc.h>
|
||||||
#include <shlguid_undoc.h>
|
#include <shlguid_undoc.h>
|
||||||
#include <shdeprecated.h>
|
#include <shdeprecated.h>
|
||||||
|
|
|
@ -56,12 +56,18 @@
|
||||||
#define IDM_TOOLS_FOLDEROPTIONS 0xA123
|
#define IDM_TOOLS_FOLDEROPTIONS 0xA123
|
||||||
#define IDM_HELP_ISTHISCOPYLEGAL 0xA104
|
#define IDM_HELP_ISTHISCOPYLEGAL 0xA104
|
||||||
#define IDM_HELP_ABOUT 0xA102
|
#define IDM_HELP_ABOUT 0xA102
|
||||||
|
|
||||||
#define IDM_TASKBAR_TOOLBARS 268
|
#define IDM_TASKBAR_TOOLBARS 268
|
||||||
#define IDM_TASKBAR_TOOLBARS_DESKTOP 3
|
#define IDM_TASKBAR_TOOLBARS_DESKTOP 3
|
||||||
#define IDM_TASKBAR_TOOLBARS_QUICKLAUNCH 4
|
#define IDM_TASKBAR_TOOLBARS_QUICKLAUNCH 4
|
||||||
#define IDM_TASKBAR_TOOLBARS_NEW 1
|
#define IDM_TASKBAR_TOOLBARS_NEW 1
|
||||||
|
|
||||||
|
/* Random id for band close button, feel free to change it */
|
||||||
|
#define IDM_BASEBAR_CLOSE 0xA200
|
||||||
|
|
||||||
|
/* User-installed explorer band IDs according to API Monitor traces */
|
||||||
|
#define IDM_EXPLORERBAND_BEGINCUSTOM 0xA240
|
||||||
|
#define IDM_EXPLORERBAND_ENDCUSTOM 0xA25C
|
||||||
|
|
||||||
#define IDM_GOTO_TRAVEL_FIRST 0xA141
|
#define IDM_GOTO_TRAVEL_FIRST 0xA141
|
||||||
#define IDM_GOTO_TRAVEL_LAST 0xA151
|
#define IDM_GOTO_TRAVEL_LAST 0xA151
|
||||||
#define IDM_GOTO_TRAVEL_SEP IDM_GOTO_TRAVEL_FIRST
|
#define IDM_GOTO_TRAVEL_SEP IDM_GOTO_TRAVEL_FIRST
|
||||||
|
@ -118,3 +124,5 @@
|
||||||
|
|
||||||
#define IDC_TEXTOPTIONS 4096
|
#define IDC_TEXTOPTIONS 4096
|
||||||
#define IDC_ICONOPTIONS 4097
|
#define IDC_ICONOPTIONS 4097
|
||||||
|
|
||||||
|
#define IDB_BANDBUTTONS 545
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <htiframe.h>
|
#include <htiframe.h>
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
|
|
||||||
#define USE_CUSTOM_EXPLORERBAND 1
|
#define USE_CUSTOM_EXPLORERBAND 0
|
||||||
|
|
||||||
extern HRESULT IUnknown_ShowDW(IUnknown * punk, BOOL fShow);
|
extern HRESULT IUnknown_ShowDW(IUnknown * punk, BOOL fShow);
|
||||||
|
|
||||||
|
@ -118,14 +118,6 @@ TODO:
|
||||||
"language='*'\"")
|
"language='*'\"")
|
||||||
#endif // __GNUC__
|
#endif // __GNUC__
|
||||||
|
|
||||||
struct categoryCacheHeader
|
|
||||||
{
|
|
||||||
long dwSize; // size of header only
|
|
||||||
long version; // currently 1
|
|
||||||
SYSTEMTIME writeTime; // time we were written to registry
|
|
||||||
long classCount; // number of classes following
|
|
||||||
};
|
|
||||||
|
|
||||||
static const unsigned int folderOptionsPageCountMax = 20;
|
static const unsigned int folderOptionsPageCountMax = 20;
|
||||||
static const long BTP_DONT_UPDATE_HISTORY = 0;
|
static const long BTP_DONT_UPDATE_HISTORY = 0;
|
||||||
static const long BTP_UPDATE_CUR_HISTORY = 1;
|
static const long BTP_UPDATE_CUR_HISTORY = 1;
|
||||||
|
@ -258,6 +250,11 @@ Switch to a new bar when it receives an Exec(CGID_IDeskBand, 1, 1, vaIn, NULL);
|
||||||
rebar
|
rebar
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
struct MenuBandInfo {
|
||||||
|
GUID barGuid;
|
||||||
|
BOOL fVertical;
|
||||||
|
};
|
||||||
|
|
||||||
class CShellBrowser :
|
class CShellBrowser :
|
||||||
public CWindowImpl<CShellBrowser, CWindow, CFrameWinTraits>,
|
public CWindowImpl<CShellBrowser, CWindow, CFrameWinTraits>,
|
||||||
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
||||||
|
@ -304,6 +301,7 @@ private:
|
||||||
IOleObject *fHistoryObject;
|
IOleObject *fHistoryObject;
|
||||||
IStream *fHistoryStream;
|
IStream *fHistoryStream;
|
||||||
IBindCtx *fHistoryBindContext;
|
IBindCtx *fHistoryBindContext;
|
||||||
|
HDSA menuDsa;
|
||||||
HACCEL m_hAccel;
|
HACCEL m_hAccel;
|
||||||
public:
|
public:
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -328,11 +326,15 @@ public:
|
||||||
FOLDERSETTINGS *folderSettings, long flags);
|
FOLDERSETTINGS *folderSettings, long flags);
|
||||||
HRESULT GetMenuBand(REFIID riid, void **shellMenu);
|
HRESULT GetMenuBand(REFIID riid, void **shellMenu);
|
||||||
HRESULT GetBaseBar(bool vertical, IUnknown **theBaseBar);
|
HRESULT GetBaseBar(bool vertical, IUnknown **theBaseBar);
|
||||||
|
BOOL IsBandLoaded(const CLSID clsidBand, bool verticali, DWORD *pdwBandID);
|
||||||
HRESULT ShowBand(const CLSID &classID, bool vertical);
|
HRESULT ShowBand(const CLSID &classID, bool vertical);
|
||||||
HRESULT NavigateToParent();
|
HRESULT NavigateToParent();
|
||||||
HRESULT DoFolderOptions();
|
HRESULT DoFolderOptions();
|
||||||
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
void RepositionBars();
|
void RepositionBars();
|
||||||
|
HRESULT BuildExplorerBandMenu();
|
||||||
|
HRESULT BuildExplorerBandCategory(HMENU hBandsMenu, CATID category, DWORD dwPos, UINT *nbFound);
|
||||||
|
BOOL IsBuiltinBand(CLSID &bandID);
|
||||||
virtual WNDPROC GetWindowProc()
|
virtual WNDPROC GetWindowProc()
|
||||||
{
|
{
|
||||||
return WindowProc;
|
return WindowProc;
|
||||||
|
@ -345,7 +347,6 @@ public:
|
||||||
HRESULT UpdateUpState();
|
HRESULT UpdateUpState();
|
||||||
void UpdateGotoMenu(HMENU theMenu);
|
void UpdateGotoMenu(HMENU theMenu);
|
||||||
void UpdateViewMenu(HMENU theMenu);
|
void UpdateViewMenu(HMENU theMenu);
|
||||||
HRESULT OnSearch();
|
|
||||||
|
|
||||||
/* // *** IDockingWindowFrame methods ***
|
/* // *** IDockingWindowFrame methods ***
|
||||||
virtual HRESULT STDMETHODCALLTYPE AddToolbar(IUnknown *punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags);
|
virtual HRESULT STDMETHODCALLTYPE AddToolbar(IUnknown *punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags);
|
||||||
|
@ -616,7 +617,9 @@ public:
|
||||||
LRESULT OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
LRESULT OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||||
LRESULT OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
LRESULT OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||||
LRESULT OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
LRESULT OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||||
|
LRESULT OnExplorerBar(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||||
LRESULT RelayCommands(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT RelayCommands(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
HRESULT OnSearch();
|
||||||
|
|
||||||
static ATL::CWndClassInfo& GetWndClassInfo()
|
static ATL::CWndClassInfo& GetWndClassInfo()
|
||||||
{
|
{
|
||||||
|
@ -657,8 +660,13 @@ public:
|
||||||
COMMAND_ID_HANDLER(IDM_TOOLBARS_LINKSBAR, OnToggleLinksBandVisible)
|
COMMAND_ID_HANDLER(IDM_TOOLBARS_LINKSBAR, OnToggleLinksBandVisible)
|
||||||
COMMAND_ID_HANDLER(IDM_TOOLBARS_TEXTLABELS, OnToggleTextLabels)
|
COMMAND_ID_HANDLER(IDM_TOOLBARS_TEXTLABELS, OnToggleTextLabels)
|
||||||
COMMAND_ID_HANDLER(IDM_TOOLBARS_CUSTOMIZE, OnToolbarCustomize)
|
COMMAND_ID_HANDLER(IDM_TOOLBARS_CUSTOMIZE, OnToolbarCustomize)
|
||||||
|
COMMAND_ID_HANDLER(IDM_EXPLORERBAR_SEARCH, OnExplorerBar)
|
||||||
|
COMMAND_ID_HANDLER(IDM_EXPLORERBAR_FOLDERS, OnExplorerBar)
|
||||||
|
COMMAND_ID_HANDLER(IDM_EXPLORERBAR_HISTORY, OnExplorerBar)
|
||||||
|
COMMAND_ID_HANDLER(IDM_EXPLORERBAR_FAVORITES, OnExplorerBar)
|
||||||
COMMAND_ID_HANDLER(IDM_BACKSPACE, OnBackspace)
|
COMMAND_ID_HANDLER(IDM_BACKSPACE, OnBackspace)
|
||||||
COMMAND_RANGE_HANDLER(IDM_GOTO_TRAVEL_FIRSTTARGET, IDM_GOTO_TRAVEL_LASTTARGET, OnGoTravel)
|
COMMAND_RANGE_HANDLER(IDM_GOTO_TRAVEL_FIRSTTARGET, IDM_GOTO_TRAVEL_LASTTARGET, OnGoTravel)
|
||||||
|
COMMAND_RANGE_HANDLER(IDM_EXPLORERBAND_BEGINCUSTOM, IDM_EXPLORERBAND_ENDCUSTOM, OnExplorerBar)
|
||||||
MESSAGE_HANDLER(WM_COMMAND, RelayCommands)
|
MESSAGE_HANDLER(WM_COMMAND, RelayCommands)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
|
@ -706,6 +714,8 @@ CShellBrowser::CShellBrowser()
|
||||||
|
|
||||||
CShellBrowser::~CShellBrowser()
|
CShellBrowser::~CShellBrowser()
|
||||||
{
|
{
|
||||||
|
if (menuDsa)
|
||||||
|
DSA_Destroy(menuDsa);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, long b, long c, long d)
|
HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, long b, long c, long d)
|
||||||
|
@ -716,6 +726,10 @@ HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, long b, long c, long d)
|
||||||
|
|
||||||
_AtlInitialConstruct();
|
_AtlInitialConstruct();
|
||||||
|
|
||||||
|
menuDsa = DSA_Create(sizeof(MenuBandInfo), 5);
|
||||||
|
if (!menuDsa)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
fCabinetState.cLength = sizeof(fCabinetState);
|
fCabinetState.cLength = sizeof(fCabinetState);
|
||||||
if (ReadCabinetState(&fCabinetState, sizeof(fCabinetState)) == FALSE)
|
if (ReadCabinetState(&fCabinetState, sizeof(fCabinetState)) == FALSE)
|
||||||
{
|
{
|
||||||
|
@ -1113,6 +1127,9 @@ HRESULT CShellBrowser::GetBaseBar(bool vertical, IUnknown **theBaseBar)
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
||||||
|
// we have to store our basebar into cache now
|
||||||
|
*cache = newBaseBar;
|
||||||
|
|
||||||
// tell the new base bar about the shell browser
|
// tell the new base bar about the shell browser
|
||||||
hResult = IUnknown_SetSite(newBaseBar, static_cast<IDropTarget *>(this));
|
hResult = IUnknown_SetSite(newBaseBar, static_cast<IDropTarget *>(this));
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
@ -1134,11 +1151,63 @@ HRESULT CShellBrowser::GetBaseBar(bool vertical, IUnknown **theBaseBar)
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
||||||
*cache = newBaseBar.Detach();
|
|
||||||
}
|
}
|
||||||
return (*cache)->QueryInterface(IID_PPV_ARG(IUnknown, theBaseBar));
|
return (*cache)->QueryInterface(IID_PPV_ARG(IUnknown, theBaseBar));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL CShellBrowser::IsBandLoaded(const CLSID clsidBand, bool vertical, DWORD *pdwBandID)
|
||||||
|
{
|
||||||
|
HRESULT hResult;
|
||||||
|
CComPtr<IUnknown> baseBar;
|
||||||
|
CComPtr<IDeskBar> deskBar;
|
||||||
|
CComPtr<IUnknown> baseBarSite;
|
||||||
|
CComPtr<IBandSite> bandSite;
|
||||||
|
CLSID clsidTmp;
|
||||||
|
DWORD numBands;
|
||||||
|
DWORD dwBandID;
|
||||||
|
DWORD i;
|
||||||
|
|
||||||
|
/* Get our basebarsite to be able to enumerate bands */
|
||||||
|
hResult = GetBaseBar(vertical, &baseBar);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return FALSE;
|
||||||
|
hResult = baseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return FALSE;
|
||||||
|
hResult = deskBar->GetClient(&baseBarSite);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return FALSE;
|
||||||
|
hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IBandSite, &bandSite));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
hResult = bandSite->EnumBands(-1, &numBands);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
for(i = 0; i < numBands; i++)
|
||||||
|
{
|
||||||
|
CComPtr<IPersist> bandPersist;
|
||||||
|
|
||||||
|
hResult = bandSite->EnumBands(i, &dwBandID);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
hResult = bandSite->GetBandObject(dwBandID, IID_PPV_ARG(IPersist, &bandPersist));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return FALSE;
|
||||||
|
hResult = bandPersist->GetClassID(&clsidTmp);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return FALSE;
|
||||||
|
if (IsEqualGUID(clsidBand, clsidTmp))
|
||||||
|
{
|
||||||
|
if (pdwBandID) *pdwBandID = dwBandID;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
|
HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
|
||||||
{
|
{
|
||||||
CComPtr<IDockingWindow> dockingWindow;
|
CComPtr<IDockingWindow> dockingWindow;
|
||||||
|
@ -1148,42 +1217,59 @@ HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
|
||||||
CComPtr<IDeskBar> deskBar;
|
CComPtr<IDeskBar> deskBar;
|
||||||
VARIANT vaIn;
|
VARIANT vaIn;
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
|
DWORD dwBandID;
|
||||||
|
|
||||||
hResult = GetBaseBar(vertical, (IUnknown **)&theBaseBar);
|
hResult = GetBaseBar(vertical, (IUnknown **)&theBaseBar);
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
||||||
#if USE_CUSTOM_EXPLORERBAND
|
hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
|
||||||
TRACE("ShowBand called for CLSID %s, vertical=%d...\n", wine_dbgstr_guid(&classID), vertical);
|
|
||||||
if (IsEqualCLSID(CLSID_ExplorerBand, classID))
|
|
||||||
{
|
|
||||||
TRACE("CLSID_ExplorerBand requested, building internal band.\n");
|
|
||||||
hResult = CExplorerBand_Constructor(IID_PPV_ARG(IUnknown, &newBand));
|
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
|
||||||
else
|
hResult = deskBar->GetClient(&baseBarSite);
|
||||||
#endif
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return hResult;
|
||||||
|
|
||||||
|
hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return hResult;
|
||||||
|
|
||||||
|
if (!IsBandLoaded(classID, vertical, &dwBandID))
|
||||||
{
|
{
|
||||||
TRACE("A different CLSID requested, using CoCreateInstance.\n");
|
|
||||||
hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &newBand));
|
hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &newBand));
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
|
else
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
{
|
||||||
return hResult;
|
CComPtr<IBandSite> pBandSite;
|
||||||
hResult = deskBar->GetClient(&baseBarSite);
|
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IBandSite, &pBandSite));
|
||||||
return hResult;
|
if (!SUCCEEDED(hResult))
|
||||||
hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
|
{
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
ERR("Can't get IBandSite interface\n");
|
||||||
return hResult;
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
hResult = pBandSite->GetBandObject(dwBandID, IID_PPV_ARG(IUnknown, &newBand));
|
||||||
|
if (!SUCCEEDED(hResult))
|
||||||
|
{
|
||||||
|
ERR("Can't find band object\n");
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// It's hackish, but we should be able to show the wanted band until we
|
||||||
|
// find the proper way to do this (but it seems to work to add a new band)
|
||||||
|
// Here we'll just re-add the existing band to the site, causing it to display.
|
||||||
|
}
|
||||||
V_VT(&vaIn) = VT_UNKNOWN;
|
V_VT(&vaIn) = VT_UNKNOWN;
|
||||||
V_UNKNOWN(&vaIn) = newBand.p;
|
V_UNKNOWN(&vaIn) = newBand.p;
|
||||||
hResult = IUnknown_Exec(baseBarSite, CGID_IDeskBand, 1, 1, &vaIn, NULL);
|
hResult = IUnknown_Exec(baseBarSite, CGID_IDeskBand, 1, 1, &vaIn, NULL);
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
{
|
||||||
return hResult;
|
return hResult;
|
||||||
|
}
|
||||||
|
|
||||||
hResult = dockingWindow->ShowDW(TRUE);
|
hResult = dockingWindow->ShowDW(TRUE);
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
@ -1634,9 +1720,93 @@ void CShellBrowser::UpdateViewMenu(HMENU theMenu)
|
||||||
SetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
|
SetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
|
||||||
}
|
}
|
||||||
SHCheckMenuItem(theMenu, IDM_VIEW_STATUSBAR, fStatusBarVisible ? TRUE : FALSE);
|
SHCheckMenuItem(theMenu, IDM_VIEW_STATUSBAR, fStatusBarVisible ? TRUE : FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Implement
|
HRESULT CShellBrowser::BuildExplorerBandMenu()
|
||||||
SHEnableMenuItem(theMenu, IDM_VIEW_EXPLORERBAR, FALSE);
|
{
|
||||||
|
HMENU hBandsMenu;
|
||||||
|
UINT nbFound;
|
||||||
|
|
||||||
|
hBandsMenu = SHGetMenuFromID(fCurrentMenuBar, IDM_VIEW_EXPLORERBAR);
|
||||||
|
if (!hBandsMenu)
|
||||||
|
{
|
||||||
|
OutputDebugString(L"No menu !\n");
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
DSA_DeleteAllItems(menuDsa);
|
||||||
|
BuildExplorerBandCategory(hBandsMenu, CATID_InfoBand, 4, NULL);
|
||||||
|
BuildExplorerBandCategory(hBandsMenu, CATID_CommBand, 20, &nbFound);
|
||||||
|
if (!nbFound)
|
||||||
|
{
|
||||||
|
// Remove separator
|
||||||
|
DeleteMenu(hBandsMenu, IDM_EXPLORERBAR_SEPARATOR, MF_BYCOMMAND);
|
||||||
|
}
|
||||||
|
// Remove media menu since XP does it (according to API Monitor)
|
||||||
|
DeleteMenu(hBandsMenu, IDM_EXPLORERBAR_MEDIA, MF_BYCOMMAND);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CShellBrowser::BuildExplorerBandCategory(HMENU hBandsMenu, CATID category, DWORD dwPos, UINT *nbFound)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
CComPtr<IEnumGUID> pEnumGUID;
|
||||||
|
WCHAR wszBandName[MAX_PATH];
|
||||||
|
WCHAR wszBandGUID[MAX_PATH];
|
||||||
|
WCHAR wRegKey[MAX_PATH];
|
||||||
|
UINT cBands;
|
||||||
|
DWORD dwRead;
|
||||||
|
DWORD dwDataSize;
|
||||||
|
GUID iter;
|
||||||
|
MenuBandInfo mbi;
|
||||||
|
|
||||||
|
mbi.fVertical = IsEqualGUID(category, CATID_InfoBand);
|
||||||
|
cBands = 0;
|
||||||
|
hr = SHEnumClassesOfCategories(1, &category, 0, NULL, &pEnumGUID);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
{
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
do
|
||||||
|
{
|
||||||
|
pEnumGUID->Next(1, &iter, &dwRead);
|
||||||
|
if (dwRead)
|
||||||
|
{
|
||||||
|
// Get the band name
|
||||||
|
if (IsBuiltinBand(iter))
|
||||||
|
continue;
|
||||||
|
if (!StringFromGUID2(iter, wszBandGUID, MAX_PATH))
|
||||||
|
continue;
|
||||||
|
StringCchPrintfW(wRegKey, MAX_PATH, L"CLSID\\%s", wszBandGUID);
|
||||||
|
dwDataSize = MAX_PATH;
|
||||||
|
SHGetValue(HKEY_CLASSES_ROOT, wRegKey, NULL, NULL, wszBandName, &dwDataSize);
|
||||||
|
|
||||||
|
mbi.barGuid = iter;
|
||||||
|
InsertMenu(hBandsMenu, dwPos + cBands, MF_BYPOSITION, IDM_EXPLORERBAND_BEGINCUSTOM + DSA_GetItemCount(menuDsa), wszBandName);
|
||||||
|
DSA_AppendItem(menuDsa, &mbi);
|
||||||
|
cBands++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (dwRead > 0);
|
||||||
|
if (nbFound)
|
||||||
|
*nbFound = cBands;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CShellBrowser::IsBuiltinBand(CLSID &bandID)
|
||||||
|
{
|
||||||
|
if (IsEqualCLSID(bandID, CLSID_ExplorerBand))
|
||||||
|
return TRUE;
|
||||||
|
if (IsEqualCLSID(bandID, CLSID_SH_SearchBand) || IsEqualCLSID(bandID, CLSID_SearchBand))
|
||||||
|
return TRUE;
|
||||||
|
if (IsEqualCLSID(bandID, CLSID_IE_SearchBand) || IsEqualCLSID(bandID, CLSID_FileSearchBand))
|
||||||
|
return TRUE;
|
||||||
|
if (IsEqualCLSID(bandID, CLSID_SH_HistBand))
|
||||||
|
return TRUE;
|
||||||
|
if (IsEqualCLSID(bandID, CLSID_SH_FavBand))
|
||||||
|
return TRUE;
|
||||||
|
if (IsEqualCLSID(bandID, CLSID_ChannelsBand))
|
||||||
|
return TRUE;
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CShellBrowser::OnSearch()
|
HRESULT CShellBrowser::OnSearch()
|
||||||
|
@ -1805,6 +1975,11 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::Exec(const GUID *pguidCmdGroup, DWORD n
|
||||||
{
|
{
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
|
|
||||||
|
if (!pguidCmdGroup)
|
||||||
|
{
|
||||||
|
TRACE("Unhandled null CGID %d %d %p %p\n", nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
|
if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
|
||||||
{
|
{
|
||||||
switch (nCmdID)
|
switch (nCmdID)
|
||||||
|
@ -1868,6 +2043,9 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::Exec(const GUID *pguidCmdGroup, DWORD n
|
||||||
case 0x12:
|
case 0x12:
|
||||||
// refresh on toolbar clicked
|
// refresh on toolbar clicked
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
case 0x26:
|
||||||
|
// called for unknown bands ?
|
||||||
|
return S_OK;
|
||||||
case 0x4d:
|
case 0x4d:
|
||||||
// tell the view if it should hide the task pane or not
|
// tell the view if it should hide the task pane or not
|
||||||
return (fClientBars[BIVerticalBaseBar].clientBar.p == NULL) ? S_FALSE : S_OK;
|
return (fClientBars[BIVerticalBaseBar].clientBar.p == NULL) ? S_FALSE : S_OK;
|
||||||
|
@ -1960,20 +2138,22 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU h
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
||||||
if (hmenuShared)
|
if (!hmenuShared)
|
||||||
{
|
{
|
||||||
|
hmenuShared = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
|
||||||
|
}
|
||||||
// FIXME: Figure out the proper way to do this.
|
// FIXME: Figure out the proper way to do this.
|
||||||
HMENU hMenuFavs = GetSubMenu(hmenuShared, 3);
|
HMENU hMenuFavs = GetSubMenu(hmenuShared, 3);
|
||||||
if (hMenuFavs)
|
if (hMenuFavs)
|
||||||
{
|
{
|
||||||
DeleteMenu(hMenuFavs, IDM_FAVORITES_EMPTY, MF_BYCOMMAND);
|
DeleteMenu(hMenuFavs, IDM_FAVORITES_EMPTY, MF_BYCOMMAND);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN);
|
hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN);
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
fCurrentMenuBar = hmenuShared;
|
fCurrentMenuBar = hmenuShared;
|
||||||
|
BuildExplorerBandMenu();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1998,7 +2178,7 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::SetStatusTextSB(LPCOLESTR pszStatusText
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
return E_NOTIMPL;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CShellBrowser::EnableModelessSB(BOOL fEnable)
|
HRESULT STDMETHODCALLTYPE CShellBrowser::EnableModelessSB(BOOL fEnable)
|
||||||
|
@ -3172,15 +3352,39 @@ LRESULT CShellBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
|
CComPtr<IDockingWindow> pdw;
|
||||||
|
CComPtr<IDeskBar> bar;
|
||||||
|
CComPtr<IUnknown> pBarSite;
|
||||||
|
CComPtr<IDeskBarClient> pClient;
|
||||||
|
|
||||||
if (fClientBars[i].clientBar == NULL)
|
if (fClientBars[i].clientBar == NULL)
|
||||||
continue;
|
continue;
|
||||||
IDockingWindow * pdw;
|
|
||||||
hr = fClientBars[i].clientBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &pdw));
|
hr = fClientBars[i].clientBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &pdw));
|
||||||
if (FAILED_UNEXPECTEDLY(hr))
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
continue;
|
continue;
|
||||||
pdw->ShowDW(FALSE);
|
|
||||||
|
/* We should destroy our basebarsite too */
|
||||||
|
hr = pdw->QueryInterface(IID_PPV_ARG(IDeskBar, &bar));
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
hr = bar->GetClient(&pBarSite);
|
||||||
|
if (SUCCEEDED(hr) && pBarSite)
|
||||||
|
{
|
||||||
|
hr = pBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pClient));
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
pClient->SetDeskBarSite(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
pdw->CloseDW(0);
|
pdw->CloseDW(0);
|
||||||
pdw->Release();
|
pdw = NULL;
|
||||||
|
/* For some reasons, it's like we miss some AddRef in ATL when QueryInterface on
|
||||||
|
* same interface or inherited one, so we are removing already removed (!) object.
|
||||||
|
* TODO: check with MSVC's ATL to see if this behaviour happens too
|
||||||
|
*/
|
||||||
|
bar.Detach();
|
||||||
|
pClient.Detach();
|
||||||
|
pBarSite.Detach();
|
||||||
ReleaseCComPtrExpectZero(fClientBars[i].clientBar);
|
ReleaseCComPtrExpectZero(fClientBars[i].clientBar);
|
||||||
}
|
}
|
||||||
ReleaseCComPtrExpectZero(fTravelLog);
|
ReleaseCComPtrExpectZero(fTravelLog);
|
||||||
|
@ -3471,6 +3675,40 @@ LRESULT CShellBrowser::OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT CShellBrowser::OnExplorerBar(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
||||||
|
{
|
||||||
|
// TODO: HACK ! use the proper mechanism to show the band (i.e. pass the BSTR to basebar)
|
||||||
|
if (wID >= IDM_EXPLORERBAND_BEGINCUSTOM && wID <= IDM_EXPLORERBAND_ENDCUSTOM)
|
||||||
|
{
|
||||||
|
MenuBandInfo *mbi;
|
||||||
|
mbi = (MenuBandInfo*)DSA_GetItemPtr(menuDsa, (wID - IDM_EXPLORERBAND_BEGINCUSTOM));
|
||||||
|
if (!mbi)
|
||||||
|
return 0;
|
||||||
|
ShowBand(mbi->barGuid, mbi->fVertical);
|
||||||
|
bHandled = TRUE;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
switch (wID)
|
||||||
|
{
|
||||||
|
case IDM_EXPLORERBAR_SEARCH:
|
||||||
|
Exec(&CLSID_CommonButtons, 0x123, 1, NULL, NULL);
|
||||||
|
break;
|
||||||
|
case IDM_EXPLORERBAR_FOLDERS:
|
||||||
|
ShowBand(CLSID_ExplorerBand, true);
|
||||||
|
break;
|
||||||
|
case IDM_EXPLORERBAR_HISTORY:
|
||||||
|
ShowBand(CLSID_SH_HistBand, true);
|
||||||
|
break;
|
||||||
|
case IDM_EXPLORERBAR_FAVORITES:
|
||||||
|
ShowBand(CLSID_SH_FavBand, true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
WARN("Unknown id %x\n", wID);
|
||||||
|
}
|
||||||
|
bHandled = TRUE;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT CShellBrowser::RelayCommands(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
LRESULT CShellBrowser::RelayCommands(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
{
|
{
|
||||||
if (HIWORD(wParam) == 0 && LOWORD(wParam) < FCIDM_SHVIEWLAST && fCurrentShellViewWindow != NULL)
|
if (HIWORD(wParam) == 0 && LOWORD(wParam) < FCIDM_SHVIEWLAST && fCurrentShellViewWindow != NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue