2014-11-02 20:18:54 +00:00
|
|
|
/*
|
|
|
|
* ReactOS Explorer
|
|
|
|
*
|
|
|
|
* Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precomp.h"
|
|
|
|
|
|
|
|
HRESULT
|
|
|
|
UpdateStartMenu(IN OUT IMenuPopup *pMenuPopup,
|
|
|
|
IN HBITMAP hbmBanner OPTIONAL,
|
2024-03-22 12:15:22 +00:00
|
|
|
IN BOOL bSmallIcons,
|
|
|
|
IN BOOL bRefresh)
|
2014-11-02 20:18:54 +00:00
|
|
|
{
|
|
|
|
CComPtr<IBanneredBar> pbb;
|
|
|
|
HRESULT hRet;
|
|
|
|
|
|
|
|
hRet = pMenuPopup->QueryInterface(IID_PPV_ARG(IBanneredBar, &pbb));
|
|
|
|
if (SUCCEEDED(hRet))
|
|
|
|
{
|
2014-11-02 22:26:44 +00:00
|
|
|
hRet = pbb->SetBitmap(hbmBanner);
|
2014-11-02 20:18:54 +00:00
|
|
|
|
|
|
|
/* Update the icon size */
|
|
|
|
hRet = pbb->SetIconSize(bSmallIcons ? BMICON_SMALL : BMICON_LARGE);
|
|
|
|
}
|
|
|
|
|
2024-03-22 12:15:22 +00:00
|
|
|
if (bRefresh)
|
|
|
|
{
|
|
|
|
FIXME("Refresh the Start menu with communicating with SHELL32\n");
|
|
|
|
}
|
|
|
|
|
2014-11-02 20:18:54 +00:00
|
|
|
return hRet;
|
|
|
|
}
|
|
|
|
|
2016-06-04 14:09:20 +00:00
|
|
|
IMenuPopup*
|
2014-11-02 20:18:54 +00:00
|
|
|
CreateStartMenu(IN ITrayWindow *Tray,
|
|
|
|
OUT IMenuBand **ppMenuBand,
|
2016-06-04 14:09:20 +00:00
|
|
|
IN HBITMAP hbmBanner OPTIONAL,
|
2014-11-02 20:18:54 +00:00
|
|
|
IN BOOL bSmallIcons)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
2014-12-09 22:49:54 +00:00
|
|
|
CComPtr<IMenuPopup> pMp;
|
|
|
|
CComPtr<IUnknown> pSms;
|
|
|
|
CComPtr<IMenuBand> pMb;
|
|
|
|
CComPtr<IInitializeObject> pIo;
|
|
|
|
CComPtr<IUnknown> pUnk;
|
|
|
|
CComPtr<IBandSite> pBs;
|
2014-11-02 20:18:54 +00:00
|
|
|
DWORD dwBandId = 0;
|
|
|
|
|
2018-11-23 17:50:42 +00:00
|
|
|
hr = CStartMenuSite_CreateInstance(Tray, IID_PPV_ARG(IUnknown, &pSms));
|
2014-11-02 20:18:54 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return NULL;
|
|
|
|
|
2017-06-19 14:27:51 +00:00
|
|
|
hr = _CStartMenu_CreateInstance(IID_PPV_ARG(IMenuPopup, &pMp));
|
2014-11-02 20:18:54 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-12-09 22:49:54 +00:00
|
|
|
return NULL;
|
2014-11-02 20:18:54 +00:00
|
|
|
|
|
|
|
/* Set the menu site so we can handle messages */
|
2014-12-09 22:49:54 +00:00
|
|
|
hr = IUnknown_SetSite(pMp, pSms);
|
2014-11-02 20:18:54 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-12-09 22:49:54 +00:00
|
|
|
return NULL;
|
2014-11-02 20:18:54 +00:00
|
|
|
|
|
|
|
/* Initialize the menu object */
|
|
|
|
hr = pMp->QueryInterface(IID_PPV_ARG(IInitializeObject, &pIo));
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = pIo->Initialize();
|
|
|
|
else
|
|
|
|
hr = S_OK;
|
|
|
|
|
|
|
|
/* Everything is initialized now. Let's get the IMenuBand interface. */
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-12-09 22:49:54 +00:00
|
|
|
return NULL;
|
2014-11-02 20:18:54 +00:00
|
|
|
|
2014-11-02 22:26:44 +00:00
|
|
|
hr = pMp->GetClient(&pUnk);
|
2014-11-02 20:18:54 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-12-09 22:49:54 +00:00
|
|
|
return NULL;
|
2014-11-02 20:18:54 +00:00
|
|
|
|
|
|
|
hr = pUnk->QueryInterface(IID_PPV_ARG(IBandSite, &pBs));
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-12-09 22:49:54 +00:00
|
|
|
return NULL;
|
2014-11-02 20:18:54 +00:00
|
|
|
|
|
|
|
/* Finally we have the IBandSite interface, there's only one
|
|
|
|
band in it that apparently provides the IMenuBand interface */
|
2014-11-02 22:26:44 +00:00
|
|
|
hr = pBs->EnumBands(0, &dwBandId);
|
2014-11-02 20:18:54 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-12-09 22:49:54 +00:00
|
|
|
return NULL;
|
2014-11-02 20:18:54 +00:00
|
|
|
|
2014-11-02 22:26:44 +00:00
|
|
|
hr = pBs->GetBandObject(dwBandId, IID_PPV_ARG(IMenuBand, &pMb));
|
2014-11-02 20:18:54 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-12-09 22:49:54 +00:00
|
|
|
return NULL;
|
2014-11-02 20:18:54 +00:00
|
|
|
|
2024-03-22 12:15:22 +00:00
|
|
|
UpdateStartMenu(pMp, hbmBanner, bSmallIcons, FALSE);
|
2014-11-02 20:18:54 +00:00
|
|
|
|
2014-12-09 22:49:54 +00:00
|
|
|
*ppMenuBand = pMb.Detach();
|
2014-11-02 20:18:54 +00:00
|
|
|
|
2014-12-09 22:49:54 +00:00
|
|
|
return pMp.Detach();
|
2014-11-02 20:18:54 +00:00
|
|
|
}
|