mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
[EXPLORER-NEW]
* Show the start menu at the same position and alignment Windows uses. [RSHELL] * Use IShellFolder methods instead of SHCreateShellItem. * Handle toolbar window events from the toolbar class. * Improve the positioning calculations. * TODO: How to tell the submenus of the start menu to show towards the left? For when the taskbar is ABE_RIGHT. CORE-7596 svn path=/branches/shell-experiments/; revision=62334
This commit is contained in:
parent
58931088c3
commit
8b06cd6325
10 changed files with 234 additions and 245 deletions
|
@ -2083,21 +2083,24 @@ static void PopupStartMenu(IN ITrayWindowImpl *This)
|
|||
if (GetWindowRect(This->hwndStart,
|
||||
(RECT*) &rcExclude))
|
||||
{
|
||||
if (ITrayWindowImpl_IsPosHorizontal(This))
|
||||
switch (This->Position)
|
||||
{
|
||||
case ABE_BOTTOM:
|
||||
pt.x = rcExclude.left;
|
||||
pt.y = rcExclude.top;
|
||||
dwFlags |= MPPF_BOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (This->Position == ABE_LEFT)
|
||||
break;
|
||||
case ABE_TOP:
|
||||
case ABE_LEFT:
|
||||
pt.x = rcExclude.left;
|
||||
else
|
||||
pt.x = rcExclude.right;
|
||||
|
||||
pt.y = rcExclude.bottom;
|
||||
dwFlags |= MPPF_BOTTOM;
|
||||
dwFlags |= MPPF_TOP | MPPF_ALIGN_RIGHT;
|
||||
break;
|
||||
case ABE_RIGHT:
|
||||
pt.x = rcExclude.right;
|
||||
pt.y = rcExclude.bottom;
|
||||
dwFlags |= MPPF_TOP | MPPF_ALIGN_LEFT;
|
||||
break;
|
||||
}
|
||||
|
||||
IMenuPopup_Popup(This->StartMenuPopup,
|
||||
|
|
|
@ -58,11 +58,6 @@ CMenuBand::CMenuBand() :
|
|||
m_popupItem(-1)
|
||||
{
|
||||
m_focusManager = CMenuFocusManager::AcquireManager();
|
||||
|
||||
m_marlett = CreateFont(
|
||||
0, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET,
|
||||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, FF_DONTCARE, L"Marlett");
|
||||
}
|
||||
|
||||
CMenuBand::~CMenuBand()
|
||||
|
@ -74,8 +69,6 @@ CMenuBand::~CMenuBand()
|
|||
|
||||
if (m_SFToolbar)
|
||||
delete m_SFToolbar;
|
||||
|
||||
DeleteObject(m_marlett);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBand::Initialize(
|
||||
|
@ -553,184 +546,16 @@ HRESULT STDMETHODCALLTYPE CMenuBand::SetMenuToolbar(IUnknown *punk, DWORD dwFlag
|
|||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
|
||||
{
|
||||
RECT rc;
|
||||
HDC hdc;
|
||||
HBRUSH bgBrush;
|
||||
HBRUSH hotBrush;
|
||||
NMHDR * hdr;
|
||||
NMTBCUSTOMDRAW * cdraw;
|
||||
NMTBHOTITEM * hot;
|
||||
NMMOUSE * rclick;
|
||||
NMPGCALCSIZE* csize;
|
||||
TBBUTTONINFO btni;
|
||||
BOOL useFlatMenus = FALSE;
|
||||
COLORREF clrText;
|
||||
COLORREF clrTextHighlight;
|
||||
|
||||
|
||||
*theResult = 0;
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
|
||||
if (m_staticToolbar && m_staticToolbar->IsWindowOwner(hWnd) == S_OK)
|
||||
{
|
||||
return m_staticToolbar->OnCommand(wParam, lParam, theResult);
|
||||
return m_staticToolbar->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
|
||||
}
|
||||
|
||||
if (m_SFToolbar && m_SFToolbar->IsWindowOwner(hWnd) == S_OK)
|
||||
{
|
||||
return m_SFToolbar->OnCommand(wParam, lParam, theResult);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
||||
case WM_NOTIFY:
|
||||
hdr = reinterpret_cast<LPNMHDR>(lParam);
|
||||
switch (hdr->code)
|
||||
{
|
||||
case PGN_CALCSIZE:
|
||||
csize = reinterpret_cast<LPNMPGCALCSIZE>(hdr);
|
||||
|
||||
if (m_staticToolbar && m_staticToolbar->IsWindowOwner(hWnd) == S_OK)
|
||||
{
|
||||
SIZE tbs;
|
||||
m_staticToolbar->GetIdealSize(tbs);
|
||||
if (csize->dwFlag == PGF_CALCHEIGHT)
|
||||
{
|
||||
csize->iHeight = tbs.cy;
|
||||
}
|
||||
else if (csize->dwFlag == PGF_CALCWIDTH)
|
||||
{
|
||||
csize->iHeight = tbs.cx;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_SFToolbar && m_SFToolbar->IsWindowOwner(hWnd) == S_OK)
|
||||
{
|
||||
SIZE tbs;
|
||||
m_SFToolbar->GetIdealSize(tbs);
|
||||
if (csize->dwFlag == PGF_CALCHEIGHT)
|
||||
{
|
||||
csize->iHeight = tbs.cy;
|
||||
}
|
||||
else if (csize->dwFlag == PGF_CALCWIDTH)
|
||||
{
|
||||
csize->iHeight = tbs.cx;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
|
||||
case TBN_DROPDOWN:
|
||||
|
||||
if (m_staticToolbar && m_staticToolbar->IsWindowOwner(hWnd) == S_OK)
|
||||
{
|
||||
WPARAM wp = reinterpret_cast<LPNMTOOLBAR>(hdr)->iItem;
|
||||
return m_staticToolbar->OnCommand(wp, 0, theResult);
|
||||
}
|
||||
|
||||
if (m_SFToolbar && m_SFToolbar->IsWindowOwner(hWnd) == S_OK)
|
||||
{
|
||||
WPARAM wp = reinterpret_cast<LPNMTOOLBAR>(hdr)->iItem;
|
||||
return m_SFToolbar->OnCommand(wp, 0, theResult);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
||||
case TBN_HOTITEMCHANGE:
|
||||
hot = reinterpret_cast<LPNMTBHOTITEM>(hdr);
|
||||
|
||||
if (m_staticToolbar && m_staticToolbar->IsWindowOwner(hWnd) == S_OK)
|
||||
{
|
||||
return m_staticToolbar->OnHotItemChange(hot);
|
||||
}
|
||||
|
||||
if (m_SFToolbar && m_SFToolbar->IsWindowOwner(hWnd) == S_OK)
|
||||
{
|
||||
return m_SFToolbar->OnHotItemChange(hot);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
||||
case NM_RCLICK:
|
||||
rclick = reinterpret_cast<LPNMMOUSE>(hdr);
|
||||
|
||||
if (m_staticToolbar && m_staticToolbar->IsWindowOwner(hWnd) == S_OK)
|
||||
{
|
||||
return m_staticToolbar->OnContextMenu(rclick);
|
||||
}
|
||||
|
||||
if (m_SFToolbar && m_SFToolbar->IsWindowOwner(hWnd) == S_OK)
|
||||
{
|
||||
return m_SFToolbar->OnContextMenu(rclick);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
||||
case NM_CUSTOMDRAW:
|
||||
cdraw = reinterpret_cast<LPNMTBCUSTOMDRAW>(hdr);
|
||||
switch (cdraw->nmcd.dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
*theResult = CDRF_NOTIFYITEMDRAW;
|
||||
return S_OK;
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
|
||||
SystemParametersInfo(SPI_GETFLATMENU, 0, &useFlatMenus, 0);
|
||||
|
||||
clrText = GetSysColor(COLOR_MENUTEXT);
|
||||
clrTextHighlight = GetSysColor(COLOR_HIGHLIGHTTEXT);
|
||||
|
||||
bgBrush = GetSysColorBrush(COLOR_MENU);
|
||||
hotBrush = GetSysColorBrush(useFlatMenus ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT);
|
||||
|
||||
rc = cdraw->nmcd.rc;
|
||||
hdc = cdraw->nmcd.hdc;
|
||||
|
||||
if (((INT)cdraw->nmcd.dwItemSpec == m_hotItem ||
|
||||
(m_hotItem < 0 && (INT)cdraw->nmcd.dwItemSpec == m_popupItem)))
|
||||
{
|
||||
cdraw->nmcd.uItemState = CDIS_HOT;
|
||||
}
|
||||
|
||||
switch (cdraw->nmcd.uItemState)
|
||||
{
|
||||
case CDIS_HOT:
|
||||
case CDIS_FOCUS:
|
||||
FillRect(hdc, &rc, hotBrush);
|
||||
SetTextColor(hdc, clrTextHighlight);
|
||||
cdraw->clrText = clrTextHighlight;
|
||||
break;
|
||||
default:
|
||||
FillRect(hdc, &rc, bgBrush);
|
||||
SetTextColor(hdc, clrText);
|
||||
cdraw->clrText = clrText;
|
||||
break;
|
||||
}
|
||||
|
||||
cdraw->iListGap += 4;
|
||||
|
||||
*theResult = CDRF_NOTIFYPOSTPAINT | TBCDRF_NOBACKGROUND | TBCDRF_NOEDGES | TBCDRF_NOOFFSET | TBCDRF_NOMARK | 0x00800000; // FIXME: the last bit is Vista+, for debugging only
|
||||
return S_OK;
|
||||
|
||||
case CDDS_ITEMPOSTPAINT:
|
||||
btni.cbSize = sizeof(btni);
|
||||
btni.dwMask = TBIF_STYLE;
|
||||
SendMessage(hWnd, TB_GETBUTTONINFO, cdraw->nmcd.dwItemSpec, reinterpret_cast<LPARAM>(&btni));
|
||||
if (btni.fsStyle & BTNS_DROPDOWN)
|
||||
{
|
||||
SelectObject(cdraw->nmcd.hdc, m_marlett);
|
||||
WCHAR text [] = L"8";
|
||||
SetBkMode(cdraw->nmcd.hdc, TRANSPARENT);
|
||||
DrawTextEx(cdraw->nmcd.hdc, text, 1, &cdraw->nmcd.rc, DT_NOCLIP | DT_VCENTER | DT_RIGHT | DT_SINGLELINE, NULL);
|
||||
}
|
||||
*theResult = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
return S_OK;
|
||||
return m_SFToolbar->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
|
||||
}
|
||||
|
||||
return S_FALSE;
|
||||
|
|
|
@ -62,8 +62,6 @@ private:
|
|||
INT m_hotItem;
|
||||
INT m_popupItem;
|
||||
|
||||
HFONT m_marlett;
|
||||
|
||||
public:
|
||||
CMenuBand();
|
||||
~CMenuBand();
|
||||
|
|
|
@ -280,6 +280,7 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::Popup(POINTL *ppt, RECTL *prcExclude, MP
|
|||
return hr;
|
||||
|
||||
::AdjustWindowRect(&rc, ::GetWindowLong(m_hWnd, GWL_STYLE), FALSE);
|
||||
::OffsetRect(&rc, -rc.left, -rc.top);
|
||||
|
||||
if (m_Banner != NULL)
|
||||
{
|
||||
|
@ -291,31 +292,42 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::Popup(POINTL *ppt, RECTL *prcExclude, MP
|
|||
int x, y, cx, cy;
|
||||
|
||||
RECT rcWorkArea;
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0);
|
||||
GetWindowRect(GetDesktopWindow(), &rcWorkArea);
|
||||
int waHeight = rcWorkArea.bottom - rcWorkArea.top;
|
||||
|
||||
switch (dwFlags & MPPF_POS_MASK)
|
||||
switch (dwFlags & 0xFF000000)
|
||||
{
|
||||
case MPPF_LEFT:
|
||||
case MPPF_TOP:
|
||||
x = ppt->x - rc.right;
|
||||
cx = rc.right - rc.left;
|
||||
break;
|
||||
default:
|
||||
case MPPF_BOTTOM:
|
||||
x = ppt->x;
|
||||
cx = rc.right - rc.left;
|
||||
y = ppt->y - rc.bottom;
|
||||
cy = rc.bottom - rc.top;
|
||||
break;
|
||||
case MPPF_RIGHT:
|
||||
x = ppt->x + rc.left;
|
||||
cx = rc.right - rc.left;
|
||||
y = ppt->y + rc.top;
|
||||
cy = rc.bottom - rc.top;
|
||||
break;
|
||||
case MPPF_TOP | MPPF_ALIGN_LEFT:
|
||||
x = ppt->x - rc.right;
|
||||
cx = rc.right - rc.left;
|
||||
y = ppt->y + rc.top;
|
||||
cy = rc.bottom - rc.top;
|
||||
break;
|
||||
case MPPF_TOP | MPPF_ALIGN_RIGHT:
|
||||
x = ppt->x;
|
||||
cx = rc.right - rc.left;
|
||||
y = ppt->y + rc.top;
|
||||
cy = rc.bottom - rc.top;
|
||||
break;
|
||||
}
|
||||
|
||||
if (dwFlags & MPPF_BOTTOM)
|
||||
if (x + cx > rcWorkArea.right)
|
||||
{
|
||||
y = ppt->y - rc.bottom;
|
||||
cy = rc.bottom - rc.top;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = ppt->y + rc.top;
|
||||
cy = rc.bottom - rc.top;
|
||||
// FIXME: Works, but it's oversimplified.
|
||||
x = prcExclude->left - cx;
|
||||
dwFlags = (dwFlags & (~MPPF_TOP)) | MPPF_LEFT;
|
||||
}
|
||||
|
||||
if (y < rcWorkArea.top)
|
||||
|
@ -333,8 +345,11 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::Popup(POINTL *ppt, RECTL *prcExclude, MP
|
|||
y = rcWorkArea.bottom - cy;
|
||||
}
|
||||
|
||||
|
||||
|
||||
this->SetWindowPos(HWND_TOPMOST, x, y, cx, cy, SWP_SHOWWINDOW);
|
||||
|
||||
m_ShowFlags = dwFlags;
|
||||
m_Shown = true;
|
||||
|
||||
// HACK: The bar needs to be notified of the size AFTER it is shown.
|
||||
|
@ -344,7 +359,6 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::Popup(POINTL *ppt, RECTL *prcExclude, MP
|
|||
|
||||
UIActivateIO(TRUE, NULL);
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ private:
|
|||
HBITMAP m_Banner;
|
||||
|
||||
BOOL m_Shown;
|
||||
DWORD m_ShowFlags;
|
||||
|
||||
public:
|
||||
CMenuDeskBar();
|
||||
|
|
|
@ -40,13 +40,149 @@ HRESULT WINAPI SHGetImageList(
|
|||
#define TIMERID_HOTTRACK 1
|
||||
#define SUBCLASS_ID_MENUBAND 1
|
||||
|
||||
HRESULT CMenuToolbarBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
|
||||
{
|
||||
RECT rc;
|
||||
HDC hdc;
|
||||
HBRUSH bgBrush;
|
||||
HBRUSH hotBrush;
|
||||
NMHDR * hdr;
|
||||
NMTBCUSTOMDRAW * cdraw;
|
||||
NMTBHOTITEM * hot;
|
||||
NMMOUSE * rclick;
|
||||
NMPGCALCSIZE* csize;
|
||||
TBBUTTONINFO btni;
|
||||
COLORREF clrText;
|
||||
COLORREF clrTextHighlight;
|
||||
SIZE tbs;
|
||||
|
||||
*theResult = 0;
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
return OnCommand(wParam, lParam, theResult);
|
||||
|
||||
case WM_NOTIFY:
|
||||
hdr = reinterpret_cast<LPNMHDR>(lParam);
|
||||
switch (hdr->code)
|
||||
{
|
||||
case PGN_CALCSIZE:
|
||||
csize = reinterpret_cast<LPNMPGCALCSIZE>(hdr);
|
||||
|
||||
GetIdealSize(tbs);
|
||||
if (csize->dwFlag == PGF_CALCHEIGHT)
|
||||
{
|
||||
csize->iHeight = tbs.cy;
|
||||
}
|
||||
else if (csize->dwFlag == PGF_CALCWIDTH)
|
||||
{
|
||||
csize->iHeight = tbs.cx;
|
||||
}
|
||||
return S_OK;
|
||||
|
||||
case TBN_DROPDOWN:
|
||||
wParam = reinterpret_cast<LPNMTOOLBAR>(hdr)->iItem;
|
||||
return OnCommand(wParam, 0, theResult);
|
||||
|
||||
case TBN_HOTITEMCHANGE:
|
||||
hot = reinterpret_cast<LPNMTBHOTITEM>(hdr);
|
||||
return OnHotItemChange(hot);
|
||||
|
||||
case NM_RCLICK:
|
||||
rclick = reinterpret_cast<LPNMMOUSE>(hdr);
|
||||
|
||||
return OnContextMenu(rclick);
|
||||
|
||||
case NM_CUSTOMDRAW:
|
||||
cdraw = reinterpret_cast<LPNMTBCUSTOMDRAW>(hdr);
|
||||
switch (cdraw->nmcd.dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
*theResult = CDRF_NOTIFYITEMDRAW;
|
||||
return S_OK;
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
|
||||
clrText = GetSysColor(COLOR_MENUTEXT);
|
||||
clrTextHighlight = GetSysColor(COLOR_HIGHLIGHTTEXT);
|
||||
|
||||
bgBrush = GetSysColorBrush(COLOR_MENU);
|
||||
hotBrush = GetSysColorBrush(m_useFlatMenus ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT);
|
||||
|
||||
rc = cdraw->nmcd.rc;
|
||||
hdc = cdraw->nmcd.hdc;
|
||||
|
||||
if (((INT) cdraw->nmcd.dwItemSpec == m_hotItem ||
|
||||
(m_hotItem < 0 && (INT) cdraw->nmcd.dwItemSpec == m_popupItem)))
|
||||
{
|
||||
cdraw->nmcd.uItemState = CDIS_HOT;
|
||||
}
|
||||
|
||||
switch (cdraw->nmcd.uItemState)
|
||||
{
|
||||
case CDIS_HOT:
|
||||
case CDIS_FOCUS:
|
||||
FillRect(hdc, &rc, hotBrush);
|
||||
SetTextColor(hdc, clrTextHighlight);
|
||||
cdraw->clrText = clrTextHighlight;
|
||||
break;
|
||||
default:
|
||||
FillRect(hdc, &rc, bgBrush);
|
||||
SetTextColor(hdc, clrText);
|
||||
cdraw->clrText = clrText;
|
||||
break;
|
||||
}
|
||||
|
||||
cdraw->iListGap += 4;
|
||||
|
||||
*theResult = CDRF_NOTIFYPOSTPAINT | TBCDRF_NOBACKGROUND | TBCDRF_NOEDGES | TBCDRF_NOOFFSET | TBCDRF_NOMARK | 0x00800000; // FIXME: the last bit is Vista+, for debugging only
|
||||
return S_OK;
|
||||
|
||||
case CDDS_ITEMPOSTPAINT:
|
||||
btni.cbSize = sizeof(btni);
|
||||
btni.dwMask = TBIF_STYLE;
|
||||
SendMessage(hWnd, TB_GETBUTTONINFO, cdraw->nmcd.dwItemSpec, reinterpret_cast<LPARAM>(&btni));
|
||||
if (btni.fsStyle & BTNS_DROPDOWN)
|
||||
{
|
||||
SelectObject(cdraw->nmcd.hdc, m_marlett);
|
||||
WCHAR text[] = L"8";
|
||||
SetBkMode(cdraw->nmcd.hdc, TRANSPARENT);
|
||||
RECT rc = cdraw->nmcd.rc;
|
||||
rc.right += 1;
|
||||
DrawTextEx(cdraw->nmcd.hdc, text, 1, &rc, DT_NOCLIP | DT_VCENTER | DT_RIGHT | DT_SINGLELINE, NULL);
|
||||
}
|
||||
*theResult = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
CMenuToolbarBase::CMenuToolbarBase(CMenuBand *menuBand, BOOL usePager) :
|
||||
m_hwnd(NULL),
|
||||
m_useFlatMenus(FALSE),
|
||||
m_menuBand(menuBand),
|
||||
m_hwndToolbar(NULL),
|
||||
m_dwMenuFlags(0),
|
||||
m_hasIdealSize(FALSE)
|
||||
m_hotItem(-1),
|
||||
m_popupItem(-1),
|
||||
m_SubclassOld(NULL),
|
||||
m_hasIdealSize(FALSE),
|
||||
m_usePager(usePager)
|
||||
{
|
||||
m_marlett = CreateFont(
|
||||
0, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET,
|
||||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, FF_DONTCARE, L"Marlett");
|
||||
}
|
||||
|
||||
CMenuToolbarBase::~CMenuToolbarBase()
|
||||
{
|
||||
DeleteObject(m_marlett);
|
||||
}
|
||||
|
||||
HRESULT CMenuToolbarBase::IsWindowOwner(HWND hwnd)
|
||||
|
@ -66,6 +202,8 @@ HRESULT CMenuToolbarBase::ShowWindow(BOOL fShow)
|
|||
|
||||
UpdateImageLists();
|
||||
|
||||
SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -283,10 +421,9 @@ HRESULT CMenuToolbarBase::PopupSubMenu(UINT itemId, UINT index, IShellMenu* chil
|
|||
ClientToScreen(m_hwndToolbar, &a);
|
||||
ClientToScreen(m_hwndToolbar, &b);
|
||||
|
||||
POINTL pt = { b.x - 4, a.y };
|
||||
POINTL pt = { b.x - 3, a.y - 3 };
|
||||
RECTL rcl = { a.x, a.y, b.x, b.y }; // maybe-TODO: fetch client area of deskbar?
|
||||
|
||||
|
||||
#if USE_SYSTEM_MENUSITE
|
||||
hr = CoCreateInstance(CLSID_MenuBandSite,
|
||||
NULL,
|
||||
|
@ -332,6 +469,7 @@ HRESULT CMenuToolbarBase::PopupSubMenu(UINT itemId, UINT index, IShellMenu* chil
|
|||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
m_popupItem = itemId;
|
||||
m_menuBand->_OnPopupSubMenu(itemId, popup, &pt, &rcl);
|
||||
|
||||
return S_OK;
|
||||
|
@ -680,21 +818,22 @@ HRESULT CMenuSFToolbar::FillToolbar()
|
|||
tbb.fsState = TBSTATE_ENABLED;
|
||||
tbb.fsStyle = 0;
|
||||
|
||||
CComPtr<IShellItem> psi;
|
||||
hr = SHCreateShellItem(NULL, m_shellFolder, item, &psi);
|
||||
STRRET sr = { STRRET_CSTR, { 0 } };
|
||||
|
||||
hr = m_shellFolder->GetDisplayNameOf(item, SIGDN_NORMALDISPLAY, &sr);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = psi->GetDisplayName(SIGDN_NORMALDISPLAY, &MenuString);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
StrRetToStr(&sr, NULL, &MenuString);
|
||||
|
||||
index = SHMapPIDLToSystemImageListIndex(m_shellFolder, item, &indexOpen);
|
||||
|
||||
SFGAOF attrs;
|
||||
hr = psi->GetAttributes(SFGAO_FOLDER, &attrs);
|
||||
LPCITEMIDLIST itemc = item;
|
||||
|
||||
if (attrs != 0)
|
||||
SFGAOF attrs = SFGAO_FOLDER;
|
||||
hr = m_shellFolder->GetAttributesOf(1, &itemc, &attrs);
|
||||
|
||||
if (attrs & SFGAO_FOLDER)
|
||||
{
|
||||
tbb.fsStyle |= BTNS_DROPDOWN;
|
||||
}
|
||||
|
@ -706,7 +845,7 @@ HRESULT CMenuSFToolbar::FillToolbar()
|
|||
// FIXME: remove before deleting the toolbar or it will leak
|
||||
|
||||
SendMessageW(m_hwndToolbar, TB_ADDBUTTONS, 1, reinterpret_cast<LPARAM>(&tbb));
|
||||
HeapFree(GetProcessHeap(), 0, MenuString);
|
||||
CoTaskMemFree(MenuString);
|
||||
|
||||
}
|
||||
CoTaskMemFree(item);
|
||||
|
@ -869,15 +1008,12 @@ HRESULT CMenuSFToolbar::PopupItem(UINT uItem)
|
|||
HRESULT CMenuSFToolbar::HasSubMenu(UINT uItem)
|
||||
{
|
||||
HRESULT hr;
|
||||
CComPtr<IShellItem> psi;
|
||||
hr = SHCreateShellItem(NULL, m_shellFolder, GetPidlFromId(uItem), &psi);
|
||||
if (FAILED(hr))
|
||||
return S_FALSE;
|
||||
LPCITEMIDLIST pidl = GetPidlFromId(uItem);
|
||||
|
||||
SFGAOF attrs;
|
||||
hr = psi->GetAttributes(SFGAO_FOLDER, &attrs);
|
||||
SFGAOF attrs = SFGAO_FOLDER;
|
||||
hr = m_shellFolder->GetAttributesOf(1, &pidl, &attrs);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
return (attrs != 0) ? S_OK : S_FALSE;
|
||||
return (attrs & SFGAO_FOLDER) ? S_OK : S_FALSE;
|
||||
}
|
||||
|
|
|
@ -26,12 +26,15 @@ class CMenuToolbarBase
|
|||
{
|
||||
private:
|
||||
HWND m_hwnd; // May be the pager
|
||||
HFONT m_marlett;
|
||||
BOOL m_useFlatMenus;
|
||||
|
||||
protected:
|
||||
CMenuBand * m_menuBand;
|
||||
HWND m_hwndToolbar;
|
||||
DWORD m_dwMenuFlags;
|
||||
INT m_hotItem;
|
||||
INT m_popupItem;
|
||||
WNDPROC m_SubclassOld;
|
||||
BOOL m_hasIdealSize;
|
||||
SIZE m_idealSize;
|
||||
|
@ -42,7 +45,7 @@ private:
|
|||
|
||||
public:
|
||||
CMenuToolbarBase(CMenuBand *menuBand, BOOL usePager);
|
||||
virtual ~CMenuToolbarBase() {}
|
||||
virtual ~CMenuToolbarBase();
|
||||
|
||||
HRESULT IsWindowOwner(HWND hwnd);
|
||||
HRESULT CreateToolbar(HWND hwndParent, DWORD dwFlags);
|
||||
|
@ -50,11 +53,12 @@ public:
|
|||
HRESULT ShowWindow(BOOL fShow);
|
||||
HRESULT Close();
|
||||
|
||||
HRESULT OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
||||
|
||||
virtual HRESULT FillToolbar() = 0;
|
||||
virtual HRESULT PopupItem(UINT uItem) = 0;
|
||||
virtual HRESULT HasSubMenu(UINT uItem) = 0;
|
||||
virtual HRESULT OnContextMenu(NMMOUSE * rclick) = 0;
|
||||
virtual HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
||||
|
||||
HRESULT PopupSubMenu(UINT itemId, UINT index, IShellMenu* childShellMenu);
|
||||
HRESULT PopupSubMenu(UINT index, HMENU menu);
|
||||
|
@ -69,6 +73,8 @@ public:
|
|||
void InvalidateDraw();
|
||||
|
||||
protected:
|
||||
virtual HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
||||
|
||||
LRESULT CALLBACK SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
HRESULT UpdateImageLists();
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
return hr;
|
||||
if (hr == S_FALSE)
|
||||
m_FirstDone = true;
|
||||
if (celt < 2)
|
||||
else if (celt < 2)
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -85,18 +85,21 @@ public:
|
|||
if (*pceltFetched < celt)
|
||||
{
|
||||
rgelt += *pceltFetched;
|
||||
celt = (*pceltFetched - celt);
|
||||
celt = (celt - *pceltFetched);
|
||||
*pceltFetched = 0;
|
||||
}
|
||||
|
||||
hr = m_UserLocal->Next(celt, rgelt, pceltFetched);
|
||||
hr = m_AllUSers->Next(celt, rgelt, pceltFetched);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
*pceltFetched += offset;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE Skip(
|
||||
ULONG celt)
|
||||
{
|
||||
|
@ -227,6 +230,7 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::GetAttributesOf(
|
|||
if (SUCCEEDED(hr))
|
||||
return hr;
|
||||
|
||||
*rgfInOut = 0;
|
||||
hr = m_AllUSers->GetAttributesOf(cidl, apidl, rgfInOut);
|
||||
|
||||
return hr;
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#define WRAP_MENUSITE 0
|
||||
#define WRAP_MENUBAND 0
|
||||
|
||||
#define MERGE_FOLDERS 0
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ void WrapLogOpen()
|
|||
{
|
||||
if (openCount == 0)
|
||||
{
|
||||
log = fopen("RShellWrap.log", "w");
|
||||
log = fopen("\\RShellWrap.log", "w");
|
||||
nTemps = 0;
|
||||
callLevel = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue