Sync with trunk (r48414)
[reactos.git] / dll / win32 / browseui / bandsite.cpp
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 #include <windows.h>
23 #include <shlobj.h>
24 #include <shlobj_undoc.h>
25 #include <shlguid.h>
26 #include <shlguid_undoc.h>
27 #include <tchar.h>
28 #include <atlbase.h>
29 #include <atlcom.h>
30 #include <atlwin.h>
31 #include "resource.h"
32 #include "wine/debug.h"
33 #include "bandsite.h"
34
35 WINE_DEFAULT_DEBUG_CHANNEL(browseui);
36
37 #ifndef ASSERT
38 #define ASSERT(cond) \
39 if (!(cond)) \
40 ERR ("ASSERTION %s AT %s:%d FAILED!\n", #cond, __FILE__, __LINE__)
41 #endif
42
43 CBandSiteBase::CBandSiteBase()
44 {
45 fBandsCount = 0;
46 fBandsAllocated = 0;
47 fBands = NULL;
48 fRebarWindow = NULL;
49 }
50
51 UINT CBandSiteBase::GetBandID(struct BandObject *Band)
52 {
53 return (UINT)(Band - fBands);
54 }
55
56 struct CBandSiteBase::BandObject *CBandSiteBase::GetBandByID(DWORD dwBandID)
57 {
58 if ((LONG)dwBandID >= fBandsAllocated)
59 return NULL;
60
61 if (fBands[dwBandID].DeskBand == NULL)
62 return NULL;
63
64 return &fBands[dwBandID];
65 }
66
67 void CBandSiteBase::FreeBand(struct BandObject *Band)
68 {
69 ATLASSERT(Band->DeskBand != NULL);
70 ATLASSERT(Band->OleWindow != NULL);
71 ATLASSERT(Band->WndEvtHandler != NULL);
72 Band->DeskBand->Release();
73 Band->OleWindow->Release();
74 Band->WndEvtHandler->Release();
75 memset(Band, 0, sizeof(*Band));
76 fBandsCount--;
77 }
78
79 DWORD CBandSiteBase::GetBandSiteViewMode()
80 {
81 DWORD dwStyle;
82
83 /* FIXME: What about DBIF_VIEWMODE_FLOATING and DBIF_VIEWMODE_TRANSPARENT? */
84 dwStyle = GetWindowLongPtr(fRebarWindow, GWL_STYLE);
85
86 if (dwStyle & CCS_VERT)
87 return DBIF_VIEWMODE_VERTICAL;
88 else
89 return DBIF_VIEWMODE_NORMAL;
90 }
91
92 VOID CBandSiteBase::BuildRebarBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi)
93 {
94 memset(prbi, 0, sizeof(*prbi));
95 prbi->cbSize = sizeof(*prbi);
96
97 prbi->fMask = RBBIM_ID;
98 prbi->wID = GetBandID(Band);
99
100 if (Band->dbi.dwMask & DBIM_MINSIZE)
101 {
102 prbi->fMask |= RBBIM_CHILDSIZE;
103 prbi->cxMinChild = Band->dbi.ptMinSize.x;
104 prbi->cyMinChild = Band->dbi.ptMinSize.y;
105 }
106
107 if (Band->dbi.dwMask & DBIM_MAXSIZE)
108 {
109 prbi->fMask |= RBBIM_CHILDSIZE;
110 prbi->cyMaxChild = Band->dbi.ptMaxSize.y;
111 }
112
113 if ((Band->dbi.dwMask & (DBIM_INTEGRAL | DBIM_MODEFLAGS)) == (DBIM_INTEGRAL | DBIM_MODEFLAGS) &&
114 (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT))
115 {
116 prbi->fMask |= RBBIM_CHILDSIZE;
117 prbi->cyIntegral = Band->dbi.ptIntegral.y;
118 }
119
120 if (Band->dbi.dwMask & DBIM_ACTUAL)
121 {
122 prbi->fMask |= RBBIM_IDEALSIZE | RBBIM_SIZE | RBBIM_CHILDSIZE;
123 prbi->cxIdeal = Band->dbi.ptActual.x;
124 prbi->cx = Band->dbi.ptActual.x;
125 prbi->cyChild = Band->dbi.ptActual.y;
126 }
127
128 if (Band->dbi.dwMask & DBIM_TITLE)
129 {
130 prbi->fMask |= RBBIM_TEXT;
131 prbi->lpText = Band->dbi.wszTitle;
132 prbi->cch = wcslen(Band->dbi.wszTitle);
133 }
134
135 if (Band->dbi.dwMask & DBIM_MODEFLAGS)
136 {
137 prbi->fMask |= RBBIM_STYLE;
138
139 if (Band->dbi.dwModeFlags & DBIMF_FIXED)
140 prbi->fStyle |= RBBS_FIXEDSIZE | RBBS_NOGRIPPER;
141 if (Band->dbi.dwModeFlags & DBIMF_FIXEDBMP)
142 prbi->fStyle |= RBBS_FIXEDBMP;
143 if (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT)
144 prbi->fStyle |= RBBS_VARIABLEHEIGHT;
145 if (Band->dbi.dwModeFlags & DBIMF_DEBOSSED)
146 prbi->fStyle |= RBBS_CHILDEDGE;
147 if (Band->dbi.dwModeFlags & DBIMF_USECHEVRON)
148 prbi->fStyle |= RBBS_USECHEVRON;
149 if (Band->dbi.dwModeFlags & DBIMF_BREAK)
150 prbi->fStyle |= RBBS_BREAK;
151 if (Band->dbi.dwModeFlags & DBIMF_TOPALIGN)
152 prbi->fStyle |= RBBS_TOPALIGN;
153 if (Band->dbi.dwModeFlags & DBIMF_NOGRIPPER)
154 prbi->fStyle |= RBBS_NOGRIPPER;
155 if (Band->dbi.dwModeFlags & DBIMF_ALWAYSGRIPPER)
156 prbi->fStyle |= RBBS_GRIPPERALWAYS;
157 }
158
159 if ((Band->dbi.dwMask & (DBIM_BKCOLOR | DBIM_MODEFLAGS)) == (DBIM_BKCOLOR | DBIM_MODEFLAGS) &&
160 (Band->dbi.dwModeFlags & DBIMF_BKCOLOR))
161 {
162 prbi->fMask |= RBBIM_COLORS;
163 prbi->clrFore = (COLORREF)(COLOR_WINDOWTEXT + 1);
164 prbi->clrBack = Band->dbi.crBkgnd;
165 }
166 }
167
168 HRESULT CBandSiteBase::UpdateSingleBand(struct BandObject *Band)
169 {
170 REBARBANDINFOW rbi;
171 DWORD dwViewMode;
172 UINT uBand;
173 HRESULT hRet;
174
175 memset(&Band->dbi, 0, sizeof(Band->dbi));
176 Band->dbi.dwMask = DBIM_MINSIZE | DBIM_MAXSIZE | DBIM_INTEGRAL |
177 DBIM_ACTUAL | DBIM_TITLE | DBIM_MODEFLAGS | DBIM_BKCOLOR;
178
179 dwViewMode = GetBandSiteViewMode();
180
181 hRet = Band->DeskBand->GetBandInfo((DWORD)GetBandID(Band), dwViewMode, &Band->dbi);
182 if (SUCCEEDED(hRet))
183 {
184 BuildRebarBandInfo(Band, &rbi);
185 if (SUCCEEDED(Band->OleWindow->GetWindow(&rbi.hwndChild)) &&
186 rbi.hwndChild != NULL)
187 {
188 rbi.fMask |= RBBIM_CHILD;
189 WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild);
190 }
191
192 uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0);
193 if (uBand != (UINT)-1)
194 {
195 if (!SendMessageW(fRebarWindow, RB_SETBANDINFOW, (WPARAM)uBand, (LPARAM)&rbi))
196 {
197 WARN("Failed to update the rebar band!\n");
198 }
199 }
200 else
201 WARN("Failed to map rebar band id to index!\n");
202
203 }
204
205 return hRet;
206 }
207
208 HRESULT CBandSiteBase::UpdateAllBands()
209 {
210 LONG i;
211 HRESULT hRet;
212
213 for (i = 0; i < fBandsAllocated; i++)
214 {
215 if (fBands[i].DeskBand != NULL)
216 {
217 hRet = UpdateSingleBand(&fBands[i]);
218 if (!SUCCEEDED(hRet))
219 return hRet;
220 }
221 }
222
223 return S_OK;
224 }
225
226 HRESULT CBandSiteBase::UpdateBand(DWORD dwBandID)
227 {
228 struct BandObject *Band;
229
230 Band = GetBandByID(dwBandID);
231 if (Band == NULL)
232 return E_FAIL;
233
234 return UpdateSingleBand(Band);
235 }
236
237 struct CBandSiteBase::BandObject *CBandSiteBase::GetBandFromHwnd(HWND hwnd)
238 {
239 HRESULT hRet;
240 HWND hWndBand;
241 LONG i;
242
243 for (i = 0; i < fBandsAllocated; i++)
244 {
245 if (fBands[i].DeskBand != NULL)
246 {
247 ASSERT(fBands[i].OleWindow);
248
249 hWndBand = NULL;
250 hRet = fBands[i].OleWindow->GetWindow(&hWndBand);
251 if (SUCCEEDED(hRet) && hWndBand == hwnd)
252 return &fBands[i];
253 }
254 }
255
256 return NULL;
257 }
258
259 CBandSiteBase::~CBandSiteBase()
260 {
261 int i;
262
263 TRACE("destroying %p\n", this);
264
265 if (fRebarWindow != NULL)
266 {
267 DestroyWindow(fRebarWindow);
268 fRebarWindow = NULL;
269 }
270
271 if (fBands != NULL)
272 {
273 for (i = 0; i < fBandsAllocated; i++)
274 {
275 if (fBands[i].DeskBand != NULL)
276 FreeBand(&fBands[i]);
277 }
278 CoTaskMemFree(fBands);
279 fBands = NULL;
280 }
281 }
282
283 HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
284 {
285 INT i;
286 LONG NewAllocated;
287 struct BandObject *NewBand = NULL;
288 CComPtr<IDeskBand> DeskBand;
289 CComPtr<IObjectWithSite> ObjWithSite;
290 CComPtr<IOleWindow> OleWindow;
291 CComPtr<IWinEventHandler> WndEvtHandler;
292 REBARBANDINFOW rbi;
293 HRESULT hRet;
294 UINT uBand;
295
296 TRACE("(%p, %p)\n", this, punk);
297
298 if (punk == NULL || fRebarWindow == NULL)
299 return E_FAIL;
300
301 hRet = punk->QueryInterface(IID_IDeskBand, (PVOID *)&DeskBand);
302 if (!SUCCEEDED(hRet) || DeskBand == NULL)
303 goto Cleanup;
304 hRet = punk->QueryInterface(IID_IObjectWithSite, (PVOID *)&ObjWithSite);
305 if (!SUCCEEDED(hRet) || ObjWithSite == NULL)
306 goto Cleanup;
307 hRet = punk->QueryInterface(IID_IOleWindow, (PVOID *)&OleWindow);
308 if (!SUCCEEDED(hRet) || OleWindow == NULL)
309 goto Cleanup;
310 hRet = punk->QueryInterface(IID_IWinEventHandler, (PVOID *)&WndEvtHandler);
311 if (!SUCCEEDED(hRet) || WndEvtHandler == NULL)
312 goto Cleanup;
313
314 hRet = S_OK;
315 if (fBandsAllocated > fBandsCount)
316 {
317 /* Search for a free band object */
318 for (i = 0; i < fBandsAllocated; i++)
319 {
320 if (fBands[i].DeskBand == NULL)
321 {
322 NewBand = &fBands[i];
323 break;
324 }
325 }
326 }
327 else if (fBandsAllocated > 0)
328 {
329 ASSERT (fBands != NULL);
330
331 /* Reallocate the band object array */
332 NewAllocated = fBandsAllocated + 8;
333 if (NewAllocated > 0xFFFF)
334 NewAllocated = 0xFFFF;
335 if (NewAllocated == fBandsAllocated)
336 {
337 hRet = E_OUTOFMEMORY;
338 goto Cleanup;
339 }
340
341
342 NewBand = reinterpret_cast<struct BandObject *>(CoTaskMemAlloc(NewAllocated * sizeof(struct BandObject)));
343 if (NewBand == NULL)
344 {
345 hRet = E_OUTOFMEMORY;
346 goto Cleanup;
347 }
348
349 /* Copy the old array */
350 memcpy(NewBand, fBands, fBandsAllocated * sizeof(struct BandObject));
351
352 /* Initialize the added bands */
353 memset(&NewBand[fBandsAllocated], 0, (NewAllocated - fBandsAllocated) * sizeof(struct BandObject));
354
355 NewBand = &fBands[fBandsAllocated];
356 fBandsAllocated = NewAllocated;
357 CoTaskMemFree(fBands);
358 fBands = NewBand;
359 }
360 else
361 {
362 ASSERT(fBands == NULL);
363 ASSERT(fBandsAllocated == 0);
364 ASSERT(fBandsCount == 0);
365
366 /* Allocate new array */
367 fBands = reinterpret_cast<struct BandObject *>(CoTaskMemAlloc(8 * sizeof(struct BandObject)));
368 if (fBands == NULL)
369 {
370 hRet = E_OUTOFMEMORY;
371 goto Cleanup;
372 }
373
374 /* Initialize the added bands */
375 memset(fBands, 0, 8 * sizeof(struct BandObject));
376
377 fBandsAllocated += 8;
378 NewBand = &fBands[0];
379 }
380
381 if (SUCCEEDED(hRet))
382 {
383 ASSERT(NewBand != NULL);
384
385 fBandsCount++;
386 NewBand->DeskBand = DeskBand.Detach();
387 NewBand->OleWindow = OleWindow.Detach();
388 NewBand->WndEvtHandler = WndEvtHandler.Detach();
389
390 /* Create the ReBar band */
391 hRet = ObjWithSite->SetSite((IOleWindow *)this);
392 if (SUCCEEDED(hRet))
393 {
394 uBand = 0xffffffff;
395 if (SUCCEEDED(UpdateSingleBand(NewBand)))
396 {
397 if (NewBand->dbi.dwMask & DBIM_MODEFLAGS)
398 {
399 if (NewBand->dbi.dwModeFlags & DBIMF_ADDTOFRONT)
400 uBand = 0;
401 }
402 }
403
404 BuildRebarBandInfo(NewBand, &rbi);
405
406 if (SUCCEEDED(NewBand->OleWindow->GetWindow(&rbi.hwndChild)) &&
407 rbi.hwndChild != NULL)
408 {
409 rbi.fMask |= RBBIM_CHILD;
410 WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild);
411 }
412
413 if (!SendMessageW(fRebarWindow, RB_INSERTBANDW, (WPARAM)uBand, (LPARAM)&rbi))
414 return E_FAIL;
415
416 hRet = (HRESULT)((USHORT)GetBandID(NewBand));
417 }
418 else
419 {
420 WARN("IBandSite::AddBand(): Call to IDeskBand::SetSite() failed: %x\n", hRet);
421
422 /* Remove the band from the ReBar control */
423 uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0);
424 if (uBand != (UINT)-1)
425 {
426 if (!SendMessageW(fRebarWindow, RB_DELETEBAND, (WPARAM)uBand, 0))
427 {
428 ERR("Failed to delete band!\n");
429 }
430 }
431 else
432 ERR("Failed to map band id to index!\n");
433
434 FreeBand(NewBand);
435
436 hRet = E_FAIL;
437 /* goto Cleanup; */
438 }
439 }
440 Cleanup:
441 return hRet;
442 }
443
444 HRESULT STDMETHODCALLTYPE CBandSiteBase::EnumBands(UINT uBand, DWORD *pdwBandID)
445 {
446 DWORD i;
447
448 TRACE("(%p, %u, %p)\n", this, uBand, pdwBandID);
449
450 if (uBand == 0xffffffff)
451 return (UINT)fBandsCount;
452
453 if (uBand >= (UINT)fBandsCount)
454 return E_FAIL;
455
456 for (i = 0; i < (DWORD)fBandsAllocated; i++)
457 {
458 if (fBands[i].DeskBand != NULL)
459 {
460 if (uBand == 0)
461 {
462 *pdwBandID = i;
463 return S_OK;
464 }
465
466 uBand--;
467 }
468 }
469
470 return E_FAIL;
471 }
472
473 HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName)
474 {
475 struct BandObject *Band;
476
477 TRACE("(%p, %u, %p, %p, %p, %d)\n", this, dwBandID, ppstb, pdwState, pszName, cchName);
478
479 Band = GetBandByID(dwBandID);
480 if (Band == NULL)
481 return E_FAIL;
482
483 if (ppstb != NULL)
484 {
485 Band->DeskBand->AddRef();
486 *ppstb = Band->DeskBand;
487 }
488
489 if (pdwState != NULL)
490 {
491 FIXME("IBandSite::QueryBand() requests band state!\n");
492 *pdwState = 0;
493 }
494
495 if (pszName != NULL && cchName > 0)
496 {
497 FIXME("IBandSite::QueryBand() requests band name!\n");
498 pszName[0] = 0;
499 }
500 return S_OK;
501 }
502
503 HRESULT STDMETHODCALLTYPE CBandSiteBase::SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState)
504 {
505 struct BandObject *Band;
506
507 TRACE("(%p, %u, %x, %x)\n", this, dwBandID, dwMask, dwState);
508
509 Band = GetBandByID(dwBandID);
510 if (Band == NULL)
511 return E_FAIL;
512
513 FIXME("Stub\n");
514 return E_NOTIMPL;
515 }
516
517 HRESULT STDMETHODCALLTYPE CBandSiteBase::RemoveBand(DWORD dwBandID)
518 {
519 struct BandObject *Band;
520 UINT uBand;
521
522 TRACE("(%p, %u)\n", this, dwBandID);
523
524 if (fRebarWindow == NULL)
525 return E_FAIL;
526
527 Band = GetBandByID(dwBandID);
528 if (Band == NULL)
529 return E_FAIL;
530
531 uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)GetBandID(Band), 0);
532 if (uBand != (UINT)-1)
533 {
534 if (!SendMessageW(fRebarWindow, RB_DELETEBAND, (WPARAM)uBand, 0))
535 {
536 ERR("Could not delete band!\n");
537 }
538 }
539 else
540 ERR("Could not map band id to index!\n");
541
542 FreeBand(Band);
543 return S_OK;
544 }
545
546 HRESULT STDMETHODCALLTYPE CBandSiteBase::GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv)
547 {
548 struct BandObject *Band;
549
550 TRACE("(%p, %u, %s, %p)\n", this, dwBandID, debugstr_guid(&riid), ppv);
551
552 Band = GetBandByID(dwBandID);
553 if (Band == NULL)
554 {
555 *ppv = NULL;
556 return E_FAIL;
557 }
558
559 return Band->DeskBand->QueryInterface(riid, ppv);
560 }
561
562 HRESULT STDMETHODCALLTYPE CBandSiteBase::SetBandSiteInfo(const BANDSITEINFO *pbsinfo)
563 {
564 FIXME("(%p, %p)\n", this, pbsinfo);
565 return E_NOTIMPL;
566 }
567
568 HRESULT STDMETHODCALLTYPE CBandSiteBase::GetBandSiteInfo(BANDSITEINFO *pbsinfo)
569 {
570 FIXME("(%p, %p)\n", this, pbsinfo);
571 return E_NOTIMPL;
572 }
573
574 HRESULT STDMETHODCALLTYPE CBandSiteBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plrResult)
575 {
576 struct BandObject *Band;
577
578 TRACE("(%p, %p, %u, %p, %p, %p)\n", this, hWnd, uMsg, wParam, lParam, plrResult);
579
580 *plrResult = 0;
581 if (fRebarWindow == NULL)
582 return E_FAIL;
583
584 if (hWnd == fRebarWindow)
585 {
586 /* FIXME: Just send the message? */
587 *plrResult = SendMessageW(hWnd, uMsg, wParam, lParam);
588 return S_OK;
589 }
590
591 Band = GetBandFromHwnd(hWnd);
592 if (Band != NULL)
593 {
594 return Band->WndEvtHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, plrResult);
595 }
596
597 return E_FAIL;
598 }
599
600 HRESULT STDMETHODCALLTYPE CBandSiteBase::IsWindowOwner(HWND hWnd)
601 {
602 struct BandObject *Band;
603
604 TRACE("(%p, %p)\n", this, hWnd);
605
606 if (fRebarWindow == NULL)
607 return E_FAIL;
608
609 Band = GetBandFromHwnd(hWnd);
610 if (Band != NULL)
611 return S_OK;
612
613 return S_FALSE;
614 }
615
616 HRESULT STDMETHODCALLTYPE CBandSiteBase::GetWindow(HWND *phWnd)
617 {
618 TRACE("(%p, %p)\n", this, phWnd);
619
620 *phWnd = fRebarWindow;
621 if (fRebarWindow != NULL)
622 return S_OK;
623
624 return E_FAIL;
625 }
626
627 HRESULT STDMETHODCALLTYPE CBandSiteBase::ContextSensitiveHelp(BOOL fEnterMode)
628 {
629 FIXME("(%p, %d)\n", this, fEnterMode);
630 return E_NOTIMPL;
631 }
632
633 HRESULT STDMETHODCALLTYPE CBandSiteBase::SetDeskBarSite(IUnknown *pUnk)
634 {
635 HWND hWndParent;
636 HRESULT hRet;
637
638 TRACE("(%p, %p)\n", this, pUnk);
639
640 fOleWindow.Release();
641
642 hRet = pUnk->QueryInterface(IID_IOleWindow, (PVOID *)&fOleWindow);
643 if (!SUCCEEDED(hRet))
644 return E_FAIL;
645
646 hRet = fOleWindow->GetWindow(&hWndParent);
647 if (!SUCCEEDED(hRet))
648 return E_FAIL;
649
650 fRebarWindow = CreateWindowExW(WS_EX_TOOLWINDOW,
651 REBARCLASSNAMEW,
652 NULL,
653 WS_CHILD | WS_CLIPSIBLINGS |
654 WS_CLIPCHILDREN | RBS_VARHEIGHT |
655 RBS_BANDBORDERS | CCS_NODIVIDER |
656 CCS_NORESIZE | CCS_NOPARENTALIGN,
657 0,
658 0,
659 0,
660 0,
661 hWndParent,
662 NULL,
663 _AtlBaseModule.GetModuleInstance(),
664 NULL);
665 if (fRebarWindow == NULL)
666 {
667 fOleWindow.Release();
668 WARN("IDeskbarClient::SetDeskBarSite() failed to create ReBar control!\n");
669 return E_FAIL;
670 }
671
672 return S_OK;
673 }
674
675 HRESULT STDMETHODCALLTYPE CBandSiteBase::SetModeDBC(DWORD dwMode)
676 {
677 LONG dwStyle;
678 LONG dwPrevStyle;
679
680 TRACE("(%p, %x)\n", this, dwMode);
681
682 if (fRebarWindow == NULL)
683 return E_FAIL;
684
685 dwStyle = dwPrevStyle = GetWindowLongPtr(fRebarWindow, GWL_STYLE);
686 if (dwMode & DBIF_VIEWMODE_VERTICAL)
687 dwStyle |= CCS_VERT;
688
689 if (dwMode & ~DBIF_VIEWMODE_VERTICAL)
690 FIXME("IDeskBarClient::SetModeDBC() unhandled modes: %x\n", dwStyle & ~DBIF_VIEWMODE_VERTICAL);
691
692 if (dwStyle != dwPrevStyle)
693 {
694 SetWindowLongPtr(fRebarWindow, GWL_STYLE, dwPrevStyle);
695 }
696
697 return S_OK;
698 }
699
700 HRESULT STDMETHODCALLTYPE CBandSiteBase::UIActivateDBC(DWORD dwState)
701 {
702 TRACE("(%p, %x)\n", this, dwState);
703
704 if (fRebarWindow == NULL)
705 return E_FAIL;
706
707 ShowWindow(fRebarWindow, (dwState & DBC_SHOW) ? SW_SHOW : SW_HIDE);
708 FIXME("IDeskBarClient::UIActivateDBC() Properly notify bands?\n");
709 return S_OK;
710 }
711
712 HRESULT STDMETHODCALLTYPE CBandSiteBase::GetSize(DWORD unknown1, LPRECT unknown2)
713 {
714 FIXME("(%p, %x, %p)\n", this, unknown1, unknown2);
715 return E_NOTIMPL;
716 }
717
718 HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryStatus(const GUID *pguidCmdGroup, DWORD cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
719 {
720 FIXME("(%p, %p, %u, %p, %p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
721 return E_NOTIMPL;
722 }
723
724 HRESULT STDMETHODCALLTYPE CBandSiteBase::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut)
725 {
726 HRESULT hRet = S_OK;
727
728 TRACE("(%p, %p, %u, %u, %p, %p)\n", this, pguidCmdGroup, nCmdID, nCmdExecOpt, pvaIn, pvaOut);
729
730 if (fRebarWindow == NULL)
731 return E_FAIL;
732
733 if (IsEqualIID(pguidCmdGroup, IID_IDeskBand))
734 {
735 switch (nCmdID)
736 {
737 case DBID_BANDINFOCHANGED:
738 if (pvaIn == NULL)
739 hRet = UpdateAllBands();
740 else
741 {
742 /* Update a single band */
743 if (pvaIn->n1.n2.vt == VT_I4)
744 hRet = UpdateBand(pvaIn->n1.n2.n3.lVal);
745 else
746 hRet = E_FAIL;
747 }
748 break;
749
750 case DBID_SHOWONLY:
751 case DBID_MAXIMIZEBAND:
752 case DBID_PUSHCHEVRON:
753 FIXME("IOleCommandTarget::Exec(): Unsupported command ID %d\n", nCmdID);
754 return E_NOTIMPL;
755 default:
756 return E_FAIL;
757 }
758 return S_OK;
759 }
760 else
761 WARN("IOleCommandTarget::Exec(): Unsupported command group GUID\n");
762
763 return E_NOTIMPL;
764 }
765
766 HRESULT STDMETHODCALLTYPE CBandSiteBase::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
767 {
768 return E_NOTIMPL;
769 }
770
771 HRESULT STDMETHODCALLTYPE CBandSiteBase::HasFocusIO()
772 {
773 return E_NOTIMPL;
774 }
775
776 HRESULT STDMETHODCALLTYPE CBandSiteBase::TranslateAcceleratorIO(LPMSG lpMsg)
777 {
778 return E_NOTIMPL;
779 }
780
781 HRESULT STDMETHODCALLTYPE CBandSiteBase::OnFocusChangeIS(struct IUnknown *paramC, int param10)
782 {
783 return E_NOTIMPL;
784 }
785
786 HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
787 {
788 return E_NOTIMPL;
789 }
790
791 HRESULT STDMETHODCALLTYPE CBandSiteBase::GetClassID(CLSID *pClassID)
792 {
793 return E_NOTIMPL;
794 }
795
796 HRESULT STDMETHODCALLTYPE CBandSiteBase::IsDirty()
797 {
798 return E_NOTIMPL;
799 }
800
801 HRESULT STDMETHODCALLTYPE CBandSiteBase::Load(IStream *pStm)
802 {
803 return E_NOTIMPL;
804 }
805
806 HRESULT STDMETHODCALLTYPE CBandSiteBase::Save(IStream *pStm, BOOL fClearDirty)
807 {
808 return E_NOTIMPL;
809 }
810
811 HRESULT STDMETHODCALLTYPE CBandSiteBase::GetSizeMax(ULARGE_INTEGER *pcbSize)
812 {
813 return E_NOTIMPL;
814 }
815
816 HRESULT STDMETHODCALLTYPE CBandSiteBase::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
817 {
818 return E_NOTIMPL;
819 }
820
821 HRESULT STDMETHODCALLTYPE CBandSiteBase::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
822 {
823 return E_NOTIMPL;
824 }
825
826 HRESULT STDMETHODCALLTYPE CBandSiteBase::DragLeave()
827 {
828 return E_NOTIMPL;
829 }
830
831 HRESULT STDMETHODCALLTYPE CBandSiteBase::Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
832 {
833 return E_NOTIMPL;
834 }
835
836 HRESULT STDMETHODCALLTYPE CBandSiteBase::LoadFromStreamBS(IStream *, const GUID &, void **)
837 {
838 return E_NOTIMPL;
839 }
840
841 HRESULT STDMETHODCALLTYPE CBandSiteBase::SaveToStreamBS(IUnknown *, IStream *)
842 {
843 return E_NOTIMPL;
844 }