mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[BROWSEUI]
* Begin implementing resizing of the rebar. * Begin implementing the addressbar function. For now, the current folder path is displayed. No icon, no parsing support, no combo dropdown list. CORE-8173 svn path=/branches/shell-experiments/; revision=63156
This commit is contained in:
parent
8c3a5f9b93
commit
6005af09db
8 changed files with 285 additions and 55 deletions
|
@ -24,6 +24,8 @@ Implements the navigation band of the cabinet window
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
|
HRESULT CreateAddressEditBox(REFIID riid, void **ppv);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO:
|
TODO:
|
||||||
****Add command handler for show/hide Go button to OnWinEvent
|
****Add command handler for show/hide Go button to OnWinEvent
|
||||||
|
@ -45,6 +47,7 @@ CAddressBand::CAddressBand()
|
||||||
fGoButton = NULL;
|
fGoButton = NULL;
|
||||||
fComboBox = NULL;
|
fComboBox = NULL;
|
||||||
fGoButtonShown = false;
|
fGoButtonShown = false;
|
||||||
|
fAdviseCookie = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAddressBand::~CAddressBand()
|
CAddressBand::~CAddressBand()
|
||||||
|
@ -97,6 +100,8 @@ HRESULT STDMETHODCALLTYPE CAddressBand::GetBandInfo(DWORD dwBandID, DWORD dwView
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
|
HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
|
||||||
{
|
{
|
||||||
|
CComPtr<IBrowserService> browserService;
|
||||||
|
CComPtr<IOleWindow> oleWindow;
|
||||||
CComPtr<IShellService> shellService;
|
CComPtr<IShellService> shellService;
|
||||||
CComPtr<IUnknown> offset34;
|
CComPtr<IUnknown> offset34;
|
||||||
HWND parentWindow;
|
HWND parentWindow;
|
||||||
|
@ -107,9 +112,14 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
|
||||||
HINSTANCE shellInstance;
|
HINSTANCE shellInstance;
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
|
|
||||||
fSite.Release();
|
|
||||||
if (pUnkSite == NULL)
|
if (pUnkSite == NULL)
|
||||||
|
{
|
||||||
|
hResult = AtlUnadvise(fSite, DIID_DWebBrowserEvents, fAdviseCookie);
|
||||||
|
fSite.Release();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
fSite.Release();
|
||||||
|
|
||||||
hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &fSite));
|
hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &fSite));
|
||||||
if (FAILED(hResult))
|
if (FAILED(hResult))
|
||||||
|
@ -138,11 +148,16 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
|
||||||
#if 1
|
#if 1
|
||||||
hResult = CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER,
|
hResult = CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER,
|
||||||
IID_PPV_ARG(IAddressEditBox, &fAddressEditBox));
|
IID_PPV_ARG(IAddressEditBox, &fAddressEditBox));
|
||||||
|
#else
|
||||||
|
hResult = E_FAIL;
|
||||||
|
#endif
|
||||||
|
if (FAILED(hResult))
|
||||||
|
{
|
||||||
|
// instantiate new version
|
||||||
|
hResult = CreateAddressEditBox(IID_PPV_ARG(IAddressEditBox, &fAddressEditBox));
|
||||||
if (FAILED(hResult))
|
if (FAILED(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
#else
|
}
|
||||||
// instantiate new version
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IShellService, &shellService));
|
hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IShellService, &shellService));
|
||||||
if (FAILED(hResult))
|
if (FAILED(hResult))
|
||||||
|
@ -169,12 +184,22 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
|
||||||
0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
|
0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
|
||||||
SendMessage(fGoButton, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
SendMessage(fGoButton, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
||||||
SendMessage(fGoButton, TB_SETMAXTEXTROWS, 1, 0);
|
SendMessage(fGoButton, TB_SETMAXTEXTROWS, 1, 0);
|
||||||
|
if (normalImagelist)
|
||||||
SendMessage(fGoButton, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(normalImagelist));
|
SendMessage(fGoButton, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(normalImagelist));
|
||||||
|
if (hotImageList)
|
||||||
SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0, reinterpret_cast<LPARAM>(hotImageList));
|
SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0, reinterpret_cast<LPARAM>(hotImageList));
|
||||||
SendMessage(fGoButton, TB_ADDSTRINGW,
|
SendMessage(fGoButton, TB_ADDSTRINGW,
|
||||||
reinterpret_cast<WPARAM>(_AtlBaseModule.GetResourceInstance()), IDS_GOBUTTONLABEL);
|
reinterpret_cast<WPARAM>(_AtlBaseModule.GetResourceInstance()), IDS_GOBUTTONLABEL);
|
||||||
SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM)&buttonInfo);
|
SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM)&buttonInfo);
|
||||||
|
|
||||||
|
// take advice to watch events
|
||||||
|
hResult = IUnknown_QueryService(pUnkSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService));
|
||||||
|
if (SUCCEEDED(hResult))
|
||||||
|
{
|
||||||
|
if (SUCCEEDED(hResult))
|
||||||
|
hResult = AtlAdvise(browserService, static_cast<IDispatch *>(this), DIID_DWebBrowserEvents, &fAdviseCookie);
|
||||||
|
}
|
||||||
|
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,12 +404,65 @@ HRESULT STDMETHODCALLTYPE CAddressBand::GetSizeMax(ULARGE_INTEGER *pcbSize)
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE CAddressBand::GetTypeInfoCount(UINT *pctinfo)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE CAddressBand::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE CAddressBand::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames,
|
||||||
|
LCID lcid, DISPID *rgDispId)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE CAddressBand::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
|
||||||
|
DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||||
|
{
|
||||||
|
CComPtr<IBrowserService> isb;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
if (pDispParams == NULL)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
switch (dispIdMember)
|
||||||
|
{
|
||||||
|
case DISPID_NAVIGATECOMPLETE2:
|
||||||
|
case DISPID_DOCUMENTCOMPLETE:
|
||||||
|
hr = IUnknown_QueryService(fSite, SID_STopLevelBrowser, IID_PPV_ARG(IBrowserService, &isb));
|
||||||
|
if (FAILED(hr))
|
||||||
|
return hr;
|
||||||
|
PIDLIST_ABSOLUTE absolutePIDL;
|
||||||
|
LPCITEMIDLIST pidlChild;
|
||||||
|
isb->GetPidl(&absolutePIDL);
|
||||||
|
|
||||||
|
CComPtr<IShellFolder> sf;
|
||||||
|
SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf), &pidlChild);
|
||||||
|
|
||||||
|
STRRET ret;
|
||||||
|
sf->GetDisplayNameOf(pidlChild, SHGDN_FORADDRESSBAR | SHGDN_FORPARSING, &ret);
|
||||||
|
|
||||||
|
WCHAR buf[4096];
|
||||||
|
StrRetToBufW(&ret, pidlChild, buf, 4095);
|
||||||
|
|
||||||
|
fAddressEditBox->SetCurrentDir(reinterpret_cast<long>(buf));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT CAddressBand::OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL &bHandled)
|
LRESULT CAddressBand::OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL &bHandled)
|
||||||
{
|
{
|
||||||
if (notifyHeader->hwndFrom == fGoButton)
|
if (notifyHeader->hwndFrom == fGoButton)
|
||||||
{
|
{
|
||||||
SendMessage(fEditControl, WM_KEYDOWN, 13, 0);
|
fAddressEditBox->ParseNow(0);
|
||||||
SendMessage(fEditControl, WM_KEYUP, 13, 0);
|
//SendMessage(fEditControl, WM_KEYDOWN, 13, 0);
|
||||||
|
//SendMessage(fEditControl, WM_KEYUP, 13, 0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,8 @@ class CAddressBand :
|
||||||
public IServiceProvider,
|
public IServiceProvider,
|
||||||
public IWinEventHandler,
|
public IWinEventHandler,
|
||||||
public IAddressBand,
|
public IAddressBand,
|
||||||
public IInputObjectSite
|
public IInputObjectSite,
|
||||||
|
public IDispatch
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CComPtr<IDockingWindowSite> fSite;
|
CComPtr<IDockingWindowSite> fSite;
|
||||||
|
@ -41,6 +42,7 @@ private:
|
||||||
HWND fGoButton;
|
HWND fGoButton;
|
||||||
HWND fComboBox;
|
HWND fComboBox;
|
||||||
bool fGoButtonShown;
|
bool fGoButtonShown;
|
||||||
|
DWORD fAdviseCookie;
|
||||||
public:
|
public:
|
||||||
CAddressBand();
|
CAddressBand();
|
||||||
~CAddressBand();
|
~CAddressBand();
|
||||||
|
@ -95,6 +97,12 @@ public:
|
||||||
virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
|
virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
|
||||||
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
|
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
|
||||||
|
|
||||||
|
// *** IDispatch methods ***
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
|
||||||
|
|
||||||
// message handlers
|
// message handlers
|
||||||
LRESULT OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL &bHandled);
|
LRESULT OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL &bHandled);
|
||||||
LRESULT OnTipText(UINT idControl, NMHDR *notifyHeader, BOOL &bHandled);
|
LRESULT OnTipText(UINT idControl, NMHDR *notifyHeader, BOOL &bHandled);
|
||||||
|
@ -128,5 +136,6 @@ public:
|
||||||
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
|
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
|
||||||
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
|
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
|
||||||
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
|
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
|
||||||
|
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
|
||||||
END_COM_MAP()
|
END_COM_MAP()
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,8 +40,7 @@ TODO:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CAddressEditBox::CAddressEditBox() :
|
CAddressEditBox::CAddressEditBox() :
|
||||||
fEditWindow(NULL, this, 1),
|
fEditWindow(NULL, this, 1)
|
||||||
fComboBoxExWindow(NULL, this, 2)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +56,8 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::SetOwner(IUnknown *)
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CAddressEditBox::FileSysChange(long param8, long paramC)
|
HRESULT STDMETHODCALLTYPE CAddressEditBox::FileSysChange(long param8, long paramC)
|
||||||
{
|
{
|
||||||
|
LPWSTR str8 = reinterpret_cast<LPWSTR>(param8);
|
||||||
|
LPWSTR strC = reinterpret_cast<LPWSTR>(paramC);
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,13 +68,15 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Refresh(long param8)
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CAddressEditBox::Init(HWND comboboxEx, HWND editControl, long param14, IUnknown *param18)
|
HRESULT STDMETHODCALLTYPE CAddressEditBox::Init(HWND comboboxEx, HWND editControl, long param14, IUnknown *param18)
|
||||||
{
|
{
|
||||||
fComboBoxExWindow.SubclassWindow(comboboxEx);
|
SubclassWindow(comboboxEx);
|
||||||
fEditWindow.SubclassWindow(editControl);
|
fEditWindow.SubclassWindow(editControl);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CAddressEditBox::SetCurrentDir(long paramC)
|
HRESULT STDMETHODCALLTYPE CAddressEditBox::SetCurrentDir(long paramC)
|
||||||
{
|
{
|
||||||
|
LPWSTR strC = reinterpret_cast<LPWSTR>(paramC);
|
||||||
|
fEditWindow.SetWindowText(strC);
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +170,25 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::GetSizeMax(ULARGE_INTEGER *pcbSize)
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT CAddressEditBox::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
|
{
|
||||||
|
bHandled = FALSE;
|
||||||
|
/*
|
||||||
|
RECT rc;
|
||||||
|
GetClientRect(&rc);
|
||||||
|
rc.left += 24;
|
||||||
|
rc.top += 4;
|
||||||
|
rc.right -= 4;
|
||||||
|
rc.bottom -= 4;
|
||||||
|
fEditWindow.SetWindowPos(NULL,
|
||||||
|
rc.left, rc.top,
|
||||||
|
rc.right - rc.left,
|
||||||
|
rc.bottom - rc.top,
|
||||||
|
SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT CreateAddressEditBox(REFIID riid, void **ppv)
|
HRESULT CreateAddressEditBox(REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
CComObject<CAddressEditBox> *theMenuBar;
|
CComObject<CAddressEditBox> *theMenuBar;
|
||||||
|
|
|
@ -34,7 +34,6 @@ class CAddressEditBox :
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CContainedWindow fEditWindow;
|
CContainedWindow fEditWindow;
|
||||||
CContainedWindow fComboBoxExWindow;
|
|
||||||
public:
|
public:
|
||||||
CAddressEditBox();
|
CAddressEditBox();
|
||||||
~CAddressEditBox();
|
~CAddressEditBox();
|
||||||
|
@ -80,6 +79,7 @@ public:
|
||||||
// message handlers
|
// message handlers
|
||||||
// LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
// LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
// LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
// LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
|
||||||
DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSEDITBOX)
|
DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSEDITBOX)
|
||||||
DECLARE_NOT_AGGREGATABLE(CAddressEditBox)
|
DECLARE_NOT_AGGREGATABLE(CAddressEditBox)
|
||||||
|
@ -94,6 +94,7 @@ public:
|
||||||
// MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSaveButton)
|
// MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSaveButton)
|
||||||
// ALT_MSG_MAP(2)
|
// ALT_MSG_MAP(2)
|
||||||
// MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSelectButton)
|
// MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSelectButton)
|
||||||
|
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
BEGIN_COM_MAP(CAddressEditBox)
|
BEGIN_COM_MAP(CAddressEditBox)
|
||||||
|
|
|
@ -25,6 +25,10 @@ toolbar, and address band for an explorer window
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
|
/* FIXME, I can't include windowsx because it conflicts with some #defines */
|
||||||
|
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
|
||||||
|
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
|
||||||
|
|
||||||
#define USE_CUSTOM_MENUBAND 1
|
#define USE_CUSTOM_MENUBAND 1
|
||||||
|
|
||||||
// navigation controls and menubar just send a message to parent window
|
// navigation controls and menubar just send a message to parent window
|
||||||
|
@ -514,33 +518,24 @@ void CInternetToolbar::AddDockItem(IUnknown *newItem, int bandID, int flags)
|
||||||
newSite->Initialize(newItem, this, fMainReBar, bandID, flags);
|
newSite->Initialize(newItem, this, fMainReBar, bandID, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CInternetToolbar::ReserveBorderSpace()
|
HRESULT CInternetToolbar::ReserveBorderSpace(LONG maxHeight)
|
||||||
{
|
{
|
||||||
CComPtr<IDockingWindowSite> dockingWindowSite;
|
CComPtr<IDockingWindowSite> dockingWindowSite;
|
||||||
RECT availableBorderSpace;
|
RECT availableBorderSpace;
|
||||||
RECT neededBorderSpace;
|
|
||||||
HRESULT hResult;
|
|
||||||
|
|
||||||
hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite));
|
HRESULT hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite));
|
||||||
if (FAILED(hResult))
|
if (FAILED(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
hResult = dockingWindowSite->GetBorderDW(static_cast<IDockingWindow *>(this), &availableBorderSpace);
|
hResult = dockingWindowSite->GetBorderDW(static_cast<IDockingWindow *>(this), &availableBorderSpace);
|
||||||
if (FAILED(hResult))
|
if (FAILED(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
SendMessage(fMainReBar, RB_SIZETORECT, RBSTR_CHANGERECT, reinterpret_cast<LPARAM>(&availableBorderSpace));
|
|
||||||
// RBSTR_CHANGERECT does not seem to set the proper size in the rect.
|
if (availableBorderSpace.top > maxHeight)
|
||||||
// Let's make sure we fetch the actual size properly.
|
{
|
||||||
GetWindowRect(fMainReBar, &availableBorderSpace);
|
availableBorderSpace.top = maxHeight;
|
||||||
neededBorderSpace.left = 0;
|
}
|
||||||
neededBorderSpace.top = availableBorderSpace.bottom - availableBorderSpace.top;
|
|
||||||
if (!fLocked)
|
return ResizeBorderDW(&availableBorderSpace, fSite, FALSE);
|
||||||
neededBorderSpace.top += 3;
|
|
||||||
neededBorderSpace.right = 0;
|
|
||||||
neededBorderSpace.bottom = 0;
|
|
||||||
hResult = dockingWindowSite->SetBorderSpaceDW(static_cast<IDockingWindow *>(this), &neededBorderSpace);
|
|
||||||
if (FAILED(hResult))
|
|
||||||
return hResult;
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **menuBar)
|
HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **menuBar)
|
||||||
|
@ -784,7 +779,36 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::CloseDW(DWORD dwReserved)
|
||||||
HRESULT STDMETHODCALLTYPE CInternetToolbar::ResizeBorderDW(LPCRECT prcBorder,
|
HRESULT STDMETHODCALLTYPE CInternetToolbar::ResizeBorderDW(LPCRECT prcBorder,
|
||||||
IUnknown *punkToolbarSite, BOOL fReserved)
|
IUnknown *punkToolbarSite, BOOL fReserved)
|
||||||
{
|
{
|
||||||
return E_NOTIMPL;
|
RECT neededBorderSpace;
|
||||||
|
RECT availableBorderSpace = *prcBorder;
|
||||||
|
|
||||||
|
SendMessage(fMainReBar, RB_SIZETORECT, RBSTR_CHANGERECT, reinterpret_cast<LPARAM>(&availableBorderSpace));
|
||||||
|
|
||||||
|
// RBSTR_CHANGERECT does not seem to set the proper size in the rect.
|
||||||
|
// Let's make sure we fetch the actual size properly.
|
||||||
|
GetWindowRect(fMainReBar, &availableBorderSpace);
|
||||||
|
neededBorderSpace.left = 0;
|
||||||
|
neededBorderSpace.top = availableBorderSpace.bottom - availableBorderSpace.top;
|
||||||
|
if (!fLocked)
|
||||||
|
neededBorderSpace.top += 3;
|
||||||
|
neededBorderSpace.right = 0;
|
||||||
|
neededBorderSpace.bottom = 0;
|
||||||
|
|
||||||
|
CComPtr<IDockingWindowSite> dockingWindowSite;
|
||||||
|
|
||||||
|
HRESULT hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite));
|
||||||
|
if (FAILED(hResult))
|
||||||
|
return hResult;
|
||||||
|
|
||||||
|
hResult = dockingWindowSite->RequestBorderSpaceDW(static_cast<IDockingWindow *>(this), &neededBorderSpace);
|
||||||
|
if (FAILED(hResult))
|
||||||
|
return hResult;
|
||||||
|
|
||||||
|
hResult = dockingWindowSite->SetBorderSpaceDW(static_cast<IDockingWindow *>(this), &neededBorderSpace);
|
||||||
|
if (FAILED(hResult))
|
||||||
|
return hResult;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CInternetToolbar::GetClassID(CLSID *pClassID)
|
HRESULT STDMETHODCALLTYPE CInternetToolbar::GetClassID(CLSID *pClassID)
|
||||||
|
@ -830,8 +854,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
|
||||||
hResult = CreateMenuBar(&menuBar);
|
hResult = CreateMenuBar(&menuBar);
|
||||||
if (FAILED(hResult))
|
if (FAILED(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
AddDockItem(menuBar, ITBBID_MENUBAND,
|
AddDockItem(menuBar, ITBBID_MENUBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
|
||||||
CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
|
|
||||||
|
|
||||||
hResult = menuBar->QueryInterface(IID_PPV_ARG(IOleWindow, &menuOleWindow));
|
hResult = menuBar->QueryInterface(IID_PPV_ARG(IOleWindow, &menuOleWindow));
|
||||||
hResult = menuOleWindow->GetWindow(&fMenuBandWindow);
|
hResult = menuOleWindow->GetWindow(&fMenuBandWindow);
|
||||||
|
@ -841,8 +864,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
|
||||||
hResult = CreateBrandBand(&logoBar);
|
hResult = CreateBrandBand(&logoBar);
|
||||||
if (FAILED(hResult))
|
if (FAILED(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
AddDockItem(logoBar, ITBBID_BRANDBAND,
|
AddDockItem(logoBar, ITBBID_BRANDBAND, CDockSite::ITF_NOGRIPPER | CDockSite::ITF_NOTITLE | CDockSite::ITF_FIXEDSIZE);
|
||||||
CDockSite::ITF_NOGRIPPER | CDockSite::ITF_NOTITLE | CDockSite::ITF_FIXEDSIZE);
|
|
||||||
fLogoBar.Attach(logoBar.Detach()); // transfer the ref count
|
fLogoBar.Attach(logoBar.Detach()); // transfer the ref count
|
||||||
|
|
||||||
/* Create and attach the standard toolbar to the rebar */
|
/* Create and attach the standard toolbar to the rebar */
|
||||||
|
@ -1184,7 +1206,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::OnWinEvent(
|
||||||
if (fMenuBar)
|
if (fMenuBar)
|
||||||
{
|
{
|
||||||
hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IWinEventHandler, &menuWinEventHandler));
|
hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IWinEventHandler, &menuWinEventHandler));
|
||||||
if (menuWinEventHandler->IsWindowOwner(hWnd))
|
if (menuWinEventHandler->IsWindowOwner(hWnd) == S_OK)
|
||||||
{
|
{
|
||||||
return menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam, lParam, theResult);
|
return menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam, lParam, theResult);
|
||||||
}
|
}
|
||||||
|
@ -1661,6 +1683,66 @@ LRESULT CInternetToolbar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT CInternetToolbar::OnLDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
|
{
|
||||||
|
bHandled = FALSE;
|
||||||
|
if (fLocked)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (wParam & MK_CONTROL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
fSizing = TRUE;
|
||||||
|
|
||||||
|
DWORD msgp = GetMessagePos();
|
||||||
|
|
||||||
|
fStartPosition.x = GET_X_LPARAM(msgp);
|
||||||
|
fStartPosition.y = GET_Y_LPARAM(msgp);
|
||||||
|
|
||||||
|
RECT rc;
|
||||||
|
GetWindowRect(m_hWnd, &rc);
|
||||||
|
|
||||||
|
fStartHeight = rc.bottom - rc.top;
|
||||||
|
|
||||||
|
SetCapture();
|
||||||
|
|
||||||
|
bHandled = TRUE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CInternetToolbar::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
|
{
|
||||||
|
bHandled = FALSE;
|
||||||
|
if (!fSizing)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
DWORD msgp = GetMessagePos();
|
||||||
|
|
||||||
|
POINT pt;
|
||||||
|
pt.x = GET_X_LPARAM(msgp);
|
||||||
|
pt.y = GET_Y_LPARAM(msgp);
|
||||||
|
|
||||||
|
ReserveBorderSpace(fStartHeight - fStartPosition.y + pt.y);
|
||||||
|
|
||||||
|
bHandled = TRUE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CInternetToolbar::OnLUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
|
{
|
||||||
|
bHandled = FALSE;
|
||||||
|
if (!fSizing)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
OnMouseMove(uMsg, wParam, lParam, bHandled);
|
||||||
|
|
||||||
|
fSizing = FALSE;
|
||||||
|
|
||||||
|
ReleaseCapture();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT CreateInternetToolbar(REFIID riid, void **ppv)
|
HRESULT CreateInternetToolbar(REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
CComObject<CInternetToolbar> *theToolbar;
|
CComObject<CInternetToolbar> *theToolbar;
|
||||||
|
|
|
@ -96,11 +96,14 @@ public:
|
||||||
HWND fToolbarWindow;
|
HWND fToolbarWindow;
|
||||||
DWORD fAdviseCookie;
|
DWORD fAdviseCookie;
|
||||||
CComPtr<IBandProxy> fBandProxy;
|
CComPtr<IBandProxy> fBandProxy;
|
||||||
|
BOOL fSizing;
|
||||||
|
POINT fStartPosition;
|
||||||
|
LONG fStartHeight;
|
||||||
public:
|
public:
|
||||||
CInternetToolbar();
|
CInternetToolbar();
|
||||||
~CInternetToolbar();
|
~CInternetToolbar();
|
||||||
void AddDockItem(IUnknown *newItem, int bandID, int flags);
|
void AddDockItem(IUnknown *newItem, int bandID, int flags);
|
||||||
HRESULT ReserveBorderSpace();
|
HRESULT ReserveBorderSpace(LONG maxHeight = -1);
|
||||||
HRESULT CreateMenuBar(IShellMenu **menuBar);
|
HRESULT CreateMenuBar(IShellMenu **menuBar);
|
||||||
HRESULT CreateBrandBand(IUnknown **logoBar);
|
HRESULT CreateBrandBand(IUnknown **logoBar);
|
||||||
HRESULT CreateToolsBar(IUnknown **toolsBar);
|
HRESULT CreateToolsBar(IUnknown **toolsBar);
|
||||||
|
@ -198,6 +201,9 @@ public:
|
||||||
LRESULT OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandled);
|
LRESULT OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandled);
|
||||||
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
LRESULT OnLDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
LRESULT OnLUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
|
||||||
BEGIN_MSG_MAP(CInternetToolbar)
|
BEGIN_MSG_MAP(CInternetToolbar)
|
||||||
COMMAND_ID_HANDLER(gBackCommandID, OnTravelBack)
|
COMMAND_ID_HANDLER(gBackCommandID, OnTravelBack)
|
||||||
|
@ -215,6 +221,9 @@ public:
|
||||||
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
|
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
|
||||||
NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText)
|
NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText)
|
||||||
MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
|
MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
|
||||||
|
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLDown)
|
||||||
|
MESSAGE_HANDLER(WM_LBUTTONUP, OnLUp)
|
||||||
|
MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
DECLARE_REGISTRY_RESOURCEID(IDR_INTERNETTOOLBAR)
|
DECLARE_REGISTRY_RESOURCEID(IDR_INTERNETTOOLBAR)
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
BOOL WINAPI Shell_GetImageLists(
|
BOOL WINAPI Shell_GetImageLists(
|
||||||
_In_ HIMAGELIST *phiml,
|
_Out_ HIMAGELIST *phiml,
|
||||||
_In_ HIMAGELIST *phimlSmall
|
_Out_ HIMAGELIST *phimlSmall
|
||||||
);
|
);
|
||||||
|
|
||||||
#include "newatlinterfaces.h"
|
#include "newatlinterfaces.h"
|
||||||
|
@ -200,8 +200,8 @@ HRESULT WINAPI SHBindToFolder(LPCITEMIDLIST path, IShellFolder **newFolder)
|
||||||
{
|
{
|
||||||
CComPtr<IShellFolder> desktop;
|
CComPtr<IShellFolder> desktop;
|
||||||
|
|
||||||
::SHGetDesktopFolder(&desktop);
|
HRESULT hr = ::SHGetDesktopFolder(&desktop);
|
||||||
if (desktop == NULL)
|
if (FAILED(hr))
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
if (path == NULL || path->mkid.cb == 0)
|
if (path == NULL || path->mkid.cb == 0)
|
||||||
{
|
{
|
||||||
|
@ -1361,26 +1361,43 @@ void CShellBrowser::RepositionBars()
|
||||||
if (borderSpace.top != 0)
|
if (borderSpace.top != 0)
|
||||||
{
|
{
|
||||||
toolbarRect.bottom = toolbarRect.top + borderSpace.top;
|
toolbarRect.bottom = toolbarRect.top + borderSpace.top;
|
||||||
clientRect.top += borderSpace.top;
|
|
||||||
}
|
}
|
||||||
else if (borderSpace.bottom != 0)
|
else if (borderSpace.bottom != 0)
|
||||||
{
|
{
|
||||||
toolbarRect.top = toolbarRect.bottom - borderSpace.bottom;
|
toolbarRect.top = toolbarRect.bottom - borderSpace.bottom;
|
||||||
clientRect.bottom -= borderSpace.bottom;
|
|
||||||
}
|
}
|
||||||
if (borderSpace.left != 0)
|
else if (borderSpace.left != 0)
|
||||||
{
|
{
|
||||||
toolbarRect.right = toolbarRect.left + borderSpace.left;
|
toolbarRect.right = toolbarRect.left + borderSpace.left;
|
||||||
clientRect.left += borderSpace.left;
|
|
||||||
}
|
}
|
||||||
else if (borderSpace.right != 0)
|
else if (borderSpace.right != 0)
|
||||||
{
|
{
|
||||||
toolbarRect.left = toolbarRect.right - borderSpace.right;
|
toolbarRect.left = toolbarRect.right - borderSpace.right;
|
||||||
clientRect.right -= borderSpace.right;
|
|
||||||
}
|
}
|
||||||
::SetWindowPos(hwnd, NULL, toolbarRect.left, toolbarRect.top,
|
|
||||||
|
::SetWindowPos(hwnd, NULL,
|
||||||
|
toolbarRect.left,
|
||||||
|
toolbarRect.top,
|
||||||
toolbarRect.right - toolbarRect.left,
|
toolbarRect.right - toolbarRect.left,
|
||||||
toolbarRect.bottom - toolbarRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
|
toolbarRect.bottom - toolbarRect.top,
|
||||||
|
SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||||
|
|
||||||
|
if (borderSpace.top != 0)
|
||||||
|
{
|
||||||
|
clientRect.top = toolbarRect.bottom;
|
||||||
|
}
|
||||||
|
else if (borderSpace.bottom != 0)
|
||||||
|
{
|
||||||
|
clientRect.bottom = toolbarRect.top;
|
||||||
|
}
|
||||||
|
else if (borderSpace.left != 0)
|
||||||
|
{
|
||||||
|
clientRect.left = toolbarRect.right;
|
||||||
|
}
|
||||||
|
else if (borderSpace.right != 0)
|
||||||
|
{
|
||||||
|
clientRect.right = toolbarRect.left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
::SetWindowPos(fCurrentShellViewWindow, NULL, clientRect.left, clientRect.top,
|
::SetWindowPos(fCurrentShellViewWindow, NULL, clientRect.left, clientRect.top,
|
||||||
|
@ -1589,9 +1606,10 @@ bool IUnknownIsEqual(IUnknown *int1, IUnknown *int2)
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CShellBrowser::GetBorderDW(IUnknown *punkObj, LPRECT prcBorder)
|
HRESULT STDMETHODCALLTYPE CShellBrowser::GetBorderDW(IUnknown *punkObj, LPRECT prcBorder)
|
||||||
{
|
{
|
||||||
RECT availableBounds;
|
|
||||||
static const INT excludeItems[] = { 1, 1, 1, 0xa001, 0, 0 };
|
static const INT excludeItems[] = { 1, 1, 1, 0xa001, 0, 0 };
|
||||||
|
|
||||||
|
RECT availableBounds;
|
||||||
|
|
||||||
GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
|
GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
|
||||||
for (INT x = 0; x < 3; x++)
|
for (INT x = 0; x < 3; x++)
|
||||||
{
|
{
|
||||||
|
@ -1853,6 +1871,15 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::RemoveMenusSB(HMENU hmenuShared)
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CShellBrowser::SetStatusTextSB(LPCOLESTR pszStatusText)
|
HRESULT STDMETHODCALLTYPE CShellBrowser::SetStatusTextSB(LPCOLESTR pszStatusText)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
if (pszStatusText)
|
||||||
|
{
|
||||||
|
::SetWindowText(fStatusBar, pszStatusText);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2041,7 +2068,9 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::GetTravelLog(ITravelLog **pptl)
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
|
|
||||||
// called by toolbar when displaying tooltips
|
// called by toolbar when displaying tooltips
|
||||||
if (pptl != NULL)
|
if (pptl == NULL)
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
*pptl = NULL;
|
*pptl = NULL;
|
||||||
if (fTravelLog.p == NULL)
|
if (fTravelLog.p == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -125,7 +125,7 @@ HRESULT CTravelEntry::GetToolTipText(IUnknown *punk, LPWSTR pwzText) const
|
||||||
{
|
{
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
|
|
||||||
hResult = ILGetDisplayNameEx(NULL, fPIDL, pwzText, ILGDN_NORMAL);
|
hResult = ILGetDisplayNameEx(NULL, fPIDL, pwzText, ILGDN_NORMAL) ? S_OK : S_FALSE;
|
||||||
if (FAILED(hResult))
|
if (FAILED(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
Loading…
Reference in a new issue