2011-05-15 15:55:49 +00:00
|
|
|
/*
|
2011-09-08 22:43:43 +00:00
|
|
|
* ShellView
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
2011-09-08 22:43:43 +00:00
|
|
|
* Copyright 1998,1999 <juergen.schmied@debitel.net>
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
* This is the view visualizing the data provided by the shellfolder.
|
|
|
|
* No direct access to data from pidls should be done from here.
|
|
|
|
*
|
|
|
|
* 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 St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*
|
|
|
|
* FIXME: The order by part of the background context menu should be
|
|
|
|
* built according to the columns shown.
|
|
|
|
*
|
|
|
|
* FIXME: CheckToolbar: handle the "new folder" and "folder up" button
|
|
|
|
*
|
|
|
|
* FIXME: ShellView_FillList: consider sort orders
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
TODO:
|
|
|
|
1. Load/Save the view state from/into the stream provided by the ShellBrowser.
|
|
|
|
2. Let the shell folder sort items.
|
|
|
|
3. Code to merge menus in the shellbrowser is incorrect.
|
|
|
|
4. Move the background context menu creation into shell view. It should store the
|
2011-09-08 22:43:43 +00:00
|
|
|
shell view HWND to send commands.
|
2011-05-15 15:55:49 +00:00
|
|
|
5. Send init, measure, and draw messages to context menu during tracking.
|
|
|
|
6. Shell view should do SetCommandTarget on internet toolbar.
|
|
|
|
7. When editing starts on item, set edit text to for editing value.
|
|
|
|
8. When shell view is called back for item info, let listview save the value.
|
|
|
|
9. Shell view should update status bar.
|
|
|
|
10. Fix shell view to handle view mode popup exec.
|
|
|
|
11. The background context menu should have a pidl just like foreground menus. This
|
2011-09-08 22:43:43 +00:00
|
|
|
causes crashes when dynamic handlers try to use the NULL pidl.
|
2011-05-15 15:55:49 +00:00
|
|
|
12. The SHELLDLL_DefView should not be filled with blue unconditionally. This causes
|
2011-09-08 22:43:43 +00:00
|
|
|
annoying flashing of blue even on XP, and is not correct.
|
2011-05-15 15:55:49 +00:00
|
|
|
13. Reorder of columns doesn't work - might be bug in comctl32
|
|
|
|
*/
|
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include "precomp.h"
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2014-01-25 17:24:24 +00:00
|
|
|
#include <atlwin.h>
|
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
|
|
|
|
|
|
|
#undef SV_CLASS_NAME
|
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
static const WCHAR SV_CLASS_NAME[] = {'S', 'H', 'E', 'L', 'L', 'D', 'L', 'L', '_', 'D', 'e', 'f', 'V', 'i', 'e', 'w', 0};
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{ BOOL bIsAscending;
|
|
|
|
INT nHeaderID;
|
|
|
|
INT nLastHeaderID;
|
2011-12-20 19:56:46 +00:00
|
|
|
} LISTVIEW_SORT_INFO, *LPLISTVIEW_SORT_INFO;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
#define SHV_CHANGE_NOTIFY WM_USER + 0x1111
|
|
|
|
|
|
|
|
class CDefView :
|
2011-09-08 22:43:43 +00:00
|
|
|
public CWindowImpl<CDefView, CWindow, CControlWinTraits>,
|
|
|
|
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
|
|
|
public IShellView,
|
|
|
|
public IFolderView,
|
2014-03-13 12:50:26 +00:00
|
|
|
public IShellFolderView,
|
2011-09-08 22:43:43 +00:00
|
|
|
public IOleCommandTarget,
|
|
|
|
public IDropTarget,
|
|
|
|
public IDropSource,
|
|
|
|
public IViewObject,
|
|
|
|
public IServiceProvider
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
private:
|
2013-11-19 19:05:17 +00:00
|
|
|
CComPtr<IShellFolder> m_pSFParent;
|
|
|
|
CComPtr<IShellFolder2> m_pSF2Parent;
|
|
|
|
CComPtr<IShellBrowser> m_pShellBrowser;
|
|
|
|
CComPtr<ICommDlgBrowser> m_pCommDlgBrowser;
|
|
|
|
HWND m_hWndList; /* ListView control */
|
|
|
|
HWND m_hWndParent;
|
|
|
|
FOLDERSETTINGS m_FolderSettings;
|
|
|
|
HMENU m_hMenu;
|
|
|
|
UINT m_uState;
|
|
|
|
UINT m_cidl;
|
|
|
|
LPITEMIDLIST *m_apidl;
|
|
|
|
LISTVIEW_SORT_INFO m_sortInfo;
|
|
|
|
ULONG m_hNotify; /* change notification handle */
|
|
|
|
HACCEL m_hAccel;
|
|
|
|
DWORD m_dwAspects;
|
|
|
|
DWORD m_dwAdvf;
|
|
|
|
CComPtr<IAdviseSink> m_pAdvSink;
|
2011-12-20 19:56:46 +00:00
|
|
|
// for drag and drop
|
2013-11-19 19:05:17 +00:00
|
|
|
CComPtr<IDropTarget> m_pCurDropTarget; /* The sub-item, which is currently dragged over */
|
|
|
|
CComPtr<IDataObject> m_pCurDataObject; /* The dragged data-object */
|
|
|
|
LONG m_iDragOverItem; /* Dragged over item's index, iff m_pCurDropTarget != NULL */
|
|
|
|
UINT m_cScrollDelay; /* Send a WM_*SCROLL msg every 250 ms during drag-scroll */
|
|
|
|
POINT m_ptLastMousePos; /* Mouse position at last DragOver call */
|
2011-12-20 19:56:46 +00:00
|
|
|
//
|
2013-11-19 19:05:17 +00:00
|
|
|
CComPtr<IContextMenu> m_pCM;
|
2011-12-20 19:56:46 +00:00
|
|
|
public:
|
|
|
|
CDefView();
|
|
|
|
~CDefView();
|
|
|
|
HRESULT WINAPI Initialize(IShellFolder *shellFolder);
|
|
|
|
HRESULT IncludeObject(LPCITEMIDLIST pidl);
|
|
|
|
HRESULT OnDefaultCommand();
|
|
|
|
HRESULT OnStateChange(UINT uFlags);
|
|
|
|
void CheckToolbar();
|
|
|
|
void SetStyle(DWORD dwAdd, DWORD dwRemove);
|
|
|
|
BOOL CreateList();
|
2012-02-13 20:52:20 +00:00
|
|
|
void UpdateListColors();
|
2011-12-20 19:56:46 +00:00
|
|
|
BOOL InitList();
|
|
|
|
static INT CALLBACK CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData);
|
|
|
|
static INT CALLBACK ListViewCompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData);
|
|
|
|
int LV_FindItemByPidl(LPCITEMIDLIST pidl);
|
|
|
|
BOOLEAN LV_AddItem(LPCITEMIDLIST pidl);
|
|
|
|
BOOLEAN LV_DeleteItem(LPCITEMIDLIST pidl);
|
|
|
|
BOOLEAN LV_RenameItem(LPCITEMIDLIST pidlOld, LPCITEMIDLIST pidlNew);
|
|
|
|
static INT CALLBACK fill_list(LPVOID ptr, LPVOID arg);
|
|
|
|
HRESULT FillList();
|
|
|
|
HMENU BuildFileMenu();
|
|
|
|
void MergeFileMenu(HMENU hSubMenu);
|
|
|
|
void MergeViewMenu(HMENU hSubMenu);
|
|
|
|
UINT GetSelections();
|
|
|
|
HRESULT OpenSelectedItems();
|
|
|
|
void OnDeactivate();
|
|
|
|
void DoActivate(UINT uState);
|
|
|
|
HRESULT drag_notify_subitem(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
|
2013-07-20 16:23:54 +00:00
|
|
|
LRESULT OnExplorerCommand(UINT uCommand, BOOL bUseSelection);
|
2011-12-20 19:56:46 +00:00
|
|
|
|
|
|
|
// *** IOleWindow methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
|
|
|
|
|
|
|
|
// *** IShellView methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(MSG *pmsg);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE EnableModeless(BOOL fEnable);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE UIActivate(UINT uState);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Refresh();
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE CreateViewWindow(IShellView *psvPrevious, LPCFOLDERSETTINGS pfs, IShellBrowser *psb, RECT *prcView, HWND *phWnd);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE DestroyViewWindow();
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetCurrentInfo(LPFOLDERSETTINGS pfs);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE AddPropertySheetPages(DWORD dwReserved, LPFNSVADDPROPSHEETPAGE pfn, LPARAM lparam);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SaveViewState();
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SelectItem(LPCITEMIDLIST pidlItem, SVSIF uFlags);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetItemObject(UINT uItem, REFIID riid, void **ppv);
|
|
|
|
|
|
|
|
// *** IFolderView methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetCurrentViewMode(UINT *pViewMode);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetCurrentViewMode(UINT ViewMode);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetFolder(REFIID riid, void **ppv);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Item(int iItemIndex, LPITEMIDLIST *ppidl);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE ItemCount(UINT uFlags, int *pcItems);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Items(UINT uFlags, REFIID riid, void **ppv);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetSelectionMarkedItem(int *piItem);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetFocusedItem(int *piItem);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetItemPosition(LPCITEMIDLIST pidl, POINT *ppt);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetSpacing(POINT *ppt);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetDefaultSpacing(POINT *ppt);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetAutoArrange();
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SelectItem(int iItem, DWORD dwFlags);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SelectAndPositionItems(UINT cidl, LPCITEMIDLIST *apidl, POINT *apt, DWORD dwFlags);
|
|
|
|
|
2014-03-13 12:50:26 +00:00
|
|
|
// *** IShellFolderView methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Rearrange(LPARAM sort);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetArrangeParam(LPARAM *sort);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE ArrangeGrid();
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE AutoArrange();
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE IShellFolderView_GetAutoArrange();
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE AddObject(PITEMID_CHILD pidl, UINT *item);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetObject(PITEMID_CHILD *pidl, UINT item);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE RemoveObject(PITEMID_CHILD pidl, UINT *item);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetObjectCount(UINT *count);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetObjectCount(UINT count, UINT flags);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE UpdateObject(PITEMID_CHILD pidl_old, PITEMID_CHILD pidl_new, UINT *item);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE RefreshObject(PITEMID_CHILD pidl, UINT *item);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetRedraw(BOOL redraw);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetSelectedCount(UINT *count);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetSelectedObjects(PCUITEMID_CHILD **pidl, UINT *items);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE IsDropOnSource(IDropTarget *drop_target);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetDragPoint(POINT *pt);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetDropPoint(POINT *pt);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE MoveIcons(IDataObject *obj);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetItemPos(PCUITEMID_CHILD pidl, POINT *pt);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE IsBkDropTarget(IDropTarget *drop_target);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetClipboard(BOOL move);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetPoints(IDataObject *obj);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetItemSpacing(ITEMSPACING *spacing);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetCallback(IShellFolderViewCB *new_cb, IShellFolderViewCB **old_cb);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Select(UINT flags);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE QuerySupport(UINT *support);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetAutomationObject(IDispatch *disp);
|
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
// *** IOleCommandTarget methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
|
|
|
|
|
|
|
|
// *** IDropTarget methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE DragLeave();
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
|
|
|
|
|
|
|
|
// *** IDropSource methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect);
|
|
|
|
|
|
|
|
// *** IViewObject methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Draw(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd,
|
|
|
|
HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds,
|
|
|
|
BOOL ( STDMETHODCALLTYPE *pfnContinue )(ULONG_PTR dwContinue), ULONG_PTR dwContinue);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetColorSet(DWORD dwDrawAspect, LONG lindex, void *pvAspect,
|
|
|
|
DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Freeze(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Unfreeze(DWORD dwFreeze);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetAdvise(DWORD aspects, DWORD advf, IAdviseSink *pAdvSink);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetAdvise(DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink);
|
|
|
|
|
|
|
|
// *** IServiceProvider methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
|
|
|
|
|
|
|
|
// message handlers
|
|
|
|
LRESULT OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnGetDlgCode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnSysColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnGetShellBrowser(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnChangeNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
|
|
|
LRESULT OnCustomItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
2012-02-13 20:52:20 +00:00
|
|
|
LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
2011-12-20 19:56:46 +00:00
|
|
|
|
|
|
|
static ATL::CWndClassInfo& GetWndClassInfo()
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
static ATL::CWndClassInfo wc =
|
|
|
|
{
|
|
|
|
{ sizeof(WNDCLASSEX), 0, StartWindowProc,
|
|
|
|
0, 0, NULL, NULL,
|
|
|
|
LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_BACKGROUND + 1), NULL, SV_CLASS_NAME, NULL
|
|
|
|
},
|
|
|
|
NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
|
|
|
|
};
|
|
|
|
return wc;
|
|
|
|
}
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
virtual WNDPROC GetWindowProc()
|
|
|
|
{
|
|
|
|
return WindowProc;
|
|
|
|
}
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
CDefView *pThis;
|
|
|
|
LRESULT result;
|
|
|
|
|
|
|
|
// must hold a reference during message handling
|
|
|
|
pThis = reinterpret_cast<CDefView *>(hWnd);
|
|
|
|
pThis->AddRef();
|
|
|
|
result = CWindowImpl<CDefView, CWindow, CControlWinTraits>::WindowProc(hWnd, uMsg, wParam, lParam);
|
|
|
|
pThis->Release();
|
|
|
|
return result;
|
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
BEGIN_MSG_MAP(CDefView)
|
|
|
|
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
|
|
|
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
|
|
|
|
MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
|
|
|
|
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
|
|
|
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
|
|
|
|
MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
|
|
|
|
MESSAGE_HANDLER(WM_COMMAND, OnCommand)
|
|
|
|
MESSAGE_HANDLER(SHV_CHANGE_NOTIFY, OnChangeNotify)
|
|
|
|
MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
|
|
|
|
MESSAGE_HANDLER(WM_DRAWITEM, OnCustomItem)
|
|
|
|
MESSAGE_HANDLER(WM_MEASUREITEM, OnCustomItem)
|
|
|
|
MESSAGE_HANDLER(WM_SHOWWINDOW, OnShowWindow)
|
|
|
|
MESSAGE_HANDLER(WM_GETDLGCODE, OnGetDlgCode)
|
|
|
|
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
|
|
|
|
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
|
|
|
|
MESSAGE_HANDLER(WM_SYSCOLORCHANGE, OnSysColorChange)
|
|
|
|
MESSAGE_HANDLER(CWM_GETISHELLBROWSER, OnGetShellBrowser)
|
2012-02-13 20:52:20 +00:00
|
|
|
MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
|
2011-12-20 19:56:46 +00:00
|
|
|
END_MSG_MAP()
|
|
|
|
|
|
|
|
BEGIN_COM_MAP(CDefView)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IShellView, IShellView)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IFolderView, IFolderView)
|
2014-03-13 12:50:26 +00:00
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IShellFolderView, IShellFolderView)
|
2011-12-20 19:56:46 +00:00
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IDropSource, IDropSource)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IViewObject, IViewObject)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
|
|
|
|
END_COM_MAP()
|
2011-05-15 15:55:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ListView Header ID's */
|
|
|
|
#define LISTVIEW_COLUMN_NAME 0
|
|
|
|
#define LISTVIEW_COLUMN_SIZE 1
|
|
|
|
#define LISTVIEW_COLUMN_TYPE 2
|
|
|
|
#define LISTVIEW_COLUMN_TIME 3
|
|
|
|
#define LISTVIEW_COLUMN_ATTRIB 4
|
|
|
|
|
|
|
|
/*menu items */
|
|
|
|
#define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500)
|
|
|
|
#define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501)
|
|
|
|
#define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502)
|
|
|
|
|
|
|
|
#define ID_LISTVIEW 1
|
|
|
|
|
|
|
|
/*windowsx.h */
|
|
|
|
#define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
|
|
|
|
#define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
|
|
|
|
#define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
|
|
|
|
|
|
|
|
/*
|
|
|
|
Items merged into the toolbar and the filemenu
|
|
|
|
*/
|
|
|
|
typedef struct
|
2011-12-20 19:56:46 +00:00
|
|
|
{ int idCommand;
|
|
|
|
int iImage;
|
|
|
|
int idButtonString;
|
|
|
|
int idMenuString;
|
|
|
|
BYTE bState;
|
|
|
|
BYTE bStyle;
|
2011-05-15 15:55:49 +00:00
|
|
|
} MYTOOLINFO, *LPMYTOOLINFO;
|
|
|
|
|
|
|
|
static const MYTOOLINFO Tools[] =
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
{ FCIDM_SHVIEW_BIGICON, 0, 0, IDS_VIEW_LARGE, TBSTATE_ENABLED, BTNS_BUTTON },
|
|
|
|
{ FCIDM_SHVIEW_SMALLICON, 0, 0, IDS_VIEW_SMALL, TBSTATE_ENABLED, BTNS_BUTTON },
|
|
|
|
{ FCIDM_SHVIEW_LISTVIEW, 0, 0, IDS_VIEW_LIST, TBSTATE_ENABLED, BTNS_BUTTON },
|
|
|
|
{ FCIDM_SHVIEW_REPORTVIEW, 0, 0, IDS_VIEW_DETAILS, TBSTATE_ENABLED, BTNS_BUTTON },
|
|
|
|
{ -1, 0, 0, 0, 0, 0}
|
2011-05-15 15:55:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
|
|
|
|
|
|
|
|
CDefView::CDefView()
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_hWndList = NULL;
|
|
|
|
m_hWndParent = NULL;
|
|
|
|
m_FolderSettings.fFlags = 0;
|
|
|
|
m_FolderSettings.ViewMode = 0;
|
|
|
|
m_hMenu = NULL;
|
|
|
|
m_uState = 0;
|
|
|
|
m_cidl = 0;
|
|
|
|
m_apidl = NULL;
|
|
|
|
m_sortInfo.bIsAscending = FALSE;
|
|
|
|
m_sortInfo.nHeaderID = 0;
|
|
|
|
m_sortInfo.nLastHeaderID = 0;
|
|
|
|
m_hNotify = 0;
|
|
|
|
m_hAccel = NULL;
|
|
|
|
m_dwAspects = 0;
|
|
|
|
m_dwAdvf = 0;
|
|
|
|
m_iDragOverItem = 0;
|
|
|
|
m_cScrollDelay = 0;
|
|
|
|
m_ptLastMousePos.x = 0;
|
|
|
|
m_ptLastMousePos.y = 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CDefView::~CDefView()
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE(" destroying IShellView(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
SHFree(m_apidl);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::Initialize(IShellFolder *shellFolder)
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pSFParent = shellFolder;
|
|
|
|
shellFolder->QueryInterface(IID_PPV_ARG(IShellFolder2, &m_pSF2Parent));
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
*
|
|
|
|
* ##### helperfunctions for communication with ICommDlgBrowser #####
|
|
|
|
*/
|
|
|
|
HRESULT CDefView::IncludeObject(LPCITEMIDLIST pidl)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
HRESULT ret = S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCommDlgBrowser.p != NULL)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);
|
2013-11-19 19:05:17 +00:00
|
|
|
ret = m_pCommDlgBrowser->IncludeObject((IShellView *)this, pidl);
|
2011-09-07 13:39:13 +00:00
|
|
|
TRACE("--0x%08x\n", ret);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return ret;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CDefView::OnDefaultCommand()
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
HRESULT ret = S_FALSE;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCommDlgBrowser.p != NULL)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
TRACE("ICommDlgBrowser::OnDefaultCommand\n");
|
2013-11-19 19:05:17 +00:00
|
|
|
ret = m_pCommDlgBrowser->OnDefaultCommand((IShellView *)this);
|
2011-09-07 13:39:13 +00:00
|
|
|
TRACE("-- returns %08x\n", ret);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return ret;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CDefView::OnStateChange(UINT uFlags)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
HRESULT ret = S_FALSE;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCommDlgBrowser.p != NULL)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
TRACE("ICommDlgBrowser::OnStateChange flags=%x\n", uFlags);
|
2013-11-19 19:05:17 +00:00
|
|
|
ret = m_pCommDlgBrowser->OnStateChange((IShellView *)this, uFlags);
|
2011-09-07 13:39:13 +00:00
|
|
|
TRACE("--\n");
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return ret;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
/**********************************************************
|
2011-09-08 22:43:43 +00:00
|
|
|
* set the toolbar of the filedialog buttons
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
* - activates the buttons from the shellbrowser according to
|
|
|
|
* the view state
|
|
|
|
*/
|
|
|
|
void CDefView::CheckToolbar()
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
LRESULT result;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("\n");
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCommDlgBrowser != NULL)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_CHECKBUTTON,
|
|
|
|
FCIDM_TB_SMALLICON, (m_FolderSettings.ViewMode == FVM_LIST) ? TRUE : FALSE, &result);
|
|
|
|
m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_CHECKBUTTON,
|
|
|
|
FCIDM_TB_REPORTVIEW, (m_FolderSettings.ViewMode == FVM_DETAILS) ? TRUE : FALSE, &result);
|
|
|
|
m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_ENABLEBUTTON,
|
2011-12-20 19:56:46 +00:00
|
|
|
FCIDM_TB_SMALLICON, TRUE, &result);
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_ENABLEBUTTON,
|
2011-12-20 19:56:46 +00:00
|
|
|
FCIDM_TB_REPORTVIEW, TRUE, &result);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
*
|
|
|
|
* ##### helperfunctions for initializing the view #####
|
|
|
|
*/
|
|
|
|
/**********************************************************
|
2011-09-08 22:43:43 +00:00
|
|
|
* change the style of the listview control
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
void CDefView::SetStyle(DWORD dwAdd, DWORD dwRemove)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
DWORD tmpstyle;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
tmpstyle = ::GetWindowLongPtrW(m_hWndList, GWL_STYLE);
|
|
|
|
::SetWindowLongPtrW(m_hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove));
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_CreateList()
|
|
|
|
*
|
|
|
|
* - creates the list view window
|
|
|
|
*/
|
|
|
|
BOOL CDefView::CreateList()
|
2011-12-20 19:56:46 +00:00
|
|
|
{ DWORD dwStyle, dwExStyle;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("%p\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
|
2011-12-20 19:56:46 +00:00
|
|
|
LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_AUTOARRANGE;
|
|
|
|
dwExStyle = WS_EX_CLIENTEDGE;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_FolderSettings.fFlags & FWF_DESKTOP)
|
2011-12-20 19:56:46 +00:00
|
|
|
dwStyle |= LVS_ALIGNLEFT;
|
2011-05-25 21:28:27 +00:00
|
|
|
else
|
2011-12-20 19:56:46 +00:00
|
|
|
dwStyle |= LVS_ALIGNTOP;
|
2011-05-25 21:28:27 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
switch (m_FolderSettings.ViewMode)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
case FVM_ICON:
|
|
|
|
dwStyle |= LVS_ICON;
|
|
|
|
break;
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
case FVM_DETAILS:
|
|
|
|
dwStyle |= LVS_REPORT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FVM_SMALLICON:
|
|
|
|
dwStyle |= LVS_SMALLICON;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FVM_LIST:
|
|
|
|
dwStyle |= LVS_LIST;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
dwStyle |= LVS_LIST;
|
|
|
|
break;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_FolderSettings.fFlags & FWF_AUTOARRANGE)
|
2011-09-07 13:39:13 +00:00
|
|
|
dwStyle |= LVS_AUTOARRANGE;
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_FolderSettings.fFlags & FWF_DESKTOP)
|
|
|
|
m_FolderSettings.fFlags |= FWF_NOCLIENTEDGE | FWF_NOSCROLL;
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_FolderSettings.fFlags & FWF_SINGLESEL)
|
2011-09-07 13:39:13 +00:00
|
|
|
dwStyle |= LVS_SINGLESEL;
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_FolderSettings.fFlags & FWF_NOCLIENTEDGE)
|
2011-09-08 22:43:43 +00:00
|
|
|
dwExStyle &= ~WS_EX_CLIENTEDGE;
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_hWndList = CreateWindowExW( dwExStyle,
|
|
|
|
WC_LISTVIEWW,
|
|
|
|
NULL,
|
|
|
|
dwStyle,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
m_hWnd,
|
|
|
|
(HMENU)ID_LISTVIEW,
|
|
|
|
shell32_hInstance,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (!m_hWndList)
|
2011-09-07 13:39:13 +00:00
|
|
|
return FALSE;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_sortInfo.bIsAscending = TRUE;
|
|
|
|
m_sortInfo.nHeaderID = -1;
|
|
|
|
m_sortInfo.nLastHeaderID = -1;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2012-02-13 20:52:20 +00:00
|
|
|
UpdateListColors();
|
|
|
|
|
|
|
|
/* UpdateShellSettings(); */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDefView::UpdateListColors()
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_FolderSettings.fFlags & FWF_DESKTOP)
|
2011-09-07 13:39:13 +00:00
|
|
|
{
|
2012-02-13 20:52:20 +00:00
|
|
|
/* Check if drop shadows option is enabled */
|
|
|
|
BOOL bDropShadow = FALSE;
|
|
|
|
DWORD cbDropShadow = sizeof(bDropShadow);
|
|
|
|
WCHAR wszBuf[16] = L"";
|
|
|
|
|
|
|
|
RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
|
|
|
L"ListviewShadow", RRF_RT_DWORD, NULL, &bDropShadow, &cbDropShadow);
|
|
|
|
if (bDropShadow && SystemParametersInfoW(SPI_GETDESKWALLPAPER, _countof(wszBuf), wszBuf, 0) && wszBuf[0])
|
2011-09-07 13:39:13 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_SETTEXTBKCOLOR, 0, CLR_NONE);
|
|
|
|
SendMessageW(m_hWndList, LVM_SETBKCOLOR, 0, CLR_NONE);
|
|
|
|
SendMessageW(m_hWndList, LVM_SETTEXTCOLOR, 0, RGB(255, 255, 255));
|
|
|
|
SendMessageW(m_hWndList, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_TRANSPARENTSHADOWTEXT, LVS_EX_TRANSPARENTSHADOWTEXT);
|
2011-09-07 13:39:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-02-13 20:52:20 +00:00
|
|
|
COLORREF crDesktop = GetSysColor(COLOR_DESKTOP);
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_SETTEXTBKCOLOR, 0, crDesktop);
|
|
|
|
SendMessageW(m_hWndList, LVM_SETBKCOLOR, 0, crDesktop);
|
2012-02-13 20:52:20 +00:00
|
|
|
if (GetRValue(crDesktop) + GetGValue(crDesktop) + GetBValue(crDesktop) > 128 * 3)
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_SETTEXTCOLOR, 0, RGB(0, 0, 0));
|
2012-02-13 20:52:20 +00:00
|
|
|
else
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_SETTEXTCOLOR, 0, RGB(255, 255, 255));
|
|
|
|
SendMessageW(m_hWndList, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_TRANSPARENTSHADOWTEXT, 0);
|
2011-09-07 13:39:13 +00:00
|
|
|
}
|
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_InitList()
|
|
|
|
*
|
|
|
|
* - adds all needed columns to the shellview
|
|
|
|
*/
|
|
|
|
BOOL CDefView::InitList()
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
LVCOLUMNW lvColumn;
|
|
|
|
SHELLDETAILS sd;
|
|
|
|
WCHAR szTemp[50];
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("%p\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_DELETEALLITEMS, 0, 0);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
|
|
|
|
lvColumn.pszText = szTemp;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pSF2Parent)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
for (int i = 0; 1; i++)
|
2011-09-07 13:39:13 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
if (FAILED(m_pSF2Parent->GetDetailsOf(NULL, i, &sd)))
|
2011-09-08 22:43:43 +00:00
|
|
|
break;
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
lvColumn.fmt = sd.fmt;
|
2011-12-20 19:56:46 +00:00
|
|
|
lvColumn.cx = sd.cxChar * 8; /* chars->pixel */
|
2011-09-07 13:39:13 +00:00
|
|
|
StrRetToStrNW( szTemp, 50, &sd.str, NULL);
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_INSERTCOLUMNW, i, (LPARAM) &lvColumn);
|
2011-09-07 13:39:13 +00:00
|
|
|
}
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("no SF2\n");
|
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ShellSmallIconList);
|
|
|
|
SendMessageW(m_hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)ShellBigIconList);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return TRUE;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_CompareItems()
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* internal, CALLBACK for DSA_Sort
|
|
|
|
*/
|
|
|
|
INT CALLBACK CDefView::CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
int ret;
|
|
|
|
TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (!lpData)
|
2011-09-07 13:39:13 +00:00
|
|
|
return 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
ret = (SHORT)SCODE_CODE(((IShellFolder *)lpData)->CompareIDs(0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2));
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("ret=%i\n", ret);
|
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
return ret;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* ShellView_ListViewCompareItems
|
|
|
|
*
|
|
|
|
* Compare Function for the Listview (FileOpen Dialog)
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lParam1 [I] the first ItemIdList to compare with
|
|
|
|
* lParam2 [I] the second ItemIdList to compare with
|
|
|
|
* lpData [I] The column ID for the header Ctrl to process
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* A negative value if the first item should precede the second,
|
|
|
|
* a positive value if the first item should follow the second,
|
|
|
|
* or zero if the two items are equivalent
|
|
|
|
*
|
|
|
|
* NOTES
|
2011-09-08 22:43:43 +00:00
|
|
|
* FIXME: function does what ShellView_CompareItems is supposed to do.
|
|
|
|
* unify it and figure out how to use the undocumented first parameter
|
|
|
|
* of IShellFolder_CompareIDs to do the job this function does and
|
|
|
|
* move this code to IShellFolder.
|
|
|
|
* make LISTVIEW_SORT_INFO obsolete
|
|
|
|
* the way this function works is only usable if we had only
|
|
|
|
* filesystemfolders (25/10/99 jsch)
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
INT CALLBACK CDefView::ListViewCompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
INT nDiff = 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
FILETIME fd1, fd2;
|
|
|
|
char strName1[MAX_PATH], strName2[MAX_PATH];
|
2011-12-20 19:56:46 +00:00
|
|
|
BOOL bIsFolder1, bIsFolder2, bIsBothFolder;
|
2011-05-15 15:55:49 +00:00
|
|
|
LPITEMIDLIST pItemIdList1 = (LPITEMIDLIST) lParam1;
|
|
|
|
LPITEMIDLIST pItemIdList2 = (LPITEMIDLIST) lParam2;
|
|
|
|
LISTVIEW_SORT_INFO *pSortInfo = (LPLISTVIEW_SORT_INFO) lpData;
|
|
|
|
|
|
|
|
|
|
|
|
bIsFolder1 = _ILIsFolder(pItemIdList1);
|
|
|
|
bIsFolder2 = _ILIsFolder(pItemIdList2);
|
|
|
|
bIsBothFolder = bIsFolder1 && bIsFolder2;
|
|
|
|
|
|
|
|
/* When sorting between a File and a Folder, the Folder gets sorted first */
|
2011-09-07 13:39:13 +00:00
|
|
|
if ( (bIsFolder1 || bIsFolder2) && !bIsBothFolder)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
nDiff = bIsFolder1 ? -1 : 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Sort by Time: Folders or Files can be sorted */
|
|
|
|
|
|
|
|
if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TIME)
|
|
|
|
{
|
|
|
|
_ILGetFileDateTime(pItemIdList1, &fd1);
|
|
|
|
_ILGetFileDateTime(pItemIdList2, &fd2);
|
|
|
|
nDiff = CompareFileTime(&fd2, &fd1);
|
|
|
|
}
|
|
|
|
/* Sort by Attribute: Folder or Files can be sorted */
|
|
|
|
else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_ATTRIB)
|
|
|
|
{
|
|
|
|
_ILGetFileAttributes(pItemIdList1, strName1, MAX_PATH);
|
|
|
|
_ILGetFileAttributes(pItemIdList2, strName2, MAX_PATH);
|
|
|
|
nDiff = lstrcmpiA(strName1, strName2);
|
|
|
|
}
|
|
|
|
/* Sort by FileName: Folder or Files can be sorted */
|
2011-09-07 13:39:13 +00:00
|
|
|
else if (pSortInfo->nHeaderID == LISTVIEW_COLUMN_NAME || bIsBothFolder)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
/* Sort by Text */
|
|
|
|
_ILSimpleGetText(pItemIdList1, strName1, MAX_PATH);
|
|
|
|
_ILSimpleGetText(pItemIdList2, strName2, MAX_PATH);
|
|
|
|
nDiff = lstrcmpiA(strName1, strName2);
|
|
|
|
}
|
|
|
|
/* Sort by File Size, Only valid for Files */
|
2011-09-07 13:39:13 +00:00
|
|
|
else if (pSortInfo->nHeaderID == LISTVIEW_COLUMN_SIZE)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
nDiff = (INT)(_ILGetFileSize(pItemIdList1, NULL, 0) - _ILGetFileSize(pItemIdList2, NULL, 0));
|
|
|
|
}
|
|
|
|
/* Sort by File Type, Only valid for Files */
|
2011-09-07 13:39:13 +00:00
|
|
|
else if (pSortInfo->nHeaderID == LISTVIEW_COLUMN_TYPE)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
/* Sort by Type */
|
|
|
|
_ILGetFileType(pItemIdList1, strName1, MAX_PATH);
|
|
|
|
_ILGetFileType(pItemIdList2, strName2, MAX_PATH);
|
|
|
|
nDiff = lstrcmpiA(strName1, strName2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* If the Date, FileSize, FileType, Attrib was the same, sort by FileName */
|
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
if (nDiff == 0)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
_ILSimpleGetText(pItemIdList1, strName1, MAX_PATH);
|
|
|
|
_ILSimpleGetText(pItemIdList2, strName2, MAX_PATH);
|
|
|
|
nDiff = lstrcmpiA(strName1, strName2);
|
|
|
|
}
|
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
if (!pSortInfo->bIsAscending)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
nDiff = -nDiff;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nDiff;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* LV_FindItemByPidl()
|
|
|
|
*/
|
|
|
|
int CDefView::LV_FindItemByPidl(LPCITEMIDLIST pidl)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
LVITEMW lvItem;
|
|
|
|
lvItem.iSubItem = 0;
|
|
|
|
lvItem.mask = LVIF_PARAM;
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
for (lvItem.iItem = 0;
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
|
2011-12-20 19:56:46 +00:00
|
|
|
lvItem.iItem++)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
LPITEMIDLIST currentpidl = (LPITEMIDLIST) lvItem.lParam;
|
2013-11-19 19:05:17 +00:00
|
|
|
HRESULT hr = m_pSFParent->CompareIDs(0, pidl, currentpidl);
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
if (SUCCEEDED(hr) && !HRESULT_CODE(hr))
|
|
|
|
{
|
|
|
|
return lvItem.iItem;
|
|
|
|
}
|
2011-12-20 19:56:46 +00:00
|
|
|
}
|
2011-09-08 22:43:43 +00:00
|
|
|
return -1;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* LV_AddItem()
|
|
|
|
*/
|
|
|
|
BOOLEAN CDefView::LV_AddItem(LPCITEMIDLIST pidl)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
LVITEMW lvItem;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("(%p)(pidl=%p)\n", this, pidl);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/
|
2013-11-19 19:05:17 +00:00
|
|
|
lvItem.iItem = ListView_GetItemCount(m_hWndList); /*add the item to the end of the list*/
|
2011-09-08 22:43:43 +00:00
|
|
|
lvItem.iSubItem = 0;
|
|
|
|
lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidl)); /*set the item's data*/
|
|
|
|
lvItem.pszText = LPSTR_TEXTCALLBACKW; /*get text on a callback basis*/
|
|
|
|
lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (SendMessageW(m_hWndList, LVM_INSERTITEMW, 0, (LPARAM)&lvItem) == -1)
|
2011-09-07 13:39:13 +00:00
|
|
|
return FALSE;
|
2011-09-08 22:43:43 +00:00
|
|
|
else
|
|
|
|
return TRUE;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* LV_DeleteItem()
|
|
|
|
*/
|
|
|
|
BOOLEAN CDefView::LV_DeleteItem(LPCITEMIDLIST pidl)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
int nIndex;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("(%p)(pidl=%p)\n", this, pidl);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
nIndex = LV_FindItemByPidl(ILFindLastID(pidl));
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
return (-1 == ListView_DeleteItem(m_hWndList, nIndex)) ? FALSE : TRUE;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* LV_RenameItem()
|
|
|
|
*/
|
|
|
|
BOOLEAN CDefView::LV_RenameItem(LPCITEMIDLIST pidlOld, LPCITEMIDLIST pidlNew)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
int nItem;
|
|
|
|
LVITEMW lvItem;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("(%p)(pidlold=%p pidlnew=%p)\n", this, pidlOld, pidlNew);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
nItem = LV_FindItemByPidl(ILFindLastID(pidlOld));
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
if ( -1 != nItem )
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
|
|
|
lvItem.mask = LVIF_PARAM; /* only the pidl */
|
2011-09-07 13:39:13 +00:00
|
|
|
lvItem.iItem = nItem;
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
|
2011-09-07 13:39:13 +00:00
|
|
|
|
|
|
|
SHFree((LPITEMIDLIST)lvItem.lParam);
|
2012-01-12 22:26:50 +00:00
|
|
|
lvItem.mask = LVIF_PARAM|LVIF_IMAGE;
|
2011-09-07 13:39:13 +00:00
|
|
|
lvItem.iItem = nItem;
|
2011-09-08 22:43:43 +00:00
|
|
|
lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidlNew)); /* set the item's data */
|
2013-11-19 19:05:17 +00:00
|
|
|
lvItem.iImage = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidlNew, 0);
|
|
|
|
SendMessageW(m_hWndList, LVM_SETITEMW, 0, (LPARAM) &lvItem);
|
|
|
|
SendMessageW(m_hWndList, LVM_UPDATE, nItem, 0);
|
2011-09-08 22:43:43 +00:00
|
|
|
return TRUE; /* FIXME: better handling */
|
|
|
|
}
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
return FALSE;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_FillList()
|
|
|
|
*
|
|
|
|
* - gets the objectlist from the shellfolder
|
|
|
|
* - sorts the list
|
|
|
|
* - fills the list into the view
|
|
|
|
*/
|
|
|
|
INT CALLBACK CDefView::fill_list( LPVOID ptr, LPVOID arg )
|
|
|
|
{
|
|
|
|
LPITEMIDLIST pidl = (LPITEMIDLIST)ptr;
|
2014-04-13 12:20:31 +00:00
|
|
|
CDefView *pThis = static_cast<CDefView *>(arg);
|
2011-05-15 15:55:49 +00:00
|
|
|
/* in a commdlg This works as a filemask*/
|
2011-09-07 13:39:13 +00:00
|
|
|
if (pThis->IncludeObject(pidl) == S_OK)
|
|
|
|
pThis->LV_AddItem(pidl);
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
SHFree(pidl);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CDefView::FillList()
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
LPENUMIDLIST pEnumIDList;
|
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
DWORD dwFetched;
|
|
|
|
HRESULT hRes;
|
|
|
|
HDPA hdpa;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("%p\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/* get the itemlist from the shfolder*/
|
2013-11-19 19:05:17 +00:00
|
|
|
hRes = m_pSFParent->EnumObjects(m_hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList);
|
2011-09-08 22:43:43 +00:00
|
|
|
if (hRes != S_OK)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
if (hRes == S_FALSE)
|
2011-09-07 13:39:13 +00:00
|
|
|
return(NOERROR);
|
|
|
|
return(hRes);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* create a pointer array */
|
|
|
|
hdpa = DPA_Create(16);
|
|
|
|
if (!hdpa)
|
|
|
|
{
|
|
|
|
return(E_OUTOFMEMORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy the items into the array*/
|
|
|
|
while((S_OK == pEnumIDList->Next(1, &pidl, &dwFetched)) && dwFetched)
|
|
|
|
{
|
|
|
|
if (DPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
|
|
|
|
{
|
|
|
|
SHFree(pidl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sort the array */
|
2013-11-19 19:05:17 +00:00
|
|
|
DPA_Sort(hdpa, CompareItems, (LPARAM)m_pSFParent.p);
|
2011-09-08 22:43:43 +00:00
|
|
|
|
|
|
|
/*turn the listview's redrawing off*/
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageA(m_hWndList, WM_SETREDRAW, FALSE, 0);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
DPA_DestroyCallback( hdpa, fill_list, (void *)this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/*turn the listview's redrawing back on and force it to draw*/
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageA(m_hWndList, WM_SETREDRAW, TRUE, 0);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
pEnumIDList->Release(); /* destroy the list*/
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT CDefView::OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
::UpdateWindow(m_hWndList);
|
2011-09-08 22:43:43 +00:00
|
|
|
bHandled = FALSE;
|
|
|
|
return 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT CDefView::OnGetDlgCode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
return SendMessageW(m_hWndList, uMsg, 0, 0);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT CDefView::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
RevokeDragDrop(m_hWnd);
|
2013-11-19 19:05:17 +00:00
|
|
|
SHChangeNotifyDeregister(m_hNotify);
|
2011-09-08 22:43:43 +00:00
|
|
|
bHandled = FALSE;
|
|
|
|
return 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT CDefView::OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_FolderSettings.fFlags & (FWF_DESKTOP | FWF_TRANSPARENT))
|
2011-09-08 22:43:43 +00:00
|
|
|
return SendMessageW(GetParent(), WM_ERASEBKGND, wParam, lParam); /* redirect to parent */
|
2011-05-25 21:28:27 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
bHandled = FALSE;
|
|
|
|
return 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
2011-05-26 21:36:39 +00:00
|
|
|
LRESULT CDefView::OnSysColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2012-02-13 20:52:20 +00:00
|
|
|
/* Update desktop labels color */
|
|
|
|
UpdateListColors();
|
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/* Forward WM_SYSCOLORCHANGE to common controls */
|
2013-11-19 19:05:17 +00:00
|
|
|
return SendMessageW(m_hWndList, uMsg, 0, 0);
|
2011-05-26 21:36:39 +00:00
|
|
|
}
|
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
LRESULT CDefView::OnGetShellBrowser(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
return (LRESULT)m_pShellBrowser.p;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_OnCreate()
|
|
|
|
*/
|
|
|
|
LRESULT CDefView::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
CComPtr<IDropTarget> pdt;
|
|
|
|
SHChangeNotifyEntry ntreg;
|
|
|
|
CComPtr<IPersistFolder2> ppf2;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("%p\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if(CreateList())
|
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
if(InitList())
|
|
|
|
{
|
|
|
|
FillList();
|
|
|
|
}
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-11 16:42:16 +00:00
|
|
|
if (SUCCEEDED(QueryInterface(IID_PPV_ARG(IDropTarget, &pdt))))
|
2013-12-19 12:51:32 +00:00
|
|
|
{
|
|
|
|
if (FAILED(RegisterDragDrop(m_hWnd, pdt)))
|
|
|
|
ERR("Registering Drag Drop Failed");
|
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/* register for receiving notifications */
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pSFParent->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2));
|
2011-09-08 22:43:43 +00:00
|
|
|
if (ppf2)
|
|
|
|
{
|
|
|
|
ppf2->GetCurFolder((LPITEMIDLIST*)&ntreg.pidl);
|
|
|
|
ntreg.fRecursive = TRUE;
|
2013-11-19 19:05:17 +00:00
|
|
|
m_hNotify = SHChangeNotifyRegister(m_hWnd, SHCNF_IDLIST, SHCNE_ALLEVENTS, SHV_CHANGE_NOTIFY, 1, &ntreg);
|
2011-09-08 22:43:43 +00:00
|
|
|
SHFree((LPITEMIDLIST)ntreg.pidl);
|
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_hAccel = LoadAcceleratorsA(shell32_hInstance, MAKEINTRESOURCEA( IDA_SHELLVIEW));
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
2011-09-08 22:43:43 +00:00
|
|
|
* #### Handling of the menus ####
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_BuildFileMenu()
|
|
|
|
*/
|
|
|
|
HMENU CDefView::BuildFileMenu()
|
2011-12-20 19:56:46 +00:00
|
|
|
{ WCHAR szText[MAX_PATH];
|
2011-09-08 22:43:43 +00:00
|
|
|
MENUITEMINFOW mii;
|
2011-12-20 19:56:46 +00:00
|
|
|
int nTools, i;
|
2011-09-08 22:43:43 +00:00
|
|
|
HMENU hSubMenu;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
hSubMenu = CreatePopupMenu();
|
|
|
|
if (hSubMenu)
|
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
/*get the number of items in our global array*/
|
2011-12-20 19:56:46 +00:00
|
|
|
for(nTools = 0; Tools[nTools].idCommand != -1; nTools++) {}
|
2011-09-08 22:43:43 +00:00
|
|
|
|
|
|
|
/*add the menu items*/
|
|
|
|
for(i = 0; i < nTools; i++)
|
|
|
|
{
|
|
|
|
LoadStringW(shell32_hInstance, Tools[i].idMenuString, szText, MAX_PATH);
|
|
|
|
|
|
|
|
ZeroMemory(&mii, sizeof(mii));
|
|
|
|
mii.cbSize = sizeof(mii);
|
|
|
|
mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
|
|
|
|
|
|
|
|
if(BTNS_SEP != Tools[i].bStyle) /* no separator*/
|
|
|
|
{
|
|
|
|
mii.fType = MFT_STRING;
|
|
|
|
mii.fState = MFS_ENABLED;
|
|
|
|
mii.dwTypeData = szText;
|
|
|
|
mii.wID = Tools[i].idCommand;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mii.fType = MFT_SEPARATOR;
|
|
|
|
}
|
|
|
|
/* tack This item onto the end of the menu */
|
2011-12-20 19:56:46 +00:00
|
|
|
InsertMenuItemW(hSubMenu, (UINT) - 1, TRUE, &mii);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("-- return (menu=%p)\n", hSubMenu);
|
2011-09-08 22:43:43 +00:00
|
|
|
return hSubMenu;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_MergeFileMenu()
|
|
|
|
*/
|
|
|
|
void CDefView::MergeFileMenu(HMENU hSubMenu)
|
2011-09-07 13:39:13 +00:00
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)->(submenu=%p) stub\n", this, hSubMenu);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (hSubMenu)
|
2011-12-20 19:56:46 +00:00
|
|
|
{ /*insert This item at the beginning of the menu */
|
|
|
|
_InsertMenuItemW(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
2014-03-14 11:45:30 +00:00
|
|
|
_InsertMenuItemW(hSubMenu, 0, TRUE, IDM_MYFILEITEM+4, MFT_STRING, L"Properties", MFS_DISABLED);
|
|
|
|
_InsertMenuItemW(hSubMenu, 0, TRUE, IDM_MYFILEITEM+3, MFT_STRING, L"Rename", MFS_DISABLED);
|
|
|
|
_InsertMenuItemW(hSubMenu, 0, TRUE, IDM_MYFILEITEM+2, MFT_STRING, L"Delete", MFS_DISABLED);
|
|
|
|
_InsertMenuItemW(hSubMenu, 0, TRUE, IDM_MYFILEITEM+1, MFT_STRING, L"Create Shortcut", MFS_DISABLED);
|
|
|
|
_InsertMenuItemW(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
|
|
|
_InsertMenuItemW(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, L"New", MFS_ENABLED);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("--\n");
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_MergeViewMenu()
|
|
|
|
*/
|
|
|
|
void CDefView::MergeViewMenu(HMENU hSubMenu)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)->(submenu=%p)\n", this, hSubMenu);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (hSubMenu)
|
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
/*add a separator at the correct position in the menu*/
|
2011-09-08 22:43:43 +00:00
|
|
|
MENUITEMINFOW mii;
|
|
|
|
static WCHAR view[] = L"View";
|
|
|
|
|
|
|
|
_InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
|
|
|
|
|
|
|
ZeroMemory(&mii, sizeof(mii));
|
|
|
|
mii.cbSize = sizeof(mii);
|
|
|
|
mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;
|
|
|
|
mii.fType = MFT_STRING;
|
|
|
|
mii.dwTypeData = view;
|
|
|
|
mii.hSubMenu = LoadMenuW(shell32_hInstance, L"MENU_001");
|
|
|
|
InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
|
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_GetSelections()
|
|
|
|
*
|
2013-11-19 19:05:17 +00:00
|
|
|
* - fills the m_apidl list with the selected objects
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* number of selected items
|
|
|
|
*/
|
|
|
|
UINT CDefView::GetSelections()
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
LVITEMW lvItem;
|
|
|
|
UINT i = 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
SHFree(m_apidl);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_cidl = ListView_GetSelectedCount(m_hWndList);
|
|
|
|
m_apidl = (LPITEMIDLIST*)SHAlloc(m_cidl * sizeof(LPITEMIDLIST));
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
TRACE("selected=%i\n", m_cidl);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_apidl)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
TRACE("-- Items selected =%u\n", m_cidl);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
lvItem.mask = LVIF_STATE | LVIF_PARAM;
|
|
|
|
lvItem.stateMask = LVIS_SELECTED;
|
|
|
|
lvItem.iItem = 0;
|
|
|
|
lvItem.iSubItem = 0;
|
2011-09-07 13:39:13 +00:00
|
|
|
lvItem.state = 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
while(SendMessageW(m_hWndList, LVM_GETITEMW, 0, (LPARAM)&lvItem) && (i < m_cidl))
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
|
|
|
if(lvItem.state & LVIS_SELECTED)
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_apidl[i] = (LPITEMIDLIST)lvItem.lParam;
|
2011-09-08 22:43:43 +00:00
|
|
|
i++;
|
2013-11-19 19:05:17 +00:00
|
|
|
if (i == m_cidl)
|
2011-12-20 19:56:46 +00:00
|
|
|
break;
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("-- selected Item found\n");
|
|
|
|
}
|
|
|
|
lvItem.iItem++;
|
|
|
|
}
|
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
return m_cidl;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
2011-09-08 22:43:43 +00:00
|
|
|
* ShellView_OpenSelectedItems()
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT CDefView::OpenSelectedItems()
|
|
|
|
{
|
2013-07-20 16:23:54 +00:00
|
|
|
HMENU hMenu;
|
|
|
|
CMINVOKECOMMANDINFO cmi;
|
|
|
|
UINT uCommand;
|
|
|
|
HRESULT hResult;
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_cidl = ListView_GetSelectedCount(m_hWndList);
|
|
|
|
if (m_cidl == 0)
|
2013-07-25 12:57:56 +00:00
|
|
|
return S_OK;
|
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
hResult = OnDefaultCommand();
|
|
|
|
if (hResult == S_OK)
|
|
|
|
return hResult;
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
hMenu = CreatePopupMenu();
|
|
|
|
if (!hMenu)
|
|
|
|
return E_FAIL;
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
hResult = GetItemObject( SVGIO_SELECTION, IID_PPV_ARG(IContextMenu, &m_pCM));
|
2013-07-20 16:23:54 +00:00
|
|
|
if (FAILED(hResult))
|
|
|
|
goto cleanup;
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
hResult = IUnknown_SetSite(m_pCM, (IShellView *)this);
|
2013-07-20 16:23:54 +00:00
|
|
|
//if (FAILED( hResult))
|
|
|
|
// goto cleanup;
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
hResult = m_pCM->QueryContextMenu(hMenu, 0, 0x20, 0x7fff, CMF_DEFAULTONLY);
|
2013-07-20 16:23:54 +00:00
|
|
|
if (FAILED(hResult))
|
|
|
|
goto cleanup;
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
uCommand = GetMenuDefaultItem(hMenu, FALSE, 0);
|
|
|
|
if (uCommand == (UINT)-1)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2013-07-20 16:23:54 +00:00
|
|
|
hResult = E_FAIL;
|
|
|
|
goto cleanup;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-12-17 22:48:16 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
ZeroMemory(&cmi, sizeof(cmi));
|
|
|
|
cmi.cbSize = sizeof(cmi);
|
|
|
|
cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);
|
|
|
|
cmi.hwnd = m_hWnd;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
hResult = m_pCM->InvokeCommand(&cmi);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
cleanup:
|
|
|
|
|
|
|
|
if (hMenu)
|
|
|
|
DestroyMenu(hMenu);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCM)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
IUnknown_SetSite(m_pCM, NULL);
|
|
|
|
m_pCM.Release();
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
return hResult;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
2011-09-08 22:43:43 +00:00
|
|
|
* ShellView_DoContextMenu()
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
LRESULT CDefView::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
WORD x;
|
|
|
|
WORD y;
|
|
|
|
UINT uCommand;
|
|
|
|
HMENU hMenu;
|
|
|
|
CMINVOKECOMMANDINFO cmi;
|
|
|
|
HRESULT hResult;
|
2011-09-08 22:43:43 +00:00
|
|
|
|
|
|
|
// for some reason I haven't figured out, we sometimes recurse into this method
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCM != NULL)
|
2011-09-08 22:43:43 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
x = LOWORD(lParam);
|
|
|
|
y = HIWORD(lParam);
|
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)->(0x%08x 0x%08x) stub\n", this, x, y);
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
hMenu = CreatePopupMenu();
|
|
|
|
if (!hMenu)
|
|
|
|
return E_FAIL;
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_cidl = ListView_GetSelectedCount(m_hWndList);
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
hResult = GetItemObject( m_cidl ? SVGIO_SELECTION : SVGIO_BACKGROUND, IID_PPV_ARG(IContextMenu, &m_pCM));
|
2013-07-20 16:23:54 +00:00
|
|
|
if (FAILED( hResult))
|
|
|
|
goto cleanup;
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
hResult = IUnknown_SetSite(m_pCM, (IShellView *)this);
|
2013-07-20 16:23:54 +00:00
|
|
|
//if (FAILED( hResult))
|
|
|
|
// goto cleanup;
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
|
2013-07-20 16:23:54 +00:00
|
|
|
if (FAILED( hResult))
|
|
|
|
goto cleanup;
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_FolderSettings.fFlags & FWF_DESKTOP)
|
2013-07-20 16:23:54 +00:00
|
|
|
SetMenuDefaultItem(hMenu, FCIDM_SHVIEW_OPEN, MF_BYCOMMAND);
|
|
|
|
|
|
|
|
uCommand = TrackPopupMenu(hMenu,
|
|
|
|
TPM_LEFTALIGN | TPM_RETURNCMD | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
|
|
|
|
x, y, 0, m_hWnd, NULL);
|
|
|
|
if (uCommand == 0)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (uCommand == FCIDM_SHVIEW_OPEN && OnDefaultCommand() == S_OK)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
ZeroMemory(&cmi, sizeof(cmi));
|
|
|
|
cmi.cbSize = sizeof(cmi);
|
|
|
|
cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);
|
|
|
|
cmi.hwnd = m_hWnd;
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pCM->InvokeCommand(&cmi);
|
2013-07-20 16:23:54 +00:00
|
|
|
|
|
|
|
cleanup:
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCM)
|
2013-07-20 16:23:54 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
IUnknown_SetSite(m_pCM, NULL);
|
|
|
|
m_pCM.Release();
|
2013-07-20 16:23:54 +00:00
|
|
|
}
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
if (hMenu)
|
|
|
|
DestroyMenu(hMenu);
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
LRESULT CDefView::OnExplorerCommand(UINT uCommand, BOOL bUseSelection)
|
|
|
|
{
|
|
|
|
HRESULT hResult;
|
|
|
|
CMINVOKECOMMANDINFO cmi;
|
|
|
|
HMENU hMenu;
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
hMenu = CreatePopupMenu();
|
|
|
|
if (!hMenu)
|
|
|
|
return 0;
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
hResult = GetItemObject( bUseSelection ? SVGIO_SELECTION : SVGIO_BACKGROUND, IID_PPV_ARG(IContextMenu, &m_pCM));
|
2013-07-20 16:23:54 +00:00
|
|
|
if (FAILED( hResult))
|
|
|
|
goto cleanup;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
hResult = IUnknown_SetSite(m_pCM, (IShellView *)this);
|
2013-07-20 16:23:54 +00:00
|
|
|
//if (FAILED( hResult))
|
|
|
|
// goto cleanup;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
|
2013-07-20 16:23:54 +00:00
|
|
|
if (FAILED( hResult))
|
|
|
|
goto cleanup;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
ZeroMemory(&cmi, sizeof(cmi));
|
|
|
|
cmi.cbSize = sizeof(cmi);
|
|
|
|
cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);
|
|
|
|
cmi.hwnd = m_hWnd;
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pCM->InvokeCommand(&cmi);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
cleanup:
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCM)
|
2013-07-20 16:23:54 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
IUnknown_SetSite(m_pCM, NULL);
|
|
|
|
m_pCM.Release();
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
if (hMenu)
|
|
|
|
DestroyMenu(hMenu);
|
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
2011-09-08 22:43:43 +00:00
|
|
|
* ##### message handling #####
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_OnSize()
|
|
|
|
*/
|
|
|
|
LRESULT CDefView::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
WORD wWidth;
|
|
|
|
WORD wHeight;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
wWidth = LOWORD(lParam);
|
|
|
|
wHeight = HIWORD(lParam);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("%p width=%u height=%u\n", this, wWidth, wHeight);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/*resize the ListView to fit our window*/
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_hWndList)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
::MoveWindow(m_hWndList, 0, 0, wWidth, wHeight, TRUE);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_OnDeactivate()
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* internal
|
|
|
|
*/
|
|
|
|
void CDefView::OnDeactivate()
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("%p\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_uState != SVUIA_DEACTIVATE)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_hMenu)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pShellBrowser->SetMenuSB(0, 0, 0);
|
|
|
|
m_pShellBrowser->RemoveMenusSB(m_hMenu);
|
|
|
|
DestroyMenu(m_hMenu);
|
|
|
|
m_hMenu = 0;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_uState = SVUIA_DEACTIVATE;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDefView::DoActivate(UINT uState)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} };
|
|
|
|
MENUITEMINFOA mii;
|
|
|
|
CHAR szText[MAX_PATH];
|
|
|
|
|
|
|
|
TRACE("%p uState=%x\n", this, uState);
|
|
|
|
|
|
|
|
/*don't do anything if the state isn't really changing */
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_uState == uState)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
OnDeactivate();
|
|
|
|
|
|
|
|
/*only do This if we are active */
|
|
|
|
if(uState != SVUIA_DEACTIVATE)
|
|
|
|
{
|
|
|
|
/*merge the menus */
|
2013-11-19 19:05:17 +00:00
|
|
|
m_hMenu = CreateMenu();
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if(m_hMenu)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pShellBrowser->InsertMenusSB(m_hMenu, &omw);
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("-- after fnInsertMenusSB\n");
|
|
|
|
|
|
|
|
/*build the top level menu get the menu item's text*/
|
2011-12-20 19:56:46 +00:00
|
|
|
strcpy(szText, "dummy 31");
|
2011-09-08 22:43:43 +00:00
|
|
|
|
|
|
|
ZeroMemory(&mii, sizeof(mii));
|
|
|
|
mii.cbSize = sizeof(mii);
|
|
|
|
mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE;
|
|
|
|
mii.fType = MFT_STRING;
|
|
|
|
mii.fState = MFS_ENABLED;
|
|
|
|
mii.dwTypeData = szText;
|
|
|
|
mii.hSubMenu = BuildFileMenu();
|
|
|
|
|
|
|
|
/*get the view menu so we can merge with it*/
|
|
|
|
ZeroMemory(&mii, sizeof(mii));
|
|
|
|
mii.cbSize = sizeof(mii);
|
|
|
|
mii.fMask = MIIM_SUBMENU;
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (GetMenuItemInfoA(m_hMenu, FCIDM_MENU_VIEW, FALSE, &mii))
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
|
|
|
MergeViewMenu(mii.hSubMenu);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*add the items that should only be added if we have the focus*/
|
|
|
|
if (SVUIA_ACTIVATE_FOCUS == uState)
|
|
|
|
{
|
|
|
|
/*get the file menu so we can merge with it */
|
|
|
|
ZeroMemory(&mii, sizeof(mii));
|
|
|
|
mii.cbSize = sizeof(mii);
|
|
|
|
mii.fMask = MIIM_SUBMENU;
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (GetMenuItemInfoA(m_hMenu, FCIDM_MENU_FILE, FALSE, &mii))
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
|
|
|
MergeFileMenu(mii.hSubMenu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("-- before fnSetMenuSB\n");
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pShellBrowser->SetMenuSB(m_hMenu, 0, m_hWnd);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
}
|
2013-11-19 19:05:17 +00:00
|
|
|
m_uState = uState;
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("--\n");
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_OnActivate()
|
|
|
|
*/
|
|
|
|
LRESULT CDefView::OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
DoActivate(SVUIA_ACTIVATE_FOCUS);
|
|
|
|
return 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_OnSetFocus()
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
LRESULT CDefView::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("%p\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/* Tell the browser one of our windows has received the focus. This
|
|
|
|
should always be done before merging menus (OnActivate merges the
|
|
|
|
menus) if one of our windows has the focus.*/
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pShellBrowser->OnViewWindowActive((IShellView *)this);
|
2011-09-08 22:43:43 +00:00
|
|
|
DoActivate(SVUIA_ACTIVATE_FOCUS);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/* Set the focus to the listview */
|
2013-11-19 19:05:17 +00:00
|
|
|
::SetFocus(m_hWndList);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/* Notify the ICommDlgBrowser interface */
|
|
|
|
OnStateChange(CDBOSC_SETFOCUS);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_OnKillFocus()
|
|
|
|
*/
|
|
|
|
LRESULT CDefView::OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("(%p) stub\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
DoActivate(SVUIA_ACTIVATE_NOFOCUS);
|
|
|
|
/* Notify the ICommDlgBrowser */
|
|
|
|
OnStateChange(CDBOSC_KILLFOCUS);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_OnCommand()
|
|
|
|
*
|
|
|
|
* NOTES
|
2011-09-08 22:43:43 +00:00
|
|
|
* the CmdID's are the ones from the context menu
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
LRESULT CDefView::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
DWORD dwCmdID;
|
|
|
|
DWORD dwCmd;
|
|
|
|
HWND hwndCmd;
|
|
|
|
|
|
|
|
dwCmdID = GET_WM_COMMAND_ID(wParam, lParam);
|
|
|
|
dwCmd = GET_WM_COMMAND_CMD(wParam, lParam);
|
|
|
|
hwndCmd = GET_WM_COMMAND_HWND(wParam, lParam);
|
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)->(0x%08x 0x%08x %p) stub\n", this, dwCmdID, dwCmd, hwndCmd);
|
2011-09-08 22:43:43 +00:00
|
|
|
|
|
|
|
switch (dwCmdID)
|
|
|
|
{
|
|
|
|
case FCIDM_SHVIEW_SMALLICON:
|
2013-11-19 19:05:17 +00:00
|
|
|
m_FolderSettings.ViewMode = FVM_SMALLICON;
|
2011-09-08 22:43:43 +00:00
|
|
|
SetStyle (LVS_SMALLICON, LVS_TYPEMASK);
|
|
|
|
CheckToolbar();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FCIDM_SHVIEW_BIGICON:
|
2013-11-19 19:05:17 +00:00
|
|
|
m_FolderSettings.ViewMode = FVM_ICON;
|
2011-09-08 22:43:43 +00:00
|
|
|
SetStyle (LVS_ICON, LVS_TYPEMASK);
|
|
|
|
CheckToolbar();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FCIDM_SHVIEW_LISTVIEW:
|
2013-11-19 19:05:17 +00:00
|
|
|
m_FolderSettings.ViewMode = FVM_LIST;
|
2011-09-08 22:43:43 +00:00
|
|
|
SetStyle (LVS_LIST, LVS_TYPEMASK);
|
|
|
|
CheckToolbar();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FCIDM_SHVIEW_REPORTVIEW:
|
2013-11-19 19:05:17 +00:00
|
|
|
m_FolderSettings.ViewMode = FVM_DETAILS;
|
2011-09-08 22:43:43 +00:00
|
|
|
SetStyle (LVS_REPORT, LVS_TYPEMASK);
|
|
|
|
CheckToolbar();
|
|
|
|
break;
|
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
/* the menu-ID's for sorting are 0x30... see shrec.rc */
|
2011-09-08 22:43:43 +00:00
|
|
|
case 0x30:
|
|
|
|
case 0x31:
|
|
|
|
case 0x32:
|
|
|
|
case 0x33:
|
2013-11-19 19:05:17 +00:00
|
|
|
m_sortInfo.nHeaderID = (LPARAM) (dwCmdID - 0x30);
|
|
|
|
m_sortInfo.bIsAscending = TRUE;
|
|
|
|
m_sortInfo.nLastHeaderID = m_sortInfo.nHeaderID;
|
|
|
|
SendMessageA(m_hWndList, LVM_SORTITEMS, (WPARAM) &m_sortInfo, (LPARAM)ListViewCompareItems);
|
2011-09-08 22:43:43 +00:00
|
|
|
break;
|
|
|
|
|
2013-07-20 16:23:54 +00:00
|
|
|
case FCIDM_SHVIEW_REFRESH:
|
|
|
|
Refresh();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FCIDM_SHVIEW_DELETE:
|
|
|
|
case FCIDM_SHVIEW_CUT:
|
|
|
|
case FCIDM_SHVIEW_COPY:
|
|
|
|
case FCIDM_SHVIEW_RENAME:
|
|
|
|
return OnExplorerCommand(dwCmdID, TRUE);
|
|
|
|
|
|
|
|
case FCIDM_SHVIEW_INSERT:
|
|
|
|
case FCIDM_SHVIEW_UNDO:
|
|
|
|
case FCIDM_SHVIEW_INSERTLINK:
|
|
|
|
case FCIDM_SHVIEW_NEWFOLDER:
|
|
|
|
return OnExplorerCommand(dwCmdID, FALSE);
|
2011-09-08 22:43:43 +00:00
|
|
|
default:
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("-- COMMAND 0x%04x unhandled\n", dwCmdID);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_OnNotify()
|
|
|
|
*/
|
|
|
|
|
|
|
|
LRESULT CDefView::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
UINT CtlID;
|
|
|
|
LPNMHDR lpnmh;
|
|
|
|
LPNMLISTVIEW lpnmlv;
|
|
|
|
NMLVDISPINFOW *lpdi;
|
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
BOOL unused;
|
|
|
|
|
|
|
|
CtlID = wParam;
|
|
|
|
lpnmh = (LPNMHDR)lParam;
|
|
|
|
lpnmlv = (LPNMLISTVIEW)lpnmh;
|
|
|
|
lpdi = (NMLVDISPINFOW *)lpnmh;
|
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("%p CtlID=%u lpnmh->code=%x\n", this, CtlID, lpnmh->code);
|
2011-09-08 22:43:43 +00:00
|
|
|
|
|
|
|
switch (lpnmh->code)
|
|
|
|
{
|
|
|
|
case NM_SETFOCUS:
|
|
|
|
TRACE("-- NM_SETFOCUS %p\n", this);
|
|
|
|
OnSetFocus(0, 0, 0, unused);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NM_KILLFOCUS:
|
|
|
|
TRACE("-- NM_KILLFOCUS %p\n", this);
|
|
|
|
OnDeactivate();
|
|
|
|
/* Notify the ICommDlgBrowser interface */
|
|
|
|
OnStateChange(CDBOSC_KILLFOCUS);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NM_CUSTOMDRAW:
|
|
|
|
TRACE("-- NM_CUSTOMDRAW %p\n", this);
|
|
|
|
return CDRF_DODEFAULT;
|
|
|
|
|
|
|
|
case NM_RELEASEDCAPTURE:
|
|
|
|
TRACE("-- NM_RELEASEDCAPTURE %p\n", this);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NM_CLICK:
|
|
|
|
TRACE("-- NM_CLICK %p\n", this);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NM_RCLICK:
|
|
|
|
TRACE("-- NM_RCLICK %p\n", this);
|
|
|
|
break;
|
2011-09-07 13:39:13 +00:00
|
|
|
|
|
|
|
case NM_DBLCLK:
|
2011-05-15 15:55:49 +00:00
|
|
|
TRACE("-- NM_DBLCLK %p\n", this);
|
2013-07-20 16:23:54 +00:00
|
|
|
OpenSelectedItems();
|
2011-05-15 15:55:49 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
case NM_RETURN:
|
2011-05-15 15:55:49 +00:00
|
|
|
TRACE("-- NM_RETURN %p\n", this);
|
2013-07-20 16:23:54 +00:00
|
|
|
OpenSelectedItems();
|
2011-05-15 15:55:49 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
case HDN_ENDTRACKW:
|
|
|
|
TRACE("-- HDN_ENDTRACKW %p\n", this);
|
2013-11-19 19:05:17 +00:00
|
|
|
/*nColumn1 = ListView_GetColumnWidth(m_hWndList, 0);
|
|
|
|
nColumn2 = ListView_GetColumnWidth(m_hWndList, 1);*/
|
2011-09-08 22:43:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LVN_DELETEITEM:
|
|
|
|
TRACE("-- LVN_DELETEITEM %p\n", this);
|
|
|
|
SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LVN_DELETEALLITEMS:
|
|
|
|
TRACE("-- LVN_DELETEALLITEMS %p\n", this);
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
case LVN_INSERTITEM:
|
|
|
|
TRACE("-- LVN_INSERTITEM (STUB)%p\n", this);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LVN_ITEMACTIVATE:
|
|
|
|
TRACE("-- LVN_ITEMACTIVATE %p\n", this);
|
|
|
|
OnStateChange(CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LVN_COLUMNCLICK:
|
2013-11-19 19:05:17 +00:00
|
|
|
m_sortInfo.nHeaderID = lpnmlv->iSubItem;
|
|
|
|
if (m_sortInfo.nLastHeaderID == m_sortInfo.nHeaderID)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_sortInfo.bIsAscending = !m_sortInfo.bIsAscending;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_sortInfo.bIsAscending = TRUE;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2013-11-19 19:05:17 +00:00
|
|
|
m_sortInfo.nLastHeaderID = m_sortInfo.nHeaderID;
|
2011-09-08 22:43:43 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(lpnmlv->hdr.hwndFrom, LVM_SORTITEMS, (WPARAM) &m_sortInfo, (LPARAM)ListViewCompareItems);
|
2011-09-08 22:43:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LVN_GETDISPINFOA:
|
2011-09-07 13:39:13 +00:00
|
|
|
case LVN_GETDISPINFOW:
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("-- LVN_GETDISPINFO %p\n", this);
|
|
|
|
pidl = (LPITEMIDLIST)lpdi->item.lParam;
|
|
|
|
|
|
|
|
if (lpdi->item.mask & LVIF_TEXT) /* text requested */
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pSF2Parent)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
|
|
|
SHELLDETAILS sd;
|
2013-11-19 19:05:17 +00:00
|
|
|
if (FAILED(m_pSF2Parent->GetDetailsOf(pidl, lpdi->item.iSubItem, &sd)))
|
2012-01-07 15:40:27 +00:00
|
|
|
{
|
|
|
|
FIXME("failed to get details\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
if (lpnmh->code == LVN_GETDISPINFOA)
|
|
|
|
{
|
|
|
|
/* shouldn't happen */
|
|
|
|
NMLVDISPINFOA *lpdiA = (NMLVDISPINFOA *)lpnmh;
|
|
|
|
StrRetToStrNA( lpdiA->item.pszText, lpdiA->item.cchTextMax, &sd.str, NULL);
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("-- text=%s\n", lpdiA->item.pszText);
|
2011-09-07 13:39:13 +00:00
|
|
|
}
|
|
|
|
else /* LVN_GETDISPINFOW */
|
|
|
|
{
|
|
|
|
StrRetToStrNW( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("-- text=%s\n", debugstr_w(lpdi->item.pszText));
|
2011-09-07 13:39:13 +00:00
|
|
|
}
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("no SF2\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(lpdi->item.mask & LVIF_IMAGE) /* image requested */
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidl, 0);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
lpdi->item.mask |= LVIF_DI_SETITEM;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LVN_ITEMCHANGED:
|
|
|
|
TRACE("-- LVN_ITEMCHANGED %p\n", this);
|
|
|
|
OnStateChange(CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LVN_BEGINDRAG:
|
|
|
|
case LVN_BEGINRDRAG:
|
|
|
|
TRACE("-- LVN_BEGINDRAG\n");
|
|
|
|
|
|
|
|
if (GetSelections())
|
|
|
|
{
|
|
|
|
IDataObject * pda;
|
|
|
|
DWORD dwAttributes = SFGAO_CANLINK;
|
|
|
|
DWORD dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
|
|
|
|
|
2014-04-29 11:14:29 +00:00
|
|
|
if (SUCCEEDED(m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, (LPCITEMIDLIST*)m_apidl, IID_NULL_PPV_ARG(IDataObject, &pda))))
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
|
|
|
IDropSource * pds = (IDropSource *)this; /* own DropSource interface */
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (SUCCEEDED(m_pSFParent->GetAttributesOf(m_cidl, (LPCITEMIDLIST*)m_apidl, &dwAttributes)))
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
|
|
|
if (dwAttributes & SFGAO_CANLINK)
|
|
|
|
{
|
|
|
|
dwEffect |= DROPEFFECT_LINK;
|
|
|
|
}
|
|
|
|
}
|
2014-01-09 13:24:39 +00:00
|
|
|
|
|
|
|
CComPtr<IAsyncOperation> piaso;
|
|
|
|
if (SUCCEEDED(pda->QueryInterface(IID_PPV_ARG(IAsyncOperation, &piaso))))
|
|
|
|
{
|
|
|
|
piaso->SetAsyncMode(TRUE);
|
|
|
|
piaso->Release();
|
|
|
|
}
|
2011-09-08 22:43:43 +00:00
|
|
|
|
|
|
|
if (pds)
|
2014-01-09 13:24:39 +00:00
|
|
|
{ DWORD dwEffect2;
|
2011-09-08 22:43:43 +00:00
|
|
|
DoDragDrop(pda, pds, dwEffect, &dwEffect2);
|
|
|
|
}
|
|
|
|
pda->Release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LVN_BEGINLABELEDITW:
|
|
|
|
{
|
|
|
|
DWORD dwAttr = SFGAO_CANRENAME;
|
|
|
|
pidl = (LPITEMIDLIST)lpdi->item.lParam;
|
|
|
|
|
|
|
|
TRACE("-- LVN_BEGINLABELEDITW %p\n", this);
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pSFParent->GetAttributesOf(1, (LPCITEMIDLIST*)&pidl, &dwAttr);
|
2011-09-08 22:43:43 +00:00
|
|
|
if (SFGAO_CANRENAME & dwAttr)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case LVN_ENDLABELEDITW:
|
|
|
|
{
|
|
|
|
TRACE("-- LVN_ENDLABELEDITW %p\n", this);
|
|
|
|
if (lpdi->item.pszText)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
LVITEMW lvItem;
|
|
|
|
|
|
|
|
lvItem.iItem = lpdi->item.iItem;
|
|
|
|
lvItem.iSubItem = 0;
|
|
|
|
lvItem.mask = LVIF_PARAM;
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
|
2011-09-08 22:43:43 +00:00
|
|
|
|
|
|
|
pidl = (LPITEMIDLIST)lpdi->item.lParam;
|
2013-11-19 19:05:17 +00:00
|
|
|
hr = m_pSFParent->SetNameOf(0, pidl, lpdi->item.pszText, SHGDN_INFOLDER, &pidl);
|
2011-09-08 22:43:43 +00:00
|
|
|
|
|
|
|
if (SUCCEEDED(hr) && pidl)
|
|
|
|
{
|
2012-01-12 22:26:50 +00:00
|
|
|
lvItem.mask = LVIF_PARAM|LVIF_IMAGE;
|
2011-09-08 22:43:43 +00:00
|
|
|
lvItem.lParam = (LPARAM)pidl;
|
2013-11-19 19:05:17 +00:00
|
|
|
lvItem.iImage = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidl, 0);
|
|
|
|
SendMessageW(m_hWndList, LVM_SETITEMW, 0, (LPARAM) &lvItem);
|
|
|
|
SendMessageW(m_hWndList, LVM_UPDATE, lpdi->item.iItem, 0);
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
return TRUE;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
}
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
return FALSE;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case LVN_KEYDOWN:
|
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
LPNMLVKEYDOWN plvKeyDown = (LPNMLVKEYDOWN) lpnmh;
|
|
|
|
|
|
|
|
/* initiate a rename of the selected file or directory */
|
2013-07-20 16:23:54 +00:00
|
|
|
if (plvKeyDown->wVKey == VK_BACK)
|
2011-09-07 13:39:13 +00:00
|
|
|
{
|
|
|
|
LPSHELLBROWSER lpSb;
|
2013-11-19 19:05:17 +00:00
|
|
|
if ((lpSb = (LPSHELLBROWSER)SendMessageW(m_hWndParent, CWM_GETISHELLBROWSER, 0, 0)))
|
2011-05-25 20:12:34 +00:00
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
lpSb->BrowseObject(NULL, SBSP_PARENT);
|
|
|
|
}
|
|
|
|
}
|
2013-07-20 16:23:54 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
else
|
2011-12-20 19:56:46 +00:00
|
|
|
FIXME("LVN_KEYDOWN key=0x%08x\n", plvKeyDown->wVKey);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
default:
|
|
|
|
TRACE("-- %p WM_COMMAND %x unhandled\n", this, lpnmh->code);
|
|
|
|
break;
|
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_OnChange()
|
|
|
|
*/
|
|
|
|
LRESULT CDefView::OnChangeNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
LPITEMIDLIST *Pidls;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
Pidls = (LPITEMIDLIST *)wParam;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("(%p)(%p,%p,0x%08x)\n", this, Pidls[0], Pidls[1], lParam);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
switch (lParam)
|
|
|
|
{
|
|
|
|
case SHCNE_MKDIR:
|
|
|
|
case SHCNE_CREATE:
|
|
|
|
LV_AddItem(Pidls[0]);
|
|
|
|
break;
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
case SHCNE_RMDIR:
|
|
|
|
case SHCNE_DELETE:
|
|
|
|
LV_DeleteItem(Pidls[0]);
|
|
|
|
break;
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
case SHCNE_RENAMEFOLDER:
|
|
|
|
case SHCNE_RENAMEITEM:
|
|
|
|
LV_RenameItem(Pidls[0], Pidls[1]);
|
|
|
|
break;
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
case SHCNE_UPDATEITEM:
|
2014-03-15 13:59:22 +00:00
|
|
|
LV_RenameItem(Pidls[0], Pidls[0]);
|
2011-09-08 22:43:43 +00:00
|
|
|
break;
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2014-03-15 13:59:22 +00:00
|
|
|
case SHCNE_UPDATEDIR:
|
|
|
|
Refresh();
|
|
|
|
break;
|
|
|
|
}
|
2011-09-08 22:43:43 +00:00
|
|
|
return TRUE;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
2012-02-13 20:52:20 +00:00
|
|
|
* CDefView::OnCustomItem
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
LRESULT CDefView::OnCustomItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
if (!m_pCM.p)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
/* no menu */
|
|
|
|
ERR("no menu!!!\n");
|
|
|
|
return FALSE;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
2013-11-11 22:36:26 +00:00
|
|
|
CComPtr<IContextMenu2> pCM2;
|
2013-11-19 19:05:17 +00:00
|
|
|
HRESULT hres = m_pCM.p->QueryInterface(IID_PPV_ARG(IContextMenu2, &pCM2));
|
2013-11-11 22:36:26 +00:00
|
|
|
if(FAILED(hres))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (pCM2.p->HandleMenuMsg(uMsg, (WPARAM)m_hWnd, lParam) == S_OK)
|
2011-05-15 15:55:49 +00:00
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-02-13 20:52:20 +00:00
|
|
|
LRESULT CDefView::OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
|
|
{
|
|
|
|
/* Wallpaper setting affects drop shadows effect */
|
|
|
|
if (wParam == SPI_SETDESKWALLPAPER || wParam == 0)
|
|
|
|
UpdateListColors();
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
/**********************************************************
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* The INTERFACE of the IShellView object
|
|
|
|
*
|
|
|
|
*
|
|
|
|
**********************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ShellView_GetWindow
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CDefView::GetWindow(HWND *phWnd)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
*phWnd = m_hWnd;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::ContextSensitiveHelp(BOOL fEnterMode)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
FIXME("(%p) stub\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* IShellView_TranslateAccelerator
|
|
|
|
*
|
|
|
|
* FIXME:
|
|
|
|
* use the accel functions
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CDefView::TranslateAccelerator(LPMSG lpmsg)
|
|
|
|
{
|
2013-07-20 16:23:54 +00:00
|
|
|
if (lpmsg->message >= WM_KEYFIRST && lpmsg->message <= WM_KEYLAST)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
if (::TranslateAcceleratorW(m_hWnd, m_hAccel, lpmsg) != 0)
|
2013-07-20 16:23:54 +00:00
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
/* FIXME: should call TranslateAcceleratorSB */
|
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("-- key=0x04%lx\n", lpmsg->wParam) ;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_FALSE; /* not handled */
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::EnableModeless(BOOL fEnable)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
FIXME("(%p) stub\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::UIActivate(UINT uState)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
/*
|
|
|
|
CHAR szName[MAX_PATH];
|
|
|
|
*/
|
2011-09-08 22:43:43 +00:00
|
|
|
LRESULT lResult;
|
2011-12-20 19:56:46 +00:00
|
|
|
int nPartArray[1] = { -1};
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)->(state=%x) stub\n", this, uState);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/*don't do anything if the state isn't really changing*/
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_uState == uState)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2011-09-07 13:39:13 +00:00
|
|
|
return S_OK;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/*OnActivate handles the menu merging and internal state*/
|
|
|
|
DoActivate(uState);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/*only do This if we are active*/
|
|
|
|
if (uState != SVUIA_DEACTIVATE)
|
|
|
|
{
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
/*
|
|
|
|
GetFolderPath is not a method of IShellFolder
|
2013-11-19 19:05:17 +00:00
|
|
|
IShellFolder_GetFolderPath( m_pSFParent, szName, sizeof(szName) );
|
2011-12-20 19:56:46 +00:00
|
|
|
*/
|
2011-09-08 22:43:43 +00:00
|
|
|
/* set the number of parts */
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pShellBrowser->SendControlMsg(FCW_STATUS, SB_SETPARTS, 1, (LPARAM)nPartArray, &lResult);
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/* set the text for the parts */
|
2011-12-20 19:56:46 +00:00
|
|
|
/*
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pShellBrowser->SendControlMsg(FCW_STATUS, SB_SETTEXTA, 0, (LPARAM)szName, &lResult);
|
2011-12-20 19:56:46 +00:00
|
|
|
*/
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::Refresh()
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_DELETEALLITEMS, 0, 0);
|
2011-09-08 22:43:43 +00:00
|
|
|
FillList();
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::CreateViewWindow(IShellView *lpPrevView, LPCFOLDERSETTINGS lpfs, IShellBrowser *psb, RECT *prcView, HWND *phWnd)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
*phWnd = 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n", this, lpPrevView, lpfs, psb, prcView, phWnd);
|
2011-05-25 20:25:42 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (lpfs != NULL)
|
|
|
|
TRACE("-- vmode=%x flags=%x\n", lpfs->ViewMode, lpfs->fFlags);
|
|
|
|
if (prcView != NULL)
|
|
|
|
TRACE("-- left=%i top=%i right=%i bottom=%i\n", prcView->left, prcView->top, prcView->right, prcView->bottom);
|
2011-05-25 20:25:42 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/* Validate the Shell Browser */
|
|
|
|
if (psb == NULL)
|
|
|
|
return E_UNEXPECTED;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/*set up the member variables*/
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pShellBrowser = psb;
|
|
|
|
m_FolderSettings = *lpfs;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/*get our parent window*/
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pShellBrowser->GetWindow(&m_hWndParent);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/* try to get the ICommDlgBrowserInterface, adds a reference !!! */
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pCommDlgBrowser = NULL;
|
|
|
|
if (SUCCEEDED(m_pShellBrowser->QueryInterface(IID_PPV_ARG(ICommDlgBrowser, &m_pCommDlgBrowser))))
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
|
|
|
TRACE("-- CommDlgBrowser\n");
|
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
Create(m_hWndParent, prcView, NULL, WS_CHILD | WS_TABSTOP, 0, 0U);
|
2011-09-08 22:43:43 +00:00
|
|
|
if (m_hWnd == NULL)
|
|
|
|
return E_FAIL;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
*phWnd = m_hWnd;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
CheckToolbar();
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (!*phWnd)
|
|
|
|
return E_FAIL;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
|
|
|
|
UpdateWindow();
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::DestroyViewWindow()
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/*Make absolutely sure all our UI is cleaned up.*/
|
|
|
|
UIActivate(SVUIA_DEACTIVATE);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_hMenu)
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
DestroyMenu(m_hMenu);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
DestroyWindow();
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pShellBrowser.Release();
|
|
|
|
m_pCommDlgBrowser.Release();
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::GetCurrentInfo(LPFOLDERSETTINGS lpfs)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)->(%p) vmode=%x flags=%x\n", this, lpfs,
|
2013-11-19 19:05:17 +00:00
|
|
|
m_FolderSettings.ViewMode, m_FolderSettings.fFlags);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (!lpfs)
|
2011-09-07 13:39:13 +00:00
|
|
|
return E_INVALIDARG;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
*lpfs = m_FolderSettings;
|
2013-11-03 12:03:54 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
HRESULT WINAPI CDefView::AddPropertySheetPages(DWORD dwReserved, LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
FIXME("(%p) stub\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::SaveViewState()
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
FIXME("(%p) stub\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::SelectItem(LPCITEMIDLIST pidl, UINT uFlags)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
int i;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)->(pidl=%p, 0x%08x) stub\n", this, pidl, uFlags);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
i = LV_FindItemByPidl(pidl);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (i != -1)
|
|
|
|
{
|
|
|
|
LVITEMW lvItem;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if(uFlags & SVSI_ENSUREVISIBLE)
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_ENSUREVISIBLE, i, 0);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
lvItem.mask = LVIF_STATE;
|
|
|
|
lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
|
|
|
|
lvItem.iItem = 0;
|
|
|
|
lvItem.iSubItem = 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
while (SendMessageW(m_hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem))
|
2011-09-08 22:43:43 +00:00
|
|
|
{
|
|
|
|
if (lvItem.iItem == i)
|
|
|
|
{
|
|
|
|
if (uFlags & SVSI_SELECT)
|
|
|
|
lvItem.state |= LVIS_SELECTED;
|
|
|
|
else
|
|
|
|
lvItem.state &= ~LVIS_SELECTED;
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (uFlags & SVSI_FOCUSED)
|
|
|
|
lvItem.state &= ~LVIS_FOCUSED;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (uFlags & SVSI_DESELECTOTHERS)
|
|
|
|
lvItem.state &= ~LVIS_SELECTED;
|
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_SETITEMW, 0, (LPARAM) &lvItem);
|
2011-09-08 22:43:43 +00:00
|
|
|
lvItem.iItem++;
|
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if(uFlags & SVSI_EDIT)
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_EDITLABELW, i, 0);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::GetItemObject(UINT uItem, REFIID riid, LPVOID *ppvOut)
|
|
|
|
{
|
2011-09-26 23:10:38 +00:00
|
|
|
HRESULT hr = E_NOINTERFACE;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n", this, uItem, debugstr_guid(&riid), ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
*ppvOut = NULL;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
switch (uItem)
|
|
|
|
{
|
|
|
|
case SVGIO_BACKGROUND:
|
|
|
|
if (IsEqualIID(riid, IID_IContextMenu))
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
//*ppvOut = ISvBgCm_Constructor(m_pSFParent, FALSE);
|
|
|
|
CDefFolderMenu_Create2(NULL, NULL, 0, NULL, m_pSFParent, NULL, 0, NULL, (IContextMenu**)ppvOut);
|
2011-09-08 22:43:43 +00:00
|
|
|
if (!ppvOut)
|
|
|
|
hr = E_OUTOFMEMORY;
|
2011-09-26 23:10:38 +00:00
|
|
|
else
|
|
|
|
hr = S_OK;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
break;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
case SVGIO_SELECTION:
|
|
|
|
GetSelections();
|
2013-11-19 19:05:17 +00:00
|
|
|
hr = m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, (LPCITEMIDLIST*)m_apidl, riid, 0, ppvOut);
|
2011-09-08 22:43:43 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("-- (%p)->(interface=%p)\n", this, *ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return hr;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetCurrentViewMode(UINT *pViewMode)
|
|
|
|
{
|
2011-09-26 19:55:35 +00:00
|
|
|
TRACE("(%p)->(%p), stub\n", this, pViewMode);
|
|
|
|
|
|
|
|
if (!pViewMode)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
*pViewMode = m_FolderSettings.ViewMode;
|
2011-09-26 19:55:35 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::SetCurrentViewMode(UINT ViewMode)
|
|
|
|
{
|
2011-09-26 23:10:38 +00:00
|
|
|
DWORD dwStyle;
|
|
|
|
TRACE("(%p)->(%u), stub\n", this, ViewMode);
|
|
|
|
|
2013-04-26 23:05:51 +00:00
|
|
|
/* It's not redundant to check FVM_AUTO because it's a (UINT)-1 */
|
2013-04-27 09:40:27 +00:00
|
|
|
if ((ViewMode < FVM_FIRST || ViewMode > FVM_LAST) && (ViewMode != (UINT)FVM_AUTO))
|
2011-09-26 23:10:38 +00:00
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
/* Windows before Vista uses LVM_SETVIEW and possibly
|
|
|
|
LVM_SETEXTENDEDLISTVIEWSTYLE to set the style of the listview,
|
|
|
|
while later versions seem to accomplish this through other
|
|
|
|
means. */
|
|
|
|
switch (ViewMode)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
case FVM_ICON:
|
|
|
|
dwStyle = LVS_ICON;
|
|
|
|
break;
|
|
|
|
case FVM_DETAILS:
|
|
|
|
dwStyle = LVS_REPORT;
|
|
|
|
break;
|
|
|
|
case FVM_SMALLICON:
|
|
|
|
dwStyle = LVS_SMALLICON;
|
|
|
|
break;
|
|
|
|
case FVM_LIST:
|
|
|
|
dwStyle = LVS_LIST;
|
|
|
|
break;
|
2011-09-26 23:10:38 +00:00
|
|
|
default:
|
|
|
|
{
|
|
|
|
FIXME("ViewMode %d not implemented\n", ViewMode);
|
|
|
|
dwStyle = LVS_LIST;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SetStyle(dwStyle, LVS_TYPEMASK);
|
|
|
|
|
|
|
|
/* This will not necessarily be the actual mode set above.
|
|
|
|
This mimics the behavior of Windows XP. */
|
2013-11-19 19:05:17 +00:00
|
|
|
m_FolderSettings.ViewMode = ViewMode;
|
2011-09-26 23:10:38 +00:00
|
|
|
|
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetFolder(REFIID riid, void **ppv)
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pSFParent == NULL)
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_FAIL;
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
return m_pSFParent->QueryInterface(riid, ppv);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::Item(int iItemIndex, LPITEMIDLIST *ppidl)
|
|
|
|
{
|
2011-09-26 19:55:35 +00:00
|
|
|
LVITEMW item;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%d %p)\n", this, iItemIndex, ppidl);
|
|
|
|
|
|
|
|
item.mask = LVIF_PARAM;
|
|
|
|
item.iItem = iItemIndex;
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (SendMessageW(m_hWndList, LVM_GETITEMW, 0, (LPARAM)&item))
|
2011-09-26 19:55:35 +00:00
|
|
|
{
|
|
|
|
*ppidl = ILClone((PITEMID_CHILD)item.lParam);
|
|
|
|
return S_OK;
|
|
|
|
}
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-26 19:55:35 +00:00
|
|
|
*ppidl = 0;
|
|
|
|
|
|
|
|
return E_INVALIDARG;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::ItemCount(UINT uFlags, int *pcItems)
|
|
|
|
{
|
2011-09-26 19:55:35 +00:00
|
|
|
TRACE("(%p)->(%u %p)\n", this, uFlags, pcItems);
|
|
|
|
|
|
|
|
if (uFlags != SVGIO_ALLVIEW)
|
|
|
|
FIXME("some flags unsupported, %x\n", uFlags & ~SVGIO_ALLVIEW);
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
*pcItems = SendMessageW(m_hWndList, LVM_GETITEMCOUNT, 0, 0);
|
2011-09-26 19:55:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::Items(UINT uFlags, REFIID riid, void **ppv)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetSelectionMarkedItem(int *piItem)
|
|
|
|
{
|
2011-09-26 19:55:35 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, piItem);
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
*piItem = SendMessageW(m_hWndList, LVM_GETSELECTIONMARK, 0, 0);
|
2011-09-26 19:55:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetFocusedItem(int *piItem)
|
|
|
|
{
|
2011-09-26 19:55:35 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, piItem);
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
*piItem = SendMessageW(m_hWndList, LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
|
2011-09-26 19:55:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetItemPosition(LPCITEMIDLIST pidl, POINT *ppt)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetSpacing(POINT *ppt)
|
|
|
|
{
|
2011-09-26 15:43:19 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, ppt);
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (NULL == m_hWndList) return S_FALSE;
|
2011-09-26 15:43:19 +00:00
|
|
|
|
|
|
|
if (ppt)
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
const DWORD ret = SendMessageW(m_hWndList, LVM_GETITEMSPACING, 0, 0);
|
2011-09-26 15:43:19 +00:00
|
|
|
|
|
|
|
ppt->x = LOWORD(ret);
|
|
|
|
ppt->y = HIWORD(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetDefaultSpacing(POINT *ppt)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetAutoArrange()
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::SelectItem(int iItem, DWORD dwFlags)
|
|
|
|
{
|
2011-09-26 19:55:35 +00:00
|
|
|
LVITEMW lvItem;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%d, %x)\n", this, iItem, dwFlags);
|
|
|
|
|
|
|
|
lvItem.state = 0;
|
|
|
|
lvItem.stateMask = LVIS_SELECTED;
|
|
|
|
|
|
|
|
if (dwFlags & SVSI_ENSUREVISIBLE)
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_ENSUREVISIBLE, iItem, 0);
|
2011-09-26 19:55:35 +00:00
|
|
|
|
|
|
|
/* all items */
|
|
|
|
if (dwFlags & SVSI_DESELECTOTHERS)
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_SETITEMSTATE, -1, (LPARAM)&lvItem);
|
2011-09-26 19:55:35 +00:00
|
|
|
|
|
|
|
/* this item */
|
|
|
|
if (dwFlags & SVSI_SELECT)
|
|
|
|
lvItem.state |= LVIS_SELECTED;
|
|
|
|
|
|
|
|
if (dwFlags & SVSI_FOCUSED)
|
|
|
|
lvItem.stateMask |= LVIS_FOCUSED;
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_SETITEMSTATE, iItem, (LPARAM)&lvItem);
|
2011-09-26 19:55:35 +00:00
|
|
|
|
|
|
|
if (dwFlags & SVSI_EDIT)
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_EDITLABELW, iItem, 0);
|
2011-09-26 19:55:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::SelectAndPositionItems(UINT cidl, LPCITEMIDLIST *apidl, POINT *apt, DWORD dwFlags)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
2014-03-13 12:50:26 +00:00
|
|
|
/**********************************************************
|
|
|
|
* IShellFolderView implementation
|
|
|
|
*/
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::Rearrange(LPARAM sort)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%ld) stub\n", this, sort);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetArrangeParam(LPARAM *sort)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub\n", this, sort);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::ArrangeGrid()
|
|
|
|
{
|
|
|
|
FIXME("(%p) stub\n", this);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::AutoArrange()
|
|
|
|
{
|
|
|
|
FIXME("(%p) stub\n", this);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::IShellFolderView_GetAutoArrange()
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", this);
|
|
|
|
return GetAutoArrange();
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::AddObject(PITEMID_CHILD pidl, UINT *item)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p %p) stub\n", this, pidl, item);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetObject(PITEMID_CHILD *pidl, UINT item)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%p %d)\n", this, pidl, item);
|
|
|
|
return Item(item, pidl);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::RemoveObject(PITEMID_CHILD pidl, UINT *item)
|
|
|
|
{
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p %p)\n", this, pidl, item);
|
|
|
|
|
|
|
|
if (pidl)
|
|
|
|
{
|
|
|
|
*item = LV_FindItemByPidl(ILFindLastID(pidl));
|
|
|
|
SendMessageW(m_hWndList, LVM_DELETEITEM, *item, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*item = 0;
|
|
|
|
SendMessageW(m_hWndList, LVM_DELETEALLITEMS, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetObjectCount(UINT *count)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%p)\n", this, count);
|
|
|
|
return ItemCount(SVGIO_ALLVIEW, reinterpret_cast<INT*>(count));
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::SetObjectCount(UINT count, UINT flags)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%d %x) stub\n", this, count, flags);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::UpdateObject(PITEMID_CHILD pidl_old, PITEMID_CHILD pidl_new, UINT *item)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p %p %p) stub\n", this, pidl_old, pidl_new, item);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::RefreshObject(PITEMID_CHILD pidl, UINT *item)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p %p) stub\n", this, pidl, item);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::SetRedraw(BOOL redraw)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%d)\n", this, redraw);
|
|
|
|
SendMessageW(m_hWndList, WM_SETREDRAW, redraw, 0);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetSelectedCount(UINT *count)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub\n", this, count);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetSelectedObjects(PCUITEMID_CHILD **pidl, UINT *items)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%p %p)\n", this, pidl, items);
|
|
|
|
|
|
|
|
*items = GetSelections();
|
|
|
|
|
|
|
|
if (*items)
|
|
|
|
{
|
|
|
|
*pidl = static_cast<PCUITEMID_CHILD *>(LocalAlloc(0, *items * sizeof(LPITEMIDLIST)));
|
|
|
|
if (!*pidl)
|
|
|
|
{
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* it's documented that caller shouldn't PIDLs, only array itself */
|
|
|
|
memcpy(static_cast<PCUITEMID_CHILD *>(*pidl), m_apidl, *items * sizeof(LPITEMIDLIST));
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::IsDropOnSource(IDropTarget *drop_target)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub\n", this, drop_target);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetDragPoint(POINT *pt)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub\n", this, pt);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetDropPoint(POINT *pt)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub\n", this, pt);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::MoveIcons(IDataObject *obj)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%p)\n", this, obj);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::SetItemPos(PCUITEMID_CHILD pidl, POINT *pt)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p %p) stub\n", this, pidl, pt);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::IsBkDropTarget(IDropTarget *drop_target)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub\n", this, drop_target);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::SetClipboard(BOOL move)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%d) stub\n", this, move);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::SetPoints(IDataObject *obj)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub\n", this, obj);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::GetItemSpacing(ITEMSPACING *spacing)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub\n", this, spacing);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::SetCallback(IShellFolderViewCB *new_cb, IShellFolderViewCB **old_cb)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p %p) stub\n", this, new_cb, old_cb);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::Select(UINT flags)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%d) stub\n", this, flags);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::QuerySupport(UINT *support)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%p)\n", this, support);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::SetAutomationObject(IDispatch *disp)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub\n", this, disp);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
/**********************************************************
|
|
|
|
* ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CDefView::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p(%s) 0x%08x %p %p\n",
|
2011-12-20 19:56:46 +00:00
|
|
|
this, pguidCmdGroup, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (!prgCmds)
|
2011-09-26 23:10:38 +00:00
|
|
|
return E_INVALIDARG;
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-12-20 19:56:46 +00:00
|
|
|
for (UINT i = 0; i < cCmds; i++)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
FIXME("\tprgCmds[%d].cmdID = %d\n", i, prgCmds[i].cmdID);
|
|
|
|
prgCmds[i].cmdf = 0;
|
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
return OLECMDERR_E_UNKNOWNGROUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ISVOleCmdTarget_Exec (IOleCommandTarget)
|
|
|
|
*
|
|
|
|
* nCmdID is the OLECMDID_* enumeration
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CDefView::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08x Opt:0x%08x %p %p)\n",
|
2011-12-20 19:56:46 +00:00
|
|
|
this, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-26 23:10:38 +00:00
|
|
|
if (!pguidCmdGroup)
|
|
|
|
return OLECMDERR_E_UNKNOWNGROUP;
|
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (IsEqualIID(*pguidCmdGroup, CGID_Explorer) &&
|
2011-12-20 19:56:46 +00:00
|
|
|
(nCmdID == 0x29) &&
|
|
|
|
(nCmdexecopt == 4) && pvaOut)
|
|
|
|
return S_OK;
|
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
if (IsEqualIID(*pguidCmdGroup, CGID_ShellDocView) &&
|
2011-12-20 19:56:46 +00:00
|
|
|
(nCmdID == 9) &&
|
|
|
|
(nCmdexecopt == 0))
|
|
|
|
return 1;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return OLECMDERR_E_UNKNOWNGROUP;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ISVDropTarget implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* 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
|
|
|
|
|
|
|
|
HRESULT CDefView::drag_notify_subitem(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
|
|
|
{
|
|
|
|
LVHITTESTINFO htinfo;
|
|
|
|
LVITEMW 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;
|
2013-11-19 19:05:17 +00:00
|
|
|
::ScreenToClient(m_hWndList, &htinfo.pt);
|
|
|
|
lResult = SendMessageW(m_hWndList, LVM_HITTEST, 0, (LPARAM)&htinfo);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
/* Send WM_*SCROLL messages every 250 ms during drag-scrolling */
|
2013-11-19 19:05:17 +00:00
|
|
|
::GetClientRect(m_hWndList, &clientRect);
|
|
|
|
if (htinfo.pt.x == m_ptLastMousePos.x && htinfo.pt.y == m_ptLastMousePos.y &&
|
2011-12-20 19:56:46 +00:00
|
|
|
(htinfo.pt.x < SCROLLAREAWIDTH || htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH ||
|
|
|
|
htinfo.pt.y < SCROLLAREAWIDTH || htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH ))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_cScrollDelay = (m_cScrollDelay + 1) % 5; /* DragOver is called every 50 ms */
|
|
|
|
if (m_cScrollDelay == 0)
|
2011-09-07 13:39:13 +00:00
|
|
|
{
|
|
|
|
/* Mouse did hover another 250 ms over the scroll-area */
|
2011-05-15 15:55:49 +00:00
|
|
|
if (htinfo.pt.x < SCROLLAREAWIDTH)
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, WM_HSCROLL, SB_LINEUP, 0);
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
if (htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH)
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, WM_HSCROLL, SB_LINEDOWN, 0);
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
if (htinfo.pt.y < SCROLLAREAWIDTH)
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, WM_VSCROLL, SB_LINEUP, 0);
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
if (htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH)
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, WM_VSCROLL, SB_LINEDOWN, 0);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_cScrollDelay = 0; /* Reset, if the cursor is not over the listview's scroll-area */
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_ptLastMousePos = htinfo.pt;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
/* If we are still over the previous sub-item, notify it via DragOver and return. */
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCurDropTarget && lResult == m_iDragOverItem)
|
|
|
|
return m_pCurDropTarget->DragOver(grfKeyState, pt, pdwEffect);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
/* We've left the previous sub-item, notify it via DragLeave and Release it. */
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCurDropTarget)
|
2011-09-07 13:39:13 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pCurDropTarget->DragLeave();
|
|
|
|
m_pCurDropTarget.Release();
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_iDragOverItem = lResult;
|
2011-09-07 13:39:13 +00:00
|
|
|
if (lResult == -1)
|
|
|
|
{
|
2011-05-15 15:55:49 +00:00
|
|
|
/* We are not above one of the listview's subitems. Bind to the parent folder's
|
|
|
|
* DropTarget interface. */
|
2013-11-19 19:05:17 +00:00
|
|
|
hr = m_pSFParent->QueryInterface(IID_PPV_ARG(IDropTarget,&m_pCurDropTarget));
|
2011-09-07 13:39:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-05-15 15:55:49 +00:00
|
|
|
/* Query the relative PIDL of the shellfolder object represented by the currently
|
|
|
|
* dragged over listview-item ... */
|
|
|
|
lvItem.mask = LVIF_PARAM;
|
|
|
|
lvItem.iItem = lResult;
|
|
|
|
lvItem.iSubItem = 0;
|
2013-11-19 19:05:17 +00:00
|
|
|
SendMessageW(m_hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
/* ... and bind m_pCurDropTarget to the IDropTarget interface of an UIObject of this object */
|
2014-04-29 11:14:29 +00:00
|
|
|
hr = m_pSFParent->GetUIObjectOf(m_hWndList, 1, (LPCITEMIDLIST*)&lvItem.lParam, IID_NULL_PPV_ARG(IDropTarget, &m_pCurDropTarget));
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
/* If anything failed, m_pCurDropTarget should be NULL now, which ought to be a save state. */
|
2011-05-15 15:55:49 +00:00
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
/* Notify the item just entered via DragEnter. */
|
2013-11-19 19:05:17 +00:00
|
|
|
return m_pCurDropTarget->DragEnter(m_pCurDataObject, grfKeyState, pt, pdwEffect);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
|
|
|
{
|
|
|
|
/* Get a hold on the data object for later calls to DragEnter on the sub-folders */
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pCurDataObject = pDataObject;
|
2011-05-15 15:55:49 +00:00
|
|
|
pDataObject->AddRef();
|
|
|
|
|
|
|
|
return drag_notify_subitem(grfKeyState, pt, pdwEffect);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
|
|
|
{
|
|
|
|
return drag_notify_subitem(grfKeyState, pt, pdwEffect);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::DragLeave()
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCurDropTarget)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pCurDropTarget->DragLeave();
|
|
|
|
m_pCurDropTarget.Release();
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
2011-05-25 20:25:42 +00:00
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCurDataObject != NULL)
|
2011-05-25 20:25:42 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pCurDataObject.Release();
|
2011-05-25 20:25:42 +00:00
|
|
|
}
|
|
|
|
|
2013-11-19 19:05:17 +00:00
|
|
|
m_iDragOverItem = 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
if (m_pCurDropTarget)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pCurDropTarget->Drop(pDataObject, grfKeyState, pt, pdwEffect);
|
|
|
|
m_pCurDropTarget.Release();
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
2014-03-15 13:59:22 +00:00
|
|
|
m_pCurDataObject.Release();
|
|
|
|
m_iDragOverItem = 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ISVDropSource implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (fEscapePressed)
|
|
|
|
return DRAGDROP_S_CANCEL;
|
|
|
|
else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON))
|
|
|
|
return DRAGDROP_S_DROP;
|
|
|
|
else
|
2013-11-03 12:03:54 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::GiveFeedback(DWORD dwEffect)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
TRACE("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return DRAGDROP_S_USEDEFAULTCURSORS;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* ISVViewObject implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::Draw(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
FIXME("Stub: this=%p\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::GetColorSet(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDevice, LOGPALETTE **ppColorSet)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
FIXME("Stub: this=%p\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::Freeze(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
FIXME("Stub: this=%p\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::Unfreeze(DWORD dwFreeze)
|
|
|
|
{
|
2011-12-20 19:56:46 +00:00
|
|
|
FIXME("Stub: this=%p\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::SetAdvise(DWORD aspects, DWORD advf, IAdviseSink *pAdvSink)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
FIXME("partial stub: %p %08x %08x %p\n", this, aspects, advf, pAdvSink);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
/* FIXME: we set the AdviseSink, but never use it to send any advice */
|
2013-11-19 19:05:17 +00:00
|
|
|
m_pAdvSink = pAdvSink;
|
|
|
|
m_dwAspects = aspects;
|
|
|
|
m_dwAdvf = advf;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CDefView::GetAdvise(DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
TRACE("this=%p pAspects=%p pAdvf=%p ppAdvSink=%p\n", this, pAspects, pAdvf, ppAdvSink);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (ppAdvSink)
|
|
|
|
{
|
2013-11-19 19:05:17 +00:00
|
|
|
*ppAdvSink = m_pAdvSink;
|
|
|
|
m_pAdvSink.p->AddRef();
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (pAspects)
|
2013-11-19 19:05:17 +00:00
|
|
|
*pAspects = m_dwAspects;
|
2011-09-07 13:39:13 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (pAdvf)
|
2013-11-19 19:05:17 +00:00
|
|
|
*pAdvf = m_dwAdvf;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE CDefView::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
if (IsEqualIID(guidService, SID_IShellBrowser))
|
2013-11-19 19:05:17 +00:00
|
|
|
return m_pShellBrowser->QueryInterface(riid, ppvObject);
|
2011-10-20 20:28:30 +00:00
|
|
|
else if(IsEqualIID(guidService, SID_IFolderView))
|
|
|
|
return QueryInterface(riid, ppvObject);
|
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_NOINTERFACE;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
2011-09-08 22:43:43 +00:00
|
|
|
* IShellView_Constructor
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI IShellView_Constructor(IShellFolder *pFolder, IShellView **newView)
|
|
|
|
{
|
2011-09-08 22:43:43 +00:00
|
|
|
CComObject<CDefView> *theView;
|
|
|
|
CComPtr<IShellView> result;
|
|
|
|
HRESULT hResult;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (newView == NULL)
|
|
|
|
return E_POINTER;
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
*newView = NULL;
|
2011-09-08 22:43:43 +00:00
|
|
|
ATLTRY (theView = new CComObject<CDefView>);
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
if (theView == NULL)
|
2011-09-08 22:43:43 +00:00
|
|
|
return E_OUTOFMEMORY;
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2013-11-11 16:42:16 +00:00
|
|
|
hResult = theView->QueryInterface(IID_PPV_ARG(IShellView, &result));
|
2011-09-08 22:43:43 +00:00
|
|
|
if (FAILED (hResult))
|
|
|
|
{
|
|
|
|
delete theView;
|
|
|
|
return hResult;
|
|
|
|
}
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
hResult = theView->Initialize (pFolder);
|
2011-09-08 22:43:43 +00:00
|
|
|
if (FAILED (hResult))
|
|
|
|
return hResult;
|
|
|
|
*newView = result.Detach ();
|
2011-12-20 19:56:46 +00:00
|
|
|
|
2011-09-07 13:39:13 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|