4 * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 This class handles the combo box of the address band.
26 #include <shlobj_undoc.h>
28 #include <shlguid_undoc.h>
34 #include "addresseditbox.h"
37 Add auto completion support
38 Subclass windows in Init method
39 Connect to browser connection point
40 Handle navigation complete messages to set edit box text
41 Handle listbox dropdown message and fill contents
42 Add drag and drop of icon in edit box
43 Handle enter in edit box to browse to typed path
44 Handle change notifies to update appropriately
45 Add handling of enter in edit box
46 Fix so selection in combo listbox navigates
47 Fix so editing text and typing enter navigates
50 CAddressEditBox::CAddressEditBox() :
51 fEditWindow(NULL
, this, 1),
52 fComboBoxExWindow(NULL
, this, 2)
56 CAddressEditBox::~CAddressEditBox()
60 HRESULT STDMETHODCALLTYPE
CAddressEditBox::SetOwner(IUnknown
*)
62 // connect to browser connection point
66 HRESULT STDMETHODCALLTYPE
CAddressEditBox::FileSysChange(long param8
, long paramC
)
71 HRESULT STDMETHODCALLTYPE
CAddressEditBox::Refresh(long param8
)
76 HRESULT STDMETHODCALLTYPE
CAddressEditBox::Init(HWND comboboxEx
, HWND editControl
, long param14
, IUnknown
*param18
)
78 fComboBoxExWindow
.SubclassWindow(comboboxEx
);
79 fEditWindow
.SubclassWindow(editControl
);
83 HRESULT STDMETHODCALLTYPE
CAddressEditBox::SetCurrentDir(long paramC
)
88 HRESULT STDMETHODCALLTYPE
CAddressEditBox::ParseNow(long paramC
)
93 HRESULT STDMETHODCALLTYPE
CAddressEditBox::Execute(long paramC
)
98 HRESULT STDMETHODCALLTYPE
CAddressEditBox::Save(long paramC
)
103 HRESULT STDMETHODCALLTYPE
CAddressEditBox::OnWinEvent(HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*theResult
)
105 // handle fill of listbox here
109 HRESULT STDMETHODCALLTYPE
CAddressEditBox::IsWindowOwner(HWND hWnd
)
114 HRESULT STDMETHODCALLTYPE
CAddressEditBox::QueryStatus(const GUID
*pguidCmdGroup
, ULONG cCmds
, OLECMD prgCmds
[ ], OLECMDTEXT
*pCmdText
)
119 HRESULT STDMETHODCALLTYPE
CAddressEditBox::Exec(const GUID
*pguidCmdGroup
, DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
124 HRESULT STDMETHODCALLTYPE
CAddressEditBox::GetTypeInfoCount(UINT
*pctinfo
)
129 HRESULT STDMETHODCALLTYPE
CAddressEditBox::GetTypeInfo(UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
134 HRESULT STDMETHODCALLTYPE
CAddressEditBox::GetIDsOfNames(REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
139 HRESULT STDMETHODCALLTYPE
CAddressEditBox::Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
141 // on navigate complete, change edit section of combobox
145 HRESULT STDMETHODCALLTYPE
CAddressEditBox::GetClassID(CLSID
*pClassID
)
147 if (pClassID
== NULL
)
149 *pClassID
= CLSID_AddressEditBox
;
153 HRESULT STDMETHODCALLTYPE
CAddressEditBox::IsDirty()
158 HRESULT STDMETHODCALLTYPE
CAddressEditBox::Load(IStream
*pStm
)
163 HRESULT STDMETHODCALLTYPE
CAddressEditBox::Save(IStream
*pStm
, BOOL fClearDirty
)
168 HRESULT STDMETHODCALLTYPE
CAddressEditBox::GetSizeMax(ULARGE_INTEGER
*pcbSize
)
173 HRESULT
CreateAddressEditBox(REFIID riid
, void **ppv
)
175 CComObject
<CAddressEditBox
> *theMenuBar
;
181 ATLTRY (theMenuBar
= new CComObject
<CAddressEditBox
>);
182 if (theMenuBar
== NULL
)
183 return E_OUTOFMEMORY
;
184 hResult
= theMenuBar
->QueryInterface (riid
, (void **)ppv
);
185 if (FAILED (hResult
))