ReactOS  0.4.14-dev-838-g99f979d
CBandSite.h
Go to the documentation of this file.
1 /*
2  * Rebar band site
3  *
4  * Copyright 2007 Hervé Poussineau
5  * Copyright 2009 Andrew Hill
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #pragma once
23 
24 extern inline BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
25 {
26  return (pidl == NULL || pidl->mkid.cb == 0);
27 }
28 
30  public CComObjectRootEx<CComMultiThreadModelNoCS>,
31  public IBandSite,
32  public IInputObjectSite,
33  public IInputObject,
34  public IDeskBarClient,
35  public IWinEventHandler,
36  public IPersistStream,
37  public IDropTarget,
38  public IServiceProvider,
39  public IBandSiteHelper,
40  public IOleCommandTarget
41 {
42 private:
43  struct BandObject
44  {
47  IWinEventHandler *WndEvtHandler;
50  };
51 
56  CComPtr<IOleWindow> m_site;
57  DWORD m_dwState; /* BSSF_ flags */
58  DWORD m_dwStyle; /* BSIS_ flags */
59 public:
60  CBandSiteBase();
62 
63  // *** IBandSite methods ***
65  virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD *pdwBandID);
66  virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName);
67  virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState);
68  virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID);
69  virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, void **ppv);
70  virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo(const BANDSITEINFO *pbsinfo);
72 
73  // *** IWinEventHandler methods ***
76 
77  // *** IOleWindow methods ***
78  virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
80 
81  // *** IDeskBarClient methods ***
83  virtual HRESULT STDMETHODCALLTYPE SetModeDBC(DWORD dwMode);
85  virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc);
86 
87  // *** IOleCommandTarget methods ***
88  virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
89  virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
90 
91  // *** IInputObject methods ***
92  virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
95 
96  // *** IInputObjectSite methods ***
97  virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(struct IUnknown *paramC, int param10);
98 
99  // *** IServiceProvider methods ***
100  virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
101 
102  // *** IPersist methods ***
103  virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
104 
105  // *** IPersistStream methods ***
107  virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
108  virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
110 
111  // *** IDropTarget methods ***
112  virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
113  virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
115  virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
116 
117  // *** IBandSiteHelper methods ***
118  virtual HRESULT STDMETHODCALLTYPE LoadFromStreamBS(IStream *, const GUID &, void **);
120 
121 private:
122  UINT _GetBandID(struct BandObject *Band);
123  struct BandObject *_GetBandByID(DWORD dwBandID);
124  void _FreeBand(struct BandObject *Band);
126  VOID _BuildBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi);
127  HRESULT _UpdateBand(struct BandObject *Band);
129  HRESULT _UpdateBand(DWORD dwBandID);
131  HRESULT _IsBandDeletable(DWORD dwBandID);
133 
135  COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
136  COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
138  COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient)
139  COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
140  COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
141  COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
142  COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
145  COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
146  COM_INTERFACE_ENTRY_IID(IID_IBandSiteHelper, IBandSiteHelper)
147  END_COM_MAP()
148 };
149 
150 class CBandSite :
151  public CComCoClass<CBandSite, &CLSID_RebarBandSite>,
152  public CBandSiteBase
153 {
154 public:
155 
158 
160 };
DBIM_BKCOLOR struct tagDESKBANDINFO DESKBANDINFO
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
virtual HRESULT STDMETHODCALLTYPE GetBandSiteInfo(BANDSITEINFO *pbsinfo)
Definition: CBandSite.cpp:692
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
Definition: CBandSite.cpp:947
virtual HRESULT STDMETHODCALLTYPE DragLeave()
Definition: CBandSite.cpp:988
#define REFIID
Definition: guiddef.h:118
LONG m_cBands
Definition: CBandSite.h:52
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize)
Definition: CBandSite.cpp:972
Definition: scsiwmi.h:51
virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName)
Definition: CBandSite.cpp:588
#define pt(x, y)
Definition: drawing.c:79
REFIID riid
Definition: precomp.h:44
const GUID IID_IPersist
Definition: proxy.cpp:14
DWORD m_dwState
Definition: CBandSite.h:57
HRESULT _IsBandDeletable(DWORD dwBandID)
Definition: CBandSite.cpp:241
struct BandObject * m_bands
Definition: CBandSite.h:54
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
VOID _BuildBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi)
Definition: CBandSite.cpp:90
HWND hWnd
Definition: settings.c:17
REFIID LPVOID * ppv
Definition: atlbase.h:39
struct BandObject * _GetBandFromHwnd(HWND hwnd)
Definition: CBandSite.cpp:357
DWORD _GetViewMode()
Definition: CBandSite.cpp:77
UINT_PTR WPARAM
Definition: windef.h:207
#define IDR_BANDSITE
Definition: resource.h:94
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd)
Definition: CBandSite.cpp:777
virtual HRESULT STDMETHODCALLTYPE HasFocusIO()
Definition: CBandSite.cpp:932
WPARAM wParam
Definition: combotst.c:138
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CBandSite.cpp:983
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2723
IOleWindow * OleWindow
Definition: CBandSite.h:46
virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty)
Definition: CBandSite.cpp:967
#define DECLARE_AGGREGATABLE(x)
Definition: atlcom.h:615
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
void _FreeBand(struct BandObject *Band)
Definition: CBandSite.cpp:65
virtual HRESULT STDMETHODCALLTYPE AddBand(IUnknown *punk)
Definition: CBandSite.cpp:402
HWND m_hwndRebar
Definition: CBandSite.h:55
virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite)
Definition: CBandSite.cpp:794
virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID)
Definition: CBandSite.cpp:633
virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CBandSite.cpp:977
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT _OnContextMenu(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plrResult)
Definition: CBandSite.cpp:258
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
virtual HRESULT STDMETHODCALLTYPE UIActivateDBC(DWORD dwState)
Definition: CBandSite.cpp:859
virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD *pdwBandID)
Definition: CBandSite.cpp:559
LONG HRESULT
Definition: typedefs.h:77
virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm)
Definition: CBandSite.cpp:962
virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, void **ppv)
Definition: CBandSite.cpp:662
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
Definition: CBandSite.cpp:877
unsigned long DWORD
Definition: ntddk_ex.h:95
const GUID IID_IPersistStream
Definition: proxy.cpp:13
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(struct IUnknown *paramC, int param10)
Definition: CBandSite.cpp:942
REFIID LPVOID * ppvObject
Definition: precomp.h:44
DWORD m_dwStyle
Definition: CBandSite.h:58
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:605
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg)
Definition: CBandSite.cpp:937
virtual HRESULT STDMETHODCALLTYPE LoadFromStreamBS(IStream *, const GUID &, void **)
Definition: CBandSite.cpp:998
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID)
Definition: CBandSite.cpp:952
LONG m_cBandsAllocated
Definition: CBandSite.h:53
UINT _GetBandID(struct BandObject *Band)
Definition: CBandSite.cpp:49
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode)
Definition: CBandSite.cpp:788
HRESULT _UpdateAllBands()
Definition: CBandSite.cpp:212
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
Definition: CBandSite.cpp:884
virtual HRESULT STDMETHODCALLTYPE IsDirty()
Definition: CBandSite.cpp:957
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
unsigned int UINT
Definition: ndis.h:50
CComPtr< IOleWindow > m_site
Definition: CBandSite.h:56
virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc)
Definition: CBandSite.cpp:871
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:639
struct BandObject * _GetBandByID(DWORD dwBandID)
Definition: CBandSite.cpp:54
const GUID IID_IOleWindow
unsigned int ULONG
Definition: retypes.h:1
HRESULT _UpdateBand(struct BandObject *Band)
Definition: CBandSite.cpp:172
IWinEventHandler * WndEvtHandler
Definition: CBandSite.h:47
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd)
Definition: CBandSite.cpp:761
#define END_COM_MAP()
Definition: atlcom.h:552
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState)
Definition: CBandSite.cpp:619
_Out_ LPRECT prc
Definition: ntgdi.h:1658
virtual HRESULT STDMETHODCALLTYPE SetModeDBC(DWORD dwMode)
Definition: CBandSite.cpp:834
virtual HRESULT STDMETHODCALLTYPE SaveToStreamBS(IUnknown *, IStream *)
Definition: CBandSite.cpp:1003
LPARAM lParam
Definition: combotst.c:139
virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CBandSite.cpp:993
virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo(const BANDSITEINFO *pbsinfo)
Definition: CBandSite.cpp:678
virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
Definition: CBandSite.cpp:705
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg)
Definition: CBandSite.cpp:927