Author: gadamopoulos
Date: Sat Jul 30 12:47:39 2016
New Revision: 72055
URL:
http://svn.reactos.org/svn/reactos?rev=72055&view=rev
Log:
[BROWSEUI]
- Move handling of DISPID_NAVIGATECOMPLETE2 event from CAddressBand to CAddressEditBox as
the todo comments say it should be.
- Remove the todo entries that are complete.
- Remove IDispatch from CAddressBand as it is not really needed. Now CAddressBand takes
care only of positioning and handling the button while CAddressEditBox does all the
parsing and interaction with the browser.
Modified:
trunk/reactos/dll/win32/browseui/addressband.cpp
trunk/reactos/dll/win32/browseui/addressband.h
trunk/reactos/dll/win32/browseui/addresseditbox.cpp
Modified: trunk/reactos/dll/win32/browseui/addressband.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/address…
==============================================================================
--- trunk/reactos/dll/win32/browseui/addressband.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/addressband.cpp [iso-8859-1] Sat Jul 30 12:47:39
2016
@@ -29,11 +29,8 @@
/*
TODO:
-****Add command handler for show/hide Go button to OnWinEvent
****Add tooltip notify handler
**Properly implement GetBandInfo
- **Add correct text to Go button
- **Implement TranslateAcceleratorIO
Implement Exec
Implement QueryService
Implement Load
@@ -46,7 +43,6 @@
fGoButton = NULL;
fComboBox = NULL;
fGoButtonShown = false;
- fAdviseCookie = 0;
}
CAddressBand::~CAddressBand()
@@ -103,7 +99,6 @@
HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
{
- CComPtr<IBrowserService> browserService;
CComPtr<IShellService> shellService;
HWND parentWindow;
HWND combobox;
@@ -112,7 +107,6 @@
if (pUnkSite == NULL)
{
- hResult = AtlUnadvise(fSite, DIID_DWebBrowserEvents, fAdviseCookie);
fSite.Release();
return S_OK;
}
@@ -170,13 +164,6 @@
fGoButtonShown = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet
Explorer\\Main", L"ShowGoButton", FALSE, TRUE);
if (fGoButtonShown)
CreateGoButton();
-
- // take advice to watch events
- hResult = IUnknown_QueryService(pUnkSite, SID_SShellBrowser,
IID_PPV_ARG(IBrowserService, &browserService));
- if (SUCCEEDED(hResult))
- {
- hResult = AtlAdvise(browserService, static_cast<IDispatch *>(this),
DIID_DWebBrowserEvents, &fAdviseCookie);
- }
return hResult;
}
@@ -398,108 +385,6 @@
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;
- CComPtr<IShellFolder> sf;
- HRESULT hr;
- INT indexClosed, indexOpen, itemExists, oldIndex;
- DWORD result;
- COMBOBOXEXITEMW item;
- PIDLIST_ABSOLUTE absolutePIDL;
- LPCITEMIDLIST pidlChild;
- LPITEMIDLIST pidlPrevious;
- STRRET ret;
- WCHAR buf[4096];
-
- if (pDispParams == NULL)
- return E_INVALIDARG;
-
- switch (dispIdMember)
- {
- case DISPID_NAVIGATECOMPLETE2:
- case DISPID_DOCUMENTCOMPLETE:
-
- oldIndex = SendMessage(m_hWnd, CB_GETCURSEL, 0, 0);
-
- itemExists = FALSE;
- pidlPrevious = NULL;
-
- ZeroMemory(&item, sizeof(item));
- item.mask = CBEIF_LPARAM;
- item.iItem = 0;
- if (SendMessage(m_hWnd, CBEM_GETITEM, 0,
reinterpret_cast<LPARAM>(&item)))
- {
- pidlPrevious = reinterpret_cast<LPITEMIDLIST>(item.lParam);
- if (pidlPrevious)
- itemExists = TRUE;
- }
-
- hr = IUnknown_QueryService(fSite, SID_STopLevelBrowser,
IID_PPV_ARG(IBrowserService, &isb));
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
- isb->GetPidl(&absolutePIDL);
-
- SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf),
&pidlChild);
-
- sf->GetDisplayNameOf(pidlChild, SHGDN_FORADDRESSBAR | SHGDN_FORPARSING,
&ret);
-
- StrRetToBufW(&ret, pidlChild, buf, 4095);
-
- indexClosed = SHMapPIDLToSystemImageListIndex(sf, pidlChild, &indexOpen);
-
- item.mask = CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_TEXT | CBEIF_LPARAM;
- item.iItem = 0;
- item.iImage = indexClosed;
- item.iSelectedImage = indexOpen;
- item.pszText = buf;
- item.lParam = reinterpret_cast<LPARAM>(absolutePIDL);
-
- if (itemExists)
- {
- result = SendMessage(m_hWnd, CBEM_SETITEM, 0,
reinterpret_cast<LPARAM>(&item));
- oldIndex = 0;
-
- if (result)
- {
- ILFree(pidlPrevious);
- }
- }
- else
- {
- oldIndex = SendMessage(m_hWnd, CBEM_INSERTITEM, 0,
reinterpret_cast<LPARAM>(&item));
-
- if (oldIndex < 0)
- DbgPrint("ERROR %d\n", GetLastError());
- }
-
- SendMessage(m_hWnd, CB_SETCURSEL, -1, 0);
- SendMessage(m_hWnd, CB_SETCURSEL, oldIndex, 0);
-
- //fAddressEditBox->SetCurrentDir(index);
-
- break;
- }
- return S_OK;
-}
-
LRESULT CAddressBand::OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL
&bHandled)
{
if (notifyHeader->hwndFrom == fGoButton)
Modified: trunk/reactos/dll/win32/browseui/addressband.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/address…
==============================================================================
--- trunk/reactos/dll/win32/browseui/addressband.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/addressband.h [iso-8859-1] Sat Jul 30 12:47:39 2016
@@ -32,8 +32,7 @@
public IServiceProvider,
public IWinEventHandler,
public IAddressBand,
- public IInputObjectSite,
- public IDispatch
+ public IInputObjectSite
{
private:
CComPtr<IDockingWindowSite> fSite;
@@ -42,7 +41,6 @@
HWND fGoButton;
HWND fComboBox;
bool fGoButtonShown;
- DWORD fAdviseCookie;
public:
CAddressBand();
virtual ~CAddressBand();
@@ -98,12 +96,6 @@
virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
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
LRESULT OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL &bHandled);
LRESULT OnTipText(UINT idControl, NMHDR *notifyHeader, BOOL &bHandled);
@@ -137,6 +129,5 @@
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
- COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
END_COM_MAP()
};
Modified: trunk/reactos/dll/win32/browseui/addresseditbox.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/address…
==============================================================================
--- trunk/reactos/dll/win32/browseui/addresseditbox.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/addresseditbox.cpp [iso-8859-1] Sat Jul 30 12:47:39
2016
@@ -26,17 +26,10 @@
/*
TODO:
- Add auto completion support
- Subclass windows in Init method
- Connect to browser connection point
- Handle navigation complete messages to set edit box text
Handle listbox dropdown message and fill contents
Add drag and drop of icon in edit box
- Handle enter in edit box to browse to typed path
Handle change notifies to update appropriately
- Add handling of enter in edit box
Fix so selection in combo listbox navigates
- Fix so editing text and typing enter navigates
*/
CAddressEditBox::CAddressEditBox() :
@@ -291,6 +284,18 @@
HRESULT STDMETHODCALLTYPE CAddressEditBox::Invoke(DISPID dispIdMember, REFIID riid, LCID
lcid,
WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
UINT *puArgErr)
{
+ CComPtr<IBrowserService> isb;
+ CComPtr<IShellFolder> sf;
+ HRESULT hr;
+ INT indexClosed, indexOpen, itemExists, oldIndex;
+ DWORD result;
+ COMBOBOXEXITEMW item;
+ PIDLIST_ABSOLUTE absolutePIDL;
+ LPCITEMIDLIST pidlChild;
+ LPITEMIDLIST pidlPrevious;
+ STRRET ret;
+ WCHAR buf[4096];
+
if (pDispParams == NULL)
return E_INVALIDARG;
@@ -299,6 +304,64 @@
case DISPID_NAVIGATECOMPLETE2:
case DISPID_DOCUMENTCOMPLETE:
pidlLastParsed = NULL;
+
+ oldIndex = fCombobox.SendMessage(CB_GETCURSEL, 0, 0);
+
+ itemExists = FALSE;
+ pidlPrevious = NULL;
+
+ ZeroMemory(&item, sizeof(item));
+ item.mask = CBEIF_LPARAM;
+ item.iItem = 0;
+ if (fCombobox.SendMessage(CBEM_GETITEM, 0,
reinterpret_cast<LPARAM>(&item)))
+ {
+ pidlPrevious = reinterpret_cast<LPITEMIDLIST>(item.lParam);
+ if (pidlPrevious)
+ itemExists = TRUE;
+ }
+
+ hr = IUnknown_QueryService(fSite, SID_STopLevelBrowser,
IID_PPV_ARG(IBrowserService, &isb));
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+ isb->GetPidl(&absolutePIDL);
+
+ SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf),
&pidlChild);
+
+ sf->GetDisplayNameOf(pidlChild, SHGDN_FORADDRESSBAR | SHGDN_FORPARSING,
&ret);
+
+ StrRetToBufW(&ret, pidlChild, buf, 4095);
+
+ indexClosed = SHMapPIDLToSystemImageListIndex(sf, pidlChild, &indexOpen);
+
+ item.mask = CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_TEXT | CBEIF_LPARAM;
+ item.iItem = 0;
+ item.iImage = indexClosed;
+ item.iSelectedImage = indexOpen;
+ item.pszText = buf;
+ item.lParam = reinterpret_cast<LPARAM>(absolutePIDL);
+
+ if (itemExists)
+ {
+ result = fCombobox.SendMessage(CBEM_SETITEM, 0,
reinterpret_cast<LPARAM>(&item));
+ oldIndex = 0;
+
+ if (result)
+ {
+ ILFree(pidlPrevious);
+ }
+ }
+ else
+ {
+ oldIndex = fCombobox.SendMessage(CBEM_INSERTITEM, 0,
reinterpret_cast<LPARAM>(&item));
+
+ if (oldIndex < 0)
+ DbgPrint("ERROR %d\n", GetLastError());
+ }
+
+ fCombobox.SendMessage(CB_SETCURSEL, -1, 0);
+ fCombobox.SendMessage(CB_SETCURSEL, oldIndex, 0);
+
+ //fAddressEditBox->SetCurrentDir(index);
}
return S_OK;
}