📄 shlview.c
字号:
/*only do This if we are active*/
if(uState != SVUIA_DEACTIVATE)
{
/*
GetFolderPath is not a method of IShellFolder
IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) );
*/
/* set the number of parts */
IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1,
(LPARAM)nPartArray, &lResult);
/* set the text for the parts */
/*
IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA,
0, (LPARAM)szName, &lResult);
*/
}
return S_OK;
}
static HRESULT WINAPI IShellView_fnRefresh(IShellView * iface)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
TRACE("(%p)\n",This);
SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
ShellView_FillList(This);
return S_OK;
}
static HRESULT WINAPI IShellView_fnCreateViewWindow(
IShellView * iface,
IShellView *lpPrevView,
LPCFOLDERSETTINGS lpfs,
IShellBrowser * psb,
RECT * prcView,
HWND *phWnd)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
WNDCLASSA wc;
*phWnd = 0;
TRACE("(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",This, lpPrevView,lpfs, psb, prcView, phWnd);
TRACE("-- vmode=%x flags=%x left=%i top=%i right=%i bottom=%i\n",lpfs->ViewMode, lpfs->fFlags ,prcView->left,prcView->top, prcView->right, prcView->bottom);
/*set up the member variables*/
This->pShellBrowser = psb;
This->FolderSettings = *lpfs;
/*get our parent window*/
IShellBrowser_AddRef(This->pShellBrowser);
IShellBrowser_GetWindow(This->pShellBrowser, &(This->hWndParent));
/* try to get the ICommDlgBrowserInterface, adds a reference !!! */
This->pCommDlgBrowser=NULL;
if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser,
(REFIID)&IID_ICommDlgBrowser, (LPVOID*) &This->pCommDlgBrowser)))
{
TRACE("-- CommDlgBrowser\n");
}
/*if our window class has not been registered, then do so*/
if(!GetClassInfoA(shell32_hInstance, SV_CLASS_NAME, &wc))
{
ZeroMemory(&wc, sizeof(wc));
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = ShellView_WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = shell32_hInstance;
wc.hIcon = 0;
wc.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = SV_CLASS_NAME;
if(!RegisterClassA(&wc))
return E_FAIL;
}
*phWnd = CreateWindowExA(0,
SV_CLASS_NAME,
NULL,
WS_CHILD | WS_TABSTOP,
prcView->left,
prcView->top,
prcView->right - prcView->left,
prcView->bottom - prcView->top,
This->hWndParent,
0,
shell32_hInstance,
(LPVOID)This);
CheckToolbar(This);
if(!*phWnd) return E_FAIL;
SetWindowPos(*phWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
UpdateWindow(*phWnd);
return S_OK;
}
static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView * iface)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
TRACE("(%p)\n",This);
/*Make absolutely sure all our UI is cleaned up.*/
IShellView_UIActivate((IShellView*)This, SVUIA_DEACTIVATE);
if(This->hMenu)
{
DestroyMenu(This->hMenu);
}
DestroyWindow(This->hWnd);
if(This->pShellBrowser) IShellBrowser_Release(This->pShellBrowser);
if(This->pCommDlgBrowser) ICommDlgBrowser_Release(This->pCommDlgBrowser);
return S_OK;
}
static HRESULT WINAPI IShellView_fnGetCurrentInfo(IShellView * iface, LPFOLDERSETTINGS lpfs)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
TRACE("(%p)->(%p) vmode=%x flags=%x\n",This, lpfs,
This->FolderSettings.ViewMode, This->FolderSettings.fFlags);
if (!lpfs) return E_INVALIDARG;
*lpfs = This->FolderSettings;
return NOERROR;
}
static HRESULT WINAPI IShellView_fnAddPropertySheetPages(IShellView * iface, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
FIXME("(%p) stub\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI IShellView_fnSaveViewState(IShellView * iface)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
FIXME("(%p) stub\n",This);
return S_OK;
}
static HRESULT WINAPI IShellView_fnSelectItem(
IShellView * iface,
LPCITEMIDLIST pidl,
UINT uFlags)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
int i;
TRACE("(%p)->(pidl=%p, 0x%08x) stub\n",This, pidl, uFlags);
i = LV_FindItemByPidl(This, pidl);
if (i != -1)
{
LVITEMA lvItem;
if(uFlags & SVSI_ENSUREVISIBLE)
SendMessageW(This->hWndList, LVM_ENSUREVISIBLE, i, 0);
lvItem.mask = LVIF_STATE;
lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
lvItem.iItem = 0;
lvItem.iSubItem = 0;
while(SendMessageA(This->hWndList, LVM_GETITEMA, 0, (LPARAM) &lvItem))
{
if (lvItem.iItem == i)
{
if (uFlags & SVSI_SELECT)
lvItem.state |= LVIS_SELECTED;
else
lvItem.state &= ~LVIS_SELECTED;
if(uFlags & SVSI_FOCUSED)
lvItem.state &= ~LVIS_FOCUSED;
}
else
{
if (uFlags & SVSI_DESELECTOTHERS)
lvItem.state &= ~LVIS_SELECTED;
}
SendMessageA(This->hWndList, LVM_SETITEMA, 0, (LPARAM) &lvItem);
lvItem.iItem++;
}
if(uFlags & SVSI_EDIT)
SendMessageW(This->hWndList, LVM_EDITLABELW, i, 0);
}
return S_OK;
}
static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem, REFIID riid, LPVOID *ppvOut)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",This, uItem, debugstr_guid(riid), ppvOut);
*ppvOut = NULL;
switch(uItem)
{
case SVGIO_BACKGROUND:
*ppvOut = ISvBgCm_Constructor(This->pSFParent, FALSE);
break;
case SVGIO_SELECTION:
ShellView_GetSelections(This);
IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, (LPCITEMIDLIST*)This->apidl, riid, 0, ppvOut);
break;
}
TRACE("-- (%p)->(interface=%p)\n",This, *ppvOut);
if(!*ppvOut) return E_OUTOFMEMORY;
return S_OK;
}
static const IShellViewVtbl svvt =
{
IShellView_fnQueryInterface,
IShellView_fnAddRef,
IShellView_fnRelease,
IShellView_fnGetWindow,
IShellView_fnContextSensitiveHelp,
IShellView_fnTranslateAccelerator,
IShellView_fnEnableModeless,
IShellView_fnUIActivate,
IShellView_fnRefresh,
IShellView_fnCreateViewWindow,
IShellView_fnDestroyViewWindow,
IShellView_fnGetCurrentInfo,
IShellView_fnAddPropertySheetPages,
IShellView_fnSaveViewState,
IShellView_fnSelectItem,
IShellView_fnGetItemObject
};
/**********************************************************
* ISVOleCmdTarget_QueryInterface (IUnknown)
*/
static HRESULT WINAPI ISVOleCmdTarget_QueryInterface(
IOleCommandTarget * iface,
REFIID iid,
LPVOID* ppvObj)
{
IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj);
}
/**********************************************************
* ISVOleCmdTarget_AddRef (IUnknown)
*/
static ULONG WINAPI ISVOleCmdTarget_AddRef(
IOleCommandTarget * iface)
{
IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
return IShellFolder_AddRef((IShellFolder*)This);
}
/**********************************************************
* ISVOleCmdTarget_Release (IUnknown)
*/
static ULONG WINAPI ISVOleCmdTarget_Release(
IOleCommandTarget * iface)
{
IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
return IShellFolder_Release((IShellFolder*)This);
}
/**********************************************************
* ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
*/
static HRESULT WINAPI ISVOleCmdTarget_QueryStatus(
IOleCommandTarget *iface,
const GUID* pguidCmdGroup,
ULONG cCmds,
OLECMD * prgCmds,
OLECMDTEXT* pCmdText)
{
UINT i;
IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
FIXME("(%p)->(%p(%s) 0x%08x %p %p\n",
This, pguidCmdGroup, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
if (!prgCmds)
return E_POINTER;
for (i = 0; i < cCmds; i++)
{
FIXME("\tprgCmds[%d].cmdID = %d\n", i, prgCmds[i].cmdID);
prgCmds[i].cmdf = 0;
}
return OLECMDERR_E_UNKNOWNGROUP;
}
/**********************************************************
* ISVOleCmdTarget_Exec (IOleCommandTarget)
*
* nCmdID is the OLECMDID_* enumeration
*/
static HRESULT WINAPI ISVOleCmdTarget_Exec(
IOleCommandTarget *iface,
const GUID* pguidCmdGroup,
DWORD nCmdID,
DWORD nCmdexecopt,
VARIANT* pvaIn,
VARIANT* pvaOut)
{
IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08x Opt:0x%08x %p %p)\n",
This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut);
if (IsEqualIID(pguidCmdGroup, &CGID_Explorer) &&
(nCmdID == 0x29) &&
(nCmdexecopt == 4) && pvaOut)
return S_OK;
if (IsEqualIID(pguidCmdGroup, &CGID_ShellDocView) &&
(nCmdID == 9) &&
(nCmdexecopt == 0))
return 1;
return OLECMDERR_E_UNKNOWNGROUP;
}
static const IOleCommandTargetVtbl ctvt =
{
ISVOleCmdTarget_QueryInterface,
ISVOleCmdTarget_AddRef,
ISVOleCmdTarget_Release,
ISVOleCmdTarget_QueryStatus,
ISVOleCmdTarget_Exec
};
/**********************************************************
* ISVDropTarget implementation
*/
static HRESULT WINAPI ISVDropTarget_QueryInterface(
IDropTarget *iface,
REFIID riid,
LPVOID *ppvObj)
{
IShellViewImpl *This = impl_from_IDropTarget(iface);
TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);
}
static ULONG WINAPI ISVDropTarget_AddRef( IDropTarget *iface)
{
IShellViewImpl *This = impl_from_IDropTarget(iface);
TRACE("(%p)->(count=%u)\n",This,This->ref);
return IShellFolder_AddRef((IShellFolder*)This);
}
static ULONG WINAPI ISVDropTarget_Release( IDropTarget *iface)
{
IShellViewImpl *This = impl_from_IDropTarget(iface);
TRACE("(%p)->(count=%u)\n",This,This->ref);
return IShellFolder_Release((IShellFolder*)This);
}
/******************************************************************************
* drag_notify_subitem [Internal]
*
* Figure out the shellfolder object, which is currently under the mouse cursor
* and notify it via the IDropTarget interface.
*/
#define SCROLLAREAWIDTH 20
static HRESULT drag_notify_subitem(IShellViewImpl *This, DWORD grfKeyState, POINTL pt,
DWORD *pdwEffect)
{
LVHITTESTINFO htinfo;
LVITEMA lvItem;
LONG lResult;
HRESULT hr;
RECT clientRect;
/* Map from global to client coordinates and query the index of the listview-item, which is
* currently under the mouse cursor. */
htinfo.pt.x = pt.x;
htinfo.pt.y = pt.y;
htinfo.flags = LVHT_ONITEM;
ScreenToClient(This->hWndList, &htinfo.pt);
lResult = SendMessageW(This->hWndList, LVM_HITTEST, 0, (LPARAM)&htinfo);
/* Send WM_*SCROLL messages every 250 ms during drag-scrolling */
GetClientRect(This->hWndList, &clientRect);
if (htinfo.pt.x == This->ptLastMousePos.x && htinfo.pt.y == This->ptLastMousePos.y &&
(htinfo.pt.x < SCROLLAREAWIDTH || htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH ||
htinfo.pt.y < SCROLLAREAWIDTH || htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH ))
{
This->cScrollDelay = (This->cScrollDelay + 1) % 5; /* DragOver is called every 50 ms */
if (This->cScrollDelay == 0) { /* Mouse did hover another 250 ms over the scroll-area */
if (htinfo.pt.x < SCROLLAREAWIDTH)
SendMessageW(This->hWndList, WM_HSCROLL, SB_LINEUP, 0);
if (htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH)
SendMessageW(This->hWndList, WM_HSCROLL, SB_LINEDOWN, 0);
if (htinfo.pt.y < SCROLLAREAWIDTH)
SendMessageW(This->hWndList, WM_VSCROLL, SB_LINEUP, 0);
if (htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH)
SendMessageW(This->hWndList, WM_VSCROLL, SB_LINEDOWN, 0);
}
} else {
This->cScrollDelay = 0; /* Reset, if the cursor is not over the listview's scroll-area */
}
This->ptLastMousePos = htinfo.pt;
/* If we are still over the previous sub-item, notify it via DragOver and return. */
if (This->pCurDropTarget && lResult == This->iDragOverItem)
return IDropTarget_DragOver(This->pCurDropTarget, grfKe
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -