xref: /reactos/dll/win32/shdocvw/CExplorerBand.h (revision 5140a990)
1 /*
2  * PROJECT:     ReactOS shdocvw
3  * LICENSE:     LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4  * PURPOSE:     Explorer bar
5  * COPYRIGHT:   Copyright 2016 Sylvain Deverre <deverre dot sylv at gmail dot com>
6  *              Copyright 2020-2024 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
7  */
8 
9 #pragma once
10 
11 #include "CNSCBand.h"
12 
13 class CExplorerBand
14     : public CNSCBand
15     , public CComCoClass<CExplorerBand, &CLSID_ExplorerBand>
16     , public CComObjectRootEx<CComMultiThreadModelNoCS>
17     , public IDispatch
18 {
19 public:
20     CExplorerBand();
21     virtual ~CExplorerBand();
22 
23     STDMETHODIMP GetClassID(CLSID *pClassID) override;
24     STDMETHODIMP OnSelectionChanged(_In_ PCIDLIST_ABSOLUTE pidl) override;
25     STDMETHODIMP Invoke(_In_ PCIDLIST_ABSOLUTE pidl) override;
26 
27     // *** IDispatch methods ***
28     STDMETHODIMP GetTypeInfoCount(UINT *pctinfo) override;
29     STDMETHODIMP GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) override;
30     STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) override;
31     STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) override;
32 
33     DECLARE_REGISTRY_RESOURCEID(IDR_EXPLORERBAND)
34     DECLARE_NOT_AGGREGATABLE(CExplorerBand)
35 
36     DECLARE_PROTECT_FINAL_CONSTRUCT()
37 
38     BEGIN_COM_MAP(CExplorerBand)
39         COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
40         COM_INTERFACE_ENTRY2_IID(IID_IDockingWindow, IDockingWindow, IDeskBand)
41         COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDeskBand)
42         COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
43         COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
44         COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
45         COM_INTERFACE_ENTRY2_IID(IID_IPersist, IPersist, IPersistStream)
46         COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
47         COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
48         COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
49         COM_INTERFACE_ENTRY_IID(IID_IBandNavigate, IBandNavigate)
50         COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
51         COM_INTERFACE_ENTRY_IID(IID_INamespaceProxy, INamespaceProxy)
52         COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
53         COM_INTERFACE_ENTRY2_IID(IID_IUnknown, IUnknown, IDispatch)
54     END_COM_MAP()
55 
56 protected:
57     INT _GetRootCsidl() override;
58     DWORD _GetTVStyle() override;
59     DWORD _GetTVExStyle() override;
60     DWORD _GetEnumFlags() override;
61     HRESULT _CreateTreeView(HWND hwndParent) override;
62     void _DestroyTreeView() override;
63     BOOL _WantsRootItem() override;
64     BOOL _GetTitle(LPWSTR pszTitle, INT cchTitle) override;
65     void _SortItems(HTREEITEM hParent) override;
66     BOOL _NavigateToCurrentFolder();
67     BOOL _NavigateToPIDL(
68         _In_ LPCITEMIDLIST dest,
69         _Out_ HTREEITEM *phItem,
70         _In_ BOOL bExpand,
71         _In_ BOOL bInsert,
72         _In_ BOOL bSelect);
73     static INT CALLBACK _CompareTreeItems(LPARAM p1, LPARAM p2, LPARAM p3); // Used by _SortItems
74 };
75