Improved a bit the folder browsing implementation.
This commit is contained in:
parent
010bc4e731
commit
125102f54b
|
@ -1,35 +1,23 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "winerror.h"
|
|
||||||
#include "heap.h"
|
|
||||||
#include "dlgs.h"
|
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
#include "winreg.h"
|
|
||||||
#include "winnls.h"
|
|
||||||
#include "commctrl.h"
|
|
||||||
|
|
||||||
#include "wine/obj_base.h"
|
|
||||||
#include "wine/obj_enumidlist.h"
|
|
||||||
#include "wine/obj_shellfolder.h"
|
|
||||||
#include "wine/undocshell.h"
|
#include "wine/undocshell.h"
|
||||||
|
#include "shlguid.h"
|
||||||
#include "pidl.h"
|
#include "pidl.h"
|
||||||
#include "shell32_main.h"
|
#include "shell32_main.h"
|
||||||
#include "shellapi.h"
|
#include "shellapi.h"
|
||||||
#include "shlguid.h"
|
#include "shresdef.h"
|
||||||
|
|
||||||
DEFAULT_DEBUG_CHANNEL(shell);
|
DEFAULT_DEBUG_CHANNEL(shell)
|
||||||
|
|
||||||
#define IDD_TREEVIEW 99
|
|
||||||
|
|
||||||
static HWND hwndTreeView;
|
static HWND hwndTreeView;
|
||||||
static LPBROWSEINFOA lpBrowseInfo;
|
static LPBROWSEINFOA lpBrowseInfo;
|
||||||
static LPITEMIDLIST pidlRet;
|
static LPITEMIDLIST pidlRet;
|
||||||
|
|
||||||
static void FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent);
|
static void FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent);
|
||||||
|
|
||||||
static void InitializeTreeView(HWND hwndParent)
|
static void InitializeTreeView(HWND hwndParent, LPCITEMIDLIST root)
|
||||||
{
|
{
|
||||||
HIMAGELIST hImageList;
|
HIMAGELIST hImageList;
|
||||||
IShellFolder * lpsf;
|
IShellFolder * lpsf;
|
||||||
|
@ -44,7 +32,22 @@ static void InitializeTreeView(HWND hwndParent)
|
||||||
{ TreeView_SetImageList(hwndTreeView, hImageList, 0);
|
{ TreeView_SetImageList(hwndTreeView, hImageList, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* so far, this method doesn't work (still missing the upper level), keep the old way */
|
||||||
|
#if 0
|
||||||
|
if (root == NULL) {
|
||||||
|
hr = SHGetDesktopFolder(&lpsf);
|
||||||
|
} else {
|
||||||
|
IShellFolder * lpsfdesktop;
|
||||||
|
|
||||||
|
hr = SHGetDesktopFolder(&lpsfdesktop);
|
||||||
|
if (SUCCEEDED(hr)) {
|
||||||
|
hr = IShellFolder_BindToObject(lpsfdesktop, root, 0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf);
|
||||||
|
IShellFolder_Release(lpsfdesktop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
hr = SHGetDesktopFolder(&lpsf);
|
hr = SHGetDesktopFolder(&lpsf);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SUCCEEDED(hr) && hwndTreeView)
|
if (SUCCEEDED(hr) && hwndTreeView)
|
||||||
{ TreeView_DeleteAllItems(hwndTreeView);
|
{ TreeView_DeleteAllItems(hwndTreeView);
|
||||||
|
@ -54,6 +57,7 @@ static void InitializeTreeView(HWND hwndParent)
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{ IShellFolder_Release(lpsf);
|
{ IShellFolder_Release(lpsf);
|
||||||
}
|
}
|
||||||
|
TRACE("done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GetIcon(LPITEMIDLIST lpi, UINT uFlags)
|
static int GetIcon(LPITEMIDLIST lpi, UINT uFlags)
|
||||||
|
@ -206,10 +210,12 @@ static LRESULT MsgNotify(HWND hWnd, UINT CtlID, LPNMHDR lpnmh)
|
||||||
case TVN_SELCHANGEDA:
|
case TVN_SELCHANGEDA:
|
||||||
lptvid=(LPTV_ITEMDATA)pnmtv->itemNew.lParam;
|
lptvid=(LPTV_ITEMDATA)pnmtv->itemNew.lParam;
|
||||||
pidlRet = lptvid->lpifq;
|
pidlRet = lptvid->lpifq;
|
||||||
|
if (lpBrowseInfo->lpfn)
|
||||||
|
(lpBrowseInfo->lpfn)(hWnd, BFFM_SELCHANGED, (LPARAM)pidlRet, lpBrowseInfo->lParam);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FIXME("unhandled\n");
|
FIXME("unhandled (%d)\n", pnmtv->hdr.code);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -227,23 +233,33 @@ static LRESULT MsgNotify(HWND hWnd, UINT CtlID, LPNMHDR lpnmh)
|
||||||
*/
|
*/
|
||||||
static BOOL WINAPI BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
|
static BOOL WINAPI BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
LPARAM lParam )
|
LPARAM lParam )
|
||||||
{ TRACE("hwnd=%i msg=%i 0x%08x 0x%08lx\n", hWnd, msg, wParam, lParam );
|
{ TRACE("hwnd=%i msg=%i 0x%08x 0x%08lx\n", hWnd, msg, wParam, lParam );
|
||||||
|
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{ case WM_INITDIALOG:
|
{ case WM_INITDIALOG:
|
||||||
pidlRet = NULL;
|
pidlRet = NULL;
|
||||||
lpBrowseInfo = (LPBROWSEINFOA) lParam;
|
lpBrowseInfo = (LPBROWSEINFOA) lParam;
|
||||||
if (lpBrowseInfo->lpfn)
|
if (lpBrowseInfo->ulFlags & ~(BIF_STATUSTEXT))
|
||||||
FIXME("Callbacks not implemented\n");
|
FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~(BIF_STATUSTEXT));
|
||||||
if (lpBrowseInfo->ulFlags)
|
if (lpBrowseInfo->lpszTitle) {
|
||||||
FIXME("flag %x not implemented\n", lpBrowseInfo->ulFlags);
|
SetWindowTextA(GetDlgItem(hWnd, IDD_TITLE), lpBrowseInfo->lpszTitle);
|
||||||
if (lpBrowseInfo->lpszTitle)
|
} else {
|
||||||
FIXME("title %s not displayed\n", lpBrowseInfo->lpszTitle);
|
ShowWindow(GetDlgItem(hWnd, IDD_TITLE), SW_HIDE);
|
||||||
|
}
|
||||||
|
if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT))
|
||||||
|
ShowWindow(GetDlgItem(hWnd, IDD_STATUS), SW_HIDE);
|
||||||
|
|
||||||
if ( lpBrowseInfo->pidlRoot )
|
if ( lpBrowseInfo->pidlRoot )
|
||||||
FIXME("root is desktop\n");
|
FIXME("root is desktop\n");
|
||||||
|
|
||||||
InitializeTreeView ( hWnd);
|
InitializeTreeView( hWnd, lpBrowseInfo->pidlRoot );
|
||||||
return 1;
|
|
||||||
|
if (lpBrowseInfo->lpfn) {
|
||||||
|
(lpBrowseInfo->lpfn)(hWnd, BFFM_INITIALIZED, 0, lpBrowseInfo->lParam);
|
||||||
|
(lpBrowseInfo->lpfn)(hWnd, BFFM_SELCHANGED, 0/*FIXME*/, lpBrowseInfo->lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
MsgNotify( hWnd, (UINT)wParam, (LPNMHDR)lParam);
|
MsgNotify( hWnd, (UINT)wParam, (LPNMHDR)lParam);
|
||||||
|
@ -260,10 +276,35 @@ static BOOL WINAPI BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hWnd, 0);
|
EndDialog(hWnd, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case BFFM_SETSTATUSTEXTA:
|
||||||
|
TRACE("Set status %s\n", debugstr_a((LPSTR)lParam));
|
||||||
|
SetWindowTextA(GetDlgItem(hWnd, IDD_STATUS), (LPSTR)lParam);
|
||||||
|
break;
|
||||||
|
case BFFM_SETSTATUSTEXTW:
|
||||||
|
TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam));
|
||||||
|
SetWindowTextW(GetDlgItem(hWnd, IDD_STATUS), (LPWSTR)lParam);
|
||||||
|
break;
|
||||||
|
case BFFM_ENABLEOK:
|
||||||
|
TRACE("Enable %ld\n", lParam);
|
||||||
|
EnableWindow(GetDlgItem(hWnd, 1), (lParam)?TRUE:FALSE);
|
||||||
|
break;
|
||||||
|
case BFFM_SETSELECTIONA:
|
||||||
|
if (wParam)
|
||||||
|
TRACE("Set selection %s\n", debugstr_a((LPSTR)lParam));
|
||||||
|
else
|
||||||
|
TRACE("Set selection %p\n", (void*)lParam);
|
||||||
|
break;
|
||||||
|
case BFFM_SETSELECTIONW:
|
||||||
|
if (wParam)
|
||||||
|
TRACE("Set selection %s\n", debugstr_w((LPWSTR)lParam));
|
||||||
|
else
|
||||||
|
TRACE("Set selection %p\n", (void*)lParam);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -272,9 +313,11 @@ static BOOL WINAPI BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
*/
|
*/
|
||||||
LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
|
LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
|
||||||
{
|
{
|
||||||
TRACE("(%p{lpszTitle=%s})\n", lpbi, debugstr_a(lpbi->lpszTitle));
|
TRACE("(%p{lpszTitle=%s,owner=%i})\n",
|
||||||
|
lpbi, debugstr_a(lpbi->lpszTitle), lpbi->hwndOwner);
|
||||||
|
|
||||||
return (LPITEMIDLIST) DialogBoxParamA( shell32_hInstance,
|
return (LPITEMIDLIST) DialogBoxParamA( shell32_hInstance,
|
||||||
"SHBRSFORFOLDER_MSGBOX", lpbi->hwndOwner,
|
"SHBRSFORFOLDER_MSGBOX",
|
||||||
BrsFolderDlgProc, (INT)lpbi );
|
lpbi->hwndOwner,
|
||||||
|
BrsFolderDlgProc, (INT)lpbi );
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* and translated. The language 0,0 is a hack to get it
|
* and translated. The language 0,0 is a hack to get it
|
||||||
* loaded properly for all languages by pretending that
|
* loaded properly for all languages by pretending that
|
||||||
* they are neutral.
|
* they are neutral.
|
||||||
* The menus are not jet properly implemented.
|
* The menus are not yet properly implemented.
|
||||||
* Don't localize it yet. (js)
|
* Don't localize it yet. (js)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -91,17 +91,20 @@ BEGIN
|
||||||
MENUITEM "&Properties", FCIDM_SHVIEW_PROPERTIES
|
MENUITEM "&Properties", FCIDM_SHVIEW_PROPERTIES
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
SHBRSFORFOLDER_MSGBOX DIALOG 15, 40, 128, 152
|
|
||||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
SHBRSFORFOLDER_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 15, 40, 188, 192
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
CAPTION "Choose a Directory:"
|
CAPTION "Choose a Directory:"
|
||||||
FONT 8, "Helv"
|
FONT 8, "Helv"
|
||||||
{
|
{
|
||||||
DEFPUSHBUTTON "OK", 1, 4, 132, 50, 12
|
DEFPUSHBUTTON "OK", 1, 80, 176, 50, 12, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
|
||||||
PUSHBUTTON "Cancel", 2, 58, 132, 50, 12
|
PUSHBUTTON "Cancel", 2, 134, 176, 50, 12, WS_GROUP | WS_TABSTOP
|
||||||
CONTROL "Tree1",99,"SysTreeView32",
|
LTEXT "", IDD_TITLE, 4, 4, 18, 12
|
||||||
|
LTEXT "", IDD_STATUS, 4, 25, 18, 12
|
||||||
|
CONTROL "Tree1",IDD_TREEVIEW,"SysTreeView32",
|
||||||
TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT |
|
TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT |
|
||||||
WS_BORDER | WS_TABSTOP,
|
WS_BORDER | WS_TABSTOP,
|
||||||
4, 4, 120, 120
|
4, 40, 180, 120
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -26,4 +26,10 @@
|
||||||
#define IDS_CREATEFOLDER_CAPTION 31
|
#define IDS_CREATEFOLDER_CAPTION 31
|
||||||
#define IDS_DELETEFOLDER_TEXT 32
|
#define IDS_DELETEFOLDER_TEXT 32
|
||||||
#define IDS_DELETEFOLDER_CAPTION 33
|
#define IDS_DELETEFOLDER_CAPTION 33
|
||||||
|
|
||||||
|
/* browse for folder dialog box */
|
||||||
|
#define IDD_STATUS 97
|
||||||
|
#define IDD_TITLE 98
|
||||||
|
#define IDD_TREEVIEW 99
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -239,25 +239,12 @@ typedef struct tagBROWSEINFOW {
|
||||||
#define BFFM_SETSELECTIONW (WM_USER+103)
|
#define BFFM_SETSELECTIONW (WM_USER+103)
|
||||||
#define BFFM_SETSTATUSTEXTW (WM_USER+104)
|
#define BFFM_SETSTATUSTEXTW (WM_USER+104)
|
||||||
|
|
||||||
/*
|
|
||||||
#ifdef UNICODE
|
|
||||||
#define SHBrowseForFolder SHBrowseForFolderW
|
|
||||||
#define BFFM_SETSTATUSTEXT BFFM_SETSTATUSTEXTW
|
|
||||||
#define BFFM_SETSELECTION BFFM_SETSELECTIONW
|
|
||||||
|
|
||||||
#define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDW
|
|
||||||
#else
|
|
||||||
#define SHBrowseForFolder SHBrowseForFolderA
|
|
||||||
#define BFFM_SETSTATUSTEXT BFFM_SETSTATUSTEXTA
|
|
||||||
#define BFFM_SETSELECTION BFFM_SETSELECTIONA
|
|
||||||
|
|
||||||
#define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDA
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
LPITEMIDLIST WINAPI SHBrowseForFolderA(LPBROWSEINFOA lpbi);
|
LPITEMIDLIST WINAPI SHBrowseForFolderA(LPBROWSEINFOA lpbi);
|
||||||
LPITEMIDLIST WINAPI SHBrowseForFolder32W(LPBROWSEINFOW lpbi);
|
LPITEMIDLIST WINAPI SHBrowseForFolderW(LPBROWSEINFOW lpbi);
|
||||||
#define SHBrowseForFolder WINELIB_NAME_AW(SHBrowseForFolder)
|
#define SHBrowseForFolder WINELIB_NAME_AW(SHBrowseForFolder)
|
||||||
|
#define BFFM_SETSTATUSTEXT WINELIB_NAME_AW(BFFM_SETSTATUSTEXT)
|
||||||
|
#define BFFM_SETSELECTION WINELIB_NAME_AW(BFFM_SETSELECTION)
|
||||||
|
#define BFFM_VALIDATEFAILED WINELIB_NAME_AW(BFFM_VALIDATEFAILED)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* SHGetDataFromIDList API
|
* SHGetDataFromIDList API
|
||||||
|
|
Loading…
Reference in New Issue