mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 12:04:51 +00:00
context menu support for winefile
svn path=/trunk/; revision=8140
This commit is contained in:
parent
f0dea6d3a0
commit
5ef2c3bbef
3 changed files with 104 additions and 6 deletions
|
@ -3,7 +3,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><address style="align: right;"><small>
|
<td><address style="align: right;"><small>
|
||||||
ROS Explorer Source Code Documentation
|
ROS Explorer Source Code Documentation
|
||||||
<br>generated on 07.02.2004 by <a href="http://www.doxygen.org/index.html">
|
<br>generated on 10.02.2004 by <a href="http://www.doxygen.org/index.html">
|
||||||
<img src="doxygen.png" alt="doxygen" align="middle" border=0>
|
<img src="doxygen.png" alt="doxygen" align="middle" border=0>
|
||||||
</small></address>
|
</small></address>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -450,10 +450,19 @@ LRESULT FileChildWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
Entry* entry = (Entry*) ListBox_GetItemData(*pane, idx);
|
Entry* entry = (Entry*) ListBox_GetItemData(*pane, idx);
|
||||||
|
|
||||||
ShellPath shell_path = entry->create_absolute_pidl();
|
ShellPath shell_path = entry->create_absolute_pidl();
|
||||||
LPCITEMIDLIST pidl = shell_path;
|
LPCITEMIDLIST pidl_abs = shell_path;
|
||||||
|
|
||||||
///@todo use parent folder instead of desktop -> correct "Properties" dialog, ...
|
IShellFolder* parentFolder;
|
||||||
CHECKERROR(ShellFolderContextMenu(GetDesktopFolder(), _hwnd, 1, &pidl, pos.x, pos.y));
|
LPCITEMIDLIST pidlLast;
|
||||||
|
|
||||||
|
// get and use the parent folder to display correct context menu in all cases -> correct "Properties" dialog for directories, ...
|
||||||
|
if (SUCCEEDED(SHBindToParent(pidl_abs, IID_IShellFolder, (LPVOID*)&parentFolder, &pidlLast))) {
|
||||||
|
HRESULT hr = ShellFolderContextMenu(GetDesktopFolder(), _hwnd, 1, &pidlLast, pos.x, pos.y);
|
||||||
|
|
||||||
|
parentFolder->Release();
|
||||||
|
|
||||||
|
CHECKERROR(hr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;}
|
break;}
|
||||||
|
|
||||||
|
|
|
@ -172,6 +172,7 @@ typedef struct {
|
||||||
|
|
||||||
static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd);
|
static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd);
|
||||||
static void set_curdir(ChildWnd* child, Entry* entry, HWND hwnd);
|
static void set_curdir(ChildWnd* child, Entry* entry, HWND hwnd);
|
||||||
|
static void get_path(Entry* dir, PTSTR path);
|
||||||
|
|
||||||
LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
|
LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||||
LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
|
LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||||
|
@ -688,9 +689,16 @@ static LPITEMIDLIST get_to_absolute_pidl(Entry* entry, HWND hwnd)
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
return pidl;
|
return pidl;
|
||||||
}
|
}
|
||||||
}
|
} else if (entry->etype == ET_WINDOWS) {
|
||||||
|
TCHAR path[MAX_PATH];
|
||||||
|
|
||||||
return entry->pidl;
|
get_path(entry, path);
|
||||||
|
|
||||||
|
return get_path_pidl(path, hwnd);
|
||||||
|
} else if (entry->pidl)
|
||||||
|
return ILClone(entry->pidl);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3170,6 +3178,47 @@ static BOOL pane_command(Pane* pane, UINT cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST* apidl, int x, int y)
|
||||||
|
{
|
||||||
|
IContextMenu* pcm;
|
||||||
|
|
||||||
|
HRESULT hr = (*shell_folder->lpVtbl->GetUIObjectOf)(shell_folder, hwndParent, cidl, apidl, &IID_IContextMenu, NULL, (LPVOID*)&pcm);
|
||||||
|
// HRESULT hr = CDefFolderMenu_Create2(dir?dir->_pidl:DesktopFolder(), hwndParent, 1, &pidl, shell_folder, NULL, 0, NULL, &pcm);
|
||||||
|
|
||||||
|
if (SUCCEEDED(hr)) {
|
||||||
|
HMENU hmenu = CreatePopupMenu();
|
||||||
|
|
||||||
|
if (hmenu) {
|
||||||
|
hr = (*pcm->lpVtbl->QueryContextMenu)(pcm, hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
|
||||||
|
|
||||||
|
if (SUCCEEDED(hr)) {
|
||||||
|
UINT idCmd = TrackPopupMenu(hmenu, TPM_LEFTALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON, x, y, 0, hwndParent, NULL);
|
||||||
|
|
||||||
|
if (idCmd) {
|
||||||
|
CMINVOKECOMMANDINFO cmi;
|
||||||
|
|
||||||
|
cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
|
||||||
|
cmi.fMask = 0;
|
||||||
|
cmi.hwnd = hwndParent;
|
||||||
|
cmi.lpVerb = (LPCSTR)(INT_PTR)(idCmd - FCIDM_SHVIEWFIRST);
|
||||||
|
cmi.lpParameters = NULL;
|
||||||
|
cmi.lpDirectory = NULL;
|
||||||
|
cmi.nShow = SW_SHOWNORMAL;
|
||||||
|
cmi.dwHotKey = 0;
|
||||||
|
cmi.hIcon = 0;
|
||||||
|
|
||||||
|
hr = (*pcm->lpVtbl->InvokeCommand)(pcm, &cmi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(*pcm->lpVtbl->Release)(pcm);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
|
LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
static int last_split;
|
static int last_split;
|
||||||
|
@ -3388,6 +3437,46 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
|
||||||
return pane_notify(pnmh->idFrom==IDW_HEADER_LEFT? &child->left: &child->right, pnmh);}
|
return pane_notify(pnmh->idFrom==IDW_HEADER_LEFT? &child->left: &child->right, pnmh);}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _SHELL_FOLDERS
|
||||||
|
case WM_CONTEXTMENU: {
|
||||||
|
Pane* pane;
|
||||||
|
int idx;
|
||||||
|
|
||||||
|
// first select the current item in the listbox
|
||||||
|
HWND hpanel = (HWND) wparam;
|
||||||
|
POINTS* ppos = &MAKEPOINTS(lparam);
|
||||||
|
POINT pt; POINTSTOPOINT(pt, *ppos);
|
||||||
|
ScreenToClient(hpanel, &pt);
|
||||||
|
SendMessage(hpanel, WM_LBUTTONDOWN, 0, MAKELONG(pt.x, pt.y));
|
||||||
|
SendMessage(hpanel, WM_LBUTTONUP, 0, MAKELONG(pt.x, pt.y));
|
||||||
|
|
||||||
|
// now create the popup menu using shell namespace and IContextMenu
|
||||||
|
pane = GetFocus()==child->left.hwnd? &child->left: &child->right;
|
||||||
|
idx = ListBox_GetCurSel(pane->hwnd);
|
||||||
|
|
||||||
|
if (idx != -1) {
|
||||||
|
HRESULT hr;
|
||||||
|
Entry* entry = (Entry*) ListBox_GetItemData(pane->hwnd, idx);
|
||||||
|
|
||||||
|
LPITEMIDLIST pidl_abs = get_to_absolute_pidl(entry, hwnd);
|
||||||
|
|
||||||
|
if (pidl_abs) {
|
||||||
|
IShellFolder* parentFolder;
|
||||||
|
LPCITEMIDLIST pidlLast;
|
||||||
|
|
||||||
|
// get and use the parent folder to display correct context menu in all cases
|
||||||
|
if (SUCCEEDED(SHBindToParent(pidl_abs, &IID_IShellFolder, (LPVOID*)&parentFolder, &pidlLast))) {
|
||||||
|
hr = ShellFolderContextMenu(parentFolder, hwnd, 1, &pidlLast, ppos->x, ppos->y);
|
||||||
|
|
||||||
|
(*parentFolder->lpVtbl->Release)(parentFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
(*Globals.iMalloc->lpVtbl->Free)(Globals.iMalloc, pidl_abs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;}
|
||||||
|
#endif
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
if (wparam != SIZE_MINIMIZED)
|
if (wparam != SIZE_MINIMIZED)
|
||||||
resize_tree(child, LOWORD(lparam), HIWORD(lparam));
|
resize_tree(child, LOWORD(lparam), HIWORD(lparam));
|
||||||
|
|
Loading…
Reference in a new issue