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