xref: /reactos/dll/win32/browseui/addressband.h (revision d6eebaa4)
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     STDMETHOD(GetBandInfo)(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi) override;
56 
57     // *** IObjectWithSite methods ***
58     STDMETHOD(SetSite)(IUnknown *pUnkSite) override;
59     STDMETHOD(GetSite)(REFIID riid, void **ppvSite) override;
60 
61     // *** IOleWindow methods ***
62     STDMETHOD(GetWindow)(HWND *lphwnd) override;
63     STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode) override;
64 
65     // *** IDockingWindow methods ***
66     STDMETHOD(CloseDW)(DWORD dwReserved) override;
67     STDMETHOD(ResizeBorderDW)(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved) override;
68     STDMETHOD(ShowDW)(BOOL fShow) override;
69 
70     // *** IOleCommandTarget methods ***
71     STDMETHOD(QueryStatus)(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[  ], OLECMDTEXT *pCmdText) override;
72     STDMETHOD(Exec)(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override;
73 
74     // *** IInputObject methods ***
75     STDMETHOD(UIActivateIO)(BOOL fActivate, LPMSG lpMsg) override;
76     STDMETHOD(HasFocusIO)() override;
77     STDMETHOD(TranslateAcceleratorIO)(LPMSG lpMsg) override;
78 
79     // *** IWinEventHandler methods ***
80     STDMETHOD(OnWinEvent)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) override;
81     STDMETHOD(IsWindowOwner)(HWND hWnd) override;
82 
83     // *** IAddressBand methods ***
84     STDMETHOD(FileSysChange)(long param8, long paramC) override;
85     STDMETHOD(Refresh)(long param8) override;
86 
87     // *** IServiceProvider methods ***
88     STDMETHOD(QueryService)(REFGUID guidService, REFIID riid, void **ppvObject) override;
89 
90     // *** IInputObjectSite methods ***
91     STDMETHOD(OnFocusChangeIS)(IUnknown *punkObj, BOOL fSetFocus) override;
92 
93     // *** IPersist methods ***
94     STDMETHOD(GetClassID)(CLSID *pClassID) override;
95 
96     // *** IPersistStream methods ***
97     STDMETHOD(IsDirty)() override;
98     STDMETHOD(Load)(IStream *pStm) override;
99     STDMETHOD(Save)(IStream *pStm, BOOL fClearDirty) override;
100     STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSize) override;
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