1 /* 2 * ReactOS Explorer 3 * 4 * Copyright 2009 Andrew Hill <ash77 at domain reactos.org> 5 * 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. 10 * 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. 15 * 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 19 */ 20 21 #pragma once 22 23 class CAddressEditBox : 24 public CWindowImpl<CAddressEditBox, CWindow, CControlWinTraits>, 25 public CComCoClass<CAddressEditBox, &CLSID_AddressEditBox>, 26 public CComObjectRootEx<CComMultiThreadModelNoCS>, 27 public IWinEventHandler, 28 public IDispatch, 29 public IAddressBand, 30 public IAddressEditBox, 31 public IOleCommandTarget, 32 public IPersistStream, 33 public IShellService 34 { 35 private: 36 CContainedWindow fCombobox; 37 CContainedWindow fEditWindow; 38 DWORD fAdviseCookie; 39 CComPtr<IUnknown> fSite; 40 LPITEMIDLIST pidlLastParsed; 41 HWND hComboBoxEx; 42 public: 43 CAddressEditBox(); 44 ~CAddressEditBox(); 45 private: 46 void PopulateComboBox(LPITEMIDLIST pidl); 47 void AddComboBoxItem(LPITEMIDLIST pidl, int index, int indent); 48 void FillOneLevel(int index, int levelIndent, int indent); 49 LPITEMIDLIST GetItemData(int index); 50 HRESULT STDMETHODCALLTYPE ShowFileNotFoundError(HRESULT hRet); 51 HRESULT GetAbsolutePidl(PIDLIST_ABSOLUTE *pAbsolutePIDL); 52 BOOL ExecuteCommandLine(); 53 BOOL GetComboBoxText(CComHeapPtr<WCHAR>& pszText); 54 HRESULT RefreshAddress(); 55 public: 56 // *** IShellService methods *** 57 virtual HRESULT STDMETHODCALLTYPE SetOwner(IUnknown *); 58 59 // *** IAddressBand methods *** 60 virtual HRESULT STDMETHODCALLTYPE FileSysChange(long param8, long paramC); 61 virtual HRESULT STDMETHODCALLTYPE Refresh(long param8); 62 63 // *** IAddressEditBox methods *** 64 virtual HRESULT STDMETHODCALLTYPE Init(HWND comboboxEx, HWND editControl, long param14, IUnknown *param18); 65 virtual HRESULT STDMETHODCALLTYPE SetCurrentDir(long paramC); 66 virtual HRESULT STDMETHODCALLTYPE ParseNow(long paramC); 67 virtual HRESULT STDMETHODCALLTYPE Execute(long paramC); 68 virtual HRESULT STDMETHODCALLTYPE Save(long paramC); 69 70 // *** IWinEventHandler methods *** 71 virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult); 72 virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd); 73 74 // *** IOleCommandTarget methods *** 75 virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText); 76 virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); 77 78 // *** IDispatch methods *** 79 virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo); 80 virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo); 81 virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId); 82 virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr); 83 84 // *** IPersist methods *** 85 virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID); 86 87 // *** IPersistStream methods *** 88 virtual HRESULT STDMETHODCALLTYPE IsDirty(); 89 virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm); 90 virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty); 91 virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize); 92 93 // message handlers 94 LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 95 96 DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSEDITBOX) 97 DECLARE_NOT_AGGREGATABLE(CAddressEditBox) 98 99 DECLARE_PROTECT_FINAL_CONSTRUCT() 100 101 BEGIN_MSG_MAP(CAddressEditBox) 102 MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) 103 END_MSG_MAP() 104 105 BEGIN_COM_MAP(CAddressEditBox) 106 COM_INTERFACE_ENTRY_IID(IID_IShellService, IShellService) 107 COM_INTERFACE_ENTRY_IID(IID_IAddressBand, IAddressBand) 108 COM_INTERFACE_ENTRY_IID(IID_IAddressEditBox, IAddressEditBox) 109 COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler) 110 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) 111 COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch) 112 COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) 113 COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) 114 END_COM_MAP() 115 }; 116