ReactOS 0.4.15-dev-7897-g78dc504
CBandSite.cpp
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#include "shellbars.h"
23
24#ifndef ASSERT
25#define ASSERT(cond) \
26 if (!(cond)) \
27 ERR ("ASSERTION %s AT %s:%d FAILED!\n", #cond, __FILE__, __LINE__)
28#endif
29
30
31/*
32TODO:
33 ** Fix tasks band gripper not appearing when quick launch is added
34 ** Fix hiding grippers in locked mode
35 ** The context menu should include the menu of both the site and the band
36 ** The chevron should be shown only when needed
37*/
38
40 m_cBands(0),
41 m_cBandsAllocated(0),
42 m_bands(NULL),
43 m_hwndRebar(NULL),
44 m_dwState(0),
45 m_dwStyle(0)
46{
47}
48
50{
51 return (UINT)(Band - m_bands);
52}
53
55{
56 if ((LONG)dwBandID >= m_cBandsAllocated)
57 return NULL;
58
59 if (m_bands[dwBandID].DeskBand == NULL)
60 return NULL;
61
62 return &m_bands[dwBandID];
63}
64
66{
67 ATLASSERT(Band->DeskBand != NULL);
68 ATLASSERT(Band->OleWindow != NULL);
70 Band->DeskBand->Release();
71 Band->OleWindow->Release();
72 Band->WndEvtHandler->Release();
73 memset(Band, 0, sizeof(*Band));
74 m_cBands--;
75}
76
78{
79 DWORD dwStyle;
80
81 /* FIXME: What about DBIF_VIEWMODE_FLOATING and DBIF_VIEWMODE_TRANSPARENT? */
83
84 if (dwStyle & CCS_VERT)
85 return DBIF_VIEWMODE_VERTICAL;
86 else
87 return DBIF_VIEWMODE_NORMAL;
88}
89
91{
92 ZeroMemory(prbi, sizeof(*prbi));
93 prbi->cbSize = sizeof(*prbi);
94
95 prbi->fMask = RBBIM_ID;
96 prbi->wID = _GetBandID(Band);
97
98 if (Band->dbi.dwMask & DBIM_MINSIZE)
99 {
100 prbi->fMask |= RBBIM_CHILDSIZE;
101 prbi->cxMinChild = Band->dbi.ptMinSize.x;
102 prbi->cyMinChild = Band->dbi.ptMinSize.y;
103 }
104
105 if (Band->dbi.dwMask & DBIM_MAXSIZE)
106 {
107 prbi->fMask |= RBBIM_CHILDSIZE;
108 prbi->cyMaxChild = Band->dbi.ptMaxSize.y;
109 }
110
111 if ((Band->dbi.dwMask & (DBIM_INTEGRAL | DBIM_MODEFLAGS)) == (DBIM_INTEGRAL | DBIM_MODEFLAGS) &&
112 (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT))
113 {
114 prbi->fMask |= RBBIM_CHILDSIZE;
115 prbi->cyIntegral = Band->dbi.ptIntegral.y;
116 }
117
118 if (Band->dbi.dwMask & DBIM_ACTUAL)
119 {
121 prbi->cxIdeal = Band->dbi.ptActual.x;
122 prbi->cx = Band->dbi.ptActual.x;
123 prbi->cyChild = Band->dbi.ptActual.y;
124 }
125
126 if (Band->dbi.dwMask & DBIM_TITLE)
127 {
128 prbi->fMask |= RBBIM_TEXT;
129 prbi->lpText = Band->dbi.wszTitle;
130 prbi->cch = wcslen(Band->dbi.wszTitle);
131 }
132
133 if (Band->dbi.dwMask & DBIM_MODEFLAGS)
134 {
135 prbi->fMask |= RBBIM_STYLE;
136
137 if (Band->dbi.dwModeFlags & DBIMF_FIXED)
139 if (Band->dbi.dwModeFlags & DBIMF_FIXEDBMP)
140 prbi->fStyle |= RBBS_FIXEDBMP;
141 if (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT)
143 if (Band->dbi.dwModeFlags & DBIMF_DEBOSSED)
144 prbi->fStyle |= RBBS_CHILDEDGE;
145 if (Band->dbi.dwModeFlags & DBIMF_USECHEVRON)
146 prbi->fStyle |= RBBS_USECHEVRON;
147 if (Band->dbi.dwModeFlags & DBIMF_BREAK)
148 prbi->fStyle |= RBBS_BREAK;
149 if (Band->dbi.dwModeFlags & DBIMF_TOPALIGN)
150 prbi->fStyle |= RBBS_TOPALIGN;
151 if ((Band->dbi.dwModeFlags & DBIMF_NOGRIPPER) || (m_dwStyle & BSIS_NOGRIPPER))
152 prbi->fStyle |= RBBS_NOGRIPPER;
153 if ((Band->dbi.dwModeFlags & DBIMF_ALWAYSGRIPPER) || (m_dwStyle & BSIS_ALWAYSGRIPPER))
154 prbi->fStyle |= RBBS_GRIPPERALWAYS;
155 }
156
157 if (Band->bHiddenTitle || (m_dwStyle & BSIS_NOCAPTION))
158 {
159 prbi->fMask |= RBBIM_STYLE;
160 prbi->fStyle |= RBBS_HIDETITLE;
161 }
162
163 if ((Band->dbi.dwMask & (DBIM_BKCOLOR | DBIM_MODEFLAGS)) == (DBIM_BKCOLOR | DBIM_MODEFLAGS) &&
164 (Band->dbi.dwModeFlags & DBIMF_BKCOLOR))
165 {
166 prbi->fMask |= RBBIM_COLORS;
167 prbi->clrFore = (COLORREF)(COLOR_WINDOWTEXT + 1);
168 prbi->clrBack = Band->dbi.crBkgnd;
169 }
170}
171
173{
174 REBARBANDINFOW rbi;
175 DWORD dwViewMode;
176 UINT uBand;
177 HRESULT hRet;
178
179 ZeroMemory(&Band->dbi, sizeof(Band->dbi));
180 Band->dbi.dwMask = DBIM_MINSIZE | DBIM_MAXSIZE | DBIM_INTEGRAL |
181 DBIM_ACTUAL | DBIM_TITLE | DBIM_MODEFLAGS | DBIM_BKCOLOR;
182
183 dwViewMode = _GetViewMode();
184
185 hRet = Band->DeskBand->GetBandInfo((DWORD)_GetBandID(Band), dwViewMode, &Band->dbi);
186 if (SUCCEEDED(hRet))
187 {
188 _BuildBandInfo(Band, &rbi);
189 if (SUCCEEDED(Band->OleWindow->GetWindow(&rbi.hwndChild)) &&
190 rbi.hwndChild != NULL)
191 {
192 rbi.fMask |= RBBIM_CHILD;
193 WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild);
194 }
195
197 if (uBand != (UINT)-1)
198 {
199 if (!SendMessageW(m_hwndRebar, RB_SETBANDINFOW, (WPARAM)uBand, reinterpret_cast<LPARAM>(&rbi)))
200 {
201 WARN("Failed to update the rebar band!\n");
202 }
203 }
204 else
205 WARN("Failed to map rebar band id to index!\n");
206
207 }
208
209 return hRet;
210}
211
213{
214 LONG i;
215 HRESULT hRet;
216
217 for (i = 0; i < m_cBandsAllocated; i++)
218 {
219 if (m_bands[i].DeskBand != NULL)
220 {
221 hRet = _UpdateBand(&m_bands[i]);
222 if (FAILED_UNEXPECTEDLY(hRet))
223 return hRet;
224 }
225 }
226
227 return S_OK;
228}
229
231{
232 struct BandObject *Band;
233
234 Band = _GetBandByID(dwBandID);
235 if (Band == NULL)
236 return E_FAIL;
237
238 return _UpdateBand(Band);
239}
240
242{
243 CComPtr<IBandSite> pbs;
244
245 /* Use QueryInterface so that we get the outer object in case we have one */
248 return hr;
249
250 DWORD dwState;
251 hr = pbs->QueryBand(dwBandID, NULL, &dwState, NULL, NULL);
253 return hr;
254
255 return ((dwState & BSSF_UNDELETEABLE) != 0) ? S_FALSE : S_OK;
256}
257
259{
260 /* Find the index fo the band that was clicked */
261 int x = GET_X_LPARAM(lParam);
262 int y = GET_Y_LPARAM(lParam);
263
264 RBHITTESTINFO htInfo = {{x, y}};
265 ScreenToClient(m_hwndRebar, &htInfo.pt);
266 int iBand = SendMessageW(m_hwndRebar, RB_HITTEST, 0, (LPARAM)&htInfo);
267 if (iBand < 0)
268 {
269 /* FIXME: what to do here? */
270 return S_OK;
271 }
272
273 /* Now get the id of the band that was clicked */
276
277 /* Finally get the band */
278 DWORD dwBandID = bandInfo.wID;
279 struct BandObject *Band = _GetBandByID(dwBandID);
280 if (Band == NULL)
281 return E_FAIL;
282
283 HMENU hMenu = CreatePopupMenu();
284 if (hMenu == NULL)
285 return E_OUTOFMEMORY;
286
287 /* Try to load the menu of the band */
288 UINT idBandLast = 0;
289 CComPtr<IContextMenu> pcm;
291 if (SUCCEEDED(hr))
292 {
293 hr = pcm->QueryContextMenu(hMenu, 0, 0, UINT_MAX, CMF_NORMAL);
294 if (SUCCEEDED(hr))
295 {
296 idBandLast = HRESULT_CODE(hr);
297 }
298 }
299
300 if (!(m_dwStyle & BSIS_LOCKED))
301 {
302 /* Load the static part of the menu */
303 HMENU hMenuStatic = LoadMenuW(GetModuleHandleW(L"browseui.dll"), MAKEINTRESOURCEW(IDM_BAND_MENU));
304
305 if (hMenuStatic)
306 {
308
309 ::DestroyMenu(hMenuStatic);
310
311 hr = _IsBandDeletable(dwBandID);
313 return hr;
314
315 /* Remove the close item if it is not deletable */
316 if (hr == S_FALSE || (Band->dbi.dwModeFlags & DBIMF_UNDELETEABLE) != 0)
318
319 if ((Band->dbi.dwMask & DBIM_TITLE) == 0)
321 else
323 }
324 }
325
326 /* TODO: Query the menu of our site */
327
328 UINT uCommand = ::TrackPopupMenuEx(hMenu, TPM_RETURNCMD, x, y, m_hwndRebar, NULL);
329 if (uCommand < idBandLast)
330 {
331 CMINVOKECOMMANDINFO cmi = { sizeof(cmi), 0, m_hwndRebar, MAKEINTRESOURCEA(uCommand)};
332 hr = pcm->InvokeCommand(&cmi);
334 return hr;
335 }
336 else
337 {
338 if (uCommand == IDM_BAND_TITLE)
339 {
340 Band->bHiddenTitle = !Band->bHiddenTitle;
341
342 hr = _UpdateBand(dwBandID);
344 return hr;
345 }
346 else if(uCommand == IDM_BAND_CLOSE)
347 {
348 hr = RemoveBand(dwBandID);
350 return hr;
351 }
352 }
353
354 return S_OK;
355}
356
358{
359 HRESULT hRet;
360 HWND hWndBand;
361 LONG i;
362
363 for (i = 0; i < m_cBandsAllocated; i++)
364 {
365 if (m_bands[i].DeskBand != NULL)
366 {
367 ASSERT(m_bands[i].OleWindow);
368
369 hWndBand = NULL;
370 hRet = m_bands[i].OleWindow->GetWindow(&hWndBand);
371 if (SUCCEEDED(hRet) && hWndBand == hwnd)
372 return &m_bands[i];
373 }
374 }
375
376 return NULL;
377}
378
380{
381
382 TRACE("destroying %p\n", this);
383
384 if (m_hwndRebar != NULL)
385 {
388 }
389
390 if (m_bands != NULL)
391 {
392 for (INT i = 0; i < m_cBandsAllocated; i++)
393 {
394 if (m_bands[i].DeskBand != NULL)
396 }
398 m_bands = NULL;
399 }
400}
401
403{
404 LONG NewAllocated;
405 struct BandObject *NewBand = NULL;
406 CComPtr<IDeskBand> DeskBand;
407 CComPtr<IObjectWithSite> ObjWithSite;
408 CComPtr<IOleWindow> OleWindow;
409 CComPtr<IWinEventHandler> WndEvtHandler;
410 REBARBANDINFOW rbi;
411 HRESULT hRet;
412 UINT uBand;
413
414 TRACE("(%p, %p)\n", this, punk);
415
416 if (punk == NULL || m_hwndRebar == NULL)
417 return E_FAIL;
418
419 hRet = punk->QueryInterface(IID_PPV_ARG(IDeskBand, &DeskBand));
420 if (FAILED_UNEXPECTEDLY(hRet))
421 return hRet;
422
423 hRet = punk->QueryInterface(IID_PPV_ARG(IObjectWithSite, &ObjWithSite));
424 if (FAILED_UNEXPECTEDLY(hRet))
425 return hRet;
426
427 hRet = punk->QueryInterface(IID_PPV_ARG(IOleWindow, &OleWindow));
428 if (FAILED_UNEXPECTEDLY(hRet))
429 return hRet;
430
431 hRet = punk->QueryInterface(IID_PPV_ARG(IWinEventHandler, &WndEvtHandler));
432 if (FAILED_UNEXPECTEDLY(hRet))
433 return hRet;
434
436 {
437 /* Search for a free band object */
438 for (INT i = 0; i < m_cBandsAllocated; i++)
439 {
440 if (m_bands[i].DeskBand == NULL)
441 {
442 NewBand = &m_bands[i];
443 break;
444 }
445 }
446 }
447 else if (m_cBandsAllocated > 0)
448 {
449 ASSERT (m_bands != NULL);
450
451 /* Reallocate the band object array */
452 NewAllocated = m_cBandsAllocated + 8;
453 if (NewAllocated > 0xFFFF)
454 NewAllocated = 0xFFFF;
455 if (NewAllocated == m_cBandsAllocated)
456 {
457 return E_OUTOFMEMORY;
458 }
459
460
461 NewBand = static_cast<struct BandObject *>(CoTaskMemAlloc(NewAllocated * sizeof(struct BandObject)));
462 if (NewBand == NULL)
463 {
464 return E_OUTOFMEMORY;
465 }
466
467 /* Copy the old array */
468 memcpy(NewBand, m_bands, m_cBandsAllocated * sizeof(struct BandObject));
469
470 /* Initialize the added bands */
471 memset(&NewBand[m_cBandsAllocated], 0, (NewAllocated - m_cBandsAllocated) * sizeof(struct BandObject));
472
473 m_cBandsAllocated = NewAllocated;
475 m_bands = NewBand;
476 }
477 else
478 {
479 ASSERT(m_bands == NULL);
481 ASSERT(m_cBands == 0);
482
483 /* Allocate new array */
484 m_bands = static_cast<struct BandObject *>(CoTaskMemAlloc(8 * sizeof(struct BandObject)));
485 if (m_bands == NULL)
486 {
487 return E_OUTOFMEMORY;
488 }
489
490 /* Initialize the added bands */
491 memset(m_bands, 0, 8 * sizeof(struct BandObject));
492
494 NewBand = &m_bands[0];
495 }
496
497 ASSERT(NewBand != NULL);
498
499 m_cBands++;
500 NewBand->DeskBand = DeskBand.Detach();
501 NewBand->OleWindow = OleWindow.Detach();
502 NewBand->WndEvtHandler = WndEvtHandler.Detach();
503
504 /* Create the ReBar band */
505 hRet = ObjWithSite->SetSite(static_cast<IOleWindow *>(this));
506 if (SUCCEEDED(hRet))
507 {
508 uBand = 0xffffffff;
509 if (SUCCEEDED(_UpdateBand(NewBand)))
510 {
511 if (NewBand->dbi.dwMask & DBIM_MODEFLAGS)
512 {
513 if (NewBand->dbi.dwModeFlags & DBIMF_ADDTOFRONT)
514 uBand = 0;
515 }
516 }
517
518 _BuildBandInfo(NewBand, &rbi);
519
520 if (SUCCEEDED(NewBand->OleWindow->GetWindow(&rbi.hwndChild)) &&
521 rbi.hwndChild != NULL)
522 {
523 rbi.fMask |= RBBIM_CHILD;
524 WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild);
525 }
526
527 if (!SendMessageW(m_hwndRebar, RB_INSERTBANDW, (WPARAM)uBand, reinterpret_cast<LPARAM>(&rbi)))
528 return E_FAIL;
529
530 hRet = (HRESULT)((USHORT)_GetBandID(NewBand));
531
533 }
534 else
535 {
536 WARN("IBandSite::AddBand(): Call to IDeskBand::SetSite() failed: %x\n", hRet);
537
538 /* Remove the band from the ReBar control */
539 _BuildBandInfo(NewBand, &rbi);
541 if (uBand != (UINT)-1)
542 {
544 {
545 ERR("Failed to delete band!\n");
546 }
547 }
548 else
549 ERR("Failed to map band id to index!\n");
550
551 _FreeBand(NewBand);
552
553 hRet = E_FAIL;
554 }
555
556 return hRet;
557}
558
560{
561 DWORD i;
562
563 TRACE("(%p, %u, %p)\n", this, uBand, pdwBandID);
564
565 if (uBand == 0xffffffff)
566 return (UINT)m_cBands;
567
568 if (uBand >= (UINT)m_cBands)
569 return E_FAIL;
570
571 for (i = 0; i < (DWORD)m_cBandsAllocated; i++)
572 {
573 if (m_bands[i].DeskBand != NULL)
574 {
575 if (uBand == 0)
576 {
577 *pdwBandID = i;
578 return S_OK;
579 }
580
581 uBand--;
582 }
583 }
584
585 return E_FAIL;
586}
587
589 DWORD *pdwState, LPWSTR pszName, int cchName)
590{
591 struct BandObject *Band;
592
593 TRACE("(%p, %u, %p, %p, %p, %d)\n", this, dwBandID, ppstb, pdwState, pszName, cchName);
594
595 Band = _GetBandByID(dwBandID);
596 if (Band == NULL)
597 return E_FAIL;
598
599 if (ppstb != NULL)
600 {
601 Band->DeskBand->AddRef();
602 *ppstb = Band->DeskBand;
603 }
604
605 if (pdwState != NULL)
606 {
607 FIXME("IBandSite::QueryBand() requests band state!\n");
608 *pdwState = 0;
609 }
610
611 if (pszName != NULL && cchName > 0)
612 {
613 FIXME("IBandSite::QueryBand() requests band name!\n");
614 pszName[0] = 0;
615 }
616 return S_OK;
617}
618
620{
621 struct BandObject *Band;
622
623 TRACE("(%p, %u, %x, %x)\n", this, dwBandID, dwMask, dwState);
624
625 Band = _GetBandByID(dwBandID);
626 if (Band == NULL)
627 return E_FAIL;
628
629 FIXME("Stub\n");
630 return E_NOTIMPL;
631}
632
634{
635 struct BandObject *Band;
636 UINT uBand;
637
638 TRACE("(%p, %u)\n", this, dwBandID);
639
640 if (m_hwndRebar == NULL)
641 return E_FAIL;
642
643 Band = _GetBandByID(dwBandID);
644 if (Band == NULL)
645 return E_FAIL;
646
648 if (uBand != (UINT)-1)
649 {
651 {
652 ERR("Could not delete band!\n");
653 }
654 }
655 else
656 ERR("Could not map band id to index!\n");
657
658 _FreeBand(Band);
659 return S_OK;
660}
661
663{
664 struct BandObject *Band;
665
666 TRACE("(%p, %u, %s, %p)\n", this, dwBandID, debugstr_guid(&riid), ppv);
667
668 Band = _GetBandByID(dwBandID);
669 if (Band == NULL)
670 {
671 *ppv = NULL;
672 return E_FAIL;
673 }
674
675 return Band->DeskBand->QueryInterface(riid, ppv);
676}
677
679{
680 if (!pbsinfo)
681 return E_INVALIDARG;
682
683 if (pbsinfo->dwMask & BSIM_STATE)
684 m_dwState = pbsinfo->dwState;
685 if (pbsinfo->dwMask & BSIM_STYLE)
686 m_dwStyle = pbsinfo->dwStyle;
687
689 return S_OK;
690}
691
693{
694 if (!pbsinfo)
695 return E_INVALIDARG;
696
697 if (pbsinfo->dwMask & BSIM_STATE)
698 pbsinfo->dwState = m_dwState;
699 if (pbsinfo->dwMask & BSIM_STYLE)
700 pbsinfo->dwStyle = m_dwStyle;
701
702 return S_OK;
703}
704
706{
707 struct BandObject *Band;
708
709 TRACE("(%p, %p, %u, %p, %p, %p)\n", this, hWnd, uMsg, wParam, lParam, plrResult);
710
711 if (plrResult)
712 *plrResult = 0;
713 if (m_hwndRebar == NULL)
714 return E_FAIL;
715
716 if (uMsg == WM_CONTEXTMENU)
717 {
718 HRESULT hr = _OnContextMenu(hWnd, uMsg, wParam, lParam, plrResult);
720 return hr;
721
722 return S_OK;
723 }
724 else if (uMsg == WM_COMMAND && lParam)
725 {
726 hWnd = reinterpret_cast<HWND>(lParam);
727 }
728 else if (uMsg == WM_NOTIFY)
729 {
730 NMHDR* pnmhdr = reinterpret_cast<NMHDR*>(lParam);
731 if (pnmhdr->hwndFrom != m_hwndRebar)
732 {
733 hWnd = pnmhdr->hwndFrom;
734 }
735 else
736 {
737 for (int i = 0; i < m_cBandsAllocated; i++)
738 {
739 if (m_bands[i].WndEvtHandler && m_bands[i].OleWindow)
740 {
741 HWND hwndBand;
742 if (SUCCEEDED(m_bands[i].OleWindow->GetWindow(&hwndBand)))
743 {
744 m_bands[i].WndEvtHandler->OnWinEvent(hwndBand, uMsg, wParam, lParam, plrResult);
745 }
746 }
747 }
748 return S_OK;
749 }
750 }
751
752 Band = _GetBandFromHwnd(hWnd);
753 if (Band != NULL)
754 {
755 return Band->WndEvtHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, plrResult);
756 }
757
758 return E_FAIL;
759}
760
762{
763 struct BandObject *Band;
764
765 TRACE("(%p, %p)\n", this, hWnd);
766
767 if (m_hwndRebar == NULL)
768 return E_FAIL;
769
770 Band = _GetBandFromHwnd(hWnd);
771 if (Band != NULL)
772 return S_OK;
773
774 return S_FALSE;
775}
776
778{
779 TRACE("(%p, %p)\n", this, phWnd);
780
781 *phWnd = m_hwndRebar;
782 if (m_hwndRebar != NULL)
783 return S_OK;
784
785 return E_FAIL;
786}
787
789{
790 FIXME("(%p, %d)\n", this, fEnterMode);
791 return E_NOTIMPL;
792}
793
795{
797 HRESULT hRet;
798 DWORD style;
799
800 TRACE("(%p, %p)\n", this, pUnk);
801
802 m_site = NULL;
803
805 if (FAILED_UNEXPECTEDLY(hRet))
806 return E_FAIL;
807
808 hRet = m_site->GetWindow(&hWndParent);
809 if (FAILED_UNEXPECTEDLY(hRet))
810 return E_FAIL;
811
813 RBS_BANDBORDERS | CCS_NODIVIDER | /*CCS_NORESIZE |*/ CCS_NOPARENTALIGN;
814
817 NULL,
818 style,
819 0, 0, 0, 0,
821 NULL,
822 _AtlBaseModule.GetModuleInstance(),
823 NULL);
824 if (m_hwndRebar == NULL)
825 {
826 m_site = NULL;
827 WARN("IDeskbarClient::SetDeskBarSite() failed to create ReBar control!\n");
828 return E_FAIL;
829 }
830
831 return S_OK;
832}
833
835{
836 LONG dwStyle;
837 LONG dwPrevStyle;
838
839 TRACE("(%p, %x)\n", this, dwMode);
840
841 if (m_hwndRebar == NULL)
842 return E_FAIL;
843
844 dwStyle = dwPrevStyle = GetWindowLongPtr(m_hwndRebar, GWL_STYLE);
845 if (dwMode & DBIF_VIEWMODE_VERTICAL)
846 dwStyle |= CCS_VERT;
847
848 if (dwMode & ~DBIF_VIEWMODE_VERTICAL)
849 FIXME("IDeskBarClient::SetModeDBC() unhandled modes: %x\n", dwStyle & ~DBIF_VIEWMODE_VERTICAL);
850
851 if (dwStyle != dwPrevStyle)
852 {
854 }
855
856 return S_OK;
857}
858
860{
861 TRACE("(%p, %x)\n", this, dwState);
862
863 if (m_hwndRebar == NULL)
864 return E_FAIL;
865
867 //FIXME: Properly notify bands?
868 return S_OK;
869}
870
872{
873 FIXME("(%p, %x, %p)\n", this, unknown1, unknown2);
874 return E_NOTIMPL;
875}
876
878 DWORD cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
879{
880 FIXME("(%p, %p, %u, %p, %p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
881 return E_NOTIMPL;
882}
883
885 DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut)
886{
887 HRESULT hRet = S_OK;
888
889 TRACE("(%p, %p, %u, %u, %p, %p)\n", this, pguidCmdGroup, nCmdID, nCmdExecOpt, pvaIn, pvaOut);
890
891 if (m_hwndRebar == NULL)
892 return E_FAIL;
893
894 if (IsEqualIID(*pguidCmdGroup, IID_IDeskBand))
895 {
896 switch (nCmdID)
897 {
899 if (pvaIn == NULL)
900 hRet = _UpdateAllBands();
901 else
902 {
903 /* Update a single band */
904 if (pvaIn->n1.n2.vt == VT_I4)
905 hRet = _UpdateBand(pvaIn->n1.n2.n3.lVal);
906 else
907 hRet = E_FAIL;
908 }
909 break;
910
911 case DBID_SHOWONLY:
913 case DBID_PUSHCHEVRON:
914 FIXME("IOleCommandTarget::Exec(): Unsupported command ID %d\n", nCmdID);
915 return E_NOTIMPL;
916 default:
917 return E_FAIL;
918 }
919 return hRet;
920 }
921 else
922 WARN("IOleCommandTarget::Exec(): Unsupported command group GUID\n");
923
924 return E_NOTIMPL;
925}
926
928{
929 return E_NOTIMPL;
930}
931
933{
934 return E_NOTIMPL;
935}
936
938{
939 return E_NOTIMPL;
940}
941
943{
944 return E_NOTIMPL;
945}
946
948{
949 return E_NOTIMPL;
950}
951
953{
954 return E_NOTIMPL;
955}
956
958{
959 return E_NOTIMPL;
960}
961
963{
964 return E_NOTIMPL;
965}
966
968{
969 return E_NOTIMPL;
970}
971
973{
974 return E_NOTIMPL;
975}
976
978 IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
979{
980 return E_NOTIMPL;
981}
982
984{
985 return E_NOTIMPL;
986}
987
989{
990 return E_NOTIMPL;
991}
992
994{
995 return E_NOTIMPL;
996}
997
999{
1000 return E_NOTIMPL;
1001}
1002
1004{
1005 return E_NOTIMPL;
1006}
1007
1008extern "C"
1010{
1011 return CBandSite::_CreatorClass::CreateInstance(pUnkOuter, riid, ppv);
1012}
HRESULT WINAPI RSHELL_CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv)
Definition: CBandSite.cpp:1009
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
Arabic default style
Definition: afstyles.h:94
HWND hWnd
Definition: settings.c:17
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define ERR(fmt,...)
Definition: debug.h:110
STDMETHOD() Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override
Definition: CBandSite.cpp:993
UINT _GetBandID(struct BandObject *Band)
Definition: CBandSite.cpp:49
STDMETHOD() LoadFromStreamBS(IStream *, const GUID &, void **) override
Definition: CBandSite.cpp:998
HRESULT _IsBandDeletable(DWORD dwBandID)
Definition: CBandSite.cpp:241
STDMETHOD() GetBandObject(DWORD dwBandID, REFIID riid, void **ppv) override
Definition: CBandSite.cpp:662
STDMETHOD() Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override
Definition: CBandSite.cpp:884
VOID _BuildBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi)
Definition: CBandSite.cpp:90
STDMETHOD() SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState) override
Definition: CBandSite.cpp:619
STDMETHOD() SaveToStreamBS(IUnknown *, IStream *) override
Definition: CBandSite.cpp:1003
STDMETHOD() TranslateAcceleratorIO(LPMSG lpMsg) override
Definition: CBandSite.cpp:937
STDMETHOD() QueryService(REFGUID guidService, REFIID riid, void **ppvObject) override
Definition: CBandSite.cpp:947
STDMETHOD() GetSizeMax(ULARGE_INTEGER *pcbSize) override
Definition: CBandSite.cpp:972
STDMETHOD() IsDirty() override
Definition: CBandSite.cpp:957
STDMETHOD() QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName) override
Definition: CBandSite.cpp:588
DWORD _GetViewMode()
Definition: CBandSite.cpp:77
STDMETHOD() OnFocusChangeIS(struct IUnknown *paramC, int param10) override
Definition: CBandSite.cpp:942
STDMETHOD() DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override
Definition: CBandSite.cpp:977
DWORD m_dwStyle
Definition: CBandSite.h:58
CComPtr< IOleWindow > m_site
Definition: CBandSite.h:56
STDMETHOD() DragLeave() override
Definition: CBandSite.cpp:988
STDMETHOD() GetClassID(CLSID *pClassID) override
Definition: CBandSite.cpp:952
STDMETHOD() OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) override
Definition: CBandSite.cpp:705
STDMETHOD() SetModeDBC(DWORD dwMode) override
Definition: CBandSite.cpp:834
STDMETHOD() UIActivateIO(BOOL fActivate, LPMSG lpMsg) override
Definition: CBandSite.cpp:927
STDMETHOD() AddBand(IUnknown *punk) override
Definition: CBandSite.cpp:402
struct BandObject * _GetBandFromHwnd(HWND hwnd)
Definition: CBandSite.cpp:357
STDMETHOD() Load(IStream *pStm) override
Definition: CBandSite.cpp:962
struct BandObject * m_bands
Definition: CBandSite.h:54
LONG m_cBands
Definition: CBandSite.h:52
STDMETHOD() GetSize(DWORD dwWhich, LPRECT prc) override
Definition: CBandSite.cpp:871
void _FreeBand(struct BandObject *Band)
Definition: CBandSite.cpp:65
STDMETHOD() Save(IStream *pStm, BOOL fClearDirty) override
Definition: CBandSite.cpp:967
STDMETHOD() IsWindowOwner(HWND hWnd) override
Definition: CBandSite.cpp:761
STDMETHOD() UIActivateDBC(DWORD dwState) override
Definition: CBandSite.cpp:859
LONG m_cBandsAllocated
Definition: CBandSite.h:53
HRESULT _OnContextMenu(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plrResult)
Definition: CBandSite.cpp:258
STDMETHOD() EnumBands(UINT uBand, DWORD *pdwBandID) override
Definition: CBandSite.cpp:559
STDMETHOD() DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override
Definition: CBandSite.cpp:983
DWORD m_dwState
Definition: CBandSite.h:57
STDMETHOD() RemoveBand(DWORD dwBandID) override
Definition: CBandSite.cpp:633
STDMETHOD() ContextSensitiveHelp(BOOL fEnterMode) override
Definition: CBandSite.cpp:788
STDMETHOD() SetDeskBarSite(IUnknown *punkSite) override
Definition: CBandSite.cpp:794
STDMETHOD() QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) override
Definition: CBandSite.cpp:877
STDMETHOD() GetWindow(HWND *lphwnd) override
Definition: CBandSite.cpp:777
STDMETHOD() HasFocusIO() override
Definition: CBandSite.cpp:932
HWND m_hwndRebar
Definition: CBandSite.h:55
HRESULT _UpdateAllBands()
Definition: CBandSite.cpp:212
struct BandObject * _GetBandByID(DWORD dwBandID)
Definition: CBandSite.cpp:54
STDMETHOD() SetBandSiteInfo(const BANDSITEINFO *pbsinfo) override
Definition: CBandSite.cpp:678
HRESULT _UpdateBand(struct BandObject *Band)
Definition: CBandSite.cpp:172
STDMETHOD() GetBandSiteInfo(BANDSITEINFO *pbsinfo) override
Definition: CBandSite.cpp:692
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define IDM_BAND_CLOSE
Definition: resource.h:65
#define IDM_BAND_TITLE
Definition: resource.h:64
#define IDM_BAND_MENU
Definition: resource.h:63
@ VT_I4
Definition: compat.h:2298
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define pt(x, y)
Definition: drawing.c:79
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define UINT_MAX
Definition: limits.h:41
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT GetBandInfo([in] DWORD dwBandID, [in] DWORD dwViewMode, [in, out] DESKBANDINFO *pdbi)
HRESULT GetWindow([out] HWND *phwnd)
ULONG AddRef()
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
nsresult QueryInterface(nsIIDRef riid, void **result)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_guid
Definition: kernel32.h:35
static const struct bandInfoStruct bandInfo[9]
Definition: layer3.c:95
#define RBBS_HIDETITLE
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ASSERT(a)
Definition: mode.c:44
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned int UINT
Definition: ndis.h:50
static LPUNKNOWN
Definition: ndr_ole.c:49
#define DWORD
Definition: nt_native.h:44
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
long LONG
Definition: pedump.c:60
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
unsigned short USHORT
Definition: pedump.c:61
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define RBBS_TOPALIGN
Definition: commctrl.h:1500
#define RB_SETBANDINFOW
Definition: commctrl.h:1584
#define RBBS_BREAK
Definition: commctrl.h:1489
#define RB_DELETEBAND
Definition: commctrl.h:1576
#define REBARCLASSNAMEW
Definition: commctrl.h:1463
#define RBBIM_CHILDSIZE
Definition: commctrl.h:1507
#define RB_INSERTBANDW
Definition: commctrl.h:1583
#define RBBS_FIXEDBMP
Definition: commctrl.h:1494
#define RBS_BANDBORDERS
Definition: commctrl.h:1472
#define RBBIM_CHILD
Definition: commctrl.h:1506
#define RBS_AUTOSIZE
Definition: commctrl.h:1475
#define CCS_VERT
Definition: commctrl.h:2249
#define RBBS_FIXEDSIZE
Definition: commctrl.h:1490
#define RBBS_NOGRIPPER
Definition: commctrl.h:1497
#define RB_GETBANDINFOW
Definition: commctrl.h:1609
#define RBBS_CHILDEDGE
Definition: commctrl.h:1491
#define CCS_NODIVIDER
Definition: commctrl.h:2248
#define RB_IDTOINDEX
Definition: commctrl.h:1588
#define RBBIM_ID
Definition: commctrl.h:1510
#define RBS_VARHEIGHT
Definition: commctrl.h:1471
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2246
#define RBBIM_STYLE
Definition: commctrl.h:1502
#define RBBIM_SIZE
Definition: commctrl.h:1508
#define RB_HITTEST
Definition: commctrl.h:1581
#define RBBIM_TEXT
Definition: commctrl.h:1504
#define RBBIM_COLORS
Definition: commctrl.h:1503
#define RBBS_USECHEVRON
Definition: commctrl.h:1498
#define RBBS_GRIPPERALWAYS
Definition: commctrl.h:1496
#define RBBS_VARIABLEHEIGHT
Definition: commctrl.h:1495
#define RBBIM_IDEALSIZE
Definition: commctrl.h:1511
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_NOTIFY
Definition: richedit.h:61
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:856
#define DBC_SHOW
Definition: shlobj.h:1048
#define MM_SUBMENUSHAVEIDS
Definition: shlobj.h:2514
#define MM_DONTREMOVESEPS
Definition: shlobj.h:2515
@ DBID_PUSHCHEVRON
Definition: shobjidl.idl:2455
@ DBID_BANDINFOCHANGED
Definition: shobjidl.idl:2452
@ DBID_MAXIMIZEBAND
Definition: shobjidl.idl:2454
@ DBID_SHOWONLY
Definition: shobjidl.idl:2453
#define TRACE(s)
Definition: solgame.cpp:4
IOleWindow * OleWindow
Definition: CBandSite.h:46
IWinEventHandler * WndEvtHandler
Definition: CBandSite.h:47
Definition: scsiwmi.h:51
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
COLORREF crBkgnd
Definition: shobjidl.idl:2424
WCHAR wszTitle[256]
Definition: shobjidl.idl:2422
HWND hwndFrom
Definition: winuser.h:3157
COLORREF clrBack
Definition: commctrl.h:1549
COLORREF clrFore
Definition: commctrl.h:1548
LONG lVal
Definition: compat.h:2393
VARTYPE vt
Definition: compat.h:2381
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT
Definition: typedefs.h:58
#define ZeroMemory
Definition: winbase.h:1712
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2767
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
DWORD COLORREF
Definition: windef.h:300
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define S_FALSE
Definition: winerror.h:2357
#define HRESULT_CODE(hr)
Definition: winerror.h:76
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define SW_HIDE
Definition: winuser.h:768
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define COLOR_WINDOWTEXT
Definition: winuser.h:921
#define WM_COMMAND
Definition: winuser.h:1740
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MF_CHECKED
Definition: winuser.h:132
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
#define MF_UNCHECKED
Definition: winuser.h:204
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define SW_SHOW
Definition: winuser.h:775
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define TPM_RETURNCMD
Definition: winuser.h:2387
#define GWL_STYLE
Definition: winuser.h:852
BOOL WINAPI DestroyWindow(_In_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define IID_PPV_ARG(Itype, ppType)
WCHAR * LPWSTR
Definition: xmlstorage.h:184