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 CAddressBand : 24 public CWindowImpl<CAddressBand, CWindow, CControlWinTraits>, 25 public CComCoClass<CAddressBand, &CLSID_SH_AddressBand>, 26 public CComObjectRootEx<CComMultiThreadModelNoCS>, 27 public IDeskBand, 28 public IObjectWithSite, 29 public IInputObject, 30 public IPersistStream, 31 public IOleCommandTarget, 32 public IServiceProvider, 33 public IWinEventHandler, 34 public IAddressBand, 35 public IInputObjectSite 36 { 37 private: 38 CComPtr<IDockingWindowSite> fSite; 39 CComPtr<IAddressEditBox> fAddressEditBox; 40 HWND fEditControl; 41 HWND fGoButton; 42 HWND fComboBox; 43 bool fGoButtonShown; 44 HIMAGELIST m_himlNormal; 45 HIMAGELIST m_himlHot; 46 47 public: 48 CAddressBand(); 49 virtual ~CAddressBand(); 50 private: 51 void FocusChange(BOOL bFocus); 52 void CreateGoButton(); 53 public: 54 // *** IDeskBand methods *** 55 virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi); 56 57 // *** IObjectWithSite methods *** 58 virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite); 59 virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite); 60 61 // *** IOleWindow methods *** 62 virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd); 63 virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); 64 65 // *** IDockingWindow methods *** 66 virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved); 67 virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved); 68 virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow); 69 70 // *** IOleCommandTarget methods *** 71 virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText); 72 virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); 73 74 // *** IInputObject methods *** 75 virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg); 76 virtual HRESULT STDMETHODCALLTYPE HasFocusIO(); 77 virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg); 78 79 // *** IWinEventHandler methods *** 80 virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult); 81 virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd); 82 83 // *** IAddressBand methods *** 84 virtual HRESULT STDMETHODCALLTYPE FileSysChange(long param8, long paramC); 85 virtual HRESULT STDMETHODCALLTYPE Refresh(long param8); 86 87 // *** IServiceProvider methods *** 88 virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); 89 90 // *** IInputObjectSite methods *** 91 virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus); 92 93 // *** IPersist methods *** 94 virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID); 95 96 // *** IPersistStream methods *** 97 virtual HRESULT STDMETHODCALLTYPE IsDirty(); 98 virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm); 99 virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty); 100 virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize); 101 102 // message handlers 103 LRESULT OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL &bHandled); 104 LRESULT OnTipText(UINT idControl, NMHDR *notifyHeader, BOOL &bHandled); 105 LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 106 LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 107 LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 108 109 BEGIN_MSG_MAP(CAddressBand) 110 NOTIFY_CODE_HANDLER(NM_CLICK, OnNotifyClick) 111 NOTIFY_CODE_HANDLER(TBN_GETINFOTIP, OnTipText) 112 MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) 113 MESSAGE_HANDLER(WM_SIZE, OnSize) 114 MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChanging) 115 END_MSG_MAP() 116 117 DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSBAND) 118 DECLARE_NOT_AGGREGATABLE(CAddressBand) 119 120 DECLARE_PROTECT_FINAL_CONSTRUCT() 121 122 BEGIN_COM_MAP(CAddressBand) 123 COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand) 124 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) 125 COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) 126 COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow) 127 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) 128 COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject) 129 COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler) 130 COM_INTERFACE_ENTRY_IID(IID_IAddressBand, IAddressBand) 131 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) 132 COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite) 133 COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) 134 COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) 135 END_COM_MAP() 136 }; 137