shell32/brsfolder: Add shortcut to rename folders with the F2 key.

Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Fabian Maurer 2018-09-14 22:01:40 +02:00 committed by Alexandre Julliard
parent 1d65be607d
commit 2e25a43f3f
1 changed files with 29 additions and 7 deletions

View File

@ -613,6 +613,32 @@ static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv
return 0;
}
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
{
SendMessageW(info->hwndTreeView, TVM_SELECTITEM, TVGN_CARET, (LPARAM)rename);
SendMessageW(info->hwndTreeView, TVM_EDITLABELW, 0, (LPARAM)rename);
return S_OK;
}
static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydown)
{
HTREEITEM selected_item;
/* Old dialog doesn't support those advanced features */
if (!(info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
return 0;
selected_item = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);
switch (keydown->wVKey)
{
case VK_F2:
BrsFolder_Rename(info, selected_item);
break;
}
return 0;
}
static LRESULT BrsFolder_OnNotify( browse_info *info, UINT CtlID, LPNMHDR lpnmh )
{
NMTREEVIEWW *pnmtv = (NMTREEVIEWW *)lpnmh;
@ -640,6 +666,9 @@ static LRESULT BrsFolder_OnNotify( browse_info *info, UINT CtlID, LPNMHDR lpnmh
case TVN_ENDLABELEDITW:
return BrsFolder_Treeview_Rename( info, (LPNMTVDISPINFOW)pnmtv );
case TVN_KEYDOWN:
return BrsFolder_Treeview_Keydown( info, (LPNMTVKEYDOWN)pnmtv );
default:
WARN("unhandled (%d)\n", pnmtv->hdr.code);
break;
@ -721,13 +750,6 @@ static BOOL BrsFolder_OnCreate( HWND hWnd, browse_info *info )
return TRUE;
}
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
{
SendMessageW(info->hwndTreeView, TVM_SELECTITEM, TVGN_CARET, (LPARAM)rename);
SendMessageW(info->hwndTreeView, TVM_EDITLABELW, 0, (LPARAM)rename);
return S_OK;
}
static HRESULT BrsFolder_NewFolder(browse_info *info)
{
DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);