ReactOS  0.4.14-dev-606-g14ebc0b
CDefView.cpp
Go to the documentation of this file.
1 /*
2  * ShellView
3  *
4  * Copyright 1998,1999 <juergen.schmied@debitel.net>
5  *
6  * This is the view visualizing the data provided by the shellfolder.
7  * No direct access to data from pidls should be done from here.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22  *
23  * FIXME: CheckToolbar: handle the "new folder" and "folder up" button
24  */
25 
26 /*
27 TODO:
28 - Load/Save the view state from/into the stream provided by the ShellBrowser.
29 - When editing starts on item, set edit text to for editing value.
30 - Fix shell view to handle view mode popup exec.
31 - The background context menu should have a pidl just like foreground menus. This
32  causes crashes when dynamic handlers try to use the NULL pidl.
33 - Reorder of columns doesn't work - might be bug in comctl32
34 */
35 
36 #include "precomp.h"
37 
38 #include <atlwin.h>
39 #include <rosctrls.h>
40 
42 
43 #undef SV_CLASS_NAME
44 
45 static const WCHAR SV_CLASS_NAME[] = {'S', 'H', 'E', 'L', 'L', 'D', 'L', 'L', '_', 'D', 'e', 'f', 'V', 'i', 'e', 'w', 0};
46 
47 typedef struct
48 {
53 
54 #define SHV_CHANGE_NOTIFY WM_USER + 0x1111
55 
56 /* For the context menu of the def view, the id of the items are based on 1 because we need
57  to call TrackPopupMenu and let it use the 0 value as an indication that the menu was canceled */
58 #define CONTEXT_MENU_BASE_ID 1
59 
60 class CDefView :
61  public CWindowImpl<CDefView, CWindow, CControlWinTraits>,
62  public CComObjectRootEx<CComMultiThreadModelNoCS>,
63  public IShellView2,
64  public IFolderView,
65  public IShellFolderView,
66  public IOleCommandTarget,
67  public IDropTarget,
68  public IDropSource,
69  public IViewObject,
70  public IServiceProvider
71 {
72  private:
82  HMENU m_hMenu; /* Handle to the menu bar of the browser */
83  HMENU m_hMenuArrangeModes; /* Handle to the popup menu with the arrange modes */
84  HMENU m_hMenuViewModes; /* Handle to the popup menu with the view modes */
85  HMENU m_hContextMenu; /* Handle to the open context menu */
92  ULONG m_hNotify; /* Change notification handle */
93  HACCEL m_hAccel;
97  // for drag and drop
99  CComPtr<IDropTarget> m_pCurDropTarget; /* The sub-item, which is currently dragged over */
100  CComPtr<IDataObject> m_pCurDataObject; /* The dragged data-object */
101  LONG m_iDragOverItem; /* Dragged over item's index, iff m_pCurDropTarget != NULL */
102  UINT m_cScrollDelay; /* Send a WM_*SCROLL msg every 250 ms during drag-scroll */
103  POINT m_ptLastMousePos; /* Mouse position at last DragOver call */
104  POINT m_ptFirstMousePos; /* Mouse position when the drag operation started */
106  //
108 
110 
114 
115  private:
117  BOOL _Sort();
119 
120  public:
121  CDefView();
122  ~CDefView();
123  HRESULT WINAPI Initialize(IShellFolder *shellFolder);
127  void UpdateStatusbar();
128  void CheckToolbar();
129  BOOL CreateList();
130  void UpdateListColors();
131  BOOL InitList();
133  static INT CALLBACK ListViewCompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData);
134 
138  int LV_AddItem(PCUITEMID_CHILD pidl);
143  HRESULT FillList();
147  HRESULT FillArrangeAsMenu(HMENU hmenuArrange);
148  HRESULT CheckViewMode(HMENU hmenuView);
151  void OnDeactivate();
152  void DoActivate(UINT uState);
153  HRESULT drag_notify_subitem(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
155  LRESULT OnExplorerCommand(UINT uCommand, BOOL bUseSelection);
156 
157  // *** IOleWindow methods ***
158  virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
160 
161  // *** IShellView methods ***
163  virtual HRESULT STDMETHODCALLTYPE EnableModeless(BOOL fEnable);
164  virtual HRESULT STDMETHODCALLTYPE UIActivate(UINT uState);
166  virtual HRESULT STDMETHODCALLTYPE CreateViewWindow(IShellView *psvPrevious, LPCFOLDERSETTINGS pfs, IShellBrowser *psb, RECT *prcView, HWND *phWnd);
172  virtual HRESULT STDMETHODCALLTYPE GetItemObject(UINT uItem, REFIID riid, void **ppv);
173 
174  // *** IShellView2 methods ***
179 
180  // *** IShellView3 methods ***
181  virtual HRESULT STDMETHODCALLTYPE CreateViewWindow3(IShellBrowser *psb, IShellView *psvPrevious, SV3CVW3_FLAGS view_flags, FOLDERFLAGS mask, FOLDERFLAGS flags, FOLDERVIEWMODE mode, const SHELLVIEWID *view_id, RECT *prcView, HWND *hwnd);
182 
183  // *** IFolderView methods ***
184  virtual HRESULT STDMETHODCALLTYPE GetCurrentViewMode(UINT *pViewMode);
187  virtual HRESULT STDMETHODCALLTYPE Item(int iItemIndex, PITEMID_CHILD *ppidl);
190  virtual HRESULT STDMETHODCALLTYPE GetSelectionMarkedItem(int *piItem);
191  virtual HRESULT STDMETHODCALLTYPE GetFocusedItem(int *piItem);
196  virtual HRESULT STDMETHODCALLTYPE SelectItem(int iItem, DWORD dwFlags);
198 
199  // *** IShellFolderView methods ***
214  virtual HRESULT STDMETHODCALLTYPE IsDropOnSource(IDropTarget *drop_target);
219  virtual HRESULT STDMETHODCALLTYPE IsBkDropTarget(IDropTarget *drop_target);
223  virtual HRESULT STDMETHODCALLTYPE SetCallback(IShellFolderViewCB *new_cb, IShellFolderViewCB **old_cb);
225  virtual HRESULT STDMETHODCALLTYPE QuerySupport(UINT *support);
227 
228  // *** IOleCommandTarget methods ***
229  virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
230  virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
231 
232  // *** IDropTarget methods ***
233  virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
234  virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
236  virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
237 
238  // *** IDropSource methods ***
239  virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState);
240  virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect);
241 
242  // *** IViewObject methods ***
243  virtual HRESULT STDMETHODCALLTYPE Draw(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd,
244  HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds,
245  BOOL ( STDMETHODCALLTYPE *pfnContinue )(ULONG_PTR dwContinue), ULONG_PTR dwContinue);
246  virtual HRESULT STDMETHODCALLTYPE GetColorSet(DWORD dwDrawAspect, LONG lindex, void *pvAspect,
247  DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet);
248  virtual HRESULT STDMETHODCALLTYPE Freeze(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze);
249  virtual HRESULT STDMETHODCALLTYPE Unfreeze(DWORD dwFreeze);
250  virtual HRESULT STDMETHODCALLTYPE SetAdvise(DWORD aspects, DWORD advf, IAdviseSink *pAdvSink);
251  virtual HRESULT STDMETHODCALLTYPE GetAdvise(DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink);
252 
253  // *** IServiceProvider methods ***
254  virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
255 
256  // Message handlers
257  LRESULT OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
258  LRESULT OnGetDlgCode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
259  LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
264  LRESULT OnNCCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
265  LRESULT OnNCDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
266  LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
268  LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
269  LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
270  LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
271  LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
272  LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
273  LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
275  LRESULT OnCustomItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
278 
280  {
281  static ATL::CWndClassInfo wc =
282  {
284  0, 0, NULL, NULL,
286  },
287  NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
288  };
289  return wc;
290  }
291 
293  {
294  return WindowProc;
295  }
296 
298  {
299  CDefView *pThis;
300  LRESULT result;
301 
302  // Must hold a reference during message handling
303  pThis = reinterpret_cast<CDefView *>(hWnd);
304  pThis->AddRef();
306  pThis->Release();
307  return result;
308  }
309 
333  END_MSG_MAP()
334 
336  // Windows returns E_NOINTERFACE for IOleWindow
337  // COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
338  COM_INTERFACE_ENTRY_IID(IID_IShellView, IShellView)
339  COM_INTERFACE_ENTRY_IID(IID_CDefView, IShellView)
340  COM_INTERFACE_ENTRY_IID(IID_IShellView2, IShellView2)
341  COM_INTERFACE_ENTRY_IID(IID_IFolderView, IFolderView)
342  COM_INTERFACE_ENTRY_IID(IID_IShellFolderView, IShellFolderView)
343  COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
344  COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
345  COM_INTERFACE_ENTRY_IID(IID_IDropSource, IDropSource)
347  COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
348  END_COM_MAP()
349 };
350 
351 /*menu items */
352 #define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500)
353 #define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501)
354 #define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502)
355 
356 #define ID_LISTVIEW 1
357 
358 /*windowsx.h */
359 #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
360 #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
361 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
362 
364 
366  m_ListView(),
368  m_hMenu(NULL),
373  m_uState(0),
374  m_cidl(0),
375  m_apidl(NULL),
377  m_hNotify(0),
378  m_hAccel(NULL),
379  m_dwAspects(0),
380  m_dwAdvf(0),
381  m_iDragOverItem(0),
382  m_cScrollDelay(0),
385 {
387  ZeroMemory(&m_sortInfo, sizeof(m_sortInfo));
389  ZeroMemory(&m_Category, sizeof(m_Category));
393 }
394 
396 {
397  TRACE(" destroying IShellView(%p)\n", this);
398 
400  {
403  }
404 
405  if (m_hWnd)
406  {
408  }
409 
410  SHFree(m_apidl);
411 }
412 
414 {
415  m_pSFParent = shellFolder;
417 
418  return S_OK;
419 }
420 
421 /**********************************************************
422  *
423  * ##### helperfunctions for communication with ICommDlgBrowser #####
424  */
426 {
427  HRESULT ret = S_OK;
428 
429  if (m_pCommDlgBrowser.p != NULL)
430  {
431  TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);
432  ret = m_pCommDlgBrowser->IncludeObject(this, pidl);
433  TRACE("-- returns 0x%08x\n", ret);
434  }
435 
436  return ret;
437 }
438 
440 {
441  HRESULT ret = S_FALSE;
442 
443  if (m_pCommDlgBrowser.p != NULL)
444  {
445  TRACE("ICommDlgBrowser::OnDefaultCommand\n");
446  ret = m_pCommDlgBrowser->OnDefaultCommand(this);
447  TRACE("-- returns 0x%08x\n", ret);
448  }
449 
450  return ret;
451 }
452 
454 {
455  HRESULT ret = S_FALSE;
456 
457  if (m_pCommDlgBrowser.p != NULL)
458  {
459  TRACE("ICommDlgBrowser::OnStateChange flags=%x\n", uFlags);
460  ret = m_pCommDlgBrowser->OnStateChange(this, uFlags);
461  TRACE("--\n");
462  }
463 
464  return ret;
465 }
466 /**********************************************************
467  * set the toolbar of the filedialog buttons
468  *
469  * - activates the buttons from the shellbrowser according to
470  * the view state
471  */
473 {
474  LRESULT result;
475 
476  TRACE("\n");
477 
478  if (m_pCommDlgBrowser != NULL)
479  {
480  m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_CHECKBUTTON,
482  m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_CHECKBUTTON,
484  m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_ENABLEBUTTON,
486  m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_ENABLEBUTTON,
488  }
489 }
490 
492 {
493  WCHAR szFormat[MAX_PATH] = {0};
494  WCHAR szObjects[MAX_PATH] = {0};
495  UINT cSelectedItems;
496 
497  cSelectedItems = m_ListView.GetSelectedCount();
498  if (cSelectedItems)
499  {
501  StringCchPrintfW(szObjects, MAX_PATH, szFormat, cSelectedItems);
502  }
503  else
504  {
505  LoadStringW(shell32_hInstance, IDS_OBJECTS, szFormat, _countof(szFormat));
506  StringCchPrintfW(szObjects, MAX_PATH, szFormat, m_ListView.GetItemCount());
507  }
508  m_pShellBrowser->SetStatusTextSB(szObjects);
509 }
510 
511 /**********************************************************
512  *
513  * ##### helperfunctions for initializing the view #####
514  */
515 
516 /**********************************************************
517 * ShellView_CreateList()
518 *
519 * - creates the list view window
520 */
522 {
523  HRESULT hr;
524  DWORD dwStyle, dwExStyle;
525  UINT ViewMode;
526 
527  TRACE("%p\n", this);
528 
531  dwExStyle = WS_EX_CLIENTEDGE;
532 
534  dwStyle |= LVS_ALIGNLEFT;
535  else
536  dwStyle |= LVS_ALIGNTOP | LVS_SHOWSELALWAYS;
537 
538  ViewMode = m_FolderSettings.ViewMode;
540  if (SUCCEEDED(hr))
541  {
542  if (ViewMode >= FVM_FIRST && ViewMode <= FVM_LAST)
543  m_FolderSettings.ViewMode = ViewMode;
544  else
545  ERR("Ignoring invalid ViewMode from SFVM_DEFVIEWMODE: %u (was: %u)\n", ViewMode, m_FolderSettings.ViewMode);
546  }
547 
548  switch (m_FolderSettings.ViewMode)
549  {
550  case FVM_ICON:
551  dwStyle |= LVS_ICON;
552  break;
553 
554  case FVM_DETAILS:
555  dwStyle |= LVS_REPORT;
556  break;
557 
558  case FVM_SMALLICON:
559  dwStyle |= LVS_SMALLICON;
560  break;
561 
562  case FVM_LIST:
563  dwStyle |= LVS_LIST;
564  break;
565 
566  default:
567  dwStyle |= LVS_LIST;
568  break;
569  }
570 
572  dwStyle |= LVS_AUTOARRANGE;
573 
576 
578  dwStyle |= LVS_SINGLESEL;
579 
581  dwExStyle &= ~WS_EX_CLIENTEDGE;
582 
583  RECT rcListView = {0,0,0,0};
584  m_ListView.Create(m_hWnd, rcListView, L"FolderView", dwStyle, dwExStyle, ID_LISTVIEW);
585 
586  if (!m_ListView)
587  return FALSE;
588 
590  m_sortInfo.nHeaderID = -1;
592 
593  /* UpdateShellSettings(); */
594  return TRUE;
595 }
596 
598 {
600  {
601  /* Check if drop shadows option is enabled */
602  BOOL bDropShadow = FALSE;
603  DWORD cbDropShadow = sizeof(bDropShadow);
604 
605  /*
606  * The desktop ListView always take the default desktop colours, by
607  * remaining transparent and letting user32/win32k paint itself the
608  * desktop background color, if any.
609  */
611 
612  SHGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
613  L"ListviewShadow", NULL, &bDropShadow, &cbDropShadow);
614  if (bDropShadow)
615  {
616  /* Set the icon background transparent */
618  m_ListView.SetTextColor(RGB(255, 255, 255));
619  m_ListView.SetExtendedListViewStyle(LVS_EX_TRANSPARENTSHADOWTEXT, LVS_EX_TRANSPARENTSHADOWTEXT);
620  }
621  else
622  {
623  /* Set the icon background as the same colour as the desktop */
624  COLORREF crDesktop = GetSysColor(COLOR_DESKTOP);
625  m_ListView.SetTextBkColor(crDesktop);
626  if (GetRValue(crDesktop) + GetGValue(crDesktop) + GetBValue(crDesktop) > 128 * 3)
627  m_ListView.SetTextColor(RGB(0, 0, 0));
628  else
629  m_ListView.SetTextColor(RGB(255, 255, 255));
630  m_ListView.SetExtendedListViewStyle(0, LVS_EX_TRANSPARENTSHADOWTEXT);
631  }
632  }
633  else
634  {
635  // text background color
636  COLORREF clrTextBack = m_viewinfo_data.clrTextBack;
637  m_ListView.SetTextBkColor(clrTextBack);
638 
639  // text color
640  COLORREF clrText;
642  clrText = m_viewinfo_data.clrText;
643  else
644  clrText = GetSysColor(COLOR_WINDOWTEXT);
645 
646  m_ListView.SetTextColor(clrText);
647 
648  // Background is painted by the parent via WM_PRINTCLIENT.
649  m_ListView.SetExtendedListViewStyle(LVS_EX_TRANSPARENTBKGND, LVS_EX_TRANSPARENTBKGND);
650  }
651 }
652 
653 /**********************************************************
654 * ShellView_InitList()
655 *
656 * - adds all needed columns to the shellview
657 */
659 {
661  WCHAR szTemp[50];
662  HIMAGELIST big_icons, small_icons;
663 
664  TRACE("%p\n", this);
665 
667 
669 
670  if (m_pSF2Parent)
671  {
672  for (int i = 0; 1; i++)
673  {
674  if (FAILED(m_pSF2Parent->GetDetailsOf(NULL, i, &sd)))
675  break;
676  StrRetToStrNW( szTemp, 50, &sd.str, NULL);
677  m_ListView.InsertColumn(i, szTemp, sd.fmt, sd.cxChar * 8);
678 
679  InsertMenuW(m_hMenuArrangeModes, -1, MF_STRING, 0x30 + i, szTemp);
680  }
681 
683  }
684  else
685  {
686  FIXME("no m_pSF2Parent\n");
687  }
688 
689  Shell_GetImageLists(&big_icons, &small_icons);
691  m_ListView.SetImageList(small_icons, LVSIL_SMALL);
692 
693  return TRUE;
694 }
695 
696 /*************************************************************************
697  * ShellView_ListViewCompareItems
698  *
699  * Compare Function for the Listview (FileOpen Dialog)
700  *
701  * PARAMS
702  * lParam1 [I] the first ItemIdList to compare with
703  * lParam2 [I] the second ItemIdList to compare with
704  * lpData [I] The column ID for the header Ctrl to process
705  *
706  * RETURNS
707  * A negative value if the first item should precede the second,
708  * a positive value if the first item should follow the second,
709  * or zero if the two items are equivalent
710  */
712 {
713  PCUIDLIST_RELATIVE pidl1 = reinterpret_cast<PCUIDLIST_RELATIVE>(lParam1);
714  PCUIDLIST_RELATIVE pidl2 = reinterpret_cast<PCUIDLIST_RELATIVE>(lParam2);
715  CDefView *pThis = reinterpret_cast<CDefView*>(lpData);
716 
717  HRESULT hres = pThis->m_pSFParent->CompareIDs(pThis->m_sortInfo.nHeaderID, pidl1, pidl2);
719  return 0;
720 
721  SHORT nDiff = HRESULT_CODE(hres);
722  if (!pThis->m_sortInfo.bIsAscending)
723  nDiff = -nDiff;
724  return nDiff;
725 }
726 
728 {
729  HWND hHeader;
730  HDITEM hColumn;
731 
732  if (m_ListView.GetWindowLongPtr(GWL_STYLE) & LVS_NOSORTHEADER)
733  return TRUE;
734 
735  hHeader = (HWND)m_ListView.SendMessage(LVM_GETHEADER, 0, 0);
736  ZeroMemory(&hColumn, sizeof(hColumn));
737 
738  /* If the sorting column changed, remove the sorting style from the old column */
739  if ( (m_sortInfo.nLastHeaderID != -1) &&
741  {
742  hColumn.mask = HDI_FORMAT;
743  Header_GetItem(hHeader, m_sortInfo.nLastHeaderID, &hColumn);
744  hColumn.fmt &= ~(HDF_SORTUP | HDF_SORTDOWN);
745  Header_SetItem(hHeader, m_sortInfo.nLastHeaderID, &hColumn);
746  }
747 
748  /* Set the sorting style to the new column */
749  hColumn.mask = HDI_FORMAT;
750  Header_GetItem(hHeader, m_sortInfo.nHeaderID, &hColumn);
751 
752  hColumn.fmt &= (m_sortInfo.bIsAscending ? ~HDF_SORTDOWN : ~HDF_SORTUP );
753  hColumn.fmt |= (m_sortInfo.bIsAscending ? HDF_SORTUP : HDF_SORTDOWN);
754  Header_SetItem(hHeader, m_sortInfo.nHeaderID, &hColumn);
755 
756  /* Sort the list, using the current values of nHeaderID and bIsAscending */
759 }
760 
762 {
763  return reinterpret_cast<PCUITEMID_CHILD>(m_ListView.GetItemData(i));
764 }
765 
767 {
768  return reinterpret_cast<PCUITEMID_CHILD>(lvItem.lParam);
769 }
770 
771 /**********************************************************
772 * LV_FindItemByPidl()
773 */
775 {
776  int cItems = m_ListView.GetItemCount();
777 
778  for (int i = 0; i<cItems; i++)
779  {
780  PCUITEMID_CHILD currentpidl = _PidlByItem(i);
781  HRESULT hr = m_pSFParent->CompareIDs(0, pidl, currentpidl);
782 
783  if (SUCCEEDED(hr) && !HRESULT_CODE(hr))
784  {
785  return i;
786  }
787  }
788  return -1;
789 }
790 
791 /**********************************************************
792 * LV_AddItem()
793 */
795 {
796  LVITEMW lvItem;
797 
798  TRACE("(%p)(pidl=%p)\n", this, pidl);
799 
800  lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/
801  lvItem.iItem = m_ListView.GetItemCount(); /*add the item to the end of the list*/
802  lvItem.iSubItem = 0;
803  lvItem.lParam = reinterpret_cast<LPARAM>(ILClone(pidl)); /*set the item's data*/
804  lvItem.pszText = LPSTR_TEXTCALLBACKW; /*get text on a callback basis*/
805  lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/
806  lvItem.stateMask = LVIS_CUT;
807 
808  return m_ListView.InsertItem(&lvItem);
809 }
810 
811 /**********************************************************
812 * LV_DeleteItem()
813 */
815 {
816  int nIndex;
817 
818  TRACE("(%p)(pidl=%p)\n", this, pidl);
819 
820  nIndex = LV_FindItemByPidl(pidl);
821 
822  return (-1 == m_ListView.DeleteItem(nIndex)) ? FALSE : TRUE;
823 }
824 
825 /**********************************************************
826 * LV_RenameItem()
827 */
829 {
830  int nItem;
831  LVITEMW lvItem;
832 
833  TRACE("(%p)(pidlold=%p pidlnew=%p)\n", this, pidlOld, pidlNew);
834 
835  nItem = LV_FindItemByPidl(pidlOld);
836 
837  if ( -1 != nItem )
838  {
839  lvItem.mask = LVIF_PARAM; /* only the pidl */
840  lvItem.iItem = nItem;
841  lvItem.iSubItem = 0;
842  m_ListView.GetItem(&lvItem);
843 
844  SHFree(reinterpret_cast<LPVOID>(lvItem.lParam));
845  lvItem.mask = LVIF_PARAM|LVIF_IMAGE;
846  lvItem.iItem = nItem;
847  lvItem.iSubItem = 0;
848  lvItem.lParam = reinterpret_cast<LPARAM>(ILClone(pidlNew)); /* set the item's data */
849  lvItem.iImage = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidlNew, 0);
850  m_ListView.SetItem(&lvItem);
851  m_ListView.Update(nItem);
852  return TRUE; /* FIXME: better handling */
853  }
854 
855  return FALSE;
856 }
857 
858 /**********************************************************
859 * LV_ProdItem()
860 */
862 {
863  int nItem;
864  LVITEMW lvItem;
865 
866  TRACE("(%p)(pidl=%p)\n", this, pidl);
867 
868  nItem = LV_FindItemByPidl(pidl);
869 
870  if (-1 != nItem)
871  {
872  lvItem.mask = LVIF_IMAGE;
873  lvItem.iItem = nItem;
874  lvItem.iSubItem = 0;
876  m_ListView.SetItem(&lvItem);
877  m_ListView.Update(nItem);
878  return TRUE;
879  }
880 
881  return FALSE;
882 }
883 
884 /**********************************************************
885 * ShellView_FillList()
886 *
887 * - gets the objectlist from the shellfolder
888 * - sorts the list
889 * - fills the list into the view
890 */
892 {
893  PITEMID_CHILD pidl = static_cast<PITEMID_CHILD>(ptr);
894  CDefView *pThis = static_cast<CDefView *>(arg);
895 
896  /* in a commdlg This works as a filemask*/
897  if (pThis->IncludeObject(pidl) == S_OK)
898  pThis->LV_AddItem(pidl);
899 
900  SHFree(pidl);
901  return TRUE;
902 }
903 
905 {
906  CComPtr<IEnumIDList> pEnumIDList;
907  PITEMID_CHILD pidl;
908  DWORD dwFetched;
909  HRESULT hRes;
910  HDPA hdpa;
911  DWORD dFlags = SHCONTF_NONFOLDERS | SHCONTF_FOLDERS;
912  DWORD dwValue, cbValue;
913 
914  TRACE("%p\n", this);
915 
916  /* determine if there is a setting to show all the hidden files/folders */
917  dwValue = 1;
918  cbValue = sizeof(dwValue);
920  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
921  L"Hidden", NULL, &dwValue, &cbValue);
922  if (dwValue == 1)
923  {
924  dFlags |= SHCONTF_INCLUDEHIDDEN;
925  m_ListView.SendMessageW(LVM_SETCALLBACKMASK, LVIS_CUT, 0);
926  }
927 
928  dwValue = 0;
929  cbValue = sizeof(dwValue);
931  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
932  L"ShowSuperHidden", NULL, &dwValue, &cbValue);
933  if (dwValue)
934  {
935  dFlags |= SHCONTF_INCLUDESUPERHIDDEN;
936  m_ListView.SendMessageW(LVM_SETCALLBACKMASK, LVIS_CUT, 0);
937  }
938 
939  /* get the itemlist from the shfolder */
940  hRes = m_pSFParent->EnumObjects(m_hWnd, dFlags, &pEnumIDList);
941  if (hRes != S_OK)
942  {
943  if (hRes == S_FALSE)
944  return(NOERROR);
945  return(hRes);
946  }
947 
948  /* create a pointer array */
949  hdpa = DPA_Create(16);
950  if (!hdpa)
951  {
952  return(E_OUTOFMEMORY);
953  }
954 
955  /* copy the items into the array*/
956  while((S_OK == pEnumIDList->Next(1, &pidl, &dwFetched)) && dwFetched)
957  {
958  if (DPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
959  {
960  SHFree(pidl);
961  }
962  }
963 
964  /*turn the listview's redrawing off*/
966 
967  DPA_DestroyCallback( hdpa, fill_list, this);
968 
969  /* sort the array */
970  if (m_pSF2Parent)
971  {
972  m_pSF2Parent->GetDefaultColumn(NULL, (ULONG*)&m_sortInfo.nHeaderID, NULL);
973  }
974  else
975  {
976  FIXME("no m_pSF2Parent\n");
977  }
979  _Sort();
980 
982  {
985  }
986 
987  // load custom background image and custom text color
990 
991  /*turn the listview's redrawing back on and force it to draw*/
993 
995 
997  {
998  // redraw now
999  m_ListView.InvalidateRect(NULL, TRUE);
1000  }
1001 
1003 
1004  return S_OK;
1005 }
1006 
1008 {
1009  m_ListView.UpdateWindow();
1010  bHandled = FALSE;
1011  return 0;
1012 }
1013 
1015 {
1016  return m_ListView.SendMessageW(uMsg, 0, 0);
1017 }
1018 
1020 {
1021  if (!m_Destroyed)
1022  {
1023  m_Destroyed = TRUE;
1024  if (m_hMenu)
1025  {
1027  m_hMenu = NULL;
1028  }
1031  m_hNotify = NULL;
1033  m_pidlParent = NULL;
1034  }
1035  bHandled = FALSE;
1036  return 0;
1037 }
1038 
1040 {
1041  /* redirect to parent */
1044 
1045  bHandled = FALSE;
1046  return 0;
1047 }
1048 
1049 static VOID
1051 {
1052  INT x0 = prc->left, y0 = prc->top, x1 = prc->right, y1 = prc->bottom;
1053  x0 += dx;
1054  y0 += dy;
1055 
1056  HDC hMemDC = CreateCompatibleDC(hDC);
1057  HGDIOBJ hbmOld = SelectObject(hMemDC, hbm);
1058 
1059  for (INT y = y0; y < y1; y += nHeight)
1060  {
1061  for (INT x = x0; x < x1; x += nWidth)
1062  {
1063  BitBlt(hDC, x, y, nWidth, nHeight, hMemDC, 0, 0, SRCCOPY);
1064  }
1065  }
1066 
1067  SelectObject(hMemDC, hbmOld);
1068  DeleteDC(hMemDC);
1069 }
1070 
1072 {
1073  HDC hDC = (HDC)wParam;
1074 
1075  RECT rc;
1077 
1079  {
1080  BITMAP bm;
1081  if (::GetObject(m_viewinfo_data.hbmBack, sizeof(BITMAP), &bm))
1082  {
1083  INT dx = -(::GetScrollPos(m_ListView, SB_HORZ) % bm.bmWidth);
1084  INT dy = -(::GetScrollPos(m_ListView, SB_VERT) % bm.bmHeight);
1085  DrawTileBitmap(hDC, &rc, m_viewinfo_data.hbmBack, bm.bmWidth, bm.bmHeight, dx, dy);
1086  }
1087  }
1088  else
1089  {
1091  }
1092 
1093  bHandled = TRUE;
1094 
1095  return TRUE;
1096 }
1097 
1099 {
1100  /* Update desktop labels color */
1101  UpdateListColors();
1102 
1103  /* Forward WM_SYSCOLORCHANGE to common controls */
1104  return m_ListView.SendMessageW(uMsg, 0, 0);
1105 }
1106 
1108 {
1109  return reinterpret_cast<LRESULT>(m_pShellBrowser.p);
1110 }
1111 
1113 {
1114  this->AddRef();
1115  bHandled = FALSE;
1116  return 0;
1117 }
1118 
1120 {
1121  this->Release();
1122  bHandled = FALSE;
1123  return 0;
1124 }
1125 
1126 /**********************************************************
1127 * ShellView_OnCreate()
1128 */
1130 {
1132  SHChangeNotifyEntry ntreg;
1134 
1135  TRACE("%p\n", this);
1136 
1138  {
1139  if (FAILED(RegisterDragDrop(m_hWnd, pdt)))
1140  ERR("Registering Drag Drop Failed");
1141  }
1142 
1143  /* register for receiving notifications */
1144  m_pSFParent->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2));
1145  if (ppf2)
1146  {
1147  ppf2->GetCurFolder(&m_pidlParent);
1148  ntreg.fRecursive = TRUE;
1149  ntreg.pidl = m_pidlParent;
1151  }
1152 
1153  if (CreateList())
1154  {
1155  if (InitList())
1156  {
1157  FillList();
1158  }
1159  }
1160 
1161  /* _DoFolderViewCB(SFVM_GETNOTIFY, ?? ??) */
1162 
1164 
1165  UpdateStatusbar();
1166 
1167  return S_OK;
1168 }
1169 
1170 /**********************************************************
1171  * #### Handling of the menus ####
1172  */
1173 
1174 extern "C" DWORD WINAPI SHMenuIndexFromID(HMENU hMenu, UINT uID);
1175 
1177 {
1178  MENUITEMINFOW mii = {sizeof(mii), MIIM_SUBMENU};
1179  if (::GetMenuItemInfoW(hmenu, id, FALSE, &mii))
1180  return mii.hSubMenu;
1181 
1182  return NULL;
1183 }
1184 
1185 /* ReallyGetMenuItemID returns the id of an item even if it opens a submenu,
1186  GetMenuItemID returns -1 if the specified item opens a submenu */
1188 {
1189  MENUITEMINFOW mii = {sizeof(mii), MIIM_ID};
1190  if (::GetMenuItemInfoW(hmenu, i, TRUE, &mii))
1191  return mii.wID;
1192 
1193  return UINT_MAX;
1194 }
1195 
1197 {
1199  if (!hFileMenu)
1200  return E_FAIL;
1201 
1202  /* Cleanup the items added previously */
1203  for (int i = GetMenuItemCount(hFileMenu) - 1; i >= 0; i--)
1204  {
1205  UINT id = GetMenuItemID(hFileMenu, i);
1207  DeleteMenu(hFileMenu, i, MF_BYPOSITION);
1208  }
1209 
1210  /* Store the context menu in m_pCM and keep it in order to invoke the selected command later on */
1212  if (FAILED_UNEXPECTEDLY(hr))
1213  return hr;
1214 
1216 
1217  hr = m_pCM->QueryContextMenu(hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
1218  if (FAILED_UNEXPECTEDLY(hr))
1219  return hr;
1220 
1221  // TODO: filter or something
1222 
1223  Shell_MergeMenus(hFileMenu, hmenu, 0, 0, 0xFFFF, MM_ADDSEPARATOR | MM_SUBMENUSHAVEIDS);
1224 
1226 
1227  return S_OK;
1228 }
1229 
1231 {
1233  if (!hEditMenu)
1234  return E_FAIL;
1235 
1236  HMENU hmenuContents = ::LoadMenuW(shell32_hInstance, L"MENU_003");
1237  if (!hmenuContents)
1238  return E_FAIL;
1239 
1240  Shell_MergeMenus(hEditMenu, hmenuContents, 0, 0, 0xFFFF, 0);
1241 
1242  ::DestroyMenu(hmenuContents);
1243 
1244  return S_OK;
1245 }
1246 
1248 {
1250  if (!hViewMenu)
1251  return E_FAIL;
1252 
1254  if (!m_hMenuViewModes)
1255  return E_FAIL;
1256 
1259 
1260  return S_OK;
1261 }
1262 
1264 {
1265  /* We only need to fill this once */
1266  if (GetMenuItemID(hmenuArrange, 0) == FCIDM_SHVIEW_AUTOARRANGE)
1267  {
1268  Shell_MergeMenus(hmenuArrange, m_hMenuArrangeModes, 0, 0, 0xFFFF,0);
1269  }
1270 
1271  /* Also check the menu item according to which we sort */
1272  CheckMenuRadioItem(hmenuArrange,
1273  0x30,
1274  0x100,
1275  m_sortInfo.nHeaderID + 0x30,
1276  MF_BYCOMMAND);
1277 
1279  {
1281  }
1282  else
1283  {
1285 
1286  if (GetAutoArrange() == S_OK)
1288  }
1289 
1290 
1291  return S_OK;
1292 }
1293 
1295 {
1297  {
1298  UINT iItemFirst = FCIDM_SHVIEW_BIGICON;
1299  UINT iItemLast = iItemFirst + FVM_LAST - FVM_FIRST;
1300  UINT iItem = iItemFirst + m_FolderSettings.ViewMode - FVM_FIRST;
1301  CheckMenuRadioItem(hmenuView, iItemFirst, iItemLast, iItem, MF_BYCOMMAND);
1302  }
1303 
1304  return S_OK;
1305 }
1306 
1307 /**********************************************************
1308 * ShellView_GetSelections()
1309 *
1310 * - fills the m_apidl list with the selected objects
1311 *
1312 * RETURNS
1313 * number of selected items
1314 */
1316 {
1317  SHFree(m_apidl);
1318 
1320  m_apidl = static_cast<PCUITEMID_CHILD*>(SHAlloc(m_cidl * sizeof(PCUITEMID_CHILD)));
1321  if (!m_apidl)
1322  {
1323  m_cidl = 0;
1324  return 0;
1325  }
1326 
1327  TRACE("-- Items selected =%u\n", m_cidl);
1328 
1329  UINT i = 0;
1330  int lvIndex = -1;
1331  while ((lvIndex = m_ListView.GetNextItem(lvIndex, LVNI_SELECTED)) > -1)
1332  {
1333  m_apidl[i] = _PidlByItem(lvIndex);
1334  i++;
1335  if (i == m_cidl)
1336  break;
1337  TRACE("-- selected Item found\n");
1338  }
1339 
1340  return m_cidl;
1341 }
1342 
1344 {
1345  CMINVOKECOMMANDINFO cmi;
1346 
1347  ZeroMemory(&cmi, sizeof(cmi));
1348  cmi.cbSize = sizeof(cmi);
1349  cmi.lpVerb = MAKEINTRESOURCEA(uCommand);
1350  cmi.hwnd = m_hWnd;
1351 
1352  if (GetKeyState(VK_SHIFT) & 0x8000)
1353  cmi.fMask |= CMIC_MASK_SHIFT_DOWN;
1354 
1355  if (GetKeyState(VK_CONTROL) & 0x8000)
1356  cmi.fMask |= CMIC_MASK_CONTROL_DOWN;
1357 
1358  HRESULT hr = m_pCM->InvokeCommand(&cmi);
1359  if (FAILED_UNEXPECTEDLY(hr))
1360  return hr;
1361 
1362  return S_OK;
1363 }
1364 
1365 /**********************************************************
1366  * ShellView_OpenSelectedItems()
1367  */
1369 {
1370  HMENU hMenu;
1371  UINT uCommand;
1372  HRESULT hResult;
1373 
1375  if (m_cidl == 0)
1376  return S_OK;
1377 
1378  hResult = OnDefaultCommand();
1379  if (hResult == S_OK)
1380  return hResult;
1381 
1382  hMenu = CreatePopupMenu();
1383  if (!hMenu)
1384  return E_FAIL;
1385 
1387  if (FAILED_UNEXPECTEDLY(hResult))
1388  goto cleanup;
1389 
1390  hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_DEFAULTONLY);
1391  if (FAILED_UNEXPECTEDLY(hResult))
1392  goto cleanup;
1393 
1394  uCommand = GetMenuDefaultItem(hMenu, FALSE, 0);
1395  if (uCommand == (UINT)-1)
1396  {
1397  hResult = E_FAIL;
1398  goto cleanup;
1399  }
1400 
1401  InvokeContextMenuCommand(uCommand);
1402 
1403 cleanup:
1404 
1405  if (hMenu)
1406  DestroyMenu(hMenu);
1407 
1408  if (m_pCM)
1409  {
1411  m_pCM.Release();
1412  }
1413 
1414  return hResult;
1415 }
1416 
1417 /**********************************************************
1418  * ShellView_DoContextMenu()
1419  */
1421 {
1422  int x, y;
1423  UINT uCommand;
1424  HRESULT hResult;
1425 
1426  TRACE("(%p)\n", this);
1427 
1429  if (!m_hContextMenu)
1430  return E_FAIL;
1431 
1432  if (lParam != ~0) // unless app key (menu key) was pressed
1433  {
1434  x = GET_X_LPARAM(lParam);
1435  y = GET_Y_LPARAM(lParam);
1436 
1437  LV_HITTESTINFO hittest = { { x, y } };
1438  ScreenToClient(&hittest.pt);
1439  m_ListView.HitTest(&hittest);
1440 
1441  // Right-Clicked item is selected? If selected, no selection change.
1442  // If not selected, then reset the selection and select the item.
1443  if ((hittest.flags & LVHT_ONITEM) &&
1445  {
1446  SelectItem(hittest.iItem, SVSI_SELECT | SVSI_DESELECTOTHERS | SVSI_ENSUREVISIBLE);
1447  }
1448  }
1449 
1451 
1453  if (FAILED_UNEXPECTEDLY(hResult))
1454  goto cleanup;
1455 
1456  /* Use 1 as the first id as we want 0 the mean that the user canceled the menu */
1457  hResult = m_pCM->QueryContextMenu(m_hContextMenu, 0, CONTEXT_MENU_BASE_ID, FCIDM_SHVIEWLAST, CMF_NORMAL);
1458  if (FAILED_UNEXPECTEDLY(hResult))
1459  goto cleanup;
1460 
1461  /* There is no position requested, so try to find one */
1462  if (lParam == ~0)
1463  {
1464  HWND hFocus = ::GetFocus();
1465  int lvIndex = -1;
1466  POINT pt;
1467 
1468  if (hFocus == m_ListView.m_hWnd || m_ListView.IsChild(hFocus))
1469  {
1470  /* Is there an item focused and selected? */
1472  /* If not, find the first selected item */
1473  if (lvIndex < 0)
1474  lvIndex = m_ListView.GetNextItem(-1, LVIS_SELECTED);
1475  }
1476 
1477  /* We got something */
1478  if (lvIndex > -1)
1479  {
1480  /* Let's find the center of the icon */
1481  RECT rc = { LVIR_ICON };
1482  m_ListView.SendMessage(LVM_GETITEMRECT, lvIndex, (LPARAM)&rc);
1483  pt.x = (rc.right + rc.left) / 2;
1484  pt.y = (rc.bottom + rc.top) / 2;
1485  }
1486  else
1487  {
1488  /* We have to drop it somewhere.. */
1489  pt.x = pt.y = 0;
1490  }
1491 
1492  m_ListView.ClientToScreen(&pt);
1493  x = pt.x;
1494  y = pt.y;
1495  }
1496 
1497  uCommand = TrackPopupMenu(m_hContextMenu,
1499  x, y, 0, m_hWnd, NULL);
1500  if (uCommand == 0)
1501  goto cleanup;
1502 
1503  if (uCommand == FCIDM_SHVIEW_OPEN && OnDefaultCommand() == S_OK)
1504  goto cleanup;
1505 
1507 
1508 cleanup:
1509  if (m_pCM)
1510  {
1512  m_pCM.Release();
1513  }
1514 
1515  if (m_hContextMenu)
1516  {
1518  m_hContextMenu = NULL;
1519  }
1520 
1521  return 0;
1522 }
1523 
1525 {
1526  HRESULT hResult;
1527  HMENU hMenu;
1528 
1529  hMenu = CreatePopupMenu();
1530  if (!hMenu)
1531  return 0;
1532 
1533  hResult = GetItemObject( bUseSelection ? SVGIO_SELECTION : SVGIO_BACKGROUND, IID_PPV_ARG(IContextMenu, &m_pCM));
1534  if (FAILED_UNEXPECTEDLY( hResult))
1535  goto cleanup;
1536 
1537  hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
1538  if (FAILED_UNEXPECTEDLY( hResult))
1539  goto cleanup;
1540 
1541  InvokeContextMenuCommand(uCommand);
1542 
1543 cleanup:
1544  if (m_pCM)
1545  {
1547  m_pCM.Release();
1548  }
1549 
1550  if (hMenu)
1551  DestroyMenu(hMenu);
1552 
1553  return 0;
1554 }
1555 
1556 /**********************************************************
1557  * ##### message handling #####
1558  */
1559 
1560 /**********************************************************
1561 * ShellView_OnSize()
1562 */
1564 {
1565  WORD wWidth, wHeight;
1566 
1567  wWidth = LOWORD(lParam);
1568  wHeight = HIWORD(lParam);
1569 
1570  TRACE("%p width=%u height=%u\n", this, wWidth, wHeight);
1571 
1572  /* Resize the ListView to fit our window */
1573  if (m_ListView)
1574  {
1575  ::MoveWindow(m_ListView, 0, 0, wWidth, wHeight, TRUE);
1576  }
1577 
1578  _DoFolderViewCB(SFVM_SIZE, 0, 0);
1579 
1580  return 0;
1581 }
1582 
1583 /**********************************************************
1584 * ShellView_OnDeactivate()
1585 *
1586 * NOTES
1587 * internal
1588 */
1590 {
1591  TRACE("%p\n", this);
1592 
1593  if (m_uState != SVUIA_DEACTIVATE)
1594  {
1595  // TODO: cleanup menu after deactivation
1596 
1598  }
1599 }
1600 
1602 {
1603  TRACE("%p uState=%x\n", this, uState);
1604 
1605  /*don't do anything if the state isn't really changing */
1606  if (m_uState == uState)
1607  {
1608  return;
1609  }
1610 
1611  if (uState == SVUIA_DEACTIVATE)
1612  {
1613  OnDeactivate();
1614  }
1615  else
1616  {
1618  {
1619  FillEditMenu();
1620  FillViewMenu();
1621  m_pShellBrowser->SetMenuSB(m_hMenu, 0, m_hWnd);
1623  }
1624 
1625  if (SVUIA_ACTIVATE_FOCUS == uState)
1626  {
1627  m_ListView.SetFocus();
1628  }
1629  }
1630 
1631  m_uState = uState;
1632  TRACE("--\n");
1633 }
1634 
1635 /**********************************************************
1636 * ShellView_OnActivate()
1637 */
1639 {
1641  return 0;
1642 }
1643 
1644 /**********************************************************
1645 * ShellView_OnSetFocus()
1646 *
1647 */
1649 {
1650  TRACE("%p\n", this);
1651 
1652  /* Tell the browser one of our windows has received the focus. This
1653  should always be done before merging menus (OnActivate merges the
1654  menus) if one of our windows has the focus.*/
1655 
1656  m_pShellBrowser->OnViewWindowActive(this);
1658 
1659  /* Set the focus to the listview */
1660  m_ListView.SetFocus();
1661 
1662  /* Notify the ICommDlgBrowser interface */
1663  OnStateChange(CDBOSC_SETFOCUS);
1664 
1665  return 0;
1666 }
1667 
1668 /**********************************************************
1669 * ShellView_OnKillFocus()
1670 */
1672 {
1673  TRACE("(%p) stub\n", this);
1674 
1676  /* Notify the ICommDlgBrowser */
1677  OnStateChange(CDBOSC_KILLFOCUS);
1678 
1679  return 0;
1680 }
1681 
1682 /**********************************************************
1683 * ShellView_OnCommand()
1684 *
1685 * NOTES
1686 * the CmdID's are the ones from the context menu
1687 */
1689 {
1690  DWORD dwCmdID;
1691  DWORD dwCmd;
1692  HWND hwndCmd;
1693  int nCount;
1694 
1695  dwCmdID = GET_WM_COMMAND_ID(wParam, lParam);
1696  dwCmd = GET_WM_COMMAND_CMD(wParam, lParam);
1697  hwndCmd = GET_WM_COMMAND_HWND(wParam, lParam);
1698 
1699  TRACE("(%p)->(0x%08x 0x%08x %p) stub\n", this, dwCmdID, dwCmd, hwndCmd);
1700 
1701  switch (dwCmdID)
1702  {
1705  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_SMALLICON);
1706  CheckToolbar();
1707  break;
1708 
1709  case FCIDM_SHVIEW_BIGICON:
1711  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_ICON);
1712  CheckToolbar();
1713  break;
1714 
1715  case FCIDM_SHVIEW_LISTVIEW:
1717  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_LIST);
1718  CheckToolbar();
1719  break;
1720 
1723  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_REPORT);
1724  CheckToolbar();
1725  break;
1726 
1727  /* the menu-ID's for sorting are 0x30... see shrec.rc */
1728  case 0x30:
1729  case 0x31:
1730  case 0x32:
1731  case 0x33:
1732  m_sortInfo.nHeaderID = dwCmdID - 0x30;
1734  _Sort();
1735  break;
1736 
1738  //FIXME
1739  break;
1741  if (GetAutoArrange() == S_OK)
1742  m_ListView.ModifyStyle(LVS_AUTOARRANGE, 0);
1743  else
1744  AutoArrange();
1745  break;
1748  break;
1749 
1751  nCount = m_ListView.GetItemCount();
1752  for (int i=0; i < nCount; i++)
1754  break;
1755 
1756  case FCIDM_SHVIEW_REFRESH:
1757  Refresh();
1758  break;
1759 
1760  case FCIDM_SHVIEW_DELETE:
1761  case FCIDM_SHVIEW_CUT:
1762  case FCIDM_SHVIEW_COPY:
1763  case FCIDM_SHVIEW_RENAME:
1765  return OnExplorerCommand(dwCmdID, TRUE);
1766 
1767  case FCIDM_SHVIEW_INSERT:
1768  case FCIDM_SHVIEW_UNDO:
1771  return OnExplorerCommand(dwCmdID, FALSE);
1772  default:
1773  /* WM_COMMAND messages from the file menu are routed to the CDefView so as to let m_pCM handle the command */
1774  if (m_pCM && dwCmd == 0)
1775  {
1776  InvokeContextMenuCommand(dwCmdID);
1777  }
1778  }
1779 
1780  return 0;
1781 }
1782 
1783 /**********************************************************
1784 * ShellView_OnNotify()
1785 */
1786 
1788 {
1789  UINT CtlID;
1790  LPNMHDR lpnmh;
1791  LPNMLISTVIEW lpnmlv;
1792  NMLVDISPINFOW *lpdi;
1793  PCUITEMID_CHILD pidl;
1794  BOOL unused;
1795 
1796  CtlID = wParam;
1797  lpnmh = (LPNMHDR)lParam;
1798  lpnmlv = (LPNMLISTVIEW)lpnmh;
1799  lpdi = (NMLVDISPINFOW *)lpnmh;
1800 
1801  TRACE("%p CtlID=%u lpnmh->code=%x\n", this, CtlID, lpnmh->code);
1802 
1803  switch (lpnmh->code)
1804  {
1805  case NM_SETFOCUS:
1806  TRACE("-- NM_SETFOCUS %p\n", this);
1807  OnSetFocus(0, 0, 0, unused);
1808  break;
1809 
1810  case NM_KILLFOCUS:
1811  TRACE("-- NM_KILLFOCUS %p\n", this);
1812  OnDeactivate();
1813  /* Notify the ICommDlgBrowser interface */
1814  OnStateChange(CDBOSC_KILLFOCUS);
1815  break;
1816 
1817  case NM_CUSTOMDRAW:
1818  TRACE("-- NM_CUSTOMDRAW %p\n", this);
1819  return CDRF_DODEFAULT;
1820 
1821  case NM_RELEASEDCAPTURE:
1822  TRACE("-- NM_RELEASEDCAPTURE %p\n", this);
1823  break;
1824 
1825  case NM_CLICK:
1826  TRACE("-- NM_CLICK %p\n", this);
1827  break;
1828 
1829  case NM_RCLICK:
1830  TRACE("-- NM_RCLICK %p\n", this);
1831  break;
1832 
1833  case NM_DBLCLK:
1834  TRACE("-- NM_DBLCLK %p\n", this);
1836  break;
1837 
1838  case NM_RETURN:
1839  TRACE("-- NM_RETURN %p\n", this);
1841  break;
1842 
1843  case HDN_ENDTRACKW:
1844  TRACE("-- HDN_ENDTRACKW %p\n", this);
1845  /*nColumn1 = m_ListView.GetColumnWidth(0);
1846  nColumn2 = m_ListView.GetColumnWidth(1);*/
1847  break;
1848 
1849  case LVN_DELETEITEM:
1850  TRACE("-- LVN_DELETEITEM %p\n", this);
1851 
1852  /*delete the pidl because we made a copy of it*/
1853  SHFree(reinterpret_cast<LPVOID>(lpnmlv->lParam));
1854 
1855  break;
1856 
1857  case LVN_DELETEALLITEMS:
1858  TRACE("-- LVN_DELETEALLITEMS %p\n", this);
1859  return FALSE;
1860 
1861  case LVN_INSERTITEM:
1862  TRACE("-- LVN_INSERTITEM (STUB)%p\n", this);
1863  break;
1864 
1865  case LVN_ITEMACTIVATE:
1866  TRACE("-- LVN_ITEMACTIVATE %p\n", this);
1867  OnStateChange(CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1868  break;
1869 
1870  case LVN_COLUMNCLICK:
1871  m_sortInfo.nHeaderID = lpnmlv->iSubItem;
1874  else
1876  _Sort();
1877  break;
1878 
1879  case LVN_GETDISPINFOA:
1880  case LVN_GETDISPINFOW:
1881  TRACE("-- LVN_GETDISPINFO %p\n", this);
1882  pidl = _PidlByItem(lpdi->item);
1883 
1884  if (lpdi->item.mask & LVIF_TEXT) /* text requested */
1885  {
1886  if (m_pSF2Parent)
1887  {
1888  SHELLDETAILS sd;
1889  if (FAILED_UNEXPECTEDLY(m_pSF2Parent->GetDetailsOf(pidl, lpdi->item.iSubItem, &sd)))
1890  break;
1891 
1892  if (lpnmh->code == LVN_GETDISPINFOA)
1893  {
1894  /* shouldn't happen */
1895  NMLVDISPINFOA *lpdiA = (NMLVDISPINFOA *)lpnmh;
1896  StrRetToStrNA( lpdiA->item.pszText, lpdiA->item.cchTextMax, &sd.str, NULL);
1897  TRACE("-- text=%s\n", lpdiA->item.pszText);
1898  }
1899  else /* LVN_GETDISPINFOW */
1900  {
1901  StrRetToStrNW( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
1902  TRACE("-- text=%s\n", debugstr_w(lpdi->item.pszText));
1903  }
1904  }
1905  else
1906  {
1907  FIXME("no m_pSF2Parent\n");
1908  }
1909  }
1910  if(lpdi->item.mask & LVIF_IMAGE) /* image requested */
1911  {
1913  }
1914  if(lpdi->item.mask & LVIF_STATE)
1915  {
1916  ULONG attributes = SFGAO_HIDDEN;
1917  if (SUCCEEDED(m_pSFParent->GetAttributesOf(1, &pidl, &attributes)))
1918  {
1919  if (attributes & SFGAO_HIDDEN)
1920  {
1921  lpdi->item.state |= LVIS_CUT;
1922  }
1923  }
1924  }
1925  lpdi->item.mask |= LVIF_DI_SETITEM;
1926  break;
1927 
1928  case LVN_ITEMCHANGED:
1929  TRACE("-- LVN_ITEMCHANGED %p\n", this);
1930  OnStateChange(CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1931  UpdateStatusbar();
1932  _DoFolderViewCB(SFVM_SELECTIONCHANGED, NULL/* FIXME */, NULL/* FIXME */);
1933  break;
1934 
1935  case LVN_BEGINDRAG:
1936  case LVN_BEGINRDRAG:
1937  TRACE("-- LVN_BEGINDRAG\n");
1938 
1939  if (GetSelections())
1940  {
1942  DWORD dwAttributes = SFGAO_CANCOPY | SFGAO_CANLINK;
1943  DWORD dwEffect = DROPEFFECT_MOVE;
1944 
1945  if (SUCCEEDED(m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, IID_NULL_PPV_ARG(IDataObject, &pda))))
1946  {
1948 
1949  if (SUCCEEDED(m_pSFParent->GetAttributesOf(m_cidl, m_apidl, &dwAttributes)))
1950  {
1951  dwEffect |= dwAttributes & (SFGAO_CANCOPY | SFGAO_CANLINK);
1952  }
1953 
1955  if (SUCCEEDED(pda->QueryInterface(IID_PPV_ARG(IAsyncOperation, &piaso))))
1956  {
1957  piaso->SetAsyncMode(TRUE);
1958  }
1959 
1960  DWORD dwEffect2;
1961 
1962  m_pSourceDataObject = pda;
1963  m_ptFirstMousePos = params->ptAction;
1965 
1966  HIMAGELIST big_icons, small_icons;
1967  Shell_GetImageLists(&big_icons, &small_icons);
1968  PCUITEMID_CHILD pidl = _PidlByItem(params->iItem);
1969  int iIcon = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidl, 0);
1970  POINT ptItem;
1971  m_ListView.GetItemPosition(params->iItem, &ptItem);
1972 
1973  ImageList_BeginDrag(big_icons, iIcon, params->ptAction.x - ptItem.x, params->ptAction.y - ptItem.y);
1974 
1975  DoDragDrop(pda, this, dwEffect, &dwEffect2);
1976 
1978  }
1979  }
1980  break;
1981 
1982  case LVN_BEGINLABELEDITW:
1983  {
1984  DWORD dwAttr = SFGAO_CANRENAME;
1985  pidl = _PidlByItem(lpdi->item);
1986 
1987  TRACE("-- LVN_BEGINLABELEDITW %p\n", this);
1988 
1989  m_pSFParent->GetAttributesOf(1, &pidl, &dwAttr);
1990  if (SFGAO_CANRENAME & dwAttr)
1991  {
1992  m_isEditing = TRUE;
1993  return FALSE;
1994  }
1995  return TRUE;
1996  }
1997 
1998  case LVN_ENDLABELEDITW:
1999  {
2000  TRACE("-- LVN_ENDLABELEDITW %p\n", this);
2001 
2002  m_isEditing = FALSE;
2003 
2004  if (lpdi->item.pszText)
2005  {
2006  HRESULT hr;
2007  LVITEMW lvItem;
2008 
2009  pidl = _PidlByItem(lpdi->item);
2010  PITEMID_CHILD pidlNew = NULL;
2011  hr = m_pSFParent->SetNameOf(0, pidl, lpdi->item.pszText, SHGDN_INFOLDER, &pidlNew);
2012 
2013  if (SUCCEEDED(hr) && pidlNew)
2014  {
2015  lvItem.mask = LVIF_PARAM|LVIF_IMAGE;
2016  lvItem.iItem = lpdi->item.iItem;
2017  lvItem.iSubItem = 0;
2018  lvItem.lParam = reinterpret_cast<LPARAM>(pidlNew);
2019  lvItem.iImage = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidlNew, 0);
2020  m_ListView.SetItem(&lvItem);
2021  m_ListView.Update(lpdi->item.iItem);
2022  return TRUE;
2023  }
2024  }
2025 
2026  return FALSE;
2027  }
2028 
2029  default:
2030  TRACE("-- %p WM_COMMAND %x unhandled\n", this, lpnmh->code);
2031  break;
2032  }
2033 
2034  return 0;
2035 }
2036 
2037 /*
2038  * This is just a quick hack to make the desktop work correctly.
2039  * ITranslateShellChangeNotify's IsChildID is undocumented, but most likely the way that
2040  * a folder should know if it should update upon a change notification.
2041  * It is exported by merged folders at a minimum.
2042  */
2044 {
2045  if (!pidl1 || !pidl2)
2046  return FALSE;
2047  if (ILIsParent(pidl1, pidl2, TRUE))
2048  return TRUE;
2049 
2050  if (_ILIsDesktop(pidl1))
2051  {
2052  PIDLIST_ABSOLUTE deskpidl;
2054  if (ILIsParent(deskpidl, pidl2, TRUE))
2055  {
2056  ILFree(deskpidl);
2057  return TRUE;
2058  }
2059  ILFree(deskpidl);
2061  if (ILIsParent(deskpidl, pidl2, TRUE))
2062  {
2063  ILFree(deskpidl);
2064  return TRUE;
2065  }
2066  ILFree(deskpidl);
2067  }
2068  return FALSE;
2069 }
2070 
2071 /**********************************************************
2072 * ShellView_OnChange()
2073 */
2075 {
2076  PCIDLIST_ABSOLUTE *Pidls = reinterpret_cast<PCIDLIST_ABSOLUTE*>(wParam);
2077  BOOL bParent0 = ILIsParentOrSpecialParent(m_pidlParent, Pidls[0]);
2078  BOOL bParent1 = ILIsParentOrSpecialParent(m_pidlParent, Pidls[1]);
2079 
2080  TRACE("(%p)(%p,%p,0x%08x)\n", this, Pidls[0], Pidls[1], lParam);
2081 
2082  switch (lParam &~ SHCNE_INTERRUPT)
2083  {
2084  case SHCNE_MKDIR:
2085  case SHCNE_CREATE:
2086  if (bParent0)
2087  {
2088  if (LV_FindItemByPidl(ILFindLastID(Pidls[0])) == -1)
2089  {
2090  LV_AddItem(ILFindLastID(Pidls[0]));
2091  }
2092  else
2093  {
2094  LV_ProdItem(ILFindLastID(Pidls[0]));
2095  }
2096  }
2097  break;
2098 
2099  case SHCNE_RMDIR:
2100  case SHCNE_DELETE:
2101  if (bParent0)
2102  LV_DeleteItem(ILFindLastID(Pidls[0]));
2103  break;
2104 
2105  case SHCNE_RENAMEFOLDER:
2106  case SHCNE_RENAMEITEM:
2107  if (bParent0 && bParent1)
2108  LV_RenameItem(ILFindLastID(Pidls[0]), ILFindLastID(Pidls[1]));
2109  else if (bParent0)
2110  LV_DeleteItem(ILFindLastID(Pidls[0]));
2111  else if (bParent1)
2112  LV_AddItem(ILFindLastID(Pidls[1]));
2113  break;
2114 
2115  case SHCNE_UPDATEITEM:
2116  if (bParent0)
2117  LV_RenameItem(ILFindLastID(Pidls[0]), ILFindLastID(Pidls[0]));
2118  break;
2119 
2120  case SHCNE_UPDATEDIR:
2121  Refresh();
2122  break;
2123  }
2124  return TRUE;
2125 }
2126 
2129 
2130 /**********************************************************
2131 * CDefView::OnCustomItem
2132 */
2134 {
2135  if (!m_pCM.p)
2136  {
2137  /* no menu */
2138  ERR("no menu!!!\n");
2139  return FALSE;
2140  }
2141 
2142  /* The lParam of WM_DRAWITEM WM_MEASUREITEM contain a menu id and this also needs to
2143  be changed to a menu identifier offset */
2144  UINT CmdID;
2145  HRESULT hres = SHGetMenuIdFromMenuMsg(uMsg, lParam, &CmdID);
2146  if (SUCCEEDED(hres))
2148 
2149  /* Forward the message to the IContextMenu2 */
2150  LRESULT result;
2152 
2153  return (SUCCEEDED(hres));
2154 }
2155 
2157 {
2158  /* Wallpaper setting affects drop shadows effect */
2159  if (wParam == SPI_SETDESKWALLPAPER || wParam == 0)
2160  UpdateListColors();
2161 
2162  return S_OK;
2163 }
2164 
2165 /**********************************************************
2166 * CDefView::OnInitMenuPopup
2167 */
2169 {
2170  HMENU hmenu = (HMENU) wParam;
2171  int nPos = LOWORD(lParam);
2172  UINT menuItemId;
2173 
2174  OnCustomItem(uMsg, wParam, lParam, bHandled);
2175 
2177 
2178  /* Lets try to find out what the hell wParam is */
2179  if (hmenu == GetSubMenu(m_hMenu, nPos))
2180  menuItemId = ReallyGetMenuItemID(m_hMenu, nPos);
2181  else if (hViewMenu && hmenu == GetSubMenu(hViewMenu, nPos))
2182  menuItemId = ReallyGetMenuItemID(hViewMenu, nPos);
2183  else if (m_hContextMenu && hmenu == GetSubMenu(m_hContextMenu, nPos))
2184  menuItemId = ReallyGetMenuItemID(m_hContextMenu, nPos);
2185  else
2186  return FALSE;
2187 
2188  switch (menuItemId)
2189  {
2190  case FCIDM_MENU_FILE:
2191  FillFileMenu();
2192  break;
2193  case FCIDM_MENU_VIEW:
2194  case FCIDM_SHVIEW_VIEW:
2196  break;
2197  case FCIDM_SHVIEW_ARRANGE:
2199  break;
2200  }
2201 
2202  return FALSE;
2203 }
2204 
2205 /**********************************************************
2206 *
2207 *
2208 * The INTERFACE of the IShellView object
2209 *
2210 *
2211 **********************************************************
2212 */
2213 
2214 /**********************************************************
2215 * ShellView_GetWindow
2216 */
2218 {
2219  TRACE("(%p)\n", this);
2220 
2221  *phWnd = m_hWnd;
2222 
2223  return S_OK;
2224 }
2225 
2227 {
2228  FIXME("(%p) stub\n", this);
2229 
2230  return E_NOTIMPL;
2231 }
2232 
2233 /**********************************************************
2234 * IShellView_TranslateAccelerator
2235 *
2236 * FIXME:
2237 * use the accel functions
2238 */
2240 {
2241  if (m_isEditing)
2242  return S_FALSE;
2243 
2244  if (lpmsg->message >= WM_KEYFIRST && lpmsg->message <= WM_KEYLAST)
2245  {
2246  if (::TranslateAcceleratorW(m_hWnd, m_hAccel, lpmsg) != 0)
2247  return S_OK;
2248 
2249  TRACE("-- key=0x%04lx\n", lpmsg->wParam) ;
2250  }
2251 
2252  return m_pShellBrowser->TranslateAcceleratorSB(lpmsg, 0);
2253 }
2254 
2256 {
2257  FIXME("(%p) stub\n", this);
2258 
2259  return E_NOTIMPL;
2260 }
2261 
2263 {
2264  // CHAR szName[MAX_PATH];
2265  LRESULT lResult;
2266  int nPartArray[1] = { -1};
2267 
2268  TRACE("(%p)->(state=%x) stub\n", this, uState);
2269 
2270  /* don't do anything if the state isn't really changing */
2271  if (m_uState == uState)
2272  {
2273  return S_OK;
2274  }
2275 
2276  /* OnActivate handles the menu merging and internal state */
2277  DoActivate(uState);
2278 
2279  /* only do This if we are active */
2280  if (uState != SVUIA_DEACTIVATE)
2281  {
2282 
2283  /*
2284  GetFolderPath is not a method of IShellFolder
2285  IShellFolder_GetFolderPath( m_pSFParent, szName, sizeof(szName) );
2286  */
2287  /* set the number of parts */
2288  m_pShellBrowser->SendControlMsg(FCW_STATUS, SB_SETPARTS, 1, (LPARAM)nPartArray, &lResult);
2289 
2290  /* set the text for the parts */
2291  /*
2292  m_pShellBrowser->SendControlMsg(FCW_STATUS, SB_SETTEXTA, 0, (LPARAM)szName, &lResult);
2293  */
2294  }
2295 
2296  return S_OK;
2297 }
2298 
2300 {
2301  TRACE("(%p)\n", this);
2302 
2304  FillList();
2305 
2306  return S_OK;
2307 }
2308 
2310 {
2311  return CreateViewWindow3(psb, lpPrevView, SV3CVW3_DEFAULT,
2312  (FOLDERFLAGS)lpfs->fFlags, (FOLDERFLAGS)lpfs->fFlags, (FOLDERVIEWMODE)lpfs->ViewMode, NULL, prcView, phWnd);
2313 }
2314 
2316 {
2317  TRACE("(%p)\n", this);
2318 
2319  /* Make absolutely sure all our UI is cleaned up */
2321 
2322  if (m_hAccel)
2323  {
2324  // "Accelerator tables loaded from resources are freed automatically when the application terminates." -- MSDN
2325  m_hAccel = NULL;
2326  }
2327 
2328  if (m_hMenuArrangeModes)
2329  {
2332  }
2333 
2334  if (m_hMenuViewModes)
2335  {
2338  }
2339 
2340  if (m_hMenu)
2341  {
2343  m_hMenu = NULL;
2344  }
2345 
2346  if (m_ListView)
2347  {
2348  m_ListView.DestroyWindow();
2349  }
2350 
2351  if (m_hWnd)
2352  {
2353  DestroyWindow();
2354  }
2355 
2358 
2359  return S_OK;
2360 }
2361 
2363 {
2364  TRACE("(%p)->(%p) vmode=%x flags=%x\n", this, lpfs,
2366 
2367  if (!lpfs)
2368  return E_INVALIDARG;
2369 
2370  *lpfs = m_FolderSettings;
2371  return S_OK;
2372 }
2373 
2375 {
2376  FIXME("(%p) stub\n", this);
2377 
2378  return E_NOTIMPL;
2379 }
2380 
2382 {
2383  FIXME("(%p) stub\n", this);
2384 
2385  return S_OK;
2386 }
2387 
2389 {
2390  int i;
2391 
2392  TRACE("(%p)->(pidl=%p, 0x%08x) stub\n", this, pidl, uFlags);
2393 
2394  i = LV_FindItemByPidl(pidl);
2395  if (i == -1)
2396  return S_OK;
2397 
2398  LVITEMW lvItem = {0};
2399  lvItem.mask = LVIF_STATE;
2401 
2402  while (m_ListView.GetItem(&lvItem))
2403  {
2404  if (lvItem.iItem == i)
2405  {
2406  if (uFlags & SVSI_SELECT)
2407  lvItem.state |= LVIS_SELECTED;
2408  else
2409  lvItem.state &= ~LVIS_SELECTED;
2410 
2411  if (uFlags & SVSI_FOCUSED)
2412  lvItem.state |= LVIS_FOCUSED;
2413  else
2414  lvItem.state &= ~LVIS_FOCUSED;
2415  }
2416  else
2417  {
2418  if (uFlags & SVSI_DESELECTOTHERS)
2419  {
2420  lvItem.state &= ~LVIS_SELECTED;
2421  }
2422  lvItem.state &= ~LVIS_FOCUSED;
2423  }
2424 
2425  m_ListView.SetItem(&lvItem);
2426  lvItem.iItem++;
2427  }
2428 
2429  if (uFlags & SVSI_ENSUREVISIBLE)
2431 
2432  if((uFlags & SVSI_EDIT) == SVSI_EDIT)
2434 
2435  return S_OK;
2436 }
2437 
2439 {
2441 
2442  TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n", this, uItem, debugstr_guid(&riid), ppvOut);
2443 
2444  if (!ppvOut)
2445  return E_INVALIDARG;
2446 
2447  *ppvOut = NULL;
2448 
2449  switch (uItem)
2450  {
2451  case SVGIO_BACKGROUND:
2452  if (IsEqualIID(riid, IID_IContextMenu))
2453  {
2455  if (FAILED_UNEXPECTEDLY(hr))
2456  return hr;
2457 
2458  IUnknown_SetSite(*((IUnknown**)ppvOut), (IShellView *)this);
2459  }
2460  else if (IsEqualIID(riid, IID_IDispatch))
2461  {
2463  {
2465  if (FAILED_UNEXPECTEDLY(hr))
2466  return hr;
2467  }
2468  hr = m_pShellFolderViewDual->QueryInterface(riid, ppvOut);
2469  }
2470  break;
2471 
2472  case SVGIO_SELECTION:
2473  GetSelections();
2474  hr = m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, riid, 0, ppvOut);
2475  if (FAILED_UNEXPECTEDLY(hr))
2476  return hr;
2477 
2478  if (IsEqualIID(riid, IID_IContextMenu))
2479  IUnknown_SetSite(*((IUnknown**)ppvOut), (IShellView *)this);
2480 
2481  break;
2482  }
2483 
2484  TRACE("-- (%p)->(interface=%p)\n", this, *ppvOut);
2485 
2486  return hr;
2487 }
2488 
2490 {
2491  TRACE("(%p)->(%p), stub\n", this, pViewMode);
2492 
2493  if (!pViewMode)
2494  return E_INVALIDARG;
2495 
2496  *pViewMode = m_FolderSettings.ViewMode;
2497  return S_OK;
2498 }
2499 
2501 {
2502  DWORD dwStyle;
2503  TRACE("(%p)->(%u), stub\n", this, ViewMode);
2504 
2505  /* It's not redundant to check FVM_AUTO because it's a (UINT)-1 */
2506  if (((INT)ViewMode < FVM_FIRST || (INT)ViewMode > FVM_LAST) && ((INT)ViewMode != FVM_AUTO))
2507  return E_INVALIDARG;
2508 
2509  /* Windows before Vista uses LVM_SETVIEW and possibly
2510  LVM_SETEXTENDEDLISTVIEWSTYLE to set the style of the listview,
2511  while later versions seem to accomplish this through other
2512  means. */
2513  switch (ViewMode)
2514  {
2515  case FVM_ICON:
2516  dwStyle = LVS_ICON;
2517  break;
2518  case FVM_DETAILS:
2519  dwStyle = LVS_REPORT;
2520  break;
2521  case FVM_SMALLICON:
2522  dwStyle = LVS_SMALLICON;
2523  break;
2524  case FVM_LIST:
2525  dwStyle = LVS_LIST;
2526  break;
2527  default:
2528  {
2529  FIXME("ViewMode %d not implemented\n", ViewMode);
2530  dwStyle = LVS_LIST;
2531  break;
2532  }
2533  }
2534 
2535  m_ListView.ModifyStyle(LVS_TYPEMASK, dwStyle);
2536 
2537  /* This will not necessarily be the actual mode set above.
2538  This mimics the behavior of Windows XP. */
2539  m_FolderSettings.ViewMode = ViewMode;
2540 
2541  return S_OK;
2542 }
2543 
2545 {
2546  if (m_pSFParent == NULL)
2547  return E_FAIL;
2548 
2549  return m_pSFParent->QueryInterface(riid, ppv);
2550 }
2551 
2553 {
2554  PCUITEMID_CHILD pidl = _PidlByItem(iItemIndex);
2555  if (pidl)
2556  {
2557  *ppidl = ILClone(pidl);
2558  return S_OK;
2559  }
2560 
2561  *ppidl = 0;
2562  return E_INVALIDARG;
2563 }
2564 
2566 {
2567  TRACE("(%p)->(%u %p)\n", this, uFlags, pcItems);
2568 
2569  if (uFlags != SVGIO_ALLVIEW)
2570  FIXME("some flags unsupported, %x\n", uFlags & ~SVGIO_ALLVIEW);
2571 
2573 
2574  return S_OK;
2575 }
2576 
2578 {
2579  return E_NOTIMPL;
2580 }
2581 
2583 {
2584  TRACE("(%p)->(%p)\n", this, piItem);
2585 
2586  *piItem = m_ListView.GetSelectionMark();
2587 
2588  return S_OK;
2589 }
2590 
2592 {
2593  TRACE("(%p)->(%p)\n", this, piItem);
2594 
2595  *piItem = m_ListView.GetNextItem(-1, LVNI_FOCUSED);
2596 
2597  return S_OK;
2598 }
2599 
2601 {
2602  int lvIndex = LV_FindItemByPidl(pidl);
2603  if (lvIndex == -1 || ppt == NULL)
2604  return E_INVALIDARG;
2605 
2606  m_ListView.GetItemPosition(lvIndex, ppt);
2607  return S_OK;
2608 }
2609 
2611 {
2612  TRACE("(%p)->(%p)\n", this, ppt);
2613 
2614  if (!m_ListView)
2615  return S_FALSE;
2616 
2617  if (ppt)
2618  {
2619  SIZE spacing;
2620  m_ListView.GetItemSpacing(spacing);
2621 
2622  ppt->x = spacing.cx;
2623  ppt->y = spacing.cy;
2624  }
2625 
2626  return S_OK;
2627 }
2628 
2630 {
2631  return E_NOTIMPL;
2632 }
2633 
2635 {
2636  return ((m_ListView.GetStyle() & LVS_AUTOARRANGE) ? S_OK : S_FALSE);
2637 }
2638 
2640 {
2641  LVITEMW lvItem;
2642 
2643  TRACE("(%p)->(%d, %x)\n", this, iItem, dwFlags);
2644 
2645  lvItem.state = 0;
2646  lvItem.stateMask = LVIS_SELECTED;
2647 
2648  if (dwFlags & SVSI_ENSUREVISIBLE)
2649  m_ListView.EnsureVisible(iItem, 0);
2650 
2651  /* all items */
2652  if (dwFlags & SVSI_DESELECTOTHERS)
2654 
2655  /* this item */
2656  if (dwFlags & SVSI_SELECT)
2657  lvItem.state |= LVIS_SELECTED;
2658 
2659  if (dwFlags & SVSI_FOCUSED)
2660  lvItem.stateMask |= LVIS_FOCUSED;
2661 
2662  m_ListView.SetItemState(iItem, lvItem.state, lvItem.stateMask);
2663 
2664  if ((dwFlags & SVSI_EDIT) == SVSI_EDIT)
2665  m_ListView.EditLabel(iItem);
2666 
2667  return S_OK;
2668 }
2669 
2671 {
2672  /* Reset the selection */
2674 
2675  int lvIndex;
2676  for (UINT i = 0 ; i < m_cidl; i++)
2677  {
2678  lvIndex = LV_FindItemByPidl(apidl[i]);
2679  if (lvIndex != -1)
2680  {
2681  SelectItem(lvIndex, dwFlags);
2682  m_ListView.SetItemPosition(lvIndex, &apt[i]);
2683  }
2684  }
2685 
2686  return S_OK;
2687 }
2688 
2689 /**********************************************************
2690  * IShellView2 implementation
2691  */
2692 
2694 {
2695  FIXME("(%p)->(%p, %lu) stub\n", this, view_guid, view_type);
2696  return E_NOTIMPL;
2697 }
2698 
2700 {
2701  return CreateViewWindow3(view_params->psbOwner, view_params->psvPrev,
2702  SV3CVW3_DEFAULT, (FOLDERFLAGS)view_params->pfs->fFlags, (FOLDERFLAGS)view_params->pfs->fFlags,
2703  (FOLDERVIEWMODE)view_params->pfs->ViewMode, view_params->pvid, view_params->prcView, &view_params->hwndView);
2704 }
2705 
2707 {
2708  OLEMENUGROUPWIDTHS omw = { { 0, 0, 0, 0, 0, 0 } };
2709 
2710  *hwnd = NULL;
2711 
2712  TRACE("(%p)->(shlview=%p shlbrs=%p rec=%p hwnd=%p vmode=%x flags=%x)\n", this, psvPrevious, psb, prcView, hwnd, mode, flags);
2713  if (prcView != NULL)
2714  TRACE("-- left=%i top=%i right=%i bottom=%i\n", prcView->left, prcView->top, prcView->right, prcView->bottom);
2715 
2716  /* Validate the Shell Browser */
2717  if (psb == NULL || m_hWnd)
2718  return E_UNEXPECTED;
2719 
2720  if (view_flags != SV3CVW3_DEFAULT)
2721  FIXME("unsupported view flags 0x%08x\n", view_flags);
2722 
2723  /* Set up the member variables */
2724  m_pShellBrowser = psb;
2727 
2728  if (view_id)
2729  {
2730  if (IsEqualIID(*view_id, VID_LargeIcons))
2732  else if (IsEqualIID(*view_id, VID_SmallIcons))
2734  else if (IsEqualIID(*view_id, VID_List))
2736  else if (IsEqualIID(*view_id, VID_Details))
2738  else if (IsEqualIID(*view_id, VID_Thumbnails))
2740  else if (IsEqualIID(*view_id, VID_Tile))
2742  else if (IsEqualIID(*view_id, VID_ThumbStrip))
2744  else
2745  FIXME("Ignoring unrecognized VID %s\n", debugstr_guid(view_id));
2746  }
2747 
2748  /* Get our parent window */
2749  m_pShellBrowser->GetWindow(&m_hWndParent);
2750 
2751  /* Try to get the ICommDlgBrowserInterface, adds a reference !!! */
2754  {
2755  TRACE("-- CommDlgBrowser\n");
2756  }
2757 
2759  if (m_hWnd == NULL)
2760  return E_FAIL;
2761 
2762  *hwnd = m_hWnd;
2763 
2764  CheckToolbar();
2765 
2766  if (!*hwnd)
2767  return E_FAIL;
2768 
2770 
2772  UpdateWindow();
2773 
2774  if (!m_hMenu)
2775  {
2776  m_hMenu = CreateMenu();
2777  m_pShellBrowser->InsertMenusSB(m_hMenu, &omw);
2778  TRACE("-- after fnInsertMenusSB\n");
2779  }
2780 
2781  _MergeToolbar();
2782 
2783  return S_OK;
2784 }
2785 
2787 {
2788  FIXME("(%p)->(%p) stub\n", this, new_pidl);
2789  return E_NOTIMPL;
2790 }
2791 
2793 {
2794  FIXME("(%p)->(%p, %u, %p) stub\n", this, item, flags, point);
2795  return E_NOTIMPL;
2796 }
2797 
2798 /**********************************************************
2799  * IShellFolderView implementation
2800  */
2802 {
2803  FIXME("(%p)->(%ld) stub\n", this, sort);
2804  return E_NOTIMPL;
2805 }
2806 
2808 {
2809  FIXME("(%p)->(%p) stub\n", this, sort);
2810  return E_NOTIMPL;
2811 }
2812 
2814 {
2815  FIXME("(%p) stub\n", this);
2816  return E_NOTIMPL;
2817 }
2818 
2820 {
2821  m_ListView.ModifyStyle(0, LVS_AUTOARRANGE);
2823  return S_OK;
2824 }
2825 
2827 {
2828  TRACE("(%p)->(%p %p)\n", this, pidl, item);
2829  *item = LV_AddItem(pidl);
2830  return (int)*item >= 0 ? S_OK : E_OUTOFMEMORY;
2831 }
2832 
2834 {
2835  TRACE("(%p)->(%p %d)\n", this, pidl, item);
2836  return Item(item, pidl);
2837 }
2838 
2840 {
2841 
2842  TRACE("(%p)->(%p %p)\n", this, pidl, item);
2843 
2844  if (pidl)
2845  {
2848  }
2849  else
2850  {
2851  *item = 0;
2853  }
2854 
2855  return S_OK;
2856 }
2857 
2859 {
2860  TRACE("(%p)->(%p)\n", this, count);
2862  return S_OK;
2863 }
2864 
2866 {
2867  FIXME("(%p)->(%d %x) stub\n", this, count, flags);
2868  return E_NOTIMPL;
2869 }
2870 
2872 {
2873  FIXME("(%p)->(%p %p %p) stub\n", this, pidl_old, pidl_new, item);
2874  return E_NOTIMPL;
2875 }
2876 
2878 {
2879  FIXME("(%p)->(%p %p) stub\n", this, pidl, item);
2880  return E_NOTIMPL;
2881 }
2882 
2884 {
2885  TRACE("(%p)->(%d)\n", this, redraw);
2887  return S_OK;
2888 }
2889 
2891 {
2892  FIXME("(%p)->(%p) stub\n", this, count);
2893  return E_NOTIMPL;
2894 }
2895 
2897 {
2898  TRACE("(%p)->(%p %p)\n", this, pidl, items);
2899 
2900  *items = GetSelections();
2901 
2902  if (*items)
2903  {
2904  *pidl = static_cast<PCUITEMID_CHILD *>(LocalAlloc(0, *items * sizeof(PCUITEMID_CHILD)));
2905  if (!*pidl)
2906  {
2907  return E_OUTOFMEMORY;
2908  }
2909 
2910  /* it's documented that caller shouldn't PIDLs, only array itself */
2911  memcpy(*pidl, m_apidl, *items * sizeof(PCUITEMID_CHILD));
2912  }
2913 
2914  return S_OK;
2915 }
2916 
2918 {
2919  if ((m_iDragOverItem == -1 || m_pCurDropTarget == NULL) &&
2921  {
2922  return S_OK;
2923  }
2924 
2925  return S_FALSE;
2926 }
2927 
2929 {
2930  if (!pt)
2931  return E_INVALIDARG;
2932 
2933  *pt = m_ptFirstMousePos;
2934  return S_OK;
2935 }
2936 
2938 {
2939  FIXME("(%p)->(%p) stub\n", this, pt);
2940  return E_NOTIMPL;
2941 }
2942 
2944 {
2945  TRACE("(%p)->(%p)\n", this, obj);
2946  return E_NOTIMPL;
2947 }
2948 
2950 {
2951  FIXME("(%p)->(%p %p) stub\n", this, pidl, pt);
2952  return E_NOTIMPL;
2953 }
2954 
2956 {
2957  FIXME("(%p)->(%p) stub\n", this, drop_target);
2958  return E_NOTIMPL;
2959 }
2960 
2962 {
2963  FIXME("(%p)->(%d) stub\n", this, move);
2964  return E_NOTIMPL;
2965 }
2966 
2968 {
2969  FIXME("(%p)->(%p) stub\n", this, obj);
2970  return E_NOTIMPL;
2971 }
2972 
2974 {
2975  FIXME("(%p)->(%p) stub\n", this, spacing);
2976  return E_NOTIMPL;
2977 }
2978 
2979 HRESULT STDMETHODCALLTYPE CDefView::SetCallback(IShellFolderViewCB *new_cb, IShellFolderViewCB **old_cb)
2980 {
2981  if (old_cb)
2982  *old_cb = m_pShellFolderViewCB.Detach();
2983 
2984  m_pShellFolderViewCB = new_cb;
2985  return S_OK;
2986 }
2987 
2989 {
2990  FIXME("(%p)->(%d) stub\n", this, flags);
2991  return E_NOTIMPL;
2992 }
2993 
2995 {
2996  TRACE("(%p)->(%p)\n", this, support);
2997  return S_OK;
2998 }
2999 
3001 {
3002  FIXME("(%p)->(%p) stub\n", this, disp);
3003  return E_NOTIMPL;
3004 }
3005 
3006 /**********************************************************
3007  * ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
3008  */
3009 HRESULT WINAPI CDefView::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
3010 {
3011  FIXME("(%p)->(%p(%s) 0x%08x %p %p\n",
3012  this, pguidCmdGroup, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
3013 
3014  if (!prgCmds)
3015  return E_INVALIDARG;
3016 
3017  for (UINT i = 0; i < cCmds; i++)
3018  {
3019  FIXME("\tprgCmds[%d].cmdID = %d\n", i, prgCmds[i].cmdID);
3020  prgCmds[i].cmdf = 0;
3021  }
3022 
3023  return OLECMDERR_E_UNKNOWNGROUP;
3024 }
3025 
3026 /**********************************************************
3027  * ISVOleCmdTarget_Exec (IOleCommandTarget)
3028  *
3029  * nCmdID is the OLECMDID_* enumeration
3030  */
3031 HRESULT WINAPI CDefView::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
3032 {
3033  FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08x Opt:0x%08x %p %p)\n",
3034  this, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut);
3035 
3036  if (!pguidCmdGroup)
3037  return OLECMDERR_E_UNKNOWNGROUP;
3038 
3039  if (IsEqualCLSID(*pguidCmdGroup, m_Category))
3040  {
3041  if (nCmdID == FCIDM_SHVIEW_AUTOARRANGE)
3042  {
3043  if (V_VT(pvaIn) != VT_INT_PTR)
3044  return OLECMDERR_E_NOTSUPPORTED;
3045 
3046  TPMPARAMS params;
3047  params.cbSize = sizeof(params);
3048  params.rcExclude = *(RECT*) V_INTREF(pvaIn);
3049 
3050  if (m_hMenuViewModes)
3051  {
3052  /* Duplicate all but the last two items of the view modes menu */
3053  HMENU hmenuViewPopup = CreatePopupMenu();
3054  Shell_MergeMenus(hmenuViewPopup, m_hMenuViewModes, 0, 0, 0xFFFF, 0);
3055  DeleteMenu(hmenuViewPopup, GetMenuItemCount(hmenuViewPopup) - 1, MF_BYPOSITION);
3056  DeleteMenu(hmenuViewPopup, GetMenuItemCount(hmenuViewPopup) - 1, MF_BYPOSITION);
3057  CheckViewMode(hmenuViewPopup);
3058  TrackPopupMenuEx(hmenuViewPopup, TPM_LEFTALIGN | TPM_TOPALIGN, params.rcExclude.left, params.rcExclude.bottom, m_hWndParent, &params);
3059  ::DestroyMenu(hmenuViewPopup);
3060  }
3061 
3062  // pvaOut is VT_I4 with value 0x403 (cmd id of the new mode maybe?)
3063  V_VT(pvaOut) = VT_I4;
3064  V_I4(pvaOut) = 0x403;
3065  }
3066  }
3067 
3068  if (IsEqualIID(*pguidCmdGroup, CGID_Explorer) &&
3069  (nCmdID == 0x29) &&
3070  (nCmdexecopt == 4) && pvaOut)
3071  return S_OK;
3072 
3073  if (IsEqualIID(*pguidCmdGroup, CGID_ShellDocView) &&
3074  (nCmdID == 9) &&
3075  (nCmdexecopt == 0))
3076  return 1;
3077 
3078  return OLECMDERR_E_UNKNOWNGROUP;
3079 }
3080 
3081 /**********************************************************
3082  * ISVDropTarget implementation
3083  */
3084 
3085 /******************************************************************************
3086  * drag_notify_subitem [Internal]
3087  *
3088  * Figure out the shellfolder object, which is currently under the mouse cursor
3089  * and notify it via the IDropTarget interface.
3090  */
3091 
3092 #define SCROLLAREAWIDTH 20
3093 
3095 {
3096  LONG lResult;
3097  HRESULT hr;
3098  RECT clientRect;
3099 
3100  /* The key state on drop doesn't have MK_LBUTTON or MK_RBUTTON because it
3101  reflects the key state after the user released the button, so we need
3102  to remember the last key state when the button was pressed */
3103  m_grfKeyState = grfKeyState;
3104 
3105  /* Map from global to client coordinates and query the index of the listview-item, which is
3106  * currently under the mouse cursor. */
3107  LVHITTESTINFO htinfo = {{pt.x, pt.y}, LVHT_ONITEM};
3108  ScreenToClient(&htinfo.pt);
3109  lResult = m_ListView.HitTest(&htinfo);
3110 
3111  /* Send WM_*SCROLL messages every 250 ms during drag-scrolling */
3112  ::GetClientRect(m_ListView, &clientRect);
3113  if (htinfo.pt.x == m_ptLastMousePos.x && htinfo.pt.y == m_ptLastMousePos.y &&
3114  (htinfo.pt.x < SCROLLAREAWIDTH || htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH ||
3115  htinfo.pt.y < SCROLLAREAWIDTH || htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH ))
3116  {
3117  m_cScrollDelay = (m_cScrollDelay + 1) % 5; /* DragOver is called every 50 ms */
3118  if (m_cScrollDelay == 0)
3119  {
3120  /* Mouse did hover another 250 ms over the scroll-area */
3121  if (htinfo.pt.x < SCROLLAREAWIDTH)
3122  m_ListView.SendMessageW(WM_HSCROLL, SB_LINEUP, 0);
3123 
3124  if (htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH)
3125  m_ListView.SendMessageW(WM_HSCROLL, SB_LINEDOWN, 0);
3126 
3127  if (htinfo.pt.y < SCROLLAREAWIDTH)
3128  m_ListView.SendMessageW(WM_VSCROLL, SB_LINEUP, 0);
3129 
3130  if (htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH)
3131  m_ListView.SendMessageW(WM_VSCROLL, SB_LINEDOWN, 0);
3132  }
3133  }
3134  else
3135  {
3136  m_cScrollDelay = 0; /* Reset, if the cursor is not over the listview's scroll-area */
3137  }
3138 
3139  m_ptLastMousePos = htinfo.pt;
3140 
3141  /* We need to check if we drag the selection over itself */
3142  if (lResult != -1 && m_pSourceDataObject.p != NULL)
3143  {
3144  PCUITEMID_CHILD pidl = _PidlByItem(lResult);
3145 
3146  for (UINT i = 0; i < m_cidl; i++)
3147  {
3148  if (pidl == m_apidl[i])
3149  {
3150  /* The item that is being draged is hovering itself. */
3151  lResult = -1;
3152  break;
3153  }
3154  }
3155  }
3156 
3157  /* If we are still over the previous sub-item, notify it via DragOver and return. */
3158  if (m_pCurDropTarget && lResult == m_iDragOverItem)
3159  return m_pCurDropTarget->DragOver(grfKeyState, pt, pdwEffect);
3160 
3161  /* We've left the previous sub-item, notify it via DragLeave and Release it. */
3162  if (m_pCurDropTarget)
3163  {
3165  if (pidl)
3166  SelectItem(pidl, 0);
3167 
3168  m_pCurDropTarget->DragLeave();
3170  }
3171 
3172  m_iDragOverItem = lResult;
3173 
3174  if (lResult == -1)
3175  {
3176  /* We are not above one of the listview's subitems. Bind to the parent folder's
3177  * DropTarget interface. */
3178  hr = m_pSFParent->CreateViewObject(NULL, IID_PPV_ARG(IDropTarget,&m_pCurDropTarget));
3179  }
3180  else
3181  {
3182  /* Query the relative PIDL of the shellfolder object represented by the currently
3183  * dragged over listview-item ... */
3184  PCUITEMID_CHILD pidl = _PidlByItem(lResult);
3185 
3186  /* ... and bind m_pCurDropTarget to the IDropTarget interface of an UIObject of this object */
3187  hr = m_pSFParent->GetUIObjectOf(m_ListView, 1, &pidl, IID_NULL_PPV_ARG(IDropTarget, &m_pCurDropTarget));
3188  }
3189 
3191 
3192  /* If anything failed, m_pCurDropTarget should be NULL now, which ought to be a save state. */
3193  if (FAILED(hr))
3194  {
3195  *pdwEffect = DROPEFFECT_NONE;
3196  return hr;
3197  }
3198 
3199  if (m_iDragOverItem != -1)
3200  {
3201  SelectItem(m_iDragOverItem, SVSI_SELECT);
3202  }
3203 
3204  /* Notify the item just entered via DragEnter. */
3205  return m_pCurDropTarget->DragEnter(m_pCurDataObject, grfKeyState, pt, pdwEffect);
3206 }
3207 
3208 HRESULT WINAPI CDefView::DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
3209 {
3210  if (*pdwEffect == DROPEFFECT_NONE)
3211  return S_OK;
3212 
3213  /* Get a hold on the data object for later calls to DragEnter on the sub-folders */
3214  m_pCurDataObject = pDataObject;
3215 
3216  HRESULT hr = drag_notify_subitem(grfKeyState, pt, pdwEffect);
3217  if (SUCCEEDED(hr))
3218  {
3219  POINT ptClient = {pt.x, pt.y};
3220  ScreenToClient(&ptClient);
3221  ImageList_DragEnter(m_hWnd, ptClient.x, ptClient.y);
3222  }
3223 
3224  return hr;
3225 }
3226 
3228 {
3229  POINT ptClient = {pt.x, pt.y};
3230  ScreenToClient(&ptClient);
3231  ImageList_DragMove(ptClient.x, ptClient.y);
3232  return drag_notify_subitem(grfKeyState, pt, pdwEffect);
3233 }
3234 
3236 {
3238 
3239  if (m_pCurDropTarget)
3240  {
3241  m_pCurDropTarget->DragLeave();
3243  }
3244 
3245  if (m_pCurDataObject != NULL)
3246  {
3248  }
3249 
3250  m_iDragOverItem = 0;
3251 
3252  return S_OK;
3253 }
3254 
3255 HRESULT WINAPI CDefView::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
3256 {
3259 
3260  if ((IsDropOnSource(NULL) == S_OK) &&
3261  (*pdwEffect & DROPEFFECT_MOVE) &&
3263  {
3264  if (m_pCurDropTarget)
3265  {
3266  m_pCurDropTarget->DragLeave();
3268  }
3269 
3270  /* Restore the selection */
3272  for (UINT i = 0 ; i < m_cidl; i++)
3273  SelectItem(m_apidl[i], SVSI_SELECT);
3274 
3275  /* Reposition the items */
3276  int lvIndex = -1;
3277  while ((lvIndex = m_ListView.GetNextItem(lvIndex, LVNI_SELECTED)) > -1)
3278  {
3279  POINT ptItem;
3280  if (m_ListView.GetItemPosition(lvIndex, &ptItem))
3281  {
3282  ptItem.x += pt.x - m_ptFirstMousePos.x;
3283  ptItem.y += pt.y - m_ptFirstMousePos.y;
3284  m_ListView.SetItemPosition(lvIndex, &ptItem);
3285  }
3286  }
3287  }
3288  else if (m_pCurDropTarget)
3289  {
3290  m_pCurDropTarget->Drop(pDataObject, grfKeyState, pt, pdwEffect);
3292  }
3293 
3295  m_iDragOverItem = 0;
3296  return S_OK;
3297 }
3298 
3299 /**********************************************************
3300  * ISVDropSource implementation
3301  */
3302 
3304 {
3305  TRACE("(%p)\n", this);
3306 
3307  if (fEscapePressed)
3308  return DRAGDROP_S_CANCEL;
3309  else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON))
3310  return DRAGDROP_S_DROP;
3311  else
3312  return S_OK;
3313 }
3314 
3316 {
3317  TRACE("(%p)\n", this);
3318 
3320 }
3321 
3322 /**********************************************************
3323  * ISVViewObject implementation
3324  */
3325 
3326 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)
3327 {
3328  FIXME("Stub: this=%p\n", this);
3329 
3330  return E_NOTIMPL;
3331 }
3332 
3333 HRESULT WINAPI CDefView::GetColorSet(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDevice, LOGPALETTE **ppColorSet)
3334 {
3335  FIXME("Stub: this=%p\n", this);
3336 
3337  return E_NOTIMPL;
3338 }
3339 
3340 HRESULT WINAPI CDefView::Freeze(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze)
3341 {
3342  FIXME("Stub: this=%p\n", this);
3343 
3344  return E_NOTIMPL;
3345 }
3346 
3348 {
3349  FIXME("Stub: this=%p\n", this);
3350 
3351  return E_NOTIMPL;
3352 }
3353 
3355 {
3356  FIXME("partial stub: %p 0x%08x 0x%08x %p\n", this, aspects, advf, pAdvSink);
3357 
3358  /* FIXME: we set the AdviseSink, but never use it to send any advice */
3359  m_pAdvSink = pAdvSink;
3360  m_dwAspects = aspects;
3361  m_dwAdvf = advf;
3362 
3363  return S_OK;
3364 }
3365 
3366 HRESULT WINAPI CDefView::GetAdvise(DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)
3367 {
3368  TRACE("this=%p pAspects=%p pAdvf=%p ppAdvSink=%p\n", this, pAspects, pAdvf, ppAdvSink);
3369 
3370  if (ppAdvSink)
3371  {
3372  *ppAdvSink = m_pAdvSink;
3373  m_pAdvSink.p->AddRef();
3374  }
3375 
3376  if (pAspects)
3377  *pAspects = m_dwAspects;
3378 
3379  if (pAdvf)
3380  *pAdvf = m_dwAdvf;
3381 
3382  return S_OK;
3383 }
3384 
3386 {
3387  if (IsEqualIID(guidService, SID_IShellBrowser))
3388  return m_pShellBrowser->QueryInterface(riid, ppvObject);
3389  else if(IsEqualIID(guidService, SID_IFolderView))
3390  return QueryInterface(riid, ppvObject);
3391 
3392  return E_NOINTERFACE;
3393 }
3394 
3396 {
3398  HRESULT hr = S_OK;
3399 
3400  hr = IUnknown_QueryService(m_pShellBrowser, IID_IExplorerToolbar, IID_PPV_ARG(IExplorerToolbar, &ptb));
3401  if (FAILED(hr))
3402  return hr;
3403 
3404  m_Category = CGID_DefViewFrame;
3405 
3406  hr = ptb->SetCommandTarget(static_cast<IOleCommandTarget*>(this), &m_Category, 0);
3407  if (FAILED(hr))
3408  return hr;
3409 
3410  if (hr == S_FALSE)
3411  return S_OK;
3412 
3413 #if 0
3414  hr = ptb->AddButtons(&m_Category, buttonsCount, buttons);
3415  if (FAILED(hr))
3416  return hr;
3417 #endif
3418 
3419  return S_OK;
3420 }
3421 
3422 // The default processing of IShellFolderView callbacks
3424 {
3425  // TODO: SFVM_GET_CUSTOMVIEWINFO, SFVM_WINDOWCREATED
3426  TRACE("CDefView::DefMessageSFVCB uMsg=%u\n", uMsg);
3427  return E_NOTIMPL;
3428 }
3429 
3431 {
3432  HRESULT hr = E_NOTIMPL;
3433 
3435  {
3436  hr = m_pShellFolderViewCB->MessageSFVCB(uMsg, wParam, lParam);
3437  }
3438 
3439  if (hr == E_NOTIMPL)
3440  {
3441  hr = DefMessageSFVCB(uMsg, wParam, lParam);
3442  }
3443 
3444  return hr;
3445 }
3446 
3448 {
3449  return ShellObjectCreatorInit<CDefView>(pFolder, riid, ppvOut);
3450 }
3451 
3453  LPCSFV psvcbi, /* [in] shelltemplate struct */
3454  IShellView **ppsv) /* [out] IShellView pointer */
3455 {
3456  CComPtr<IShellView> psv;
3457  HRESULT hRes;
3458 
3459  TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n",
3460  psvcbi->pshf, psvcbi->pidl, psvcbi->pfnCallback,
3461  psvcbi->fvm, psvcbi->psvOuter);
3462 
3463  *ppsv = NULL;
3464  hRes = CDefView_CreateInstance(psvcbi->pshf, IID_PPV_ARG(IShellView, &psv));
3465  if (FAILED_UNEXPECTEDLY(hRes))
3466  return hRes;
3467 
3468  *ppsv = psv.Detach();
3469  return hRes;
3470 }
3471 
3473  IShellView **ppsv)
3474 {
3475  CComPtr<IShellView> psv;
3476  HRESULT hRes;
3477 
3478  if (!ppsv)
3479  return E_INVALIDARG;
3480 
3481  *ppsv = NULL;
3482 
3483  if (!pcsfv || pcsfv->cbSize != sizeof(*pcsfv))
3484  return E_INVALIDARG;
3485 
3486  TRACE("sf=%p outer=%p callback=%p\n",
3487  pcsfv->pshf, pcsfv->psvOuter, pcsfv->psfvcb);
3488 
3489  hRes = CDefView_CreateInstance(pcsfv->pshf, IID_PPV_ARG(IShellView, &psv));
3490  if (FAILED(hRes))
3491  return hRes;
3492 
3493  if (pcsfv->psfvcb)
3494  {
3496  if (SUCCEEDED(psv->QueryInterface(IID_PPV_ARG(IShellFolderView, &sfv))))
3497  {
3498  sfv->SetCallback(pcsfv->psfvcb, NULL);
3499  }
3500  }
3501 
3502  *ppsv = psv.Detach();
3503  return hRes;
3504 }
#define SHCNE_MKDIR
Definition: shlobj.h:1723
HRESULT FillViewMenu()
Definition: CDefView.cpp:1247
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
HMENU m_hMenuArrangeModes
Definition: CDefView.cpp:83
HRESULT CDefView_CreateInstance(IShellFolder *pFolder, REFIID riid, LPVOID *ppvOut)
Definition: CDefView.cpp:3447
ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, int fSources, LONG wEventMask, UINT uMsg, int cItems, SHChangeNotifyEntry *lpItems)
Definition: changenotify.c:215
HRESULT FillEditMenu()
Definition: CDefView.cpp:1230
POINT m_ptFirstMousePos
Definition: CDefView.cpp:104
#define FCIDM_SHVIEW_UNDO
Definition: shresdef.h:750
virtual HRESULT STDMETHODCALLTYPE SetItemPos(PCUITEMID_CHILD pidl, POINT *pt)
Definition: CDefView.cpp:2949
int LV_FindItemByPidl(PCUITEMID_CHILD pidl)
Definition: CDefView.cpp:774
HRESULT FillArrangeAsMenu(HMENU hmenuArrange)
Definition: CDefView.cpp:1263
DWORD_PTR GetItemData(int i)
Definition: rosctrls.h:204
disp
Definition: i386-dis.c:3181
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define NM_KILLFOCUS
Definition: commctrl.h:136
HMENU WINAPI CreateMenu(void)
Definition: menu.c:837
virtual HRESULT STDMETHODCALLTYPE SetAdvise(DWORD aspects, DWORD advf, IAdviseSink *pAdvSink)
Definition: CDefView.cpp:3354
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
virtual HRESULT STDMETHODCALLTYPE DestroyViewWindow()
Definition: CDefView.cpp:2315
void WINAPI DPA_DestroyCallback(HDPA hdpa, PFNDPAENUMCALLBACK enumProc, LPVOID lParam)
Definition: dpa.c:1003
BOOL GetScrollPos(int nBar)
Definition: atlwin.h:666
#define LVN_BEGINRDRAG
Definition: commctrl.h:3137
int iImage
Definition: commctrl.h:2363
#define FCIDM_SHVIEW_INVERTSELECTION
Definition: shresdef.h:755
int LV_AddItem(PCUITEMID_CHILD pidl)
Definition: CDefView.cpp:794
#define FCIDM_SHVIEW_LISTVIEW
Definition: shresdef.h:759
BOOL m_Destroyed
Definition: CDefView.cpp:112
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
WINE_DEFAULT_DEBUG_CHANNEL(shell)
HACCEL m_hAccel
Definition: CDefView.cpp:93
#define SHCNE_RMDIR
Definition: shlobj.h:1724
#define FCIDM_TB_REPORTVIEW
Definition: shresdef.h:778
UINT m_cScrollDelay
Definition: CDefView.cpp:102
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CDefView.cpp:3227
const GUID IID_IViewObject
BOOL MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
Definition: atlwin.h:958
virtual HRESULT STDMETHODCALLTYPE GetAutoArrange()
Definition: CDefView.cpp:2634
virtual HRESULT STDMETHODCALLTYPE Refresh()
Definition: CDefView.cpp:2299
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define E_NOINTERFACE
Definition: winerror.h:2364
HDPA WINAPI DPA_Create(INT nGrow)
Definition: dpa.c:950
Definition: compat.h:1947
#define LVN_BEGINDRAG
Definition: commctrl.h:3136
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define MF_BYCOMMAND
Definition: winuser.h:202
HRESULT WINAPI CDefViewDual_Constructor(REFIID riid, LPVOID *ppvOut)
#define LVSIL_SMALL
Definition: commctrl.h:2295
virtual HRESULT STDMETHODCALLTYPE Select(UINT flags)
Definition: CDefView.cpp:2988
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
Definition: CDefView.cpp:3385
long y
Definition: polytest.cpp:48
#define FCIDM_SHVIEW_SNAPTOGRID
Definition: shresdef.h:763
#define WM_GETDLGCODE
Definition: winuser.h:1671
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:857
#define WM_CONTEXTMENU
Definition: richedit.h:64
HRESULT OpenSelectedItems()
Definition: CDefView.cpp:1368
LRESULT OnPrintClient(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1071
#define FCIDM_SHVIEW_AUTOARRANGE
Definition: shresdef.h:762
#define IDS_OBJECTS_SELECTED
Definition: shresdef.h:257
HRESULT hr
Definition: shlfolder.c:183
GLint x0
Definition: linetemp.h:95
static HMENU hmenu
Definition: win.c:66
IShellFolderViewCB * psfvcb
Definition: shlobj.h:1276
Definition: scsiwmi.h:51
#define NOERROR
Definition: winerror.h:2354
HRESULT WINAPI Initialize(IShellFolder *shellFolder)
Definition: CDefView.cpp:413
BOOL WINAPI InsertMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
static const WCHAR SV_CLASS_NAME[]
Definition: CDefView.cpp:45
#define MK_LBUTTON
Definition: winuser.h:2342
long x
Definition: polytest.cpp:48
BOOL m_isEditing
Definition: CDefView.cpp:109
#define LVIR_ICON
Definition: commctrl.h:2469
#define CSIDL_COMMON_DESKTOPDIRECTORY
Definition: shlobj.h:2027
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2263
virtual HRESULT STDMETHODCALLTYPE CreateViewWindow2(LPSV2CVW2_PARAMS view_params)
Definition: CDefView.cpp:2699
int GetSelectionMark()
Definition: rosctrls.h:156
#define SB_VERT
Definition: winuser.h:553
FOLDERSETTINGS m_FolderSettings
Definition: CDefView.cpp:81
LPFNVIEWCALLBACK pfnCallback
Definition: shlobj.h:1199
#define FCIDM_MENU_VIEW_SEP_OPTIONS
Definition: shlobj.h:551
virtual HRESULT STDMETHODCALLTYPE MoveIcons(IDataObject *obj)
Definition: CDefView.cpp:2943
struct LISTVIEW_SORT_INFO * LPLISTVIEW_SORT_INFO
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1638
#define pt(x, y)
Definition: drawing.c:79
#define TPM_LEFTALIGN
Definition: winuser.h:2352
#define GET_WM_COMMAND_ID(wp, lp)
Definition: CDefView.cpp:359
virtual HRESULT STDMETHODCALLTYPE GetSelectedCount(UINT *count)
Definition: CDefView.cpp:2890
#define WM_INITMENUPOPUP
Definition: winuser.h:1728
REFIID riid
Definition: precomp.h:44
#define SPI_SETDESKWALLPAPER
Definition: winuser.h:1351
static BOOL ILIsParentOrSpecialParent(PCIDLIST_ABSOLUTE pidl1, PCIDLIST_ABSOLUTE pidl2)
Definition: CDefView.cpp:2043
#define LVS_REPORT
Definition: commctrl.h:2258
virtual WNDPROC GetWindowProc()
Definition: CDefView.cpp:292
HWND Create(HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:1631
#define LVN_GETDISPINFOA
Definition: commctrl.h:3149
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define TPM_RETURNCMD
Definition: winuser.h:2362
#define _countof(array)
Definition: fontsub.cpp:30
_STLP_MOVE_TO_STD_NAMESPACE void sort(_RandomAccessIter __first, _RandomAccessIter __last)
Definition: _algo.c:993
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define HKEY_CURRENT_USER
Definition: winreg.h:11
GLint dy
Definition: linetemp.h:97
virtual HRESULT STDMETHODCALLTYPE GetView(SHELLVIEWID *view_guid, ULONG view_type)
Definition: CDefView.cpp:2693
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
PCUITEMID_CHILD _PidlByItem(int i)
Definition: CDefView.cpp:761
#define SB_HORZ
Definition: winuser.h:552
#define U(x)
Definition: wordpad.c:44
Definition: shlobj.h:1192
LRESULT OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1007
#define LVN_ITEMCHANGED
Definition: commctrl.h:3127
#define NM_RELEASEDCAPTURE
Definition: commctrl.h:141
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
BOOL WINAPI ImageList_DragMove(INT x, INT y)
Definition: imagelist.c:1070
void SetRedraw(BOOL redraw)
Definition: rosctrls.h:27
#define FCIDM_SHVIEW_OPEN
Definition: shresdef.h:773
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1737
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
IShellBrowser * psbOwner
Definition: shobjidl.idl:789
static HDC
Definition: imagelist.c:92
CComPtr< ICommDlgBrowser > m_pCommDlgBrowser
Definition: CDefView.cpp:77
#define CALLBACK
Definition: compat.h:27
#define SHCNE_INTERRUPT
Definition: shlobj.h:1745
#define MF_STRING
Definition: winuser.h:138
#define CLR_INVALID
Definition: wingdi.h:882
#define GetRValue(rgb)
Definition: wingdi.h:2934
HWND hWnd
Definition: settings.c:17
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT FillList()
Definition: CDefView.cpp:904
BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
Definition: atlwin.h:1220
LONG top
Definition: windef.h:307
static INT CALLBACK ListViewCompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
Definition: CDefView.cpp:711
#define LVN_GETDISPINFOW
Definition: commctrl.h:3150
HANDLE HWND
Definition: compat.h:13
IShellView * psvOuter
Definition: shlobj.h:1275
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
virtual HRESULT STDMETHODCALLTYPE GetDefaultSpacing(POINT *ppt)
Definition: CDefView.cpp:2629
int GetNextItem(int i, WORD flags)
Definition: rosctrls.h:161
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define WM_SHOWWINDOW
Definition: winuser.h:1610
virtual HRESULT STDMETHODCALLTYPE SetCurrentViewMode(UINT ViewMode)
Definition: CDefView.cpp:2500
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
#define ZeroMemory
Definition: winbase.h:1642
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define LVIS_CUT
Definition: commctrl.h:2316
#define HWND_TOP
Definition: winuser.h:1193
CComPtr< IShellFolderViewDual > m_pShellFolderViewDual
Definition: CDefView.cpp:78
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define HDF_SORTUP
Definition: commctrl.h:720
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:499
WPARAM wParam
Definition: winuser.h:3091
LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1671
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
Definition: prsht.h:309
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define COLOR_DESKTOP
Definition: winuser.h:904
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:557
#define LVHT_ONITEM
Definition: commctrl.h:2493
virtual HRESULT STDMETHODCALLTYPE Item(int iItemIndex, PITEMID_CHILD *ppidl)
Definition: CDefView.cpp:2552
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG int * pcItems
Definition: usp10.c:62
BOOL EnsureVisible(int i, BOOL fPartialOK)
Definition: rosctrls.h:146
#define LVNI_SELECTED
Definition: commctrl.h:2420
UINT_PTR WPARAM
Definition: windef.h:207
view_type
HRESULT FillFileMenu()
Definition: CDefView.cpp:1196
#define WS_CHILD
Definition: pedump.c:617
HMENU m_hMenu
Definition: CDefView.cpp:82
virtual HRESULT STDMETHODCALLTYPE Rearrange(LPARAM sort)
Definition: CDefView.cpp:2801
LONG left
Definition: windef.h:306
virtual HRESULT STDMETHODCALLTYPE GetSpacing(POINT *ppt)
Definition: CDefView.cpp:2610
virtual HRESULT STDMETHODCALLTYPE GetItemObject(UINT uItem, REFIID riid, void **ppv)
Definition: CDefView.cpp:2438
UINT uFlags
Definition: api.c:59
#define LVM_SETCALLBACKMASK
Definition: commctrl.h:2415
int GetItemCount()
Definition: rosctrls.h:121
#define WS_CLIPCHILDREN
Definition: pedump.c:619
virtual HRESULT STDMETHODCALLTYPE GetFocusedItem(int *piItem)
Definition: CDefView.cpp:2591
virtual HRESULT STDMETHODCALLTYPE RemoveObject(PITEMID_CHILD pidl, UINT *item)
Definition: CDefView.cpp:2839
#define SID_IFolderView
virtual HRESULT STDMETHODCALLTYPE EnableModeless(BOOL fEnable)
Definition: CDefView.cpp:2255
LONG right
Definition: windef.h:308
#define SHCNE_RENAMEITEM
Definition: shlobj.h:1720
#define HDITEM
Definition: commctrl.h:693
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3472
VOID WINAPI ImageList_EndDrag(void)
Definition: imagelist.c:1847
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
#define WM_NCCREATE
Definition: winuser.h:1665
HWND Create(HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: rosctrls.h:8
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define COLOR_WINDOW
Definition: winuser.h:908
int32_t INT
Definition: typedefs.h:56
#define FCIDM_SHVIEW_PROPERTIES
Definition: shresdef.h:746
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:639
virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(MSG *pmsg)
Definition: CDefView.cpp:2239
DWORD WINAPI GetSysColor(_In_ int)
POINTL point
Definition: edittest.c:50
WPARAM wParam
Definition: combotst.c:138
#define LVS_SHAREIMAGELISTS
Definition: commctrl.h:2266
#define SFVM_GET_CUSTOMVIEWINFO
#define FCIDM_MENU_EDIT
Definition: shlobj.h:549
UINT stateMask
Definition: commctrl.h:2360
#define DRAGDROP_S_CANCEL
Definition: winerror.h:2647
DWORD dwAttributes
Definition: vdmdbg.h:34
virtual HRESULT STDMETHODCALLTYPE GetObject(PITEMID_CHILD *pidl, UINT item)
Definition: CDefView.cpp:2833
struct tagNMHDR * LPNMHDR
#define SFVM_SIZE
Definition: shlobj.h:1255
#define WM_SETTINGCHANGE
Definition: winuser.h:1611
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define V_I4(A)
Definition: oleauto.h:247
virtual HRESULT STDMETHODCALLTYPE DragLeave()
Definition: CDefView.cpp:3235
CComPtr< IShellFolder2 > m_pSF2Parent
Definition: CDefView.cpp:74
virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CDefView.cpp:3255
BOOL SetTextColor(COLORREF cr)
Definition: rosctrls.h:42
DWORD SetExtendedListViewStyle(DWORD dw, DWORD dwMask=0)
Definition: rosctrls.h:47
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define LVIF_TEXT
Definition: commctrl.h:2305
int cchTextMax
Definition: commctrl.h:2362
#define FCIDM_SHVIEW_INSERTLINK
Definition: shresdef.h:751
SHELLVIEWID const * pvid
Definition: shobjidl.idl:791
UINT code
Definition: winuser.h:3134
virtual HRESULT STDMETHODCALLTYPE UIActivate(UINT uState)
Definition: CDefView.cpp:2262
#define GetGValue(rgb)
Definition: wingdi.h:2935
#define FCIDM_SHVIEW_REFRESH
Definition: shresdef.h:771
#define FCIDM_BROWSERLAST
Definition: shlobj.h:541
IShellView * psvOuter
Definition: shlobj.h:1196
WORD unused[29]
Definition: crypt.c:1155
const DWORD DROPEFFECT_NONE
Definition: oleidl.idl:929
#define TPM_RIGHTBUTTON
Definition: winuser.h:2355
HRESULT WINAPI SHForwardContextMenuMsg(IUnknown *pUnk, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pResult, BOOL useIContextMenu2)
Definition: rosordinal.c:11
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MIIM_SUBMENU
Definition: winuser.h:718
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1787
#define FCIDM_SHVIEW_ARRANGE
Definition: shresdef.h:743
BOOL WINAPI ImageList_DragEnter(HWND hwndLock, INT x, INT y)
Definition: imagelist.c:958
#define WM_KEYFIRST
Definition: winuser.h:1696
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
GLenum GLint GLuint mask
Definition: glext.h:6028
CComPtr< IShellFolderViewCB > m_pShellFolderViewCB
Definition: CDefView.cpp:75
BOOL DeleteAllItems()
Definition: rosctrls.h:126
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
BOOL CreateList()
Definition: CDefView.cpp:521
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
#define SHV_CHANGE_NOTIFY
Definition: CDefView.cpp:54
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
GLenum const GLfloat * params
Definition: glext.h:5645
SFVM_CUSTOMVIEWINFO_DATA m_viewinfo_data
Definition: CDefView.cpp:113
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
virtual HRESULT STDMETHODCALLTYPE HandleRename(LPCITEMIDLIST new_pidl)
Definition: CDefView.cpp:2786
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SHCNE_ALLEVENTS
Definition: shlobj.h:1744
long LONG
Definition: pedump.c:60
CComPtr< IDataObject > m_pCurDataObject
Definition: CDefView.cpp:100
#define LVN_ITEMACTIVATE
Definition: commctrl.h:3143
BOOL GetItemPosition(int nItem, POINT *pPoint)
Definition: rosctrls.h:231
virtual HRESULT STDMETHODCALLTYPE SelectItem(PCUITEMID_CHILD pidlItem, SVSIF uFlags)
HRESULT OnStateChange(UINT uFlags)
Definition: CDefView.cpp:453
short SHORT
Definition: pedump.c:59
#define FCIDM_SHVIEW_INSERT
Definition: shresdef.h:749
LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:2156
#define MF_BYPOSITION
Definition: winuser.h:203
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
int iSubItem
Definition: commctrl.h:2358
DWORD WINAPI SHMenuIndexFromID(HMENU hMenu, UINT uID)
Definition: ordinal.c:4333
HRESULT CDefViewBckgrndMenu_CreateInstance(IShellFolder *psf, REFIID riid, void **ppv)
#define debugstr_w
Definition: kernel32.h:32
#define TPM_TOPALIGN
Definition: winuser.h:2358
#define HDI_FORMAT
Definition: commctrl.h:701
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1358
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
LPARAM lParam
Definition: commctrl.h:2364
#define FIXME(fmt,...)
Definition: debug.h:110
#define Header_GetItem(hwndHD, i, phdi)
Definition: commctrl.h:747
static PVOID ptr
Definition: dispmode.c:27
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
HMENU m_hContextMenu
Definition: CDefView.cpp:85
PIDLIST_ABSOLUTE m_pidlParent
Definition: CDefView.cpp:90
#define SFVM_LISTREFRESHED
BOOL Arrange(UINT nCode)
Definition: rosctrls.h:241
#define LVS_ALIGNLEFT
Definition: commctrl.h:2276
ULONG Release()
#define TB_ENABLEBUTTON
Definition: commctrl.h:1038
#define S_FALSE
Definition: winerror.h:2357
#define VK_SHIFT
Definition: winuser.h:2177
#define E_INVALIDARG
Definition: ddrawi.h:101
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1648
HRESULT CheckViewMode(HMENU hmenuView)
Definition: CDefView.cpp:1294
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
CComPtr< IAdviseSink > m_pAdvSink
Definition: CDefView.cpp:96
unsigned char BOOLEAN
static INT CALLBACK fill_list(LPVOID ptr, LPVOID arg)
Definition: CDefView.cpp:891
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1765
smooth NULL
Definition: ftsmooth.c:416
HRESULT InvokeContextMenuCommand(UINT uCommand)
Definition: CDefView.cpp:1343
#define LVIS_SELECTED
Definition: commctrl.h:2315
BOOL GetItem(LV_ITEM *pitem)
Definition: rosctrls.h:106
ULONG m_hNotify
Definition: CDefView.cpp:92
HRESULT WINAPI SHCreateShellFolderViewEx(LPCSFV psvcbi, IShellView **ppsv)
Definition: CDefView.cpp:3452
HRESULT DefMessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CDefView.cpp:3423
LONG cx
Definition: windef.h:334
#define MF_SEPARATOR
Definition: winuser.h:137
LONG_PTR LPARAM
Definition: windef.h:208
#define LVS_AUTOARRANGE
Definition: commctrl.h:2268
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
CListView m_ListView
Definition: CDefView.cpp:79
virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
Definition: CDefView.cpp:3303
#define IDS_OBJECTS
Definition: shresdef.h:256
virtual HRESULT STDMETHODCALLTYPE AddObject(PITEMID_CHILD pidl, UINT *item)
Definition: CDefView.cpp:2826
#define LVNI_FOCUSED
Definition: commctrl.h:2419
#define SCROLLAREAWIDTH
Definition: CDefView.cpp:3092
#define CLR_NONE
Definition: commctrl.h:315
HRESULT _MergeToolbar()
Definition: CDefView.cpp:3395
FOLDERVIEWMODE
Definition: shobjidl.idl:663
#define LVS_LIST
Definition: commctrl.h:2260
#define WS_CHILDWINDOW
Definition: pedump.c:639
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1688
BOOLEAN LV_RenameItem(PCUITEMID_CHILD pidlOld, PCUITEMID_CHILD pidlNew)
Definition: CDefView.cpp:828
#define debugstr_guid
Definition: kernel32.h:35
#define MK_RBUTTON
Definition: winuser.h:2343
#define V_INTREF(A)
Definition: oleauto.h:252
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: fontsub.cpp:1519
CComPtr< IDataObject > m_pSourceDataObject
Definition: CDefView.cpp:98
virtual HRESULT STDMETHODCALLTYPE QuerySupport(UINT *support)
Definition: CDefView.cpp:2994
virtual HRESULT STDMETHODCALLTYPE Freeze(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze)
Definition: CDefView.cpp:3340
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:532
#define WM_DESTROY
Definition: winuser.h:1591
UINT GetSelections()
Definition: CDefView.cpp:1315
HWND EditLabel(int i)
Definition: rosctrls.h:151
#define FCIDM_SHVIEW_NEWFOLDER
Definition: shresdef.h:769
#define MIIM_ID
Definition: winuser.h:717
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)
Definition: CDefView.cpp:3326
SHORT WINAPI GetKeyState(_In_ int)
#define FCIDM_MENU_FILE
Definition: shlobj.h:548
#define LVN_BEGINLABELEDITW
Definition: commctrl.h:3132
#define LVN_DELETEALLITEMS
Definition: commctrl.h:3130
#define FCIDM_MENU_VIEW
Definition: shlobj.h:550
virtual HRESULT STDMETHODCALLTYPE SetObjectCount(UINT count, UINT flags)
Definition: CDefView.cpp:2865
#define MF_CHECKED
Definition: winuser.h:132
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
void DoActivate(UINT uState)
Definition: CDefView.cpp:1601
HWND m_hWndParent
Definition: CDefView.cpp:80
BOOL ClientToScreen(LPPOINT lpPoint) const
Definition: atlwin.h:359
#define IID_NULL_PPV_ARG(Itype, ppType)
void UpdateListColors()
Definition: CDefView.cpp:597
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
virtual HRESULT STDMETHODCALLTYPE SelectAndPositionItems(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, POINT *apt, DWORD dwFlags)
Definition: CDefView.cpp:2670
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1563
#define _T(x)
Definition: vfdio.h:22
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_KILLFOCUS
Definition: winuser.h:1596
HRESULT hres
Definition: protocol.c:465
UINT m_uState
Definition: CDefView.cpp:87
LPSTR pszText
Definition: commctrl.h:2344
BOOL m_bmenuBarInitialized
Definition: CDefView.cpp:86
virtual HRESULT STDMETHODCALLTYPE GetArrangeParam(LPARAM *sort)
Definition: CDefView.cpp:2807
BOOL Update(int i)
Definition: rosctrls.h:131
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define GET_WM_COMMAND_HWND(wp, lp)
Definition: CDefView.cpp:360
#define MM_ADDSEPARATOR
Definition: shlobj.h:2319
#define FCIDM_SHVIEW_COPY
Definition: shresdef.h:748
SVSI_NOSTATECHANGE typedef UINT SVSIF
Definition: shobjidl.idl:724
#define WM_SIZE
Definition: winuser.h:1593
LISTVIEW_SORT_INFO m_sortInfo
Definition: CDefView.cpp:91
#define SFVM_WINDOWCREATED
Definition: shlobj.h:1226
LONG HRESULT
Definition: typedefs.h:77
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define NM_SETFOCUS
Definition: commctrl.h:135
#define END_MSG_MAP()
Definition: atlwin.h:1789
BOOL SetTextBkColor(COLORREF cr)
Definition: rosctrls.h:32
DWORD COLORREF
Definition: windef.h:300
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
#define FCIDM_SHVIEW_REPORTVIEW
Definition: shresdef.h:760
LPWSTR pszText
Definition: commctrl.h:2361
#define LV_HITTESTINFO
Definition: commctrl.h:2500
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define WM_NCDESTROY
Definition: winuser.h:1666
#define FCIDM_SHVIEW_VIEW
Definition: shresdef.h:744
#define RGB(r, g, b)
Definition: wingdi.h:2939
#define MAX_PATH
Definition: compat.h:26
BOOL UpdateWindow()
Definition: atlwin.h:1277
#define WINAPI
Definition: msvc.h:6
#define SHCNRF_ShellLevel
Definition: shlobj.h:1766
#define LVIF_IMAGE
Definition: commctrl.h:2306
virtual HRESULT STDMETHODCALLTYPE GetCurrentViewMode(UINT *pViewMode)
Definition: CDefView.cpp:2489
LPCITEMIDLIST pidl
Definition: shlobj.h:1197
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2376
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
UINT GetSelectedCount()
Definition: rosctrls.h:136
#define LVS_SINGLESEL
Definition: commctrl.h:2262
unsigned short WORD
Definition: ntddk_ex.h:93
#define HDF_SORTDOWN
Definition: commctrl.h:721
#define LVN_DELETEITEM
Definition: commctrl.h:3129
unsigned long DWORD
Definition: ntddk_ex.h:95
LPARAM LPFNSVADDPROPSHEETPAGE
Definition: shobjidl.idl:117
LONG m_iDragOverItem
Definition: CDefView.cpp:101
#define WM_KEYLAST
Definition: winuser.h:1710
#define WM_MEASUREITEM
Definition: winuser.h:1628
#define DRAGDROP_S_USEDEFAULTCURSORS
Definition: winerror.h:2648
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
virtual HRESULT STDMETHODCALLTYPE AutoArrange()
Definition: CDefView.cpp:2819
virtual HRESULT STDMETHODCALLTYPE SetClipboard(BOOL move)
Definition: CDefView.cpp:2961
UINT GetItemState(int i, UINT mask)
Definition: rosctrls.h:173
#define HDN_ENDTRACKW
Definition: commctrl.h:846
#define CDRF_DODEFAULT
Definition: commctrl.h:264
HRESULT IncludeObject(PCUITEMID_CHILD pidl)
Definition: CDefView.cpp:425
#define CONTEXT_MENU_BASE_ID
Definition: CDefView.cpp:58
void CheckToolbar()
Definition: CDefView.cpp:472
#define IDA_SHELLVIEW
Definition: shresdef.h:25
ULONG AddRef()
GLbitfield flags
Definition: glext.h:7161
POINT m_ptLastMousePos
Definition: CDefView.cpp:103
#define LVS_ICON
Definition: commctrl.h:2257
UINT mask
Definition: commctrl.h:2356
#define FCIDM_SHVIEW_DELETE
Definition: shresdef.h:745
virtual HRESULT STDMETHODCALLTYPE GetSelectionMarkedItem(int *piItem)
Definition: CDefView.cpp:2582