ReactOS  0.4.14-dev-593-g1793dcc
CDefView.cpp File Reference
#include "precomp.h"
#include <atlwin.h>
#include <rosctrls.h>
Include dependency graph for CDefView.cpp:

Go to the source code of this file.

Classes

struct  LISTVIEW_SORT_INFO
 
class  CDefView
 

Macros

#define SHV_CHANGE_NOTIFY   WM_USER + 0x1111
 
#define CONTEXT_MENU_BASE_ID   1
 
#define IDM_VIEW_FILES   (FCIDM_SHVIEWFIRST + 0x500)
 
#define IDM_VIEW_IDW   (FCIDM_SHVIEWFIRST + 0x501)
 
#define IDM_MYFILEITEM   (FCIDM_SHVIEWFIRST + 0x502)
 
#define ID_LISTVIEW   1
 
#define GET_WM_COMMAND_ID(wp, lp)   LOWORD(wp)
 
#define GET_WM_COMMAND_HWND(wp, lp)   (HWND)(lp)
 
#define GET_WM_COMMAND_CMD(wp, lp)   HIWORD(wp)
 
#define SCROLLAREAWIDTH   20
 

Typedefs

typedef struct LISTVIEW_SORT_INFOLPLISTVIEW_SORT_INFO
 
typedef void(CALLBACKPFNSHGETSETTINGSPROC) (LPSHELLFLAGSTATE lpsfs, DWORD dwMask)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static VOID DrawTileBitmap (HDC hDC, LPCRECT prc, HBITMAP hbm, INT nWidth, INT nHeight, INT dx, INT dy)
 
DWORD WINAPI SHMenuIndexFromID (HMENU hMenu, UINT uID)
 
HMENU GetSubmenuByID (HMENU hmenu, UINT id)
 
UINT ReallyGetMenuItemID (HMENU hmenu, int i)
 
static BOOL ILIsParentOrSpecialParent (PCIDLIST_ABSOLUTE pidl1, PCIDLIST_ABSOLUTE pidl2)
 
HRESULT SHGetMenuIdFromMenuMsg (UINT uMsg, LPARAM lParam, UINT *CmdId)
 
HRESULT SHSetMenuIdInMenuMsg (UINT uMsg, LPARAM lParam, UINT CmdId)
 
HRESULT CDefView_CreateInstance (IShellFolder *pFolder, REFIID riid, LPVOID *ppvOut)
 
HRESULT WINAPI SHCreateShellFolderViewEx (LPCSFV psvcbi, IShellView **ppsv)
 
HRESULT WINAPI SHCreateShellFolderView (const SFV_CREATE *pcsfv, IShellView **ppsv)
 

Variables

static const WCHAR SV_CLASS_NAME [] = {'S', 'H', 'E', 'L', 'L', 'D', 'L', 'L', '_', 'D', 'e', 'f', 'V', 'i', 'e', 'w', 0}
 

Macro Definition Documentation

◆ CONTEXT_MENU_BASE_ID

#define CONTEXT_MENU_BASE_ID   1

Definition at line 58 of file CDefView.cpp.

◆ GET_WM_COMMAND_CMD

#define GET_WM_COMMAND_CMD (   wp,
  lp 
)    HIWORD(wp)

Definition at line 361 of file CDefView.cpp.

◆ GET_WM_COMMAND_HWND

#define GET_WM_COMMAND_HWND (   wp,
  lp 
)    (HWND)(lp)

Definition at line 360 of file CDefView.cpp.

◆ GET_WM_COMMAND_ID

#define GET_WM_COMMAND_ID (   wp,
  lp 
)    LOWORD(wp)

Definition at line 359 of file CDefView.cpp.

◆ ID_LISTVIEW

#define ID_LISTVIEW   1

Definition at line 356 of file CDefView.cpp.

◆ IDM_MYFILEITEM

#define IDM_MYFILEITEM   (FCIDM_SHVIEWFIRST + 0x502)

Definition at line 354 of file CDefView.cpp.

◆ IDM_VIEW_FILES

#define IDM_VIEW_FILES   (FCIDM_SHVIEWFIRST + 0x500)

Definition at line 352 of file CDefView.cpp.

◆ IDM_VIEW_IDW

#define IDM_VIEW_IDW   (FCIDM_SHVIEWFIRST + 0x501)

Definition at line 353 of file CDefView.cpp.

◆ SCROLLAREAWIDTH

#define SCROLLAREAWIDTH   20

Definition at line 3092 of file CDefView.cpp.

◆ SHV_CHANGE_NOTIFY

#define SHV_CHANGE_NOTIFY   WM_USER + 0x1111

Definition at line 54 of file CDefView.cpp.

Typedef Documentation

◆ LPLISTVIEW_SORT_INFO

◆ PFNSHGETSETTINGSPROC

typedef void(CALLBACK * PFNSHGETSETTINGSPROC) (LPSHELLFLAGSTATE lpsfs, DWORD dwMask)

Definition at line 363 of file CDefView.cpp.

Function Documentation

◆ CDefView_CreateInstance()

HRESULT CDefView_CreateInstance ( IShellFolder pFolder,
REFIID  riid,
LPVOID ppvOut 
)

Definition at line 3447 of file CDefView.cpp.

3448 {
3449  return ShellObjectCreatorInit<CDefView>(pFolder, riid, ppvOut);
3450 }
REFIID riid
Definition: precomp.h:44

Referenced by SHCreateShellFolderView(), and SHCreateShellFolderViewEx().

◆ DrawTileBitmap()

static VOID DrawTileBitmap ( HDC  hDC,
LPCRECT  prc,
HBITMAP  hbm,
INT  nWidth,
INT  nHeight,
INT  dx,
INT  dy 
)
static

Definition at line 1050 of file CDefView.cpp.

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 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
GLint x0
Definition: linetemp.h:95
GLint dy
Definition: linetemp.h:97
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
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
int32_t INT
Definition: typedefs.h:56
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI DeleteDC(_In_ HDC)
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
GLint y0
Definition: linetemp.h:96
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
LONG bottom
Definition: windef.h:309
_Out_ LPRECT prc
Definition: ntgdi.h:1658
#define SRCCOPY
Definition: wingdi.h:332

Referenced by CDefView::OnPrintClient().

◆ GetSubmenuByID()

HMENU GetSubmenuByID ( HMENU  hmenu,
UINT  id 
)

Definition at line 1176 of file CDefView.cpp.

1177 {
1178  MENUITEMINFOW mii = {sizeof(mii), MIIM_SUBMENU};
1179  if (::GetMenuItemInfoW(hmenu, id, FALSE, &mii))
1180  return mii.hSubMenu;
1181 
1182  return NULL;
1183 }
static HMENU hmenu
Definition: win.c:66
#define MIIM_SUBMENU
Definition: winuser.h:718
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)

Referenced by CDefView::FillEditMenu(), CDefView::FillFileMenu(), CDefView::FillViewMenu(), and CDefView::OnInitMenuPopup().

◆ ILIsParentOrSpecialParent()

static BOOL ILIsParentOrSpecialParent ( PCIDLIST_ABSOLUTE  pidl1,
PCIDLIST_ABSOLUTE  pidl2 
)
static

Definition at line 2043 of file CDefView.cpp.

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 }
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define CSIDL_COMMON_DESKTOPDIRECTORY
Definition: shlobj.h:2027
smooth NULL
Definition: ftsmooth.c:416
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
BOOL WINAPI ILIsParent(LPCITEMIDLIST pidlParent, LPCITEMIDLIST pidlChild, BOOL bImmediate)
Definition: pidl.c:592
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2606
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2018

Referenced by CDefView::OnChangeNotify().

◆ ReallyGetMenuItemID()

UINT ReallyGetMenuItemID ( HMENU  hmenu,
int  i 
)

Definition at line 1187 of file CDefView.cpp.

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 }
#define TRUE
Definition: types.h:120
static HMENU hmenu
Definition: win.c:66
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_ID
Definition: winuser.h:717
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define UINT_MAX
Definition: limits.h:41

Referenced by CDefView::OnInitMenuPopup().

◆ SHCreateShellFolderView()

HRESULT WINAPI SHCreateShellFolderView ( const SFV_CREATE pcsfv,
IShellView **  ppsv 
)

Definition at line 3472 of file CDefView.cpp.

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 }
HRESULT CDefView_CreateInstance(IShellFolder *pFolder, REFIID riid, LPVOID *ppvOut)
Definition: CDefView.cpp:3447
IShellFolderViewCB * psfvcb
Definition: shlobj.h:1276
IShellView * psvOuter
Definition: shlobj.h:1275
#define IID_PPV_ARG(Itype, ppType)
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
IShellFolder * pshf
Definition: shlobj.h:1274
UINT cbSize
Definition: shlobj.h:1273
T * Detach()
Definition: atlcomcli.h:156
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CFontExt::CreateViewObject(), CNetFolder::CreateViewObject(), CDrivesFolder::CreateViewObject(), CPrinterFolder::CreateViewObject(), CControlPanelFolder::CreateViewObject(), CFindFolder::CreateViewObject(), CDesktopFolder::CreateViewObject(), CFSFolder::CreateViewObject(), CRecycleBin::CreateViewObject(), CZipFolder::CreateViewObject(), CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >::CreateViewObject(), START_TEST(), test_SHCreateShellFolderView(), and ShellBrowser::UpdateFolderView().

◆ SHCreateShellFolderViewEx()

HRESULT WINAPI SHCreateShellFolderViewEx ( LPCSFV  psvcbi,
IShellView **  ppsv 
)

Definition at line 3452 of file CDefView.cpp.

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 }
HRESULT CDefView_CreateInstance(IShellFolder *pFolder, REFIID riid, LPVOID *ppvOut)
Definition: CDefView.cpp:3447
LPFNVIEWCALLBACK pfnCallback
Definition: shlobj.h:1199
#define IID_PPV_ARG(Itype, ppType)
IShellView * psvOuter
Definition: shlobj.h:1196
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
LPCITEMIDLIST pidl
Definition: shlobj.h:1197
FOLDERVIEWMODE fvm
Definition: shlobj.h:1200
IShellFolder * pshf
Definition: shlobj.h:1195
T * Detach()
Definition: atlcomcli.h:156

Referenced by CNetworkConnections::CreateViewObject(), CDesktopBrowser::Initialize(), and test_SHCreateShellFolderViewEx().

◆ SHGetMenuIdFromMenuMsg()

HRESULT SHGetMenuIdFromMenuMsg ( UINT  uMsg,
LPARAM  lParam,
UINT CmdId 
)

Definition at line 1373 of file CDefaultContextMenu.cpp.

1374 {
1375  if (uMsg == WM_DRAWITEM)
1376  {
1377  DRAWITEMSTRUCT* pDrawStruct = reinterpret_cast<DRAWITEMSTRUCT*>(lParam);
1378  *CmdId = pDrawStruct->itemID;
1379  return S_OK;
1380  }
1381  else if (uMsg == WM_MEASUREITEM)
1382  {
1383  MEASUREITEMSTRUCT* pMeasureStruct = reinterpret_cast<MEASUREITEMSTRUCT*>(lParam);
1384  *CmdId = pMeasureStruct->itemID;
1385  return S_OK;
1386  }
1387 
1388  return E_FAIL;
1389 }
#define E_FAIL
Definition: ddrawi.h:102
#define WM_MEASUREITEM
Definition: winuser.h:1628
#define S_OK
Definition: intsafe.h:59
#define WM_DRAWITEM
Definition: winuser.h:1627
LPARAM lParam
Definition: combotst.c:139

Referenced by CDefaultContextMenu::HandleMenuMsg2(), and CDefView::OnCustomItem().

◆ SHMenuIndexFromID()

DWORD WINAPI SHMenuIndexFromID ( HMENU  hMenu,
UINT  uID 
)

Definition at line 4333 of file ordinal.c.

4334 {
4335  TRACE("%p %u\n", hMenu, uID);
4336  return GetMenuPosFromID(hMenu, uID);
4337 }
INT WINAPI GetMenuPosFromID(HMENU hMenu, UINT wID)
Definition: ordinal.c:4306
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by CDefView::FillViewMenu().

◆ SHSetMenuIdInMenuMsg()

HRESULT SHSetMenuIdInMenuMsg ( UINT  uMsg,
LPARAM  lParam,
UINT  CmdId 
)

Definition at line 1391 of file CDefaultContextMenu.cpp.

1392 {
1393  if (uMsg == WM_DRAWITEM)
1394  {
1395  DRAWITEMSTRUCT* pDrawStruct = reinterpret_cast<DRAWITEMSTRUCT*>(lParam);
1396  pDrawStruct->itemID = CmdId;
1397  return S_OK;
1398  }
1399  else if (uMsg == WM_MEASUREITEM)
1400  {
1401  MEASUREITEMSTRUCT* pMeasureStruct = reinterpret_cast<MEASUREITEMSTRUCT*>(lParam);
1402  pMeasureStruct->itemID = CmdId;
1403  return S_OK;
1404  }
1405 
1406  return E_FAIL;
1407 }
#define E_FAIL
Definition: ddrawi.h:102
#define WM_MEASUREITEM
Definition: winuser.h:1628
#define S_OK
Definition: intsafe.h:59
#define WM_DRAWITEM
Definition: winuser.h:1627
LPARAM lParam
Definition: combotst.c:139

Referenced by CDefaultContextMenu::HandleMenuMsg2(), and CDefView::OnCustomItem().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ SV_CLASS_NAME

const WCHAR SV_CLASS_NAME[] = {'S', 'H', 'E', 'L', 'L', 'D', 'L', 'L', '_', 'D', 'e', 'f', 'V', 'i', 'e', 'w', 0}
static

Definition at line 45 of file CDefView.cpp.

Referenced by CDefView::GetWndClassInfo().