Author: gadamopoulos
Date: Wed Jun 1 21:12:17 2016
New Revision: 71492
URL:
http://svn.reactos.org/svn/reactos?rev=71492&view=rev
Log:
[BROWSEUI]
- CExplorerBand: Implement IOleWindow, IDockingWindow, IDeskBand, IObjectWithSite,
IInputObject and IPersist interfaces. This creates and shows an empty tree view control in
the bar.
- CShellBrowser: Restore the hack to use the local CExplorerBand instead of the system
one.
Modified:
trunk/reactos/dll/win32/browseui/explorerband.cpp
trunk/reactos/dll/win32/browseui/explorerband.h
trunk/reactos/dll/win32/browseui/shellbrowser.cpp
Modified: trunk/reactos/dll/win32/browseui/explorerband.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/explore…
==============================================================================
--- trunk/reactos/dll/win32/browseui/explorerband.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/explorerband.cpp [iso-8859-1] Wed Jun 1 21:12:17
2016
@@ -12,19 +12,32 @@
return ShellObjectCreator<CExplorerBand>(riid, ppv);
}
-CExplorerBand::CExplorerBand()
+CExplorerBand::CExplorerBand() :
+ pSite(NULL), fVisible(FALSE), dwBandID(0)
{
}
CExplorerBand::~CExplorerBand()
{
+}
+
+void CExplorerBand::InitializeExplorerBand()
+{
+
+}
+
+void CExplorerBand::DestroyExplorerBand()
+{
+
}
// *** IOleWindow methods ***
HRESULT STDMETHODCALLTYPE CExplorerBand::GetWindow(HWND *lphwnd)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ if (!lphwnd)
+ return E_INVALIDARG;
+ *lphwnd = m_hWnd;
+ return S_OK;
}
HRESULT STDMETHODCALLTYPE CExplorerBand::ContextSensitiveHelp(BOOL fEnterMode)
@@ -37,42 +50,135 @@
// *** IDockingWindow methods ***
HRESULT STDMETHODCALLTYPE CExplorerBand::CloseDW(DWORD dwReserved)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ // We do nothing, we don't have anything to save yet
+ TRACE("CloseDW called\n");
+ return S_OK;
}
HRESULT STDMETHODCALLTYPE CExplorerBand::ResizeBorderDW(const RECT *prcBorder, IUnknown
*punkToolbarSite, BOOL fReserved)
{
- UNIMPLEMENTED;
+ /* Must return E_NOTIMPL according to MSDN */
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CExplorerBand::ShowDW(BOOL fShow)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ fVisible = fShow;
+ ShowWindow(fShow);
+ return S_OK;
}
// *** IDeskBand methods ***
HRESULT STDMETHODCALLTYPE CExplorerBand::GetBandInfo(DWORD dwBandID, DWORD dwViewMode,
DESKBANDINFO *pdbi)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ if (!pdbi)
+ {
+ return E_INVALIDARG;
+ }
+ this->dwBandID = dwBandID;
+
+ if (pdbi->dwMask & DBIM_MINSIZE)
+ {
+ pdbi->ptMinSize.x = 200;
+ pdbi->ptMinSize.y = 30;
+ }
+
+ if (pdbi->dwMask & DBIM_MAXSIZE)
+ {
+ pdbi->ptMaxSize.y = -1;
+ }
+
+ if (pdbi->dwMask & DBIM_INTEGRAL)
+ {
+ pdbi->ptIntegral.y = 1;
+ }
+
+ if (pdbi->dwMask & DBIM_ACTUAL)
+ {
+ pdbi->ptActual.x = 200;
+ pdbi->ptActual.y = 30;
+ }
+
+ if (pdbi->dwMask & DBIM_TITLE)
+ {
+ lstrcpyW(pdbi->wszTitle, L"Explorer");
+ }
+
+ if (pdbi->dwMask & DBIM_MODEFLAGS)
+ {
+ pdbi->dwModeFlags = DBIMF_NORMAL | DBIMF_VARIABLEHEIGHT;
+ }
+
+ if (pdbi->dwMask & DBIM_BKCOLOR)
+ {
+ pdbi->dwMask &= ~DBIM_BKCOLOR;
+ }
+ return S_OK;
}
// *** IObjectWithSite methods ***
HRESULT STDMETHODCALLTYPE CExplorerBand::SetSite(IUnknown *pUnkSite)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ HRESULT hr;
+ HWND parentWnd;
+
+ if (pUnkSite == pSite)
+ return S_OK;
+
+ TRACE("SetSite called \n");
+ if (!pUnkSite)
+ {
+ DestroyExplorerBand();
+ DestroyWindow();
+ m_hWnd = NULL;
+ }
+
+ if (pUnkSite != pSite)
+ {
+ pSite = NULL;
+ }
+
+ if(!pUnkSite)
+ return S_OK;
+
+ hr = IUnknown_GetWindow(pUnkSite, &parentWnd);
+ if (!SUCCEEDED(hr))
+ {
+ ERR("Could not get parent's window ! Status: %08lx\n", hr);
+ return E_INVALIDARG;
+ }
+
+ pSite = pUnkSite;
+
+ if (m_hWnd)
+ {
+ // Change its parent
+ SetParent(parentWnd);
+ }
+ else
+ {
+ HWND wnd = CreateWindow(WC_TREEVIEW, NULL,
+ WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TVS_HASLINES | TVS_HASBUTTONS
| TVS_SHOWSELALWAYS | TVS_EDITLABELS /* | TVS_SINGLEEXPAND*/ , // remove TVS_SINGLEEXPAND
for now since it has strange behaviour
+ 0, 0, 0, 0, parentWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
+
+ // Subclass the window
+ SubclassWindow(wnd);
+
+ // Initialize our treeview now
+ InitializeExplorerBand();
+ RegisterDragDrop(m_hWnd, dynamic_cast<IDropTarget*>(this));
+ }
+ return S_OK;
}
HRESULT STDMETHODCALLTYPE CExplorerBand::GetSite(REFIID riid, void **ppvSite)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ if (!ppvSite)
+ return E_POINTER;
+ *ppvSite = pSite;
+ return S_OK;
}
@@ -101,28 +207,40 @@
// *** IInputObject methods ***
HRESULT STDMETHODCALLTYPE CExplorerBand::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ if (fActivate)
+ {
+ //SetFocus();
+ SetActiveWindow();
+ }
+ // TODO: handle message
+ if(lpMsg)
+ {
+ TranslateMessage(lpMsg);
+ DispatchMessage(lpMsg);
+ }
+ return S_OK;
}
HRESULT STDMETHODCALLTYPE CExplorerBand::HasFocusIO()
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ return bFocused ? S_OK : S_FALSE;
}
HRESULT STDMETHODCALLTYPE CExplorerBand::TranslateAcceleratorIO(LPMSG lpMsg)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ TranslateMessage(lpMsg);
+ DispatchMessage(lpMsg);
+ return S_OK;
}
// *** IPersist methods ***
HRESULT STDMETHODCALLTYPE CExplorerBand::GetClassID(CLSID *pClassID)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ if (!pClassID)
+ return E_POINTER;
+ memcpy(pClassID, &CLSID_ExplorerBand, sizeof(CLSID));
+ return S_OK;
}
@@ -161,8 +279,7 @@
HRESULT STDMETHODCALLTYPE CExplorerBand::IsWindowOwner(HWND hWnd)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ return (hWnd == m_hWnd) ? S_OK : S_FALSE;
}
// *** IBandNavigate methods ***
Modified: trunk/reactos/dll/win32/browseui/explorerband.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/explore…
==============================================================================
--- trunk/reactos/dll/win32/browseui/explorerband.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/explorerband.h [iso-8859-1] Wed Jun 1 21:12:17 2016
@@ -29,6 +29,17 @@
LPITEMIDLIST relativePidl;
BOOL expanded;
};
+
+ // *** BaseBarSite information ***
+ CComPtr<IUnknown> pSite;
+
+ // *** tree explorer band stuff ***
+ BOOL fVisible;
+ BOOL bFocused;
+ DWORD dwBandID;
+
+ void InitializeExplorerBand();
+ void DestroyExplorerBand();
public:
CExplorerBand();
Modified: trunk/reactos/dll/win32/browseui/shellbrowser.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellbr…
==============================================================================
--- trunk/reactos/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Wed Jun 1 21:12:17
2016
@@ -24,7 +24,7 @@
#include <htiframe.h>
#include <strsafe.h>
-#define USE_CUSTOM_EXPLORERBAND 0
+#define USE_CUSTOM_EXPLORERBAND 1
extern HRESULT IUnknown_ShowDW(IUnknown * punk, BOOL fShow);
@@ -1237,9 +1237,23 @@
if (!IsBandLoaded(classID, vertical, &dwBandID))
{
- hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IUnknown, &newBand));
- if (FAILED_UNEXPECTEDLY(hResult))
- return hResult;
+#if USE_CUSTOM_EXPLORERBAND
+ 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))
+ return hResult;
+ }
+ else
+#endif
+ {
+ TRACE("A different CLSID requested, using CoCreateInstance.\n");
+ hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IUnknown, &newBand));
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ }
}
else
{