ReactOS 0.4.16-dev-334-g4d9f67c
basebarsite.cpp
Go to the documentation of this file.
1/*
2 * ReactOS Explorer
3 *
4 * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/*
22Base bar that contains a vertical or horizontal explorer band. It also
23provides resizing abilities.
24*/
25
26#include "precomp.h"
27
28/*
29TODO:
30****When a new bar is added, resize correctly the band inside instead of keeping current size.
31 *Translate close button label
32 **Add owner draw for base bar -- hackplemented atm
33 **Make label text in base bar always draw in black
34 ***Set rebar band style flags accordingly to what band object asked.
35 ***Set rebar style accordingly to direction
36****This class should also manage desktop bands ? (another kind of explorer bands)
37*/
38
40 public CWindowImpl<CBaseBarSite, CWindow, CControlWinTraits>,
41 public CComObjectRootEx<CComMultiThreadModelNoCS>,
42// public IDockingWindowSite,
43 public IInputObject,
44 public IServiceProvider,
45 public IWinEventHandler,
46 public IInputObjectSite,
47 public IDeskBarClient,
48 public IOleCommandTarget,
49 public IBandSite,
50// public IBandSiteHelper,
51// public IExplorerToolbar,
52 public IPersistStream
53{
54private:
56 {
57 public:
59 CLSID fBarClass; // class of active bar
61
62 };
64// HWND fRebarWindow; // rebar for top of window
70public:
73 HRESULT Initialize(BOOL vert) { fVertical = vert; return S_OK; };
74private:
75 HRESULT InsertBar(IUnknown *newBar);
76
77 // *** IOleWindow methods ***
78 STDMETHOD(GetWindow)(HWND *lphwnd) override;
79 STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode) override;
80
81 // *** IInputObject methods ***
82 STDMETHOD(UIActivateIO)(BOOL fActivate, LPMSG lpMsg) override;
83 STDMETHOD(HasFocusIO)() override;
84 STDMETHOD(TranslateAcceleratorIO)(LPMSG lpMsg) override;
85
86 // *** IServiceProvider methods ***
87 STDMETHOD(QueryService)(REFGUID guidService, REFIID riid, void **ppvObject) override;
88
89 // *** IWinEventHandler methods ***
91 HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) override;
93
94 // *** IInputObjectSite specific methods ***
95 STDMETHOD(OnFocusChangeIS)(IUnknown *punkObj, BOOL fSetFocus) override;
96
97 // *** IDeskBarClient methods ***
98 STDMETHOD(SetDeskBarSite)(IUnknown *punkSite) override;
99 STDMETHOD(SetModeDBC)(DWORD dwMode) override;
100 STDMETHOD(UIActivateDBC)(DWORD dwState) override;
101 STDMETHOD(GetSize)(DWORD dwWhich, LPRECT prc) override;
102
103 // *** IOleCommandTarget methods ***
104 STDMETHOD(QueryStatus)(const GUID *pguidCmdGroup, ULONG cCmds,
105 OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) override;
106 STDMETHOD(Exec)(const GUID *pguidCmdGroup, DWORD nCmdID,
107 DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override;
108
109 // *** IBandSite specific methods ***
110 STDMETHOD(AddBand)(IUnknown *punk) override;
111 STDMETHOD(EnumBands)(UINT uBand, DWORD *pdwBandID) override;
112 STDMETHOD(QueryBand)(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState,
113 LPWSTR pszName, int cchName) override;
114 STDMETHOD(SetBandState)(DWORD dwBandID, DWORD dwMask, DWORD dwState) override;
115 STDMETHOD(RemoveBand)(DWORD dwBandID) override;
116 STDMETHOD(GetBandObject)(DWORD dwBandID, REFIID riid, void **ppv) override;
117 STDMETHOD(SetBandSiteInfo)(const BANDSITEINFO *pbsinfo) override;
118 STDMETHOD(GetBandSiteInfo)(BANDSITEINFO *pbsinfo) override;
119
120 // *** IPersist methods ***
121 STDMETHOD(GetClassID)(CLSID *pClassID) override;
122
123 // *** IPersistStream methods ***
124 STDMETHOD(IsDirty)() override;
125 STDMETHOD(Load)(IStream *pStm) override;
126 STDMETHOD(Save)(IStream *pStm, BOOL fClearDirty) override;
127 STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSize) override;
128
129 // message handlers
130 LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
131 LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
133
134 // Helper functions
136 HRESULT FindBandByGUID(REFIID pGuid, DWORD *pdwBandID);
137 HRESULT ShowBand(DWORD dwBandID);
139 HRESULT GetInternalBandInfo(UINT uBand, REBARBANDINFO *pBandInfo, DWORD fMask);
140
141
146
149// COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite)
150 COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
151 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
152 COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
153 COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
154 COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient)
155 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
156 COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
157// COM_INTERFACE_ENTRY_IID(IID_IBandSiteHelper, IBandSiteHelper)
158// COM_INTERFACE_ENTRY_IID(IID_IExplorerToolbar, IExplorerToolbar)
162};
163
165{
167 fNextBandID = 1;
168}
169
171{
172 TRACE("CBaseBarSite deleted\n");
173}
174
176{
177 CComPtr<IPersist> persist;
179 CComPtr<IOleWindow> oleWindow;
180 CComPtr<IDeskBand> deskBand;
181 CBarInfo *newInfo;
183 DESKBANDINFO deskBandInfo;
184 DWORD thisBandID;
185 HRESULT hResult;
186 CLSID tmp;
187
188 hResult = newBar->QueryInterface(IID_PPV_ARG(IPersist, &persist));
189 if (FAILED_UNEXPECTEDLY(hResult))
190 return hResult;
191 hResult = newBar->QueryInterface(IID_PPV_ARG(IObjectWithSite, &site));
192 if (FAILED_UNEXPECTEDLY(hResult))
193 return hResult;
194 hResult = newBar->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
195 if (FAILED_UNEXPECTEDLY(hResult))
196 return hResult;
197 hResult = newBar->QueryInterface(IID_PPV_ARG(IDeskBand, &deskBand));
198 if (FAILED_UNEXPECTEDLY(hResult))
199 return hResult;
200
201 // Check if the GUID already exists
202 hResult = persist->GetClassID(&tmp);
203 if (!SUCCEEDED(hResult))
204 {
205 return E_INVALIDARG;
206 }
207 if (FindBandByGUID(tmp, &thisBandID) == S_OK)
208 {
209 return ShowBand(thisBandID);
210 }
211
212 hResult = site->SetSite(static_cast<IOleWindow *>(this));
213 if (FAILED_UNEXPECTEDLY(hResult))
214 return hResult;
215
216 ATLTRY(newInfo = new CBarInfo);
217 if (newInfo == NULL)
218 return E_OUTOFMEMORY;
219
220 // set new bar info
221 thisBandID = fNextBandID++;
222 newInfo->fTheBar = newBar;
223 newInfo->fBandID = thisBandID;
224 newInfo->fBarClass = tmp;
225
226 // get band info
227 deskBandInfo.dwMask = DBIM_MINSIZE | DBIM_ACTUAL | DBIM_TITLE | DBIM_BKCOLOR;
228 deskBandInfo.wszTitle[0] = 0;
229 hResult = deskBand->GetBandInfo(0, (fVertical) ? DBIF_VIEWMODE_VERTICAL : DBIF_VIEWMODE_NORMAL, &deskBandInfo);
230
231 // insert band
232 memset(&bandInfo, 0, sizeof(bandInfo));
233 bandInfo.cbSize = sizeof(bandInfo);
237 bandInfo.lpText = deskBandInfo.wszTitle;
238 hResult = oleWindow->GetWindow(&bandInfo.hwndChild);
239 /* It seems Windows XP doesn't take account of band minsize */
240#if 0
241 bandInfo.cxMinChild = 200; //deskBandInfo.ptMinSize.x;
242 bandInfo.cyMinChild = 200; //deskBandInfo.ptMinSize.y;
243#endif
244 bandInfo.cx = 0;
245 bandInfo.wID = thisBandID;
246 bandInfo.cyChild = -1; //deskBandInfo.ptActual.y;
247 bandInfo.cyMaxChild = 32000;
248 bandInfo.cyIntegral = 1;
249 bandInfo.cxIdeal = 0; //deskBandInfo.ptActual.x;
250 bandInfo.lParam = reinterpret_cast<LPARAM>(newInfo);
251 SendMessage(RB_INSERTBANDW, -1, reinterpret_cast<LPARAM>(&bandInfo));
252 hResult = ShowBand(newInfo->fBandID);
253 //fCurrentActiveBar = newInfo;
254 return hResult;
255 }
256
258{
259 if (lphwnd == NULL)
260 return E_POINTER;
261 *lphwnd = m_hWnd;
262 return S_OK;
263}
264
266{
267 return E_NOTIMPL;
268}
269
271{
273 return S_OK;
274
275 return IUnknown_UIActivateIO(fCurrentActiveBar->fTheBar, fActivate, lpMsg);
276}
277
279{
281 return S_FALSE;
282
284}
285
287{
289 {
290 if (lpMsg)
291 {
292 TranslateMessage(lpMsg);
293 DispatchMessage(lpMsg);
294 }
295 return S_OK;
296 }
297
299}
300
302{
303 CComPtr<IServiceProvider> serviceProvider;
304 HRESULT hResult;
305
306 if (fDeskBarSite == NULL)
307 return E_FAIL;
308 hResult = fDeskBarSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
309 if (FAILED_UNEXPECTEDLY(hResult))
310 return hResult;
311 // called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser
312 // called for SID_IWebBrowserApp, IID_IConnectionPointContainer
313 // connection point called for DIID_DWebBrowserEvents2 to establish connection
314 return serviceProvider->QueryService(guidService, riid, ppvObject);
315}
316
318 HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
319{
320 CComPtr<IDeskBar> deskBar;
321 CComPtr<IWinEventHandler> winEventHandler;
322 NMHDR *notifyHeader;
323 // RECT newBounds;
324 HRESULT hResult;
326
327 hResult = S_OK;
328 if (uMsg == WM_NOTIFY)
329 {
330 notifyHeader = (NMHDR *)lParam;
331 if (notifyHeader->hwndFrom == m_hWnd)
332 {
333 switch (notifyHeader->code)
334 {
335 case RBN_AUTOSIZE:
336 // For now, don't notify basebar we tried to resize ourselves, we don't
337 // get correct values at the moment.
338#if 0
339 hResult = fDeskBarSite->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
340 GetClientRect(&newBounds);
341 hResult = deskBar->OnPosRectChangeDB(&newBounds);
342
343#endif
344 break;
345 case NM_CUSTOMDRAW:
347 if (theResult)
348 *theResult = result;
349 return S_OK;
350 }
351 }
352 }
353 if (fCurrentActiveBar != NULL)
354 {
355 hResult = fCurrentActiveBar->fTheBar->QueryInterface(
356 IID_PPV_ARG(IWinEventHandler, &winEventHandler));
357 if (SUCCEEDED(hResult) && winEventHandler.p != NULL)
358 hResult = winEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
359 }
360 return hResult;
361}
362
364{
365 return E_NOTIMPL;
366}
367
369{
370 // FIXME: should we directly pass-through, or advertise ourselves as focus owner ?
371 return IUnknown_OnFocusChangeIS(fDeskBarSite, punkObj, fSetFocus);
372}
373
375{
376 CComPtr<IOleWindow> oleWindow;
377 HWND ownerWindow;
378 HRESULT hResult;
379 DWORD dwBandID;
380
381 if (punkSite == NULL)
382 {
383
384 TRACE("Destroying site \n");
385 /* Cleanup our bands */
386 while(SUCCEEDED(EnumBands(-1, &dwBandID)) && dwBandID)
387 {
388 hResult = EnumBands(0, &dwBandID);
389 if(FAILED_UNEXPECTEDLY(hResult))
390 continue;
391 RemoveBand(dwBandID);
392 }
394 }
395 else
396 {
397 TBBUTTON closeBtn;
398 HBITMAP hBmp;
399
400 hResult = punkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
401 if (FAILED_UNEXPECTEDLY(hResult))
402 return hResult;
403 hResult = punkSite->QueryInterface(IID_PPV_ARG(IUnknown, &fDeskBarSite));
404 if (FAILED_UNEXPECTEDLY(hResult))
405 return hResult;
406 hResult = oleWindow->GetWindow(&ownerWindow);
407 if (FAILED_UNEXPECTEDLY(hResult))
408 return hResult;
409
413 if (fVertical)
414 dwStyle |= CCS_VERT;
415
416 /* Create site window */
417 HWND tmp = CreateWindowW(REBARCLASSNAMEW, NULL, dwStyle, 0, 0, 0, 0, ownerWindow, NULL,
418 _AtlBaseModule.GetModuleInstance(), NULL);
419
420 /* Give window management to ATL */
421 SubclassWindow(tmp);
422
425
426 /* Create close toolbar and imagelist */
431 , 0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
432
434
435 hBmp = (HBITMAP)LoadImage(_AtlBaseModule.GetModuleInstance(),
438
439 ImageList_AddMasked(toolImageList, hBmp, RGB(192, 192, 192));
440 DeleteObject(hBmp);
441
443
444 /* Add button to toolbar */
445 closeBtn.iBitmap = MAKELONG(1, 0);
446 closeBtn.idCommand = IDM_BASEBAR_CLOSE;
447 closeBtn.fsState = TBSTATE_ENABLED;
448 closeBtn.fsStyle = BTNS_BUTTON;
449 ZeroMemory(closeBtn.bReserved, sizeof(closeBtn.bReserved));
450 closeBtn.dwData = 0;
451 closeBtn.iString = (INT_PTR)L"Close";
452
455 //SendMessage(toolbarWnd, TB_AUTOSIZE, 0, 0);
456 }
457 return S_OK;
458}
459
461{
462 return E_NOTIMPL;
463}
464
466{
467 return E_NOTIMPL;
468}
469
471{
472 return E_NOTIMPL;
473}
474
476 ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
477{
478 return E_NOTIMPL;
479}
480
482 DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
483{
484 if (IsEqualIID(*pguidCmdGroup, IID_IDeskBand))
485 {
486 switch (nCmdID)
487 {
488 case 0:
489 //update band info ?
490 case 1: // insert a new band
491 if (V_VT(pvaIn) != VT_UNKNOWN)
492 return E_INVALIDARG;
493 return InsertBar(V_UNKNOWN(pvaIn));
494 case 0x17:
495 // redim band
496 break;
497 }
498 }
499 return E_FAIL;
500}
501
503{
504 if (!pBandInfo)
505 return E_INVALIDARG;
506 memset(pBandInfo, 0, sizeof(REBARBANDINFO));
507 pBandInfo->cbSize = sizeof(REBARBANDINFO);
508 pBandInfo->fMask = RBBIM_LPARAM | RBBIM_ID;
509
510 // Grab our bandinfo from rebar control
511 if (!SendMessage(RB_GETBANDINFO, uBand, reinterpret_cast<LPARAM>(pBandInfo)))
512 return E_INVALIDARG;
513 return S_OK;
514}
515
517{
518 if (!pBandInfo)
519 return E_INVALIDARG;
520 pBandInfo->cbSize = sizeof(REBARBANDINFO);
521 pBandInfo->fMask = fMask;
522
523 // Grab our bandinfo from rebar control
524 if (!SendMessage(RB_GETBANDINFO, uBand, reinterpret_cast<LPARAM>(pBandInfo)))
525 return E_INVALIDARG;
526 return S_OK;
527}
528
530{
531 return InsertBar(punk);
532}
533
535{
537
538 if (pdwBandID == NULL)
539 return E_INVALIDARG;
540 if (uBand == 0xffffffff)
541 {
542 *pdwBandID = (DWORD)SendMessage(RB_GETBANDCOUNT, 0, 0);
543 return S_OK;
544 }
546 return E_INVALIDARG;
547 *pdwBandID = bandInfo.wID;
548 return S_OK;
549}
550
552 DWORD *pdwState, LPWSTR pszName, int cchName)
553{
554 return E_NOTIMPL;
555}
556
558{
559 return E_NOTIMPL;
560}
561
563{
565 HRESULT hr;
566 CBarInfo *pInfo;
568 CComPtr<IDeskBand> pDockWnd;
569 DWORD index;
570
571 // Retrieve the right index of the coolbar knowing the id
572 index = SendMessage(RB_IDTOINDEX, dwBandID, 0);
573 if (index == 0xffffffff)
574 return E_INVALIDARG;
575
577 return E_INVALIDARG;
578
579 pInfo = reinterpret_cast<CBarInfo*>(bandInfo.lParam);
580 if (!pInfo)
581 return E_INVALIDARG;
582
583 hr = pInfo->fTheBar->QueryInterface(IID_PPV_ARG(IDeskBand, &pDockWnd));
585 {
586 return E_NOINTERFACE;
587 }
588 hr = pInfo->fTheBar->QueryInterface(IID_PPV_ARG(IObjectWithSite, &pSite));
590 {
591 return E_NOINTERFACE;
592 }
593 /* Windows sends a CloseDW before setting site to NULL */
594 pDockWnd->CloseDW(0);
595 pSite->SetSite(NULL);
596
597 // Delete the band from rebar
599 {
600 ERR("Can't delete the band\n");
601 return E_INVALIDARG;
602 }
603 if (pInfo == fCurrentActiveBar)
604 {
605 // FIXME: what to do when we are deleting active bar ? Let's assume we remove it for now
607 }
608 delete pInfo;
609 return S_OK;
610}
611
613{
615 HRESULT hr;
616 CBarInfo *pInfo;
617 DWORD index;
618
619 if (ppv == NULL)
620 return E_POINTER;
621
622 // Retrieve the right index of the coolbar knowing the id
623 index = SendMessage(RB_IDTOINDEX, dwBandID, 0);
624 if (index == 0xffffffff)
625 return E_INVALIDARG;
626
628 return E_INVALIDARG;
629
630 pInfo = reinterpret_cast<CBarInfo*>(bandInfo.lParam);
631 hr = pInfo->fTheBar->QueryInterface(riid, ppv);
632 if (!SUCCEEDED(hr))
633 return E_NOINTERFACE;
634 return S_OK;
635}
636
638{
639 if (pbsinfo == NULL)
640 return E_POINTER;
641 return E_NOTIMPL;
642}
643
645{
646 if (pbsinfo == NULL)
647 return E_POINTER;
648 return E_NOTIMPL;
649}
650
652{
653 if (pClassID == NULL)
654 return E_POINTER;
655 // TODO: what class to return here?
656 return E_NOTIMPL;
657}
658
660{
661 return E_NOTIMPL;
662}
663
665{
666 return E_NOTIMPL;
667}
668
670{
671 return E_NOTIMPL;
672}
673
675{
676 if (pcbSize == NULL)
677 return E_POINTER;
678 return E_NOTIMPL;
679}
680
682{
683 NMHDR *notifyHeader;
684
685 notifyHeader = reinterpret_cast<NMHDR *>(lParam);
686 if (notifyHeader->hwndFrom == m_hWnd)
687 {
688 }
689 bHandled = FALSE; /* forward notification to parent */
690 return 0;
691}
692
694{
696 {
697 /* Tell the base bar to hide */
698 IUnknown_Exec(fDeskBarSite, IID_IDeskBarClient, 0, 0, NULL, NULL);
699 bHandled = TRUE;
700 }
701 return 0;
702}
703
705{
706 switch (pnmcd->dwDrawStage)
707 {
708 case CDDS_PREPAINT:
709 case CDDS_PREERASE:
710 return CDRF_NOTIFYITEMDRAW;
712 if (fVertical)
713 {
715 WCHAR wszTitle[MAX_PATH];
716 DWORD index;
717 UINT pad = GetSystemMetrics(SM_CXEDGE), leftpad = max(pad * 2, 4);
718 UINT btnw = 20, btnh = 18, btnarea = 1 + btnw + 1;
719 HFONT newFont, oldFont;
720
722 ZeroMemory(&info, sizeof(info));
723 ZeroMemory(wszTitle, sizeof(wszTitle));
724 DrawEdge(pnmcd->hdc, &pnmcd->rc, EDGE_ETCHED, BF_BOTTOM);
725 // We also resize our close button
726 ::SetWindowPos(toolbarWnd, HWND_TOP, pnmcd->rc.right - btnarea, 0, btnw, btnh, SWP_SHOWWINDOW);
727 // Draw the text
728 info.cch = MAX_PATH;
729 info.lpText = wszTitle;
730 RECT rt = pnmcd->rc;
731 rt.right -= btnarea;
732 rt.left += leftpad;
733 rt.bottom -= 1;
735 return CDRF_SKIPDEFAULT;
736 newFont = GetTitleFont();
737 if (newFont)
738 oldFont = (HFONT)SelectObject(pnmcd->hdc, newFont);
739 COLORREF orgclrtxt = SetTextColor(pnmcd->hdc, GetSysColor(COLOR_BTNTEXT));
740 DrawText(pnmcd->hdc, info.lpText, -1, &rt, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
741 SetTextColor(pnmcd->hdc, orgclrtxt);
742 SelectObject(pnmcd->hdc, oldFont);
743 DeleteObject(newFont);
744 return CDRF_SKIPDEFAULT;
745 }
746 else
747 {
748 DrawEdge(pnmcd->hdc, &pnmcd->rc, EDGE_ETCHED, BF_BOTTOM);
749 // We also resize our close button
751 }
752 return CDRF_SKIPDEFAULT;
753 default:
754 break;
755 }
756 return CDRF_DODEFAULT;
757}
758
760{
761 NONCLIENTMETRICS mt;
762 mt.cbSize = sizeof(mt);
763 if (!SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(mt), &mt, 0))
764 {
765 ERR("Can't get system parameters !\n");
766 return NULL;
767 }
768 return CreateFontIndirect(&mt.lfMenuFont);
769
770}
771
773{
774 DWORD numBands;
775 DWORD i;
776 HRESULT hr;
778 CBarInfo *realInfo;
779
780 hr = EnumBands(-1, &numBands);
782 return E_FAIL;
783
784 for(i = 0; i < numBands; i++)
785 {
787 return E_FAIL;
788 realInfo = (CBarInfo*)bandInfo.lParam;
789 if (IsEqualGUID(pGuid, realInfo->fBarClass))
790 {
791 *pdwBandID = realInfo->fBandID;
792 return S_OK;
793 }
794 }
795 return S_FALSE;
796}
797
799{
800 UINT index;
801 CComPtr<IDeskBand> dockingWindow;
802 HRESULT hResult;
804
805 // show our band
806 hResult = GetBandObject(dwBandID, IID_PPV_ARG(IDeskBand, &dockingWindow));
807 if (FAILED_UNEXPECTEDLY(hResult))
808 return E_FAIL;
809
810 hResult = dockingWindow->ShowDW(TRUE);
811
812 // Hide old band while adding new one
813 if (fCurrentActiveBar && fCurrentActiveBar->fBandID != dwBandID)
814 {
815 DWORD index;
817 if (index != 0xffffffff)
819 }
820 if (FAILED_UNEXPECTEDLY(hResult))
821 return hResult;
822
823 // Display the current band
824 index = SendMessage(RB_IDTOINDEX, dwBandID, 0);
825 if (index != 0xffffffff)
828 return E_FAIL;
830 return S_OK;
831}
832
834{
835 return ShellObjectCreatorInit<CBaseBarSite, BOOL>(bVertical, riid, ppv);
836}
#define ATLTRY(x)
Definition: atlcomcli.h:44
HWND hWnd
Definition: settings.c:17
#define index(s, c)
Definition: various.h:29
#define ERR(fmt,...)
Definition: precomp.h:57
HRESULT CBaseBarSite_CreateInstance(REFIID riid, void **ppv, BOOL bVertical)
#define STDMETHOD(m)
Definition: basetyps.h:62
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
HWND m_hWnd
Definition: atlwin.h:273
CComPtr< IUnknown > fTheBar
Definition: basebarsite.cpp:58
STDMETHOD() EnumBands(UINT uBand, DWORD *pdwBandID) override
STDMETHOD() GetSize(DWORD dwWhich, LPRECT prc) override
STDMETHOD() IsDirty() override
HRESULT InsertBar(IUnknown *newBar)
HRESULT FindBandByGUID(REFIID pGuid, DWORD *pdwBandID)
DWORD fNextBandID
Definition: basebarsite.cpp:66
HFONT GetTitleFont()
HRESULT Initialize(BOOL vert)
Definition: basebarsite.cpp:73
STDMETHOD() GetSizeMax(ULARGE_INTEGER *pcbSize) override
STDMETHOD() OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus) override
STDMETHOD() SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState) override
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT OnCustomDraw(LPNMCUSTOMDRAW pnmcd)
STDMETHOD() Save(IStream *pStm, BOOL fClearDirty) override
STDMETHOD() UIActivateDBC(DWORD dwState) override
STDMETHOD() RemoveBand(DWORD dwBandID) override
STDMETHOD() GetClassID(CLSID *pClassID) override
CBarInfo * fCurrentActiveBar
Definition: basebarsite.cpp:63
STDMETHOD() QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) override
STDMETHOD() SetBandSiteInfo(const BANDSITEINFO *pbsinfo) override
CComPtr< IUnknown > fDeskBarSite
Definition: basebarsite.cpp:65
STDMETHOD() Load(IStream *pStm) override
STDMETHOD() AddBand(IUnknown *punk) override
STDMETHOD() SetModeDBC(DWORD dwMode) override
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
STDMETHOD() GetBandSiteInfo(BANDSITEINFO *pbsinfo) override
STDMETHOD() Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override
HRESULT GetInternalBandInfo(UINT uBand, REBARBANDINFO *pBandInfo)
HRESULT ShowBand(DWORD dwBandID)
STDMETHOD() IsWindowOwner(HWND hWnd) override
STDMETHOD() QueryService(REFGUID guidService, REFIID riid, void **ppvObject) override
STDMETHOD() ContextSensitiveHelp(BOOL fEnterMode) override
STDMETHOD() SetDeskBarSite(IUnknown *punkSite) override
STDMETHOD() UIActivateIO(BOOL fActivate, LPMSG lpMsg) override
STDMETHOD() QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName) override
STDMETHOD() TranslateAcceleratorIO(LPMSG lpMsg) override
STDMETHOD() OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) override
STDMETHOD() GetWindow(HWND *lphwnd) override
HIMAGELIST toolImageList
Definition: basebarsite.cpp:68
STDMETHOD() GetBandObject(DWORD dwBandID, REFIID riid, void **ppv) override
STDMETHOD() HasFocusIO() override
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 TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDM_BASEBAR_CLOSE
Definition: resource.h:75
#define IDB_BANDBUTTONS
Definition: resource.h:149
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define MAX_PATH
Definition: compat.h:34
@ VT_UNKNOWN
Definition: compat.h:2308
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
HRESULT WINAPI IUnknown_UIActivateIO(IUnknown *unknown, BOOL activate, LPMSG msg)
Definition: ordinal.c:1633
HRESULT WINAPI IUnknown_TranslateAcceleratorIO(IUnknown *lpUnknown, LPMSG lpMsg)
Definition: ordinal.c:4279
HRESULT WINAPI IUnknown_HasFocusIO(IUnknown *lpUnknown)
Definition: ordinal.c:4311
HRESULT WINAPI IUnknown_Exec(IUnknown *lpUnknown, REFGUID pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
Definition: ordinal.c:1087
HRESULT WINAPI IUnknown_OnFocusChangeIS(LPUNKNOWN lpUnknown, LPUNKNOWN pFocusObject, BOOL bFocus)
Definition: ordinal.c:4783
#define RGB(r, g, b)
Definition: precomp.h:71
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
GLuint index
Definition: glext.h:6031
GLuint64EXT * result
Definition: glext.h:11304
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
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
struct IOleCommandTarget::_tagOLECMDTEXT OLECMDTEXT
struct IOleCommandTarget::_tagOLECMD OLECMD
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static const struct bandInfoStruct bandInfo[9]
Definition: layer3.c:95
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define END_COM_MAP()
Definition: atlcom.h:592
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1926
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1898
#define END_MSG_MAP()
Definition: atlwin.h:1917
if(dx< 0)
Definition: linetemp.h:194
static HBITMAP
Definition: button.c:44
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static IActiveScriptSite * site
Definition: script.c:149
unsigned int UINT
Definition: ndis.h:50
#define DWORD
Definition: nt_native.h:44
_Out_ LPRECT prc
Definition: ntgdi.h:1658
#define L(x)
Definition: ntvdm.h:50
#define V_UNKNOWN(A)
Definition: oleauto.h:281
#define V_VT(A)
Definition: oleauto.h:211
const GUID IID_IOleWindow
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_BORDER
Definition: pedump.c:625
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistStream
Definition: proxy.cpp:13
#define RBBS_TOPALIGN
Definition: commctrl.h:1500
#define TB_INSERTBUTTON
Definition: commctrl.h:1270
#define RB_SETTEXTCOLOR
Definition: commctrl.h:1593
#define RB_GETBANDINFO
Definition: commctrl.h:1612
#define BTNS_BUTTON
Definition: commctrl.h:998
#define RB_DELETEBAND
Definition: commctrl.h:1576
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define RBS_REGISTERDROP
Definition: commctrl.h:1474
#define REBARCLASSNAMEW
Definition: commctrl.h:1463
#define RBBIM_CHILDSIZE
Definition: commctrl.h:1507
#define RB_INSERTBANDW
Definition: commctrl.h:1583
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define REBARBANDINFO
Definition: commctrl.h:1569
#define CDRF_DODEFAULT
Definition: commctrl.h:268
#define RBBIM_CHILD
Definition: commctrl.h:1506
#define RBS_AUTOSIZE
Definition: commctrl.h:1475
#define CCS_VERT
Definition: commctrl.h:2254
#define TB_SETIMAGELIST
Definition: commctrl.h:1150
#define RBBS_NOGRIPPER
Definition: commctrl.h:1497
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define RB_SETBKCOLOR
Definition: commctrl.h:1591
#define TBSTYLE_TRANSPARENT
Definition: commctrl.h:996
#define RB_SHOWBAND
Definition: commctrl.h:1618
#define CCS_NODIVIDER
Definition: commctrl.h:2253
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:943
#define RBN_AUTOSIZE
Definition: commctrl.h:1631
#define CLR_DEFAULT
Definition: commctrl.h:320
#define RB_IDTOINDEX
Definition: commctrl.h:1588
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define TBSTYLE_FLAT
Definition: commctrl.h:992
#define RBBIM_ID
Definition: commctrl.h:1510
#define RBBIM_LPARAM
Definition: commctrl.h:1512
#define RBS_VARHEIGHT
Definition: commctrl.h:1471
#define ILC_MASK
Definition: commctrl.h:351
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2251
#define CCS_NORESIZE
Definition: commctrl.h:2250
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:270
#define CCS_NOMOVEY
Definition: commctrl.h:2248
#define RBBIM_STYLE
Definition: commctrl.h:1502
#define ILC_COLOR24
Definition: commctrl.h:357
#define RBBIM_TEXT
Definition: commctrl.h:1504
#define TB_SETMAXTEXTROWS
Definition: commctrl.h:1162
#define CDDS_PREERASE
Definition: commctrl.h:282
#define RBS_DBLCLKTOGGLE
Definition: commctrl.h:1477
#define RB_GETBANDCOUNT
Definition: commctrl.h:1585
#define RBS_VERTICALGRIPPER
Definition: commctrl.h:1476
#define RBBS_VARIABLEHEIGHT
Definition: commctrl.h:1495
#define RBBIM_IDEALSIZE
Definition: commctrl.h:1511
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define WM_NOTIFY
Definition: richedit.h:61
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
Definition: scsiwmi.h:51
BYTE fsState
Definition: commctrl.h:951
INT_PTR iString
Definition: commctrl.h:959
int idCommand
Definition: commctrl.h:950
DWORD_PTR dwData
Definition: commctrl.h:958
int iBitmap
Definition: commctrl.h:949
BYTE fsStyle
Definition: commctrl.h:952
BYTE bReserved[2]
Definition: commctrl.h:956
WCHAR wszTitle[256]
Definition: shobjidl.idl:2497
UINT code
Definition: winuser.h:3162
HWND hwndFrom
Definition: winuser.h:3160
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG left
Definition: windef.h:306
#define max(a, b)
Definition: svc.c:63
int32_t INT_PTR
Definition: typedefs.h:64
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define ZeroMemory
Definition: winbase.h:1737
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2792
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
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 SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:542
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_POINTER
Definition: winerror.h:2365
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
#define CreateFontIndirect
Definition: wingdi.h:4444
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_BTNTEXT
Definition: winuser.h:936
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_LOADTRANSPARENT
Definition: winuser.h:1096
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define SM_CXEDGE
Definition: winuser.h:1011
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_COMMAND
Definition: winuser.h:1743
#define EDGE_ETCHED
Definition: winuser.h:452
#define BF_BOTTOM
Definition: winuser.h:457
#define DrawText
Definition: winuser.h:5783
#define DT_LEFT
Definition: winuser.h:534
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define HWND_TOP
Definition: winuser.h:1210
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define SWP_SHOWWINDOW
Definition: winuser.h:1251
#define SendMessage
Definition: winuser.h:5855
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4319
#define DT_VCENTER
Definition: winuser.h:543
#define LoadImage
Definition: winuser.h:5827
#define BN_CLICKED
Definition: winuser.h:1928
#define DispatchMessage
Definition: winuser.h:5777
#define SystemParametersInfo
Definition: winuser.h:5870
#define MAKEINTRESOURCE
Definition: winuser.h:591
int WINAPI GetSystemMetrics(_In_ int)
#define IID_PPV_ARG(Itype, ppType)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184