Commit e2b88045 authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard

- new files related to context menu and drag drop file operations

- render functions for clipboardformats
parent 3712c465
......@@ -16,8 +16,9 @@ SPEC_SRCS = \
C_SRCS = \
brsfolder.c \
changenotify.c \
classes.c \
contmenu.c \
clipboard.c \
dataobject.c \
enumidlist.c \
folders.c \
......@@ -33,10 +34,12 @@ C_SRCS = \
shellole.c \
shellord.c \
shellpath.c \
shlfileop.c \
shlfolder.c \
shlview.c \
shpolicy.c \
shv_bg_cmenu.c \
shv_item_cmenu.c \
systray.c
RC_SRCS= \
......
/*
* clipboard helper functions
*
* Copyright 2000 Juergen Schmied <juergen.schmied@debitel.de>
*
* For copy & paste functions within contextmenus does the shell use
* the OLE clipboard functions in combination with dataobjects.
* The OLE32.DLL gets loaded with LoadLibrary
*
* - a right mousebutton-copy sets the following formats:
* classic:
* Shell IDList Array
* Prefered Drop Effect
* Shell Object Offsets
* HDROP
* FileName
* ole:
* OlePrivateData (ClipboardDataObjectInterface)
*
*/
#include <string.h>
#include "debugtools.h"
#include "pidl.h"
#include "wine/undocshell.h"
#include "shell32_main.h"
#include "shell.h" /* DROPFILESTRUCT */
DEFAULT_DEBUG_CHANNEL(shell)
static int refClipCount = 0;
static HINSTANCE hShellOle32 = 0;
/**************************************************************************
* InitShellOle
*
*
*/
void InitShellOle(void)
{
}
/**************************************************************************
* FreeShellOle
*
* unload OLE32.DLL
*/
void FreeShellOle(void)
{
if (!--refClipCount)
{
pOleUninitialize();
FreeLibrary(hShellOle32);
}
}
/**************************************************************************
* LoadShellOle
*
* make sure OLE32.DLL is loaded
*/
BOOL GetShellOle(void)
{
if(!refClipCount)
{
hShellOle32 = LoadLibraryA("ole32.dll");
if(hShellOle32)
{
pOleInitialize=(void*)GetProcAddress(hShellOle32,"OleInitialize");
pOleUninitialize=(void*)GetProcAddress(hShellOle32,"OleUninitialize");
pRegisterDragDrop=(void*)GetProcAddress(hShellOle32,"RegisterDragDrop");
pRevokeDragDrop=(void*)GetProcAddress(hShellOle32,"RevokeDragDrop");
pDoDragDrop=(void*)GetProcAddress(hShellOle32,"DoDragDrop");
pReleaseStgMedium=(void*)GetProcAddress(hShellOle32,"ReleaseStgMedium");
pOleSetClipboard=(void*)GetProcAddress(hShellOle32,"OleSetClipboard");
pOleGetClipboard=(void*)GetProcAddress(hShellOle32,"OleGetClipboard");
pOleInitialize(NULL);
refClipCount++;
}
}
return TRUE;
}
/**************************************************************************
* RenderHDROP
*
* creates a CF_HDROP structure
*/
HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
{
int i;
int rootsize = 0,size = 0;
char szRootPath[MAX_PATH];
char szFileName[MAX_PATH];
HGLOBAL hGlobal;
LPDROPFILESTRUCT pDropFiles;
int offset;
TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
/* get the size needed */
size = sizeof(DROPFILESTRUCT);
SHGetPathFromIDListA(pidlRoot, szRootPath);
PathAddBackslashA(szRootPath);
rootsize = strlen(szRootPath);
for (i=0; i<cidl;i++)
{
_ILSimpleGetText(apidl[i], szFileName, MAX_PATH);
size += rootsize + strlen(szFileName) + 1;
}
size++;
/* Fill the structure */
hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);
if(!hGlobal) return hGlobal;
pDropFiles = (LPDROPFILESTRUCT)GlobalLock(hGlobal);
pDropFiles->lSize = sizeof(DROPFILESTRUCT);
pDropFiles->fWideChar = FALSE;
offset = pDropFiles->lSize;
strcpy(szFileName, szRootPath);
for (i=0; i<cidl;i++)
{
_ILSimpleGetText(apidl[i], szFileName + rootsize, MAX_PATH - rootsize);
size = strlen(szFileName) + 1;
lstrcpyA(((char*)pDropFiles)+offset, szFileName);
offset += size;
}
((char*)pDropFiles)[offset] = 0;
GlobalUnlock(hGlobal);
return hGlobal;
}
HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
{
int i,offset = 0, sizePidl, size;
HGLOBAL hGlobal;
LPCIDA pcida;
TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
/* get the size needed */
size = sizeof(CIDA) + sizeof (UINT)*(cidl); /* header */
size += ILGetSize (pidlRoot); /* root pidl */
for(i=0; i<cidl; i++)
{
size += ILGetSize(apidl[i]); /* child pidls */
}
/* fill the structure */
hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);
if(!hGlobal) return hGlobal;
pcida = GlobalLock (hGlobal);
pcida->cidl = cidl;
/* root pidl */
offset = sizeof(CIDA) + sizeof (UINT)*(cidl);
pcida->aoffset[0] = offset; /* first element */
sizePidl = ILGetSize (pidlRoot);
memcpy(((LPBYTE)pcida)+offset, pidlRoot, sizePidl);
offset += sizePidl;
for(i=0; i<cidl; i++) /* child pidls */
{
pcida->aoffset[i+1] = offset;
sizePidl = ILGetSize(apidl[i]);
memcpy(((LPBYTE)pcida)+offset, apidl[i], sizePidl);
offset += sizePidl;
}
GlobalUnlock(hGlobal);
return hGlobal;
}
HGLOBAL RenderSHELLIDLISTOFFSET (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
{
FIXME("\n");
return 0;
}
HGLOBAL RenderFILECONTENTS (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
{
FIXME("\n");
return 0;
}
HGLOBAL RenderFILEDESCRIPTOR (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
{
FIXME("\n");
return 0;
}
HGLOBAL RenderFILENAME (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
{
int len, size = 0;
char szTemp[MAX_PATH], *szFileName;
HGLOBAL hGlobal;
TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
/* build name of first file */
SHGetPathFromIDListA(pidlRoot, szTemp);
PathAddBackslashA(szTemp);
len = strlen(szTemp);
_ILSimpleGetText(apidl[0], szTemp+len, MAX_PATH - len);
size = strlen(szTemp) + 1;
/* fill the structure */
hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);
if(!hGlobal) return hGlobal;
szFileName = (char *)GlobalLock(hGlobal);
GlobalUnlock(hGlobal);
return hGlobal;
}
HGLOBAL RenderPREFEREDDROPEFFECT (DWORD dwFlags)
{
DWORD * pdwFlag;
HGLOBAL hGlobal;
TRACE("(0x%08lx)\n", dwFlags);
hGlobal = GlobalAlloc(GHND|GMEM_SHARE, sizeof(DWORD));
if(!hGlobal) return hGlobal;
pdwFlag = (DWORD*)GlobalLock(hGlobal);
*pdwFlag = dwFlags;
GlobalUnlock(hGlobal);
return hGlobal;
}
/**************************************************************************
* IsDataInClipboard
*
* checks if there is something in the clipboard we can use
*/
BOOL IsDataInClipboard (HWND hwnd)
{
BOOL ret = FALSE;
if (OpenClipboard(hwnd))
{
if (GetOpenClipboardWindow())
{
ret = IsClipboardFormatAvailable(CF_TEXT);
}
CloseClipboard();
}
return ret;
}
......@@ -17,12 +17,6 @@ DEFINE_SHLGUID(IID_IContextMenu, 0x000214E4L, 0, 0);
DEFINE_SHLGUID(IID_IContextMenu2, 0x000214F4L, 0, 0);
typedef struct IContextMenu IContextMenu, *LPCONTEXTMENU;
/* default menu items*/
#define IDM_EXPLORE 0
#define IDM_OPEN 1
#define IDM_RENAME 2
#define IDM_LAST IDM_RENAME
/* QueryContextMenu uFlags */
#define CMF_NORMAL 0x00000000
#define CMF_DEFAULTONLY 0x00000001
......
......@@ -62,14 +62,25 @@ typedef struct IShellView IShellView, *LPSHELLVIEW;
#define FCIDM_SHVIEW_UNDO 0x701B
#define FCIDM_SHVIEW_INSERTLINK 0x701C
#define FCIDM_SHVIEW_SELECTALL 0x7021
#define FCIDM_SHVIEW_INVERTSELECTION 0x7022
#define FCIDM_SHVIEW_INVERTSELECTION 0x7022
#define FCIDM_SHVIEW_BIGICON 0x7029
#define FCIDM_SHVIEW_SMALLICON 0x702A
#define FCIDM_SHVIEW_LISTVIEW 0x702B
#define FCIDM_SHVIEW_REPORTVIEW 0x702C
#define FCIDM_SHVIEW_AUTOARRANGE 0x7031
/* 0x7030-0x703f are used by the shellbrowser */
#define FCIDM_SHVIEW_AUTOARRANGE 0x7031
#define FCIDM_SHVIEW_SNAPTOGRID 0x7032
#define FCIDM_SHVIEW_HELP 0x7041
#define FCIDM_SHVIEW_RENAME 0x7050
#define FCIDM_SHVIEW_CREATELINK 0x7051
#define FCIDM_SHVIEW_NEWLINK 0x7052
#define FCIDM_SHVIEW_NEWFOLDER 0x7053
#define FCIDM_SHVIEW_REFRESH 0x7100 /* fixme */
#define FCIDM_SHVIEW_EXPLORE 0x7101 /* fixme */
#define FCIDM_SHVIEW_OPEN 0x7102 /* fixme */
#define FCIDM_SHVIEWLAST 0x7fff
#define FCIDM_BROWSERFIRST 0xA000
......@@ -121,7 +132,8 @@ typedef enum
ICOM_METHOD3(HRESULT, AddPropertySheetPages, DWORD, dwReserved, LPFNADDPROPSHEETPAGE, lpfn, LPARAM, lparam) \
ICOM_METHOD (HRESULT, SaveViewState) \
ICOM_METHOD2(HRESULT, SelectItem, LPCITEMIDLIST, pidlItem, UINT, uFlags) \
ICOM_METHOD3(HRESULT, GetItemObject, UINT, uItem, REFIID, riid, LPVOID*, ppv)
ICOM_METHOD3(HRESULT, GetItemObject, UINT, uItem, REFIID, riid, LPVOID*, ppv) \
ICOM_METHOD1(HRESULT, EditItem, LPCITEMIDLIST, pidlItem)
#define IShellView_IMETHODS \
IOleWindow_IMETHODS \
IShellView_METHODS
......@@ -146,6 +158,8 @@ ICOM_DEFINE(IShellView,IOleWindow)
#define IShellView_SaveViewState(p) ICOM_CALL(SaveViewState,p)
#define IShellView_SelectItem(p,a,b) ICOM_CALL2(SelectItem,p,a,b)
#define IShellView_GetItemObject(p,a,b,c) ICOM_CALL3(GetItemObject,p,a,b,c)
/* WINE specific */
#define IShellView_EditItem(p,a) ICOM_CALL1(EditItem,p,a)
#ifdef __cplusplus
} /* extern "C" */
......
......@@ -29,9 +29,9 @@ BOOL WINAPI ILGetDisplayName(LPCITEMIDLIST pidl,LPSTR path);
DWORD WINAPI ILFree(LPITEMIDLIST pidl);
LPITEMIDLIST WINAPI SHSimpleIDListFromPathA (LPSTR lpszPath);
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW (LPWSTR lpszPath);
LPITEMIDLIST WINAPI SHSimpleIDListFromPathAW (LPVOID lpszPath);
LPITEMIDLIST WINAPI SHSimpleIDListFromPathA (LPCSTR lpszPath);
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW (LPCWSTR lpszPath);
LPITEMIDLIST WINAPI SHSimpleIDListFromPathAW (LPCVOID lpszPath);
HRESULT WINAPI SHILCreateFromPathA (LPCSTR path, LPITEMIDLIST * ppidl, DWORD *attributes);
HRESULT WINAPI SHILCreateFromPathW (LPCWSTR path, LPITEMIDLIST * ppidl, DWORD *attributes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment