[RSHELL]
[reactos.git] / base / shell / rshell / logging / CMenuBandWrap.cpp
1 /*
2 * Shell Menu Band
3 *
4 * Copyright 2014 David Quintana
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20 #include "precomp.h"
21 #include "wraplog.h"
22
23 WINE_DEFAULT_DEBUG_CHANNEL(CMenuBandWrap);
24
25 class CMenuBandWrap :
26 public CComCoClass<CMenuBandWrap>,
27 public CComObjectRootEx<CComMultiThreadModelNoCS>,
28 public IDeskBand,
29 public IObjectWithSite,
30 public IInputObject,
31 public IPersistStream,
32 public IOleCommandTarget,
33 public IServiceProvider,
34 public IMenuPopup,
35 public IMenuBand,
36 public IShellMenu2,
37 public IWinEventHandler,
38 public IShellMenuAcc
39 {
40 public:
41 CMenuBandWrap() {}
42 ~CMenuBandWrap();
43
44 HRESULT InitWrap(IShellMenu * shellMenu);
45
46 private:
47 CComPtr<IDeskBand > m_IDeskBand;
48 CComPtr<IDockingWindow > m_IDockingWindow;
49 CComPtr<IOleWindow > m_IOleWindow;
50 CComPtr<IObjectWithSite > m_IObjectWithSite;
51 CComPtr<IInputObject > m_IInputObject;
52 CComPtr<IPersistStream > m_IPersistStream;
53 CComPtr<IPersist > m_IPersist;
54 CComPtr<IOleCommandTarget > m_IOleCommandTarget;
55 CComPtr<IServiceProvider > m_IServiceProvider;
56 CComPtr<IMenuPopup > m_IMenuPopup;
57 CComPtr<IDeskBar > m_IDeskBar;
58 CComPtr<IMenuBand > m_IMenuBand;
59 CComPtr<IShellMenu2 > m_IShellMenu2;
60 CComPtr<IShellMenu > m_IShellMenu;
61 CComPtr<IWinEventHandler > m_IWinEventHandler;
62 CComPtr<IShellMenuAcc > m_IShellMenuAcc;
63
64 public:
65
66 // *** IDeskBand methods ***
67 virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
68
69 // *** IDockingWindow methods ***
70 virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
71 virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved);
72 virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
73
74 // *** IOleWindow methods ***
75 virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
76 virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
77
78 // *** IObjectWithSite methods ***
79 virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
80 virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite);
81
82 // *** IInputObject methods ***
83 virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
84 virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
85 virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
86
87 // *** IPersistStream methods ***
88 virtual HRESULT STDMETHODCALLTYPE IsDirty();
89 virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
90 virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
91 virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
92
93 // *** IPersist methods ***
94 virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
95
96 // *** IOleCommandTarget methods ***
97 virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
98 virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
99
100 // *** IServiceProvider methods ***
101 virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
102
103 // *** IMenuPopup methods ***
104 virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags);
105 virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType);
106 virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet);
107
108 // *** IDeskBar methods ***
109 virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient);
110 virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient);
111 virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(RECT *prc);
112
113 // *** IMenuBand methods ***
114 virtual HRESULT STDMETHODCALLTYPE IsMenuMessage(MSG *pmsg);
115 virtual HRESULT STDMETHODCALLTYPE TranslateMenuMessage(MSG *pmsg, LRESULT *plRet);
116
117 // *** IShellMenu methods ***
118 virtual HRESULT STDMETHODCALLTYPE Initialize(IShellMenuCallback *psmc, UINT uId, UINT uIdAncestor, DWORD dwFlags);
119 virtual HRESULT STDMETHODCALLTYPE GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags);
120 virtual HRESULT STDMETHODCALLTYPE SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags);
121 virtual HRESULT STDMETHODCALLTYPE GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv);
122 virtual HRESULT STDMETHODCALLTYPE SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags);
123 virtual HRESULT STDMETHODCALLTYPE GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags);
124 virtual HRESULT STDMETHODCALLTYPE InvalidateItem(LPSMDATA psmd, DWORD dwFlags);
125 virtual HRESULT STDMETHODCALLTYPE GetState(LPSMDATA psmd);
126 virtual HRESULT STDMETHODCALLTYPE SetMenuToolbar(IUnknown *punk, DWORD dwFlags);
127
128 // *** IWinEventHandler methods ***
129 virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
130 virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
131
132 // *** IShellMenu2 methods ***
133 virtual HRESULT STDMETHODCALLTYPE GetSubMenu(THIS);
134 virtual HRESULT STDMETHODCALLTYPE SetToolbar(THIS);
135 virtual HRESULT STDMETHODCALLTYPE SetMinWidth(THIS);
136 virtual HRESULT STDMETHODCALLTYPE SetNoBorder(THIS);
137 virtual HRESULT STDMETHODCALLTYPE SetTheme(THIS);
138
139 // *** IShellMenuAcc methods ***
140 virtual HRESULT STDMETHODCALLTYPE GetTop(THIS);
141 virtual HRESULT STDMETHODCALLTYPE GetBottom(THIS);
142 virtual HRESULT STDMETHODCALLTYPE GetTracked(THIS);
143 virtual HRESULT STDMETHODCALLTYPE GetParentSite(THIS);
144 virtual HRESULT STDMETHODCALLTYPE GetState(THIS);
145 virtual HRESULT STDMETHODCALLTYPE DoDefaultAction(THIS);
146 virtual HRESULT STDMETHODCALLTYPE IsEmpty(THIS);
147
148 DECLARE_NOT_AGGREGATABLE(CMenuBandWrap)
149 DECLARE_PROTECT_FINAL_CONSTRUCT()
150
151 BEGIN_COM_MAP(CMenuBandWrap)
152 COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup)
153 COM_INTERFACE_ENTRY_IID(IID_IShellMenu, IShellMenu)
154 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
155 COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IDeskBand)
156 COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
157 COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
158 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
159 COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
160 COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
161 COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersistStream)
162 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
163 COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup)
164 COM_INTERFACE_ENTRY_IID(IID_IMenuBand, IMenuBand)
165 COM_INTERFACE_ENTRY_IID(IID_IShellMenu2, IShellMenu2)
166 COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
167 COM_INTERFACE_ENTRY_IID(IID_IShellMenuAcc, IShellMenuAcc)
168 END_COM_MAP()
169 };
170
171 extern "C"
172 HRESULT CMenuBand_Wrapper(IShellMenu * shellMenu, REFIID riid, LPVOID *ppv)
173 {
174 HRESULT hr;
175
176 *ppv = NULL;
177
178 CMenuBandWrap * site = new CComObject<CMenuBandWrap>();
179
180 if (!site)
181 return E_OUTOFMEMORY;
182
183 hr = site->InitWrap(shellMenu);
184 if (FAILED(hr))
185 {
186 site->Release();
187 return hr;
188 }
189
190 hr = site->QueryInterface(riid, ppv);
191
192 if (FAILED(hr))
193 site->Release();
194
195 return hr;
196 }
197
198 HRESULT CMenuBandWrap::InitWrap(IShellMenu * shellMenu)
199 {
200 HRESULT hr;
201
202 WrapLogOpen();
203
204 m_IShellMenu = shellMenu;
205
206 hr = shellMenu->QueryInterface(IID_PPV_ARG(IDeskBand, &m_IDeskBand));
207 if (FAILED(hr)) return hr;
208 hr = shellMenu->QueryInterface(IID_PPV_ARG(IDockingWindow, &m_IDockingWindow));
209 if (FAILED(hr)) return hr;
210 hr = shellMenu->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
211 if (FAILED(hr)) return hr;
212 hr = shellMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite, &m_IObjectWithSite));
213 if (FAILED(hr)) return hr;
214 hr = shellMenu->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject));
215 if (FAILED(hr)) return hr;
216 hr = shellMenu->QueryInterface(IID_PPV_ARG(IPersistStream, &m_IPersistStream));
217 if (FAILED(hr)) return hr;
218 hr = shellMenu->QueryInterface(IID_PPV_ARG(IPersist, &m_IPersist));
219 if (FAILED(hr)) return hr;
220 hr = shellMenu->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget));
221 if (FAILED(hr)) return hr;
222 hr = shellMenu->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider));
223 if (FAILED(hr)) return hr;
224 hr = shellMenu->QueryInterface(IID_PPV_ARG(IMenuPopup, &m_IMenuPopup));
225 if (FAILED(hr)) return hr;
226 hr = shellMenu->QueryInterface(IID_PPV_ARG(IDeskBar, &m_IDeskBar));
227 if (FAILED(hr)) return hr;
228 hr = shellMenu->QueryInterface(IID_PPV_ARG(IMenuBand, &m_IMenuBand));
229 if (FAILED(hr)) return hr;
230 hr = shellMenu->QueryInterface(IID_PPV_ARG(IShellMenu2, &m_IShellMenu2));
231 if (FAILED(hr)) return hr;
232 hr = shellMenu->QueryInterface(IID_PPV_ARG(IWinEventHandler, &m_IWinEventHandler));
233 if (FAILED(hr)) return hr;
234 //hr = shellMenu->QueryInterface(IID_PPV_ARG(IShellMenuAcc, &m_IShellMenuAcc));
235 m_IShellMenuAcc = NULL;
236 return hr;
237 }
238
239 CMenuBandWrap::~CMenuBandWrap()
240 {
241 WrapLogClose();
242 }
243
244
245 // *** IShellMenu2 methods ***
246 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetSubMenu(THIS)
247 {
248 WrapLogEnter("CMenuBandWrap<%p>::GetSubMenu()\n", this);
249 HRESULT hr = m_IShellMenu2->GetSubMenu();
250 WrapLogExit("CMenuBandWrap::GetSubMenu() = %08x\n", hr);
251 return hr;
252 }
253
254 HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetToolbar(THIS)
255 {
256 WrapLogEnter("CMenuBandWrap<%p>::SetToolbar()\n", this);
257 HRESULT hr = m_IShellMenu2->SetToolbar();
258 WrapLogExit("CMenuBandWrap::SetToolbar() = %08x\n", hr);
259 return hr;
260 }
261
262 HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetMinWidth(THIS)
263 {
264 WrapLogEnter("CMenuBandWrap<%p>::SetMinWidth()\n", this);
265 HRESULT hr = m_IShellMenu2->SetMinWidth();
266 WrapLogExit("CMenuBandWrap::SetMinWidth() = %08x\n", hr);
267 return hr;
268 }
269
270 HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetNoBorder(THIS)
271 {
272 WrapLogEnter("CMenuBandWrap<%p>::SetNoBorder()\n", this);
273 HRESULT hr = m_IShellMenu2->SetNoBorder();
274 WrapLogExit("CMenuBandWrap::SetNoBorder() = %08x\n", hr);
275 return hr;
276 }
277
278 HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetTheme(THIS)
279 {
280 WrapLogEnter("CMenuBandWrap<%p>::SetTheme()\n", this);
281 HRESULT hr = m_IShellMenu2->SetTheme();
282 WrapLogExit("CMenuBandWrap::SetTheme() = %08x\n", hr);
283 return hr;
284 }
285
286
287 // *** IShellMenuAcc methods ***
288 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetTop(THIS)
289 {
290 WrapLogEnter("CMenuBandWrap<%p>::GetTop()\n", this);
291 HRESULT hr = m_IShellMenuAcc->GetTop();
292 WrapLogExit("CMenuBandWrap::GetTop() = %08x\n", hr);
293 return hr;
294 }
295
296 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetBottom(THIS)
297 {
298 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
299 HRESULT hr = m_IShellMenuAcc->GetBottom();
300 WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr);
301 return hr;
302 }
303
304 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetTracked(THIS)
305 {
306 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
307 HRESULT hr = m_IShellMenuAcc->GetBottom();
308 WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr);
309 return hr;
310 }
311
312 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetParentSite(THIS)
313 {
314 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
315 HRESULT hr = m_IShellMenuAcc->GetBottom();
316 WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr);
317 return hr;
318 }
319
320 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetState(THIS)
321 {
322 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
323 HRESULT hr = m_IShellMenuAcc->GetBottom();
324 WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr);
325 return hr;
326 }
327
328 HRESULT STDMETHODCALLTYPE CMenuBandWrap::DoDefaultAction(THIS)
329 {
330 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
331 HRESULT hr = m_IShellMenuAcc->GetBottom();
332 WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr);
333 return hr;
334 }
335
336 HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsEmpty(THIS)
337 {
338 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
339 HRESULT hr = m_IShellMenuAcc->GetBottom();
340 WrapLogExit("CMenuBandWrap::GetBottom() = %08x\n", hr);
341 return hr;
342 }
343
344 // *** IDeskBand methods ***
345 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi)
346 {
347 WrapLogEnter("CMenuBandWrap<%p>::GetBandInfo(DWORD dwBandID=%d, DWORD dwViewMode=%d, DESKBANDINFO *pdbi=%p)\n", this, dwBandID, dwViewMode, pdbi);
348 HRESULT hr = m_IDeskBand->GetBandInfo(dwBandID, dwViewMode, pdbi);
349 WrapLogExit("CMenuBandWrap::GetBandInfo() = %08x\n", hr);
350 return hr;
351 }
352
353 // *** IDockingWindow methods ***
354 HRESULT STDMETHODCALLTYPE CMenuBandWrap::ShowDW(BOOL fShow)
355 {
356 WrapLogEnter("CMenuBandWrap<%p>::ShowDW(BOOL fShow=%d)\n", this, fShow);
357 HRESULT hr = m_IDockingWindow->ShowDW(fShow);
358 WrapLogExit("CMenuBandWrap::ShowDW() = %08x\n", hr);
359 return hr;
360 }
361
362 HRESULT STDMETHODCALLTYPE CMenuBandWrap::CloseDW(DWORD dwReserved)
363 {
364 WrapLogEnter("CMenuBandWrap<%p>::CloseDW(DWORD dwReserved=%d)\n", this, dwReserved);
365 HRESULT hr = m_IDockingWindow->CloseDW(dwReserved);
366 WrapLogExit("CMenuBandWrap::CloseDW() = %08x\n", hr);
367 return hr;
368 }
369
370 HRESULT STDMETHODCALLTYPE CMenuBandWrap::ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
371 {
372 WrapLogEnter("CMenuBandWrap<%p>::ResizeBorderDW(LPCRECT prcBorder=%p, IUnknown *punkToolbarSite=%p, BOOL fReserved=%d)\n", this, prcBorder, punkToolbarSite, fReserved);
373 if (prcBorder) WrapLogMsg("*prcBorder=%s\n", Wrap(*prcBorder));
374 HRESULT hr = m_IDockingWindow->ResizeBorderDW(prcBorder, punkToolbarSite, fReserved);
375 if (prcBorder) WrapLogMsg("*prcBorder=%s\n", Wrap(*prcBorder));
376 WrapLogExit("CMenuBandWrap::ResizeBorderDW() = %08x\n", hr);
377 return hr;
378 }
379
380 // *** IOleWindow methods ***
381 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetWindow(HWND *phwnd)
382 {
383 WrapLogEnter("CMenuBandWrap<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd);
384 HRESULT hr = m_IOleWindow->GetWindow(phwnd);
385 if (phwnd) WrapLogMsg("*phwnd=%p\n", *phwnd);
386 WrapLogExit("CMenuBandWrap::GetWindow() = %08x\n", hr);
387 return hr;
388 }
389 HRESULT STDMETHODCALLTYPE CMenuBandWrap::ContextSensitiveHelp(BOOL fEnterMode)
390 {
391 WrapLogEnter("CMenuBandWrap<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode);
392 HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode);
393 WrapLogExit("CMenuBandWrap::ContextSensitiveHelp() = %08x\n", hr);
394 return hr;
395 }
396
397 // *** IWinEventHandler methods ***
398 HRESULT STDMETHODCALLTYPE CMenuBandWrap::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
399 {
400 //WrapLogEnter("CMenuBandWrap<%p>::OnWinEvent(HWND hWnd=%p, UINT uMsg=%u, WPARAM wParam=%08x, LPARAM lParam=%08x, LRESULT *theResult=%p)\n", this, hWnd, uMsg, wParam, lParam, theResult);
401 HRESULT hr = m_IWinEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
402 //WrapLogExit("CMenuBandWrap::OnWinEvent() = %08x\n", hr);
403 return hr;
404 }
405
406 HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsWindowOwner(HWND hWnd)
407 {
408 //WrapLogEnter("CMenuBandWrap<%p>::IsWindowOwner(HWND hWnd=%08x)\n", this, hWnd);
409 HRESULT hr = m_IWinEventHandler->IsWindowOwner(hWnd);
410 //WrapLogExit("CMenuBandWrap::IsWindowOwner() = %08x\n", hr);
411 return hr;
412 }
413
414 // *** IObjectWithSite methods ***
415 HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetSite(IUnknown *pUnkSite)
416 {
417 WrapLogEnter("CMenuBandWrap<%p>::SetSite(IUnknown *pUnkSite=%p)\n", this, pUnkSite);
418 HRESULT hr = m_IObjectWithSite->SetSite(pUnkSite);
419 WrapLogExit("CMenuBandWrap::SetSite() = %08x\n", hr);
420 return hr;
421 }
422
423 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetSite(REFIID riid, PVOID *ppvSite)
424 {
425 WrapLogEnter("CMenuBandWrap<%p>::GetSite(REFIID riid=%s, PVOID *ppvSite=%p)\n", this, Wrap(riid), ppvSite);
426 HRESULT hr = m_IObjectWithSite->GetSite(riid, ppvSite);
427 if (ppvSite) WrapLogMsg("*ppvSite=%p\n", *ppvSite);
428 WrapLogExit("CMenuBandWrap::GetSite() = %08x\n", hr);
429 return hr;
430 }
431
432 // *** IInputObject methods ***
433 HRESULT STDMETHODCALLTYPE CMenuBandWrap::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
434 {
435 WrapLogEnter("CMenuBandWrap<%p>::UIActivateIO(BOOL fActivate=%d, LPMSG lpMsg=%p)\n", this, fActivate, lpMsg);
436 HRESULT hr = m_IInputObject->UIActivateIO(fActivate, lpMsg);
437 WrapLogExit("CMenuBandWrap::UIActivateIO() = %08x\n", hr);
438 return hr;
439 }
440
441 HRESULT STDMETHODCALLTYPE CMenuBandWrap::HasFocusIO()
442 {
443 WrapLogEnter("CMenuBandWrap<%p>::HasFocusIO()\n", this);
444 HRESULT hr = m_IInputObject->HasFocusIO();
445 WrapLogExit("CMenuBandWrap::HasFocusIO() = %08x\n", hr);
446 return hr;
447 }
448
449 HRESULT STDMETHODCALLTYPE CMenuBandWrap::TranslateAcceleratorIO(LPMSG lpMsg)
450 {
451 WrapLogEnter("CMenuBandWrap<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg);
452 if (lpMsg) WrapLogMsg("*lpMsg=%s\n", Wrap(*lpMsg));
453 HRESULT hr = m_IInputObject->TranslateAcceleratorIO(lpMsg);
454 WrapLogExit("CMenuBandWrap::TranslateAcceleratorIO() = %08x\n", hr);
455 return hr;
456 }
457
458 // *** IPersistStream methods ***
459 HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsDirty()
460 {
461 WrapLogEnter("CMenuBandWrap<%p>::IsDirty()\n", this);
462 HRESULT hr = m_IPersistStream->IsDirty();
463 WrapLogExit("CMenuBandWrap::IsDirty() = %08x\n", hr);
464 return hr;
465 }
466 HRESULT STDMETHODCALLTYPE CMenuBandWrap::Load(IStream *pStm)
467 {
468 WrapLogEnter("CMenuBandWrap<%p>::Load(IStream *pStm=%p)\n", this, pStm);
469 HRESULT hr = m_IPersistStream->Load(pStm);
470 WrapLogExit("CMenuBandWrap::Load() = %08x\n", hr);
471 return hr;
472 }
473 HRESULT STDMETHODCALLTYPE CMenuBandWrap::Save(IStream *pStm, BOOL fClearDirty)
474 {
475 WrapLogEnter("CMenuBandWrap<%p>::Save(IStream *pStm=%p, BOOL fClearDirty=%d)\n", this, pStm, fClearDirty);
476 HRESULT hr = m_IPersistStream->Save(pStm, fClearDirty);
477 WrapLogExit("CMenuBandWrap::Save() = %08x\n", hr);
478 return hr;
479 }
480 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetSizeMax(ULARGE_INTEGER *pcbSize)
481 {
482 WrapLogEnter("CMenuBandWrap<%p>::GetSizeMax(ULARGE_INTEGER *pcbSize=%p)\n", this, pcbSize);
483 HRESULT hr = m_IPersistStream->GetSizeMax(pcbSize);
484 WrapLogExit("CMenuBandWrap::GetSizeMax() = %08x\n", hr);
485 return hr;
486 }
487
488 // *** IPersist methods ***
489 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetClassID(CLSID *pClassID)
490 {
491 WrapLogEnter("CMenuBandWrap<%p>::GetClassID(CLSID *pClassID=%p)\n", this, pClassID);
492 HRESULT hr = m_IPersist->GetClassID(pClassID);
493 if (pClassID) WrapLogMsg("*pClassID=%s\n", Wrap(*pClassID));
494 WrapLogExit("CMenuBandWrap::GetClassID() = %08x\n", hr);
495 return hr;
496 }
497
498 // *** IOleCommandTarget methods ***
499 HRESULT STDMETHODCALLTYPE CMenuBandWrap::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
500 {
501 WrapLogEnter("CMenuBandWrap<%p>::QueryStatus(const GUID *pguidCmdGroup=%p, ULONG cCmds=%u, prgCmds=%p, pCmdText=%p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
502 HRESULT hr = m_IOleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
503 if (pguidCmdGroup) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
504 WrapLogExit("CMenuBandWrap::QueryStatus() = %08x\n", hr);
505 return hr;
506 }
507
508 HRESULT STDMETHODCALLTYPE CMenuBandWrap::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
509 {
510 WrapLogEnter("CMenuBandWrap<%p>::Exec(const GUID *pguidCmdGroup=%p, DWORD nCmdID=%d, DWORD nCmdexecopt=%d, VARIANT *pvaIn=%p, VARIANT *pvaOut=%p)\n", this, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
511 if (pguidCmdGroup) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
512 HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
513 WrapLogExit("CMenuBandWrap::Exec() = %08x\n", hr);
514 return hr;
515 }
516
517 // *** IServiceProvider methods ***
518 HRESULT STDMETHODCALLTYPE CMenuBandWrap::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
519 {
520 WrapLogEnter("CMenuBandWrap<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject);
521
522 if (IsEqualIID(guidService, SID_SMenuBandChild))
523 {
524 WrapLogMsg("SID is SID_SMenuBandChild. Using QueryInterface of self instead of wrapped object.\n");
525 HRESULT hr = this->QueryInterface(riid, ppvObject);
526 if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
527 if (SUCCEEDED(hr))
528 {
529 WrapLogExit("CMenuBandWrap::QueryService() = %08x\n", hr);
530 return hr;
531 }
532 else
533 {
534 WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n");
535 }
536 }
537 else if (IsEqualIID(guidService, SID_SMenuBandBottom))
538 {
539 WrapLogMsg("SID is SID_SMenuBandBottom. Using QueryInterface of self instead of wrapped object.\n");
540 HRESULT hr = this->QueryInterface(riid, ppvObject);
541 if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
542 if (SUCCEEDED(hr))
543 {
544 WrapLogExit("CMenuBandWrap::QueryService() = %08x\n", hr);
545 return hr;
546 }
547 else
548 {
549 WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n");
550 }
551 }
552 else if (IsEqualIID(guidService, SID_SMenuBandBottomSelected))
553 {
554 WrapLogMsg("SID is SID_SMenuBandBottomSelected. Using QueryInterface of self instead of wrapped object.\n");
555 HRESULT hr = this->QueryInterface(riid, ppvObject);
556 if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
557 if (SUCCEEDED(hr))
558 {
559 WrapLogExit("CMenuBandWrap::QueryService() = %08x\n", hr);
560 return hr;
561 }
562 else
563 {
564 WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n");
565 }
566 }
567 else
568 {
569 WrapLogMsg("SID not identified.\n");
570 }
571 HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject);
572 if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
573 WrapLogExit("CMenuBandWrap::QueryService() = %08x\n", hr);
574 return hr;
575 }
576
577
578 // *** IMenuPopup methods ***
579 HRESULT STDMETHODCALLTYPE CMenuBandWrap::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags)
580 {
581 WrapLogEnter("CMenuBandWrap<%p>::Popup(POINTL *ppt=%p, RECTL *prcExclude=%p, MP_POPUPFLAGS dwFlags=%08x)\n", this, ppt, prcExclude, dwFlags);
582 HRESULT hr = m_IMenuPopup->Popup(ppt, prcExclude, dwFlags);
583 WrapLogExit("CMenuBandWrap::Popup() = %08x\n", hr);
584 return hr;
585 }
586
587 HRESULT STDMETHODCALLTYPE CMenuBandWrap::OnSelect(DWORD dwSelectType)
588 {
589 WrapLogEnter("CMenuBandWrap<%p>::OnSelect(DWORD dwSelectType=%08x)\n", this, dwSelectType);
590 HRESULT hr = m_IMenuPopup->OnSelect(dwSelectType);
591 WrapLogExit("CMenuBandWrap::OnSelect() = %08x\n", hr);
592 return hr;
593 }
594
595 HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetSubMenu(IMenuPopup *pmp, BOOL fSet)
596 {
597 WrapLogEnter("CMenuBandWrap<%p>::SetSubMenu(IMenuPopup *pmp=%p, BOOL fSet=%d)\n", this, pmp, fSet);
598 HRESULT hr = m_IMenuPopup->SetSubMenu(pmp, fSet);
599 WrapLogExit("CMenuBandWrap::SetSubMenu() = %08x\n", hr);
600 return hr;
601 }
602
603
604 // *** IDeskBar methods ***
605 HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetClient(IUnknown *punkClient)
606 {
607 WrapLogEnter("CMenuBandWrap<%p>::SetClient(IUnknown *punkClient=%p)\n", this, punkClient);
608 HRESULT hr = m_IDeskBar->SetClient(punkClient);
609 WrapLogExit("CMenuBandWrap::SetClient() = %08x\n", hr);
610 return hr;
611 }
612
613 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetClient(IUnknown **ppunkClient)
614 {
615 WrapLogEnter("CMenuBandWrap<%p>::GetClient(IUnknown **ppunkClient=%p)\n", this, ppunkClient);
616 HRESULT hr = m_IDeskBar->GetClient(ppunkClient);
617 if (ppunkClient) WrapLogMsg("*ppunkClient=%p\n", *ppunkClient);
618 WrapLogExit("CMenuBandWrap::GetClient() = %08x\n", hr);
619 return hr;
620 }
621
622 HRESULT STDMETHODCALLTYPE CMenuBandWrap::OnPosRectChangeDB(RECT *prc)
623 {
624 WrapLogEnter("CMenuBandWrap<%p>::OnPosRectChangeDB(RECT *prc=%p)\n", this, prc);
625 HRESULT hr = m_IDeskBar->OnPosRectChangeDB(prc);
626 if (prc) WrapLogMsg("*prc=%s\n", Wrap(*prc));
627 WrapLogExit("CMenuBandWrap::OnPosRectChangeDB() = %08x\n", hr);
628 return hr;
629 }
630
631
632 // *** IMenuBand methods ***
633 HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsMenuMessage(MSG *pmsg)
634 {
635 //WrapLogEnter("CMenuBandWrap<%p>::IsMenuMessage(MSG *pmsg=%p)\n", this, pmsg);
636 HRESULT hr = m_IMenuBand->IsMenuMessage(pmsg);
637 //WrapLogExit("CMenuBandWrap::IsMenuMessage() = %08x\n", hr);
638 return hr;
639 }
640
641 HRESULT STDMETHODCALLTYPE CMenuBandWrap::TranslateMenuMessage(MSG *pmsg, LRESULT *plRet)
642 {
643 //WrapLogEnter("CMenuBandWrap<%p>::TranslateMenuMessage(MSG *pmsg=%p, LRESULT *plRet=%p)\n", this, pmsg, plRet);
644 HRESULT hr = m_IMenuBand->TranslateMenuMessage(pmsg, plRet);
645 //WrapLogExit("CMenuBandWrap::TranslateMenuMessage(*plRet=%d) = %08x\n", *plRet, hr);
646 return hr;
647 }
648
649 // *** IShellMenu methods ***
650 HRESULT STDMETHODCALLTYPE CMenuBandWrap::Initialize(IShellMenuCallback *psmc, UINT uId, UINT uIdAncestor, DWORD dwFlags)
651 {
652 WrapLogEnter("CMenuBandWrap<%p>::Initialize(IShellMenuCallback *psmc=%p, UINT uId=%u, UINT uIdAncestor=%u, DWORD dwFlags=%08x)\n", this, psmc, uId, uIdAncestor, dwFlags);
653 HRESULT hr = m_IShellMenu->Initialize(psmc, uId, uIdAncestor, dwFlags);
654 WrapLogExit("CMenuBandWrap::Initialize() = %08x\n", hr);
655 return hr;
656 }
657
658 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags)
659 {
660 WrapLogEnter("CMenuBandWrap<%p>::GetMenuInfo(IShellMenuCallback **ppsmc=%p, UINT *puId=%p, UINT *puIdAncestor=%p, DWORD *pdwFlags=%p)\n", this, ppsmc, puId, puIdAncestor, pdwFlags);
661 HRESULT hr = m_IShellMenu->GetMenuInfo(ppsmc, puId, puIdAncestor, pdwFlags);
662 if (ppsmc) WrapLogMsg("*ppsmc=%p\n", *ppsmc);
663 if (puId) WrapLogMsg("*puId=%u\n", *puId);
664 if (puIdAncestor) WrapLogMsg("*puIdAncestor=%u\n", *puIdAncestor);
665 if (pdwFlags) WrapLogMsg("*pdwFlags=%08x\n", *pdwFlags);
666 WrapLogExit("CMenuBandWrap::GetMenuInfo() = %08x\n", hr);
667 return hr;
668 }
669
670 HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags)
671 {
672 WrapLogEnter("CMenuBandWrap<%p>::SetShellFolder(IShellFolder *psf=%p, LPCITEMIDLIST pidlFolder=%p, HKEY hKey=%p, DWORD dwFlags=%08x)\n", this, psf, pidlFolder, hKey, dwFlags);
673 HRESULT hr = m_IShellMenu->SetShellFolder(psf, pidlFolder, hKey, dwFlags);
674 WrapLogExit("CMenuBandWrap::SetShellFolder() = %08x\n", hr);
675 return hr;
676 }
677
678 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv)
679 {
680 WrapLogEnter("CMenuBandWrap<%p>::GetShellFolder(DWORD *pdwFlags=%p, LPITEMIDLIST *ppidl=%p, REFIID riid=%s, void **ppv=%p)\n", this, pdwFlags, ppidl, Wrap(riid), ppv);
681 HRESULT hr = m_IShellMenu->GetShellFolder(pdwFlags, ppidl, riid, ppv);
682 if (pdwFlags) WrapLogMsg("*pdwFlags=%08x\n", *pdwFlags);
683 if (ppidl) WrapLogMsg("*ppidl=%p\n", *ppidl);
684 if (ppv) WrapLogMsg("*ppv=%p\n", *ppv);
685 WrapLogExit("CMenuBandWrap::GetShellFolder() = %08x\n", hr);
686 return hr;
687 }
688
689 HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags)
690 {
691 WrapLogEnter("CMenuBandWrap<%p>::SetMenu(HMENU hmenu=%p, HWND hwnd=%p, DWORD dwFlags=%08x)\n", this, hmenu, hwnd, dwFlags);
692 HRESULT hr = m_IShellMenu->SetMenu(hmenu, hwnd, dwFlags);
693 WrapLogExit("CMenuBandWrap::SetMenu() = %08x\n", hr);
694 return hr;
695 }
696
697 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags)
698 {
699 WrapLogEnter("CMenuBandWrap<%p>::GetMenu(HMENU *phmenu=%p, HWND *phwnd=%p, DWORD *pdwFlags=%p)\n", this, phmenu, phwnd, pdwFlags);
700 HRESULT hr = m_IShellMenu->GetMenu(phmenu, phwnd, pdwFlags);
701 if (phmenu) WrapLogMsg("*phmenu=%p\n", *phmenu);
702 if (phwnd) WrapLogMsg("*phwnd=%p\n", *phwnd);
703 if (pdwFlags) WrapLogMsg("*pdwFlags=%08x\n", *pdwFlags);
704 WrapLogExit("CMenuBandWrap::GetMenu() = %08x\n", hr);
705 return hr;
706 }
707
708 HRESULT STDMETHODCALLTYPE CMenuBandWrap::InvalidateItem(LPSMDATA psmd, DWORD dwFlags)
709 {
710 WrapLogEnter("CMenuBandWrap<%p>::InvalidateItem(LPSMDATA psmd=%p, DWORD dwFlags=%08x)\n", this, psmd, dwFlags);
711 HRESULT hr = m_IShellMenu->InvalidateItem(psmd, dwFlags);
712 WrapLogExit("CMenuBandWrap::InvalidateItem() = %08x\n", hr);
713 return hr;
714 }
715
716 HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetState(LPSMDATA psmd)
717 {
718 WrapLogEnter("CMenuBandWrap<%p>::GetState(LPSMDATA psmd=%p)\n", this, psmd);
719 HRESULT hr = m_IShellMenu->GetState(psmd);
720 WrapLogExit("CMenuBandWrap::GetState() = %08x\n", hr);
721 return hr;
722 }
723
724 HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetMenuToolbar(IUnknown *punk, DWORD dwFlags)
725 {
726 WrapLogEnter("CMenuBandWrap<%p>::SetMenuToolbar(IUnknown *punk=%p, DWORD dwFlags=%08x)\n", this, punk, dwFlags);
727 HRESULT hr = m_IShellMenu->SetMenuToolbar(punk, dwFlags);
728 WrapLogExit("CMenuBandWrap::SetMenuToolbar() = %08x\n", hr);
729 return hr;
730 }