mirror of
https://github.com/reactos/reactos.git
synced 2025-06-24 14:29:57 +00:00
[RSHELL]
* I forgot a cast and a couple IID_PPV_ARG uncommited. [BROWSEUI] * Fixed rebar flags to match windows. Adds the missing border around the toolbars. * Fix some calculations of the rebar size. * Fetch the icon of the current folder and assign it to the browse window. CORE-7330 svn path=/branches/shell-experiments/; revision=63103
This commit is contained in:
parent
fb6dcedf18
commit
dcc7bb6c0d
4 changed files with 77 additions and 33 deletions
|
@ -1341,7 +1341,7 @@ HRESULT CMenuSFToolbar::GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REF
|
|||
pidl = ILClone(m_idList);
|
||||
if (!pidl)
|
||||
{
|
||||
(*(IUnknown**) ppv)->Release();
|
||||
(*reinterpret_cast<IUnknown**>(ppv))->Release();
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -313,11 +313,11 @@ CStartMenu_Constructor(REFIID riid, void **ppv)
|
|||
/* CLSID_MergedFolder 26fdc864-be88-46e7-9235-032d8ea5162e */
|
||||
/* IID_IAugmentedShellFolder2 8db3b3f4-6cfe-11d1-8ae9-00c04fd918d0 */
|
||||
hr = SHGetFolderLocation(NULL, CSIDL_STARTMENU, 0, 0, &pidlStartMenuUser);
|
||||
hr = shellFolder->BindToObject(pidlStartMenuUser, NULL, IID_IShellFolder, (void**) &psfStartMenuUser);
|
||||
hr = shellFolder->BindToObject(pidlStartMenuUser, NULL, IID_PPV_ARG(IShellFolder, &psfStartMenuUser));
|
||||
|
||||
#if MERGE_FOLDERS
|
||||
hr = SHGetFolderLocation(NULL, CSIDL_COMMON_STARTMENU, 0, 0, &pidlStartMenuAll);
|
||||
hr = shellFolder->BindToObject(pidlStartMenuAll, NULL, IID_IShellFolder, (void**) &psfStartMenuAll);
|
||||
hr = shellFolder->BindToObject(pidlStartMenuAll, NULL, IID_PPV_ARG(IShellFolder, &psfStartMenuAll));
|
||||
|
||||
IShellFolder * psfMerged;
|
||||
hr = CMergedFolder_Constructor(psfStartMenuUser, psfStartMenuAll, IID_PPV_ARG(IShellFolder, &psfMerged));
|
||||
|
|
|
@ -528,6 +528,9 @@ HRESULT CInternetToolbar::ReserveBorderSpace()
|
|||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
SendMessage(fMainReBar, RB_SIZETORECT, RBSTR_CHANGERECT, reinterpret_cast<LPARAM>(&availableBorderSpace));
|
||||
// RBSTR_CHANGERECT does not seem to set the proper size in the rect.
|
||||
// Let's make sure we fetch the actual size properly.
|
||||
GetWindowRect(fMainReBar, &availableBorderSpace);
|
||||
neededBorderSpace.left = 0;
|
||||
neededBorderSpace.top = availableBorderSpace.bottom - availableBorderSpace.top;
|
||||
if (!fLocked)
|
||||
|
@ -1095,7 +1098,6 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite)
|
|||
HWND ownerWindow;
|
||||
HWND dockContainer;
|
||||
HRESULT hResult;
|
||||
DWORD style;
|
||||
|
||||
if (pUnkSite == NULL)
|
||||
{
|
||||
|
@ -1125,9 +1127,11 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite)
|
|||
SubclassWindow(dockContainer);
|
||||
|
||||
// create rebar in dock container
|
||||
style = WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT |
|
||||
RBS_BANDBORDERS | RBS_REGISTERDROP | RBS_AUTOSIZE | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_TOP;
|
||||
fMainReBar = CreateWindow(REBARCLASSNAMEW, NULL, style,
|
||||
DWORD style = WS_VISIBLE | WS_BORDER | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
|
||||
RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_REGISTERDROP | RBS_AUTOSIZE | RBS_DBLCLKTOGGLE |
|
||||
CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_TOP;
|
||||
DWORD exStyle = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_TOOLWINDOW;
|
||||
fMainReBar = CreateWindowEx(exStyle, REBARCLASSNAMEW, NULL, style,
|
||||
0, 0, 700, 60, dockContainer, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
|
||||
if (fMainReBar == NULL)
|
||||
return E_FAIL;
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
#include <shellapi.h>
|
||||
#include <htiframe.h>
|
||||
|
||||
extern "C"
|
||||
BOOL WINAPI Shell_GetImageLists(
|
||||
_In_ HIMAGELIST *phiml,
|
||||
_In_ HIMAGELIST *phimlSmall
|
||||
);
|
||||
|
||||
#include "newatlinterfaces.h"
|
||||
|
||||
/*
|
||||
|
@ -708,8 +714,7 @@ CShellBrowser::CShellBrowser()
|
|||
fCurrentDirectoryPIDL = NULL;
|
||||
fStatusBar = NULL;
|
||||
fStatusBarVisible = true;
|
||||
for (INT x = 0; x < 3; x++)
|
||||
fClientBars[x].hwnd = NULL;
|
||||
memset(fClientBars, 0, sizeof(fClientBars));
|
||||
fCurrentMenuBar = NULL;
|
||||
fHistoryObject = NULL;
|
||||
fHistoryStream = NULL;
|
||||
|
@ -920,7 +925,6 @@ long IEGetNameAndFlags(LPITEMIDLIST pidl, SHGDNF uFlags, LPWSTR pszBuf, UINT cch
|
|||
HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
|
||||
LPCITEMIDLIST absolutePIDL, FOLDERSETTINGS *folderSettings, long flags)
|
||||
{
|
||||
CComPtr<IOleCommandTarget> oleCommandTarget;
|
||||
CComPtr<IObjectWithSite> objectWithSite;
|
||||
CComPtr<IShellFolder> saveCurrentShellFolder;
|
||||
CComPtr<IShellView> saveCurrentShellView;
|
||||
|
@ -1006,10 +1010,6 @@ HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
|
|||
saveCurrentShellView->DestroyViewWindow();
|
||||
fCurrentShellViewWindow = newShellViewWindow;
|
||||
|
||||
// get command target
|
||||
oleCommandTarget.Release();
|
||||
hResult = newShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
|
||||
|
||||
// no use
|
||||
saveCurrentShellView.Release();
|
||||
saveCurrentShellFolder.Release();
|
||||
|
@ -1029,7 +1029,18 @@ HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
|
|||
}
|
||||
|
||||
// completed
|
||||
FireNavigateComplete(L"c:\\temp"); // TODO: use real path here
|
||||
nameFlags = SHGDN_FORADDRESSBAR | SHGDN_FORPARSING;
|
||||
hResult = IEGetNameAndFlags(fCurrentDirectoryPIDL, nameFlags, newTitle,
|
||||
sizeof(newTitle) / sizeof(wchar_t), NULL);
|
||||
if (SUCCEEDED(hResult))
|
||||
{
|
||||
FireNavigateComplete(newTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
FireNavigateComplete(L"ERROR");
|
||||
}
|
||||
|
||||
if (fCabinetState.fFullPathTitle)
|
||||
nameFlags = SHGDN_FORADDRESSBAR | SHGDN_FORPARSING;
|
||||
else
|
||||
|
@ -1037,8 +1048,27 @@ HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
|
|||
hResult = IEGetNameAndFlags(fCurrentDirectoryPIDL, nameFlags, newTitle,
|
||||
sizeof(newTitle) / sizeof(wchar_t), NULL);
|
||||
if (SUCCEEDED(hResult))
|
||||
{
|
||||
SetWindowText(newTitle);
|
||||
|
||||
LPCITEMIDLIST pidlChild;
|
||||
INT index, indexOpen;
|
||||
HIMAGELIST himlSmall, himlLarge;
|
||||
|
||||
CComPtr<IShellFolder> sf;
|
||||
SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf), &pidlChild);
|
||||
|
||||
index = SHMapPIDLToSystemImageListIndex(sf, pidlChild, &indexOpen);
|
||||
|
||||
Shell_GetImageLists(&himlSmall, &himlLarge);
|
||||
|
||||
HICON icSmall = ImageList_GetIcon(himlSmall, indexOpen, 0);
|
||||
HICON icLarge = ImageList_GetIcon(himlLarge, indexOpen, 0);
|
||||
|
||||
SendMessage(WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icSmall));
|
||||
SendMessage(WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(icLarge));
|
||||
}
|
||||
|
||||
// TODO: Update the window icon
|
||||
|
||||
FireCommandStateChangeAll();
|
||||
|
@ -1303,7 +1333,6 @@ void CShellBrowser::RepositionBars()
|
|||
{
|
||||
RECT clientRect;
|
||||
RECT statusRect;
|
||||
RECT toolbarRect;
|
||||
int x;
|
||||
|
||||
GetClientRect(&clientRect);
|
||||
|
@ -1319,28 +1348,39 @@ void CShellBrowser::RepositionBars()
|
|||
|
||||
for (x = 0; x < 3; x++)
|
||||
{
|
||||
if (fClientBars[x].hwnd == NULL && fClientBars[x].clientBar != NULL)
|
||||
HWND hwnd = fClientBars[x].hwnd;
|
||||
RECT borderSpace = fClientBars[x].borderSpace;
|
||||
if (hwnd == NULL && fClientBars[x].clientBar != NULL)
|
||||
{
|
||||
IUnknown_GetWindow(fClientBars[x].clientBar, &fClientBars[x].hwnd);
|
||||
IUnknown_GetWindow(fClientBars[x].clientBar, &hwnd);
|
||||
fClientBars[x].hwnd = hwnd;
|
||||
}
|
||||
if (fClientBars[x].hwnd != NULL)
|
||||
if (hwnd != NULL)
|
||||
{
|
||||
toolbarRect = clientRect;
|
||||
if (fClientBars[x].borderSpace.top != 0)
|
||||
toolbarRect.bottom = toolbarRect.top + fClientBars[x].borderSpace.top;
|
||||
else if (fClientBars[x].borderSpace.bottom != 0)
|
||||
toolbarRect.top = toolbarRect.bottom - fClientBars[x].borderSpace.bottom;
|
||||
if (fClientBars[x].borderSpace.left != 0)
|
||||
toolbarRect.right = toolbarRect.left + fClientBars[x].borderSpace.left;
|
||||
else if (fClientBars[x].borderSpace.right != 0)
|
||||
toolbarRect.left = toolbarRect.right - fClientBars[x].borderSpace.right;
|
||||
::SetWindowPos(fClientBars[x].hwnd, NULL, toolbarRect.left, toolbarRect.top,
|
||||
RECT toolbarRect = clientRect;
|
||||
if (borderSpace.top != 0)
|
||||
{
|
||||
toolbarRect.bottom = toolbarRect.top + borderSpace.top;
|
||||
clientRect.top += borderSpace.top;
|
||||
}
|
||||
else if (borderSpace.bottom != 0)
|
||||
{
|
||||
toolbarRect.top = toolbarRect.bottom - borderSpace.bottom;
|
||||
clientRect.bottom -= borderSpace.bottom;
|
||||
}
|
||||
if (borderSpace.left != 0)
|
||||
{
|
||||
toolbarRect.right = toolbarRect.left + borderSpace.left;
|
||||
clientRect.left += borderSpace.left;
|
||||
}
|
||||
else if (borderSpace.right != 0)
|
||||
{
|
||||
toolbarRect.left = toolbarRect.right - borderSpace.right;
|
||||
clientRect.right -= borderSpace.right;
|
||||
}
|
||||
::SetWindowPos(hwnd, NULL, toolbarRect.left, toolbarRect.top,
|
||||
toolbarRect.right - toolbarRect.left,
|
||||
toolbarRect.bottom - toolbarRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||
clientRect.top += fClientBars[x].borderSpace.top;
|
||||
clientRect.left += fClientBars[x].borderSpace.left;
|
||||
clientRect.bottom += fClientBars[x].borderSpace.bottom;
|
||||
clientRect.right += fClientBars[x].borderSpace.right;
|
||||
}
|
||||
}
|
||||
::SetWindowPos(fCurrentShellViewWindow, NULL, clientRect.left, clientRect.top,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue