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 STDMETHOD(SetOwner)(IUnknown *) override; 58 59 // *** IAddressBand methods *** 60 STDMETHOD(FileSysChange)(long param8, long paramC) override; 61 STDMETHOD(Refresh)(long param8) override; 62 63 // *** IAddressEditBox methods *** 64 STDMETHOD(Init)(HWND comboboxEx, HWND editControl, long param14, IUnknown *param18) override; 65 STDMETHOD(SetCurrentDir)(long paramC) override; 66 STDMETHOD(ParseNow)(long paramC) override; 67 STDMETHOD(Execute)(long paramC) override; 68 STDMETHOD(Save)(long paramC) override; 69 70 // *** IWinEventHandler methods *** 71 STDMETHOD(OnWinEvent)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) override; 72 STDMETHOD(IsWindowOwner)(HWND hWnd) override; 73 74 // *** IOleCommandTarget methods *** 75 STDMETHOD(QueryStatus)(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) override; 76 STDMETHOD(Exec)(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override; 77 78 // *** IDispatch methods *** 79 STDMETHOD(GetTypeInfoCount)(UINT *pctinfo) override; 80 STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) override; 81 STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) override; 82 STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) override; 83 84 // *** IPersist methods *** 85 STDMETHOD(GetClassID)(CLSID *pClassID) override; 86 87 // *** IPersistStream methods *** 88 STDMETHOD(IsDirty)() override; 89 STDMETHOD(Load)(IStream *pStm) override; 90 STDMETHOD(Save)(IStream *pStm, BOOL fClearDirty) override; 91 STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSize) override; 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