ReactOS 0.4.15-dev-7906-g1b85a5f
brsfolder.c File Reference
#include <windef.h>
#include <winbase.h>
#include <shlobj.h>
#include <undocshell.h>
#include <shellapi.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include "pidl.h"
#include "shell32_main.h"
#include "shresdef.h"
Include dependency graph for brsfolder.c:

Go to the source code of this file.

Classes

struct  tagLAYOUT_DATA
 
struct  tagbrowse_info
 
struct  tagTV_ITEMDATA
 
struct  tagLAYOUT_INFO
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COBJMACROS
 
#define NONAMELESSUNION
 
#define NONAMELESSSTRUCT
 
#define SHV_CHANGE_NOTIFY   (WM_USER + 0x1111)
 
#define LAYOUT_INFO_COUNT   (sizeof(g_layout_info)/sizeof(g_layout_info[0]))
 
#define SUPPORTEDFLAGS
 

Typedefs

typedef struct tagLAYOUT_DATA LAYOUT_DATA
 
typedef struct tagbrowse_info browse_info
 
typedef struct tagTV_ITEMDATA TV_ITEMDATA
 
typedef struct tagTV_ITEMDATALPTV_ITEMDATA
 
typedef struct tagLAYOUT_INFO LAYOUT_INFO
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static void FillTreeView (browse_info *, LPSHELLFOLDER, LPITEMIDLIST, HTREEITEM, IEnumIDList *)
 
static HTREEITEM InsertTreeViewItem (browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
 
static DWORD BrowseFlagsToSHCONTF (UINT ulFlags)
 
static void browsefolder_callback (LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
 
static LAYOUT_DATALayoutInit (HWND hwnd, const LAYOUT_INFO *layout_info, int layout_count)
 
static void LayoutUpdate (HWND hwnd, LAYOUT_DATA *data, const LAYOUT_INFO *layout_info, int layout_count)
 
static void InitializeTreeView (browse_info *info)
 
static int GetIcon (LPCITEMIDLIST lpi, UINT uFlags)
 
static void GetNormalAndSelectedIcons (LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
 
static BOOL GetName (LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
 
static void FillTreeView (browse_info *info, IShellFolder *lpsf, LPITEMIDLIST pidl, HTREEITEM hParent, IEnumIDList *lpe)
 
static BOOL PIDLIsType (LPCITEMIDLIST pidl, PIDLTYPE type)
 
static void BrsFolder_CheckValidSelection (browse_info *info, LPTV_ITEMDATA lptvid)
 
static LRESULT BrsFolder_Treeview_Delete (browse_info *info, NMTREEVIEWW *pnmtv)
 
static LRESULT BrsFolder_Treeview_Expand (browse_info *info, NMTREEVIEWW *pnmtv)
 
static HRESULT BrsFolder_Treeview_Changed (browse_info *info, NMTREEVIEWW *pnmtv)
 
static LRESULT BrsFolder_Treeview_Rename (browse_info *info, NMTVDISPINFOW *pnmtv)
 
static HRESULT BrsFolder_Rename (browse_info *info, HTREEITEM rename)
 
static LRESULT BrsFolder_Treeview_Keydown (browse_info *info, LPNMTVKEYDOWN keydown)
 
static LRESULT BrsFolder_OnNotify (browse_info *info, UINT CtlID, LPNMHDR lpnmh)
 
static BOOL BrsFolder_OnCreate (HWND hWnd, browse_info *info)
 
static HRESULT BrsFolder_NewFolder (browse_info *info)
 
static BOOL BrsFolder_OnCommand (browse_info *info, UINT id)
 
static BOOL BrsFolder_OnSetExpanded (browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem)
 
static BOOL BrsFolder_OnSetSelectionW (browse_info *info, LPVOID selection, BOOL is_str)
 
static BOOL BrsFolder_OnSetSelectionA (browse_info *info, LPVOID selection, BOOL is_str)
 
static LRESULT BrsFolder_OnWindowPosChanging (browse_info *info, WINDOWPOS *pos)
 
static INT BrsFolder_OnDestroy (browse_info *info)
 
static HTREEITEM BrsFolder_FindItemByPidl (browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
 
static LRESULT BrsFolder_OnChange (browse_info *info, const LPCITEMIDLIST *pidls, LONG event)
 
static INT_PTR CALLBACK BrsFolderDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
 
LPITEMIDLIST WINAPI SHBrowseForFolderW (LPBROWSEINFOW lpbi)
 

Variables

static const LAYOUT_INFO g_layout_info []
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 25 of file brsfolder.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file brsfolder.c.

◆ LAYOUT_INFO_COUNT

#define LAYOUT_INFO_COUNT   (sizeof(g_layout_info)/sizeof(g_layout_info[0]))

Definition at line 106 of file brsfolder.c.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 28 of file brsfolder.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 27 of file brsfolder.c.

◆ SHV_CHANGE_NOTIFY

#define SHV_CHANGE_NOTIFY   (WM_USER + 0x1111)

Definition at line 49 of file brsfolder.c.

◆ SUPPORTEDFLAGS

#define SUPPORTEDFLAGS
Value:
#define BIF_STATUSTEXT
Definition: shlobj.h:1212
#define BIF_RETURNONLYFSDIRS
Definition: shlobj.h:1210
#define BIF_RETURNFSANCESTORS
Definition: shlobj.h:1213
#define BIF_BROWSEINCLUDEFILES
Definition: shlobj.h:1225
#define BIF_NONEWFOLDERBUTTON
Definition: shlobj.h:1220
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1216
#define BIF_BROWSEFORCOMPUTER
Definition: shlobj.h:1223

Definition at line 108 of file brsfolder.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 24 of file brsfolder.c.

Typedef Documentation

◆ browse_info

◆ LAYOUT_DATA

◆ LAYOUT_INFO

◆ LPTV_ITEMDATA

◆ TV_ITEMDATA

Function Documentation

◆ BrowseFlagsToSHCONTF()

static DWORD BrowseFlagsToSHCONTF ( UINT  ulFlags)
inlinestatic

Definition at line 121 of file brsfolder.c.

122{
123 return SHCONTF_FOLDERS | (ulFlags & BIF_BROWSEINCLUDEFILES ? SHCONTF_NONFOLDERS : 0);
124}

Referenced by BrsFolder_NewFolder(), FillTreeView(), and InitializeTreeView().

◆ browsefolder_callback()

static void browsefolder_callback ( LPBROWSEINFOW  lpBrowseInfo,
HWND  hWnd,
UINT  msg,
LPARAM  param 
)
static

Definition at line 126 of file brsfolder.c.

128{
129 if (!lpBrowseInfo->lpfn)
130 return;
131 lpBrowseInfo->lpfn( hWnd, msg, param, lpBrowseInfo->lParam );
132}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
GLfloat param
Definition: glext.h:5796
BFFCALLBACK lpfn
Definition: shlobj.h:1198
LPARAM lParam
Definition: shlobj.h:1199

Referenced by BrsFolder_OnCreate(), and BrsFolder_Treeview_Changed().

◆ BrsFolder_CheckValidSelection()

static void BrsFolder_CheckValidSelection ( browse_info info,
LPTV_ITEMDATA  lptvid 
)
static

Definition at line 497 of file brsfolder.c.

498{
499 LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
500 LPCITEMIDLIST pidl = lptvid->lpi;
501 BOOL bEnabled = TRUE;
503 HRESULT r;
504
505 if ((lpBrowseInfo->ulFlags & BIF_BROWSEFORCOMPUTER) &&
506 !PIDLIsType(pidl, PT_COMP))
507 bEnabled = FALSE;
508 if (lpBrowseInfo->ulFlags & BIF_RETURNFSANCESTORS)
509 {
510 dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
511 r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
512 (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
513 if (FAILED(r) || !(dwAttributes & (SFGAO_FILESYSANCESTOR|SFGAO_FILESYSTEM)))
514 bEnabled = FALSE;
515 }
516
517 dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSTEM;
518 r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
519 (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
520 if (FAILED(r) ||
521 ((dwAttributes & (SFGAO_FOLDER|SFGAO_FILESYSTEM)) != (SFGAO_FOLDER|SFGAO_FILESYSTEM)))
522 {
523 if (lpBrowseInfo->ulFlags & BIF_RETURNONLYFSDIRS)
524 bEnabled = FALSE;
526 }
527 else
529
530 SendMessageW(info->hWnd, BFFM_ENABLEOK, 0, bEnabled);
531}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOL PIDLIsType(LPCITEMIDLIST pidl, PIDLTYPE type)
Definition: brsfolder.c:489
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define FAILED(hr)
Definition: intsafe.h:51
#define PT_COMP
Definition: pidl.h:99
#define BFFM_ENABLEOK
Definition: shlobj.h:1237
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:433
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
UINT ulFlags
Definition: shlobj.h:1197
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:73
LPITEMIDLIST lpi
Definition: brsfolder.c:74
DWORD dwAttributes
Definition: vdmdbg.h:34
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by BrsFolder_Treeview_Changed().

◆ BrsFolder_FindItemByPidl()

static HTREEITEM BrsFolder_FindItemByPidl ( browse_info info,
LPCITEMIDLIST  pidl,
HTREEITEM  hItem 
)
static

Definition at line 1240 of file brsfolder.c.

1241{
1242 TV_ITEMW item;
1243 TV_ITEMDATA *item_data;
1244 HRESULT hr;
1245
1246 item.mask = TVIF_HANDLE | TVIF_PARAM;
1247 item.hItem = hItem;
1248 SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
1249 item_data = (TV_ITEMDATA *)item.lParam;
1250
1251 hr = IShellFolder_CompareIDs(item_data->lpsfParent, 0, item_data->lpifq, pidl);
1252 if(SUCCEEDED(hr) && !HRESULT_CODE(hr))
1253 return hItem;
1254
1256
1257 while (hItem)
1258 {
1259 HTREEITEM newItem = BrsFolder_FindItemByPidl(info, pidl, hItem);
1260 if (newItem)
1261 return newItem;
1263 }
1264 return NULL;
1265}
#define NULL
Definition: types.h:112
static HTREEITEM BrsFolder_FindItemByPidl(browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
Definition: brsfolder.c:1240
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static ATOM item
Definition: dde.c:856
#define TVM_GETITEMW
Definition: commctrl.h:3486
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3264
#define TV_ITEMW
Definition: commctrl.h:3297
#define TVIF_HANDLE
Definition: commctrl.h:3270
#define TVGN_CHILD
Definition: commctrl.h:3456
#define TVIF_PARAM
Definition: commctrl.h:3268
#define TVGN_NEXT
Definition: commctrl.h:3453
#define TVM_GETNEXTITEM
Definition: commctrl.h:3449
HRESULT hr
Definition: shlfolder.c:183
LPITEMIDLIST lpifq
Definition: brsfolder.c:75
HTREEITEM hItem
Definition: treelist.h:37
LONG_PTR LPARAM
Definition: windef.h:208
#define HRESULT_CODE(hr)
Definition: winerror.h:76

Referenced by BrsFolder_FindItemByPidl(), and BrsFolder_OnChange().

◆ BrsFolder_NewFolder()

static HRESULT BrsFolder_NewFolder ( browse_info info)
static

Definition at line 895 of file brsfolder.c.

896{
897 DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
898 IShellFolder *desktop, *cur;
899#ifdef __REACTOS__
900 WCHAR wszNewFolder[25];
902#else
903 ISFHelper *sfhelper;
904#endif
906 HTREEITEM parent, added;
907 LPTV_ITEMDATA item_data;
908 LPITEMIDLIST new_item;
910 HRESULT hr;
911 int len;
912
913#ifdef __REACTOS__
914 hr = SHGetDesktopFolder(&desktop);
915 if(FAILED(hr))
916 return hr;
917
918 if (info->pidlRet)
919 {
920 hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur);
921 IShellFolder_Release(desktop);
922 if(FAILED(hr))
923 return hr;
924
925 hr = SHGetPathFromIDListW(info->pidlRet, path);
926 }
927 else
928 {
929 cur = desktop;
931 }
932 if(FAILED(hr))
933 return hr;
934
935 if (!LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, _countof(wszNewFolder)))
936 return E_FAIL;
937
938 if (!PathYetAnotherMakeUniqueName(name, path, NULL, wszNewFolder))
939 return E_FAIL;
940
941 len = strlenW(path);
942 if(len<MAX_PATH && name[len] == L'\\')
943 len++;
944#else
945 if(!info->pidlRet) {
946 ERR("Make new folder button should be disabled\n");
947 return E_FAIL;
948 }
949
950 /* Create new directory */
951 hr = SHGetDesktopFolder(&desktop);
952 if(FAILED(hr))
953 return hr;
954
955 hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur);
956 IShellFolder_Release(desktop);
957 if(FAILED(hr))
958 return hr;
959
960 hr = IShellFolder_QueryInterface(cur, &IID_ISFHelper, (void**)&sfhelper);
961 if(FAILED(hr))
962 return hr;
963
964 if(!SHGetPathFromIDListW(info->pidlRet, name)) {
965 hr = E_FAIL;
966 goto cleanup;
967 }
968
969 len = strlenW(name);
970 if(len<MAX_PATH)
971 name[len++] = '\\';
972 hr = ISFHelper_GetUniqueName(sfhelper, &name[len], MAX_PATH-len);
973 ISFHelper_Release(sfhelper);
974 if(FAILED(hr))
975 goto cleanup;
976#endif
977
978 hr = E_FAIL;
980 goto cleanup;
981
982 /* Update parent of newly created directory */
984 if(!parent)
985 goto cleanup;
986
988
989 memset(&item, 0, sizeof(TVITEMW));
991 item.hItem = parent;
992 SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
993 item_data = (LPTV_ITEMDATA)item.lParam;
994 if(!item_data)
995 goto cleanup;
996
997 if(item_data->pEnumIL)
998 IEnumIDList_Release(item_data->pEnumIL);
999 hr = IShellFolder_EnumObjects(cur, info->hwndTreeView, flags, &item_data->pEnumIL);
1000 if(FAILED(hr))
1001 goto cleanup;
1002
1003 /* Update treeview */
1004 if(!(item.state&TVIS_EXPANDEDONCE)) {
1005 item.mask = TVIF_STATE;
1006 item.state = TVIS_EXPANDEDONCE;
1007 item.stateMask = TVIS_EXPANDEDONCE;
1008 SendMessageW(info->hwndTreeView, TVM_SETITEMW, 0, (LPARAM)&item);
1009 }
1010
1011 hr = IShellFolder_ParseDisplayName(cur, NULL, NULL, name+len, NULL, &new_item, NULL);
1012 if(FAILED(hr))
1013 goto cleanup;
1014
1015 added = InsertTreeViewItem(info, cur, new_item, item_data->lpifq, NULL, parent);
1016 IShellFolder_Release(cur);
1017 SHFree(new_item);
1018
1020 return BrsFolder_Rename(info, added);
1021
1022cleanup:
1023 return hr;
1024}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define shell32_hInstance
#define ERR(fmt,...)
Definition: debug.h:110
#define E_FAIL
Definition: ddrawi.h:102
#define MAX_PATH
Definition: compat.h:34
static void cleanup(void)
Definition: main.c:1335
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
struct tagTV_ITEMDATA * LPTV_ITEMDATA
static DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
Definition: brsfolder.c:121
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
Definition: brsfolder.c:375
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
Definition: brsfolder.c:640
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2589
BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR shortname, LPCWSTR longname)
Definition: shellpath.c:699
r parent
Definition: btrfs.c:3010
#define IDS_NEWFOLDER
FxCollectionEntry * cur
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
#define L(x)
Definition: ntvdm.h:50
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1353
#define TVM_SETITEMW
Definition: commctrl.h:3493
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3285
#define TVE_EXPAND
Definition: commctrl.h:3423
#define TVM_SORTCHILDREN
Definition: commctrl.h:3541
#define TVGN_CARET
Definition: commctrl.h:3461
#define TVM_EXPAND
Definition: commctrl.h:3419
#define TVIF_STATE
Definition: commctrl.h:3269
#define strlenW(s)
Definition: unicode.h:28
#define memset(x, y, z)
Definition: compat.h:39
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2173
@ SHGFP_TYPE_CURRENT
Definition: shlobj.h:2134
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define _countof(array)
Definition: sndvol32.h:68
Definition: name.c:39
IEnumIDList * pEnumIL
Definition: brsfolder.c:76
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by BrsFolder_OnCommand().

◆ BrsFolder_OnChange()

static LRESULT BrsFolder_OnChange ( browse_info info,
const LPCITEMIDLIST pidls,
LONG  event 
)
static

Definition at line 1267 of file brsfolder.c.

1268{
1269 BOOL ret = TRUE;
1270
1271 TRACE("(%p)->(%p, %p, 0x%08x)\n", info, pidls[0], pidls[1], event);
1272
1273 switch (event)
1274 {
1275 case SHCNE_RMDIR:
1276 case SHCNE_DELETE:
1277 {
1278 HTREEITEM handle_root = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_ROOT, 0);
1279 HTREEITEM handle_item = BrsFolder_FindItemByPidl(info, pidls[0], handle_root);
1280
1281 if (handle_item)
1282 SendMessageW(info->hwndTreeView, TVM_DELETEITEM, 0, (LPARAM)handle_item);
1283
1284 break;
1285 }
1286 }
1287 return ret;
1288}
struct _cl_event * event
Definition: glext.h:7739
#define TVM_DELETEITEM
Definition: commctrl.h:3414
#define TVGN_ROOT
Definition: commctrl.h:3452
#define SHCNE_RMDIR
Definition: shlobj.h:1879
#define SHCNE_DELETE
Definition: shlobj.h:1877
#define TRACE(s)
Definition: solgame.cpp:4
int ret

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnCommand()

static BOOL BrsFolder_OnCommand ( browse_info info,
UINT  id 
)
static

Definition at line 1026 of file brsfolder.c.

1027{
1028 LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
1029#ifdef __REACTOS__
1031#endif
1032
1033 switch (id)
1034 {
1035 case IDOK:
1036#ifdef __REACTOS__
1037 /* Get the text */
1039 StrTrimW(szPath, L" \t");
1040
1041 /* The original pidl is owned by the treeview and will be free'd. */
1043 {
1044 /* It's valid path */
1045 info->pidlRet = ILCreateFromPathW(szPath);
1046 }
1047 else
1048 {
1049 info->pidlRet = ILClone(info->pidlRet);
1050 }
1051#endif
1052 if (info->pidlRet == NULL) /* A null pidl would mean a cancel */
1053 info->pidlRet = _ILCreateDesktop();
1054 pdump( info->pidlRet );
1055 if (lpBrowseInfo->pszDisplayName)
1056#ifdef __REACTOS__
1057 {
1058 SHFILEINFOW fileInfo = { NULL };
1059 lpBrowseInfo->pszDisplayName[0] = UNICODE_NULL;
1060 if (SHGetFileInfoW((LPCWSTR)info->pidlRet, 0, &fileInfo, sizeof(fileInfo),
1062 {
1063 lstrcpynW(lpBrowseInfo->pszDisplayName, fileInfo.szDisplayName, MAX_PATH);
1064 }
1065 }
1066#else
1067 SHGetPathFromIDListW( info->pidlRet, lpBrowseInfo->pszDisplayName );
1068#endif
1069 EndDialog( info->hWnd, 1 );
1070 return TRUE;
1071
1072 case IDCANCEL:
1073 EndDialog( info->hWnd, 0 );
1074 return TRUE;
1075
1078 return TRUE;
1079 }
1080 return FALSE;
1081}
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:311
#define lstrcpynW
Definition: compat.h:738
static HRESULT BrsFolder_NewFolder(browse_info *info)
Definition: brsfolder.c:895
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1723
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1579
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1877
LPCWSTR szPath
Definition: env.c:37
#define UNICODE_NULL
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1646
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:995
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:415
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:166
#define SHGFI_PIDL
Definition: shellapi.h:180
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:434
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:375
LPWSTR pszDisplayName
Definition: shlobj.h:1195
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define IDCANCEL
Definition: winuser.h:831
#define IDOK
Definition: winuser.h:830
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnCreate()

static BOOL BrsFolder_OnCreate ( HWND  hWnd,
browse_info info 
)
static

Definition at line 771 of file brsfolder.c.

772{
773 LPITEMIDLIST computer_pidl;
775 LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
776
777 info->hWnd = hWnd;
778 SetPropW( hWnd, L"__WINE_BRSFOLDERDLG_INFO", info );
779
780 if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
781 FIXME("flags BIF_NEWDIALOGSTYLE partially implemented\n");
782 if (lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS)
783 FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS);
784
785#ifdef __REACTOS__
786 if (lpBrowseInfo->ulFlags & BIF_USENEWUI)
787#else
788 if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
789#endif
790 {
791 RECT rcWnd;
792
793#ifdef __REACTOS__
794 /* Resize the treeview if there's not editbox */
795 if ((lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
796 && !(lpBrowseInfo->ulFlags & BIF_EDITBOX))
797 {
798 RECT rcEdit, rcTreeView;
799 INT cy;
802 cy = rcTreeView.top - rcEdit.top;
803 MapWindowPoints(NULL, hWnd, (LPPOINT)&rcTreeView, sizeof(RECT) / sizeof(POINT));
804 rcTreeView.top -= cy;
806 rcTreeView.left, rcTreeView.top,
807 rcTreeView.right - rcTreeView.left,
808 rcTreeView.bottom - rcTreeView.top, TRUE);
809 }
810 if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
812 else
813 info->layout = NULL;
814#else
816#endif
817
818 /* TODO: Windows allows shrinking the windows a bit */
819 GetWindowRect(hWnd, &rcWnd);
820 info->szMin.cx = rcWnd.right - rcWnd.left;
821 info->szMin.cy = rcWnd.bottom - rcWnd.top;
822 }
823 else
824 {
825 info->layout = NULL;
826 }
827
828 if (lpBrowseInfo->lpszTitle)
830 else
832
833 if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT)
834#ifdef __REACTOS__
835 || (lpBrowseInfo->ulFlags & BIF_USENEWUI))
836#else
837 || (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
838#endif
840
841 /* Hide "Make New Folder" Button? */
842 if ((lpBrowseInfo->ulFlags & BIF_NONEWFOLDERBUTTON)
843 || !(lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
845
846 /* Hide the editbox? */
847 if (!(lpBrowseInfo->ulFlags & BIF_EDITBOX))
848 {
851 }
852
854 if (info->hwndTreeView)
855 {
857
858#ifndef __REACTOS__
859 /* Resize the treeview if there's not editbox */
860 if ((lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
861 && !(lpBrowseInfo->ulFlags & BIF_EDITBOX))
862 {
863 RECT rc;
864 GetClientRect(info->hwndTreeView, &rc);
865 SetWindowPos(info->hwndTreeView, HWND_TOP, 0, 0,
866 rc.right, rc.bottom + 40, SWP_NOMOVE);
867 }
868#endif
869 }
870 else
871 ERR("treeview control missing!\n");
872
873 /* Register for change notifications */
874 SHGetFolderLocation(NULL, CSIDL_DESKTOP, NULL, 0, &computer_pidl);
875
876 ntreg.pidl = computer_pidl;
877 ntreg.fRecursive = TRUE;
878
880
881#ifdef __REACTOS__
882 SetFocus(info->hwndTreeView);
883#endif
884 browsefolder_callback( info->lpBrowseInfo, hWnd, BFFM_INITIALIZED, 0 );
885
886#ifdef __REACTOS__
889 return TRUE;
890#else
891 return TRUE;
892#endif
893}
#define FIXME(fmt,...)
Definition: debug.h:111
EXTERN_C ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, INT fSources, LONG wEventMask, UINT uMsg, INT cItems, SHChangeNotifyEntry *lpItems)
#define LAYOUT_INFO_COUNT
Definition: brsfolder.c:106
static const LAYOUT_INFO g_layout_info[]
Definition: brsfolder.c:87
#define SHV_CHANGE_NOTIFY
Definition: brsfolder.c:49
static void InitializeTreeView(browse_info *info)
Definition: brsfolder.c:207
static LAYOUT_DATA * LayoutInit(HWND hwnd, const LAYOUT_INFO *layout_info, int layout_count)
Definition: brsfolder.c:135
static void browsefolder_callback(LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
Definition: brsfolder.c:126
#define SUPPORTEDFLAGS
Definition: brsfolder.c:108
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3124
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define BIF_USENEWUI
Definition: shlobj.h:1217
#define CSIDL_DESKTOP
Definition: shlobj.h:2158
#define BFFM_INITIALIZED
Definition: shlobj.h:1229
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1920
#define SHCNE_ALLEVENTS
Definition: shlobj.h:1899
#define BIF_EDITBOX
Definition: shlobj.h:1214
HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
Definition: autocomp.cpp:191
#define SHACF_FILESYSTEM
Definition: shlwapi.h:1912
#define SHACF_URLHISTORY
Definition: shlwapi.h:1913
#define SHACF_FILESYS_ONLY
Definition: shlwapi.h:1917
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:438
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:436
#define IDC_BROWSE_FOR_FOLDER_TITLE
Definition: shresdef.h:437
#define IDC_BROWSE_FOR_FOLDER_FOLDER
Definition: shresdef.h:435
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1871
LPCWSTR lpszTitle
Definition: shlobj.h:1196
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
#define SW_HIDE
Definition: winuser.h:768
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1244
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define HWND_TOP
Definition: winuser.h:1207
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnDestroy()

static INT BrsFolder_OnDestroy ( browse_info info)
static

Definition at line 1222 of file brsfolder.c.

1223{
1224 if (info->layout)
1225 {
1226#ifdef __REACTOS__
1227 LayoutDestroy(info->layout);
1228#else
1229 SHFree(info->layout);
1230#endif
1231 info->layout = NULL;
1232 }
1233
1235
1236 return 0;
1237}
EXTERN_C BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)
static __inline void LayoutDestroy(LAYOUT_DATA *pData)
Definition: layout.h:251

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnNotify()

static LRESULT BrsFolder_OnNotify ( browse_info info,
UINT  CtlID,
LPNMHDR  lpnmh 
)
static

Definition at line 732 of file brsfolder.c.

733{
734 NMTREEVIEWW *pnmtv = (NMTREEVIEWW *)lpnmh;
735
736 TRACE("%p %x %p msg=%x\n", info, CtlID, lpnmh, pnmtv->hdr.code);
737
739 return 0;
740
741 switch (pnmtv->hdr.code)
742 {
743 case TVN_DELETEITEMA:
744 case TVN_DELETEITEMW:
745 return BrsFolder_Treeview_Delete( info, pnmtv );
746
749 return BrsFolder_Treeview_Expand( info, pnmtv );
750
751 case TVN_SELCHANGEDA:
752 case TVN_SELCHANGEDW:
753 return BrsFolder_Treeview_Changed( info, pnmtv );
754
758
759 case TVN_KEYDOWN:
761
762 default:
763 WARN("unhandled (%d)\n", pnmtv->hdr.code);
764 break;
765 }
766
767 return 0;
768}
#define WARN(fmt,...)
Definition: debug.h:112
static LRESULT BrsFolder_Treeview_Expand(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:548
static HRESULT BrsFolder_Treeview_Changed(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:583
static LRESULT BrsFolder_Treeview_Delete(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:533
static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv)
Definition: brsfolder.c:600
static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydown)
Definition: brsfolder.c:681
#define TVN_ENDLABELEDITA
Definition: commctrl.h:3711
#define TVN_KEYDOWN
Definition: commctrl.h:3713
#define TVN_ITEMEXPANDINGA
Definition: commctrl.h:3699
#define TVN_SELCHANGEDW
Definition: commctrl.h:3648
#define TVN_DELETEITEMA
Definition: commctrl.h:3707
#define TVN_ITEMEXPANDINGW
Definition: commctrl.h:3700
#define TVN_SELCHANGEDA
Definition: commctrl.h:3647
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3712
#define TVN_DELETEITEMW
Definition: commctrl.h:3708
UINT_PTR idFrom
Definition: winuser.h:3158
UINT code
Definition: winuser.h:3159

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnSetExpanded()

static BOOL BrsFolder_OnSetExpanded ( browse_info info,
LPVOID  selection,
BOOL  is_str,
HTREEITEM pItem 
)
static

Definition at line 1083 of file brsfolder.c.

1085{
1086 LPITEMIDLIST pidlSelection = selection;
1087 LPCITEMIDLIST pidlCurrent, pidlRoot;
1089 BOOL bResult = FALSE;
1090
1091 memset(&item, 0, sizeof(item));
1092
1093 /* If 'selection' is a string, convert to a Shell ID List. */
1094 if (is_str) {
1095 IShellFolder *psfDesktop;
1096 HRESULT hr;
1097
1098 hr = SHGetDesktopFolder(&psfDesktop);
1099 if (FAILED(hr))
1100 goto done;
1101
1102 hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL,
1103 selection, NULL, &pidlSelection, NULL);
1104 IShellFolder_Release(psfDesktop);
1105 if (FAILED(hr))
1106 goto done;
1107 }
1108#ifdef __REACTOS__
1109 if (_ILIsDesktop(pidlSelection))
1110 {
1111 item.hItem = TVI_ROOT;
1112 bResult = TRUE;
1113 goto done;
1114 }
1115#endif
1116
1117 /* Move pidlCurrent behind the SHITEMIDs in pidlSelection, which are the root of
1118 * the sub-tree currently displayed. */
1119 pidlRoot = info->lpBrowseInfo->pidlRoot;
1120 pidlCurrent = pidlSelection;
1121 while (!_ILIsEmpty(pidlRoot) && _ILIsEqualSimple(pidlRoot, pidlCurrent)) {
1122 pidlRoot = ILGetNext(pidlRoot);
1123 pidlCurrent = ILGetNext(pidlCurrent);
1124 }
1125
1126 /* The given ID List is not part of the SHBrowseForFolder's current sub-tree. */
1127 if (!_ILIsEmpty(pidlRoot))
1128 goto done;
1129
1130 /* Initialize item to point to the first child of the root folder. */
1131 item.mask = TVIF_PARAM;
1132 item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_ROOT, 0);
1133
1134 if (item.hItem)
1135 item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CHILD,
1136 (LPARAM)item.hItem);
1137
1138 /* Walk the tree along the nodes corresponding to the remaining ITEMIDLIST */
1139 while (item.hItem && !_ILIsEmpty(pidlCurrent)) {
1140 LPTV_ITEMDATA pItemData;
1141
1142 SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
1143 pItemData = (LPTV_ITEMDATA)item.lParam;
1144
1145 if (_ILIsEqualSimple(pItemData->lpi, pidlCurrent)) {
1146 pidlCurrent = ILGetNext(pidlCurrent);
1147 if (!_ILIsEmpty(pidlCurrent)) {
1148 /* Only expand current node and move on to its first child,
1149 * if we didn't already reach the last SHITEMID */
1150 SendMessageW(info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)item.hItem);
1151 item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CHILD,
1152 (LPARAM)item.hItem);
1153 }
1154 } else {
1155 item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_NEXT,
1156 (LPARAM)item.hItem);
1157 }
1158 }
1159
1160 if (_ILIsEmpty(pidlCurrent) && item.hItem)
1161 bResult = TRUE;
1162
1163done:
1164 if (pidlSelection && pidlSelection != selection)
1165 ILFree(pidlSelection);
1166
1167 if (pItem)
1168 *pItem = item.hItem;
1169
1170 return bResult;
1171}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
int selection
Definition: ctm.c:92
if(dx< 0)
Definition: linetemp.h:194
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:938
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:864
static BOOL _ILIsEqualSimple(LPCITEMIDLIST pidlA, LPCITEMIDLIST pidlB)
Definition: pidl.h:251
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:257
#define TVI_ROOT
Definition: commctrl.h:3368

Referenced by BrsFolder_OnSetSelectionW(), and BrsFolderDlgProc().

◆ BrsFolder_OnSetSelectionA()

static BOOL BrsFolder_OnSetSelectionA ( browse_info info,
LPVOID  selection,
BOOL  is_str 
)
static

Definition at line 1185 of file brsfolder.c.

1185 {
1186 LPWSTR selectionW = NULL;
1187 BOOL result = FALSE;
1188 int length;
1189
1190 if (!is_str)
1191 return BrsFolder_OnSetSelectionW(info, selection, is_str);
1192
1193 if ((length = MultiByteToWideChar(CP_ACP, 0, selection, -1, NULL, 0)) &&
1194 (selectionW = HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR))) &&
1195 MultiByteToWideChar(CP_ACP, 0, selection, -1, selectionW, length))
1196 {
1197 result = BrsFolder_OnSetSelectionW(info, selectionW, is_str);
1198 }
1199
1200 HeapFree(GetProcessHeap(), 0, selectionW);
1201 return result;
1202}
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
static BOOL BrsFolder_OnSetSelectionW(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1173
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint64EXT * result
Definition: glext.h:11304
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnSetSelectionW()

static BOOL BrsFolder_OnSetSelectionW ( browse_info info,
LPVOID  selection,
BOOL  is_str 
)
static

Definition at line 1173 of file brsfolder.c.

1173 {
1175 BOOL bResult;
1176
1177 if (!selection) return FALSE;
1178
1179 bResult = BrsFolder_OnSetExpanded(info, selection, is_str, &hItem);
1180 if (bResult)
1182 return bResult;
1183}
static BOOL BrsFolder_OnSetExpanded(browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem)
Definition: brsfolder.c:1083
#define TVM_SELECTITEM
Definition: commctrl.h:3478

Referenced by BrsFolder_OnSetSelectionA(), and BrsFolderDlgProc().

◆ BrsFolder_OnWindowPosChanging()

static LRESULT BrsFolder_OnWindowPosChanging ( browse_info info,
WINDOWPOS pos 
)
static

Definition at line 1205 of file brsfolder.c.

1206{
1207#ifdef __REACTOS__
1208 if ((info->lpBrowseInfo->ulFlags & BIF_USENEWUI) && !(pos->flags & SWP_NOSIZE))
1209#else
1210 if ((info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE) && !(pos->flags & SWP_NOSIZE))
1211#endif
1212 {
1213 if (pos->cx < info->szMin.cx)
1214 pos->cx = info->szMin.cx;
1215 if (pos->cy < info->szMin.cy)
1216 pos->cy = info->szMin.cy;
1217 }
1218 return 0;
1219}
#define SWP_NOSIZE
Definition: winuser.h:1245

Referenced by BrsFolderDlgProc().

◆ BrsFolder_Rename()

static HRESULT BrsFolder_Rename ( browse_info info,
HTREEITEM  rename 
)
static

Definition at line 640 of file brsfolder.c.

641{
643 SendMessageW(info->hwndTreeView, TVM_EDITLABELW, 0, (LPARAM)rename);
644 return S_OK;
645}
#define S_OK
Definition: intsafe.h:52
#define TVM_EDITLABELW
Definition: commctrl.h:3500
_Check_return_ int __cdecl rename(_In_z_ const char *_OldFilename, _In_z_ const char *_NewFilename)

Referenced by BrsFolder_NewFolder(), and BrsFolder_Treeview_Keydown().

◆ BrsFolder_Treeview_Changed()

static HRESULT BrsFolder_Treeview_Changed ( browse_info info,
NMTREEVIEWW pnmtv 
)
static

Definition at line 583 of file brsfolder.c.

584{
585 LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
587
588 ILFree(info->pidlRet);
589 info->pidlRet = ILClone(lptvid->lpifq);
590
591 if (GetName(lptvid->lpsfParent, lptvid->lpi, SHGDN_NORMAL, name))
593
594 browsefolder_callback( info->lpBrowseInfo, info->hWnd, BFFM_SELCHANGED,
595 (LPARAM)info->pidlRet );
597 return S_OK;
598}
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
Definition: brsfolder.c:345
static void BrsFolder_CheckValidSelection(browse_info *info, LPTV_ITEMDATA lptvid)
Definition: brsfolder.c:497
#define BFFM_SELCHANGED
Definition: shlobj.h:1230
TVITEMW itemNew
Definition: commctrl.h:3638
LPARAM lParam
Definition: commctrl.h:3325

Referenced by BrsFolder_OnNotify(), and BrsFolder_Treeview_Rename().

◆ BrsFolder_Treeview_Delete()

static LRESULT BrsFolder_Treeview_Delete ( browse_info info,
NMTREEVIEWW pnmtv 
)
static

Definition at line 533 of file brsfolder.c.

534{
535 LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA)pnmtv->itemOld.lParam;
536
537 TRACE("TVN_DELETEITEMA/W %p\n", lptvid);
538
539 IShellFolder_Release(lptvid->lpsfParent);
540 if (lptvid->pEnumIL)
541 IEnumIDList_Release(lptvid->pEnumIL);
542 SHFree(lptvid->lpi);
543 SHFree(lptvid->lpifq);
544 SHFree(lptvid);
545 return 0;
546}
TVITEMW itemOld
Definition: commctrl.h:3637

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Expand()

static LRESULT BrsFolder_Treeview_Expand ( browse_info info,
NMTREEVIEWW pnmtv 
)
static

Definition at line 548 of file brsfolder.c.

549{
550 IShellFolder *lpsf2 = NULL;
551 LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
552 HRESULT r;
553
554 TRACE("TVN_ITEMEXPANDINGA/W\n");
555
556 if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))
557 return 0;
558
559 if (!_ILIsEmpty(lptvid->lpi)) {
560 r = IShellFolder_BindToObject( lptvid->lpsfParent, lptvid->lpi, 0,
561 &IID_IShellFolder, (void**)&lpsf2 );
562 } else {
563 lpsf2 = lptvid->lpsfParent;
564 IShellFolder_AddRef(lpsf2);
565 r = S_OK;
566 }
567
568 if (SUCCEEDED(r))
569 {
570 FillTreeView( info, lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem, lptvid->pEnumIL);
571 IShellFolder_Release( lpsf2 );
572 }
573
574 /* My Computer is already sorted and trying to do a simple text
575 * sort will only mess things up */
576 if (!_ILIsMyComputer(lptvid->lpi))
577 SendMessageW( info->hwndTreeView, TVM_SORTCHILDREN,
578 FALSE, (LPARAM)pnmtv->itemNew.hItem );
579
580 return 0;
581}
static void FillTreeView(browse_info *, LPSHELLFOLDER, LPITEMIDLIST, HTREEITEM, IEnumIDList *)
BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
Definition: pidl.c:1975
HTREEITEM hItem
Definition: commctrl.h:3317
UINT state
Definition: commctrl.h:3318

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Keydown()

static LRESULT BrsFolder_Treeview_Keydown ( browse_info info,
LPNMTVKEYDOWN  keydown 
)
static

Definition at line 681 of file brsfolder.c.

682{
683 HTREEITEM selected_item;
684
685 /* Old dialog doesn't support those advanced features */
686#ifdef __REACTOS__
687 if (!(info->lpBrowseInfo->ulFlags & BIF_USENEWUI))
688#else
689 if (!(info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
690#endif
691 return 0;
692
693 selected_item = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);
694
695 switch (keydown->wVKey)
696 {
697 case VK_F2:
698 BrsFolder_Rename(info, selected_item);
699 break;
700 case VK_DELETE:
701 {
702#ifdef __REACTOS__
703 BrsFolder_Delete(info, selected_item);
704#else
705 const ITEMIDLIST *item_id;
706 ISFHelper *psfhlp;
707 HRESULT hr;
709 TV_ITEMDATA *item_data;
710
711 item.mask = TVIF_PARAM;
713 item.hItem = selected_item;
714 SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
715 item_data = (TV_ITEMDATA *)item.lParam;
716 item_id = item_data->lpi;
717
718 hr = IShellFolder_QueryInterface(item_data->lpsfParent, &IID_ISFHelper, (void**)&psfhlp);
719 if(FAILED(hr))
720 return 0;
721
722 /* perform the item deletion - tree view gets updated over shell notification */
723 ISFHelper_DeleteItems(psfhlp, 1, &item_id);
724 ISFHelper_Release(psfhlp);
725#endif
726 }
727 break;
728 }
729 return 0;
730}
#define VK_DELETE
Definition: winuser.h:2233
#define VK_F2
Definition: winuser.h:2256

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Rename()

static LRESULT BrsFolder_Treeview_Rename ( browse_info info,
NMTVDISPINFOW pnmtv 
)
static

Definition at line 600 of file brsfolder.c.

601{
602 LPTV_ITEMDATA item_data;
603 WCHAR old_path[MAX_PATH], new_path[MAX_PATH], *p;
604 NMTREEVIEWW nmtv;
606
607 if(!pnmtv->item.pszText)
608 return 0;
609
611 item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);
612 SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
613 item_data = (LPTV_ITEMDATA)item.lParam;
614
615 SHGetPathFromIDListW(item_data->lpifq, old_path);
616 if(!(p = strrchrW(old_path, '\\')))
617 return 0;
618 p = new_path+(p-old_path+1);
619 memcpy(new_path, old_path, (p-new_path)*sizeof(WCHAR));
620 strcpyW(p, pnmtv->item.pszText);
621
622 if(!MoveFileW(old_path, new_path))
623 return 0;
624
625 SHFree(item_data->lpifq);
626 SHFree(item_data->lpi);
627 item_data->lpifq = SHSimpleIDListFromPathW(new_path);
628 IShellFolder_ParseDisplayName(item_data->lpsfParent, NULL, NULL,
629 pnmtv->item.pszText, NULL, &item_data->lpi, NULL);
630
632 item.pszText = pnmtv->item.pszText;
633 SendMessageW(info->hwndTreeView, TVM_SETITEMW, 0, (LPARAM)&item);
634
635 nmtv.itemNew.lParam = item.lParam;
637 return 0;
638}
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1104
GLfloat GLfloat p
Definition: glext.h:8902
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW(LPCWSTR lpszPath)
Definition: pidl.c:1133
#define TVIF_TEXT
Definition: commctrl.h:3266
#define strrchrW(s, c)
Definition: unicode.h:35
#define strcpyW(d, s)
Definition: unicode.h:29
TVITEMW item
Definition: commctrl.h:3672
LPWSTR pszText
Definition: commctrl.h:3320

Referenced by BrsFolder_OnNotify().

◆ BrsFolderDlgProc()

static INT_PTR CALLBACK BrsFolderDlgProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1293 of file brsfolder.c.

1295{
1297
1298 TRACE("hwnd=%p msg=%04x 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam );
1299
1300 if (msg == WM_INITDIALOG)
1302
1303 info = GetPropW( hWnd, L"__WINE_BRSFOLDERDLG_INFO" );
1304
1305 switch (msg)
1306 {
1307 case WM_NOTIFY:
1309
1310 case WM_COMMAND:
1311 return BrsFolder_OnCommand( info, wParam );
1312
1313#ifdef __REACTOS__
1314 case WM_GETMINMAXINFO:
1315 ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = info->szMin.cx;
1316 ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = info->szMin.cy;
1317 return 0;
1318#else /* This is a buggy way (resize on title bar) */
1321#endif
1322
1323 case WM_SIZE:
1324 if (info->layout) /* new style dialogs */
1326 return 0;
1327
1329 TRACE("Set status %s\n", debugstr_a((LPSTR)lParam));
1331 break;
1332
1334 TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam));
1336 break;
1337
1338 case BFFM_ENABLEOK:
1339 TRACE("Enable %ld\n", lParam);
1341 break;
1342
1343 case BFFM_SETOKTEXT: /* unicode only */
1344 TRACE("Set OK text %s\n", debugstr_w((LPWSTR)lParam));
1346 break;
1347
1348 case BFFM_SETSELECTIONA:
1350
1351 case BFFM_SETSELECTIONW:
1353
1354 case BFFM_SETEXPANDED: /* unicode only */
1356
1357 case SHV_CHANGE_NOTIFY:
1359
1360 case WM_DESTROY:
1361 return BrsFolder_OnDestroy(info);
1362 }
1363 return FALSE;
1364}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static BOOL BrsFolder_OnCreate(HWND hWnd, browse_info *info)
Definition: brsfolder.c:771
static INT BrsFolder_OnDestroy(browse_info *info)
Definition: brsfolder.c:1222
static LRESULT BrsFolder_OnChange(browse_info *info, const LPCITEMIDLIST *pidls, LONG event)
Definition: brsfolder.c:1267
static LRESULT BrsFolder_OnWindowPosChanging(browse_info *info, WINDOWPOS *pos)
Definition: brsfolder.c:1205
static LRESULT BrsFolder_OnNotify(browse_info *info, UINT CtlID, LPNMHDR lpnmh)
Definition: brsfolder.c:732
static BOOL BrsFolder_OnSetSelectionA(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1185
static void LayoutUpdate(HWND hwnd, LAYOUT_DATA *data, const LAYOUT_INFO *layout_info, int layout_count)
Definition: brsfolder.c:164
static BOOL BrsFolder_OnCommand(browse_info *info, UINT id)
Definition: brsfolder.c:1026
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
#define WM_NOTIFY
Definition: richedit.h:61
#define BFFM_SETOKTEXT
Definition: shlobj.h:1241
#define BFFM_SETEXPANDED
Definition: shlobj.h:1242
#define BFFM_SETSELECTIONW
Definition: shlobj.h:1239
#define BFFM_SETSTATUSTEXTW
Definition: shlobj.h:1240
#define BFFM_SETSTATUSTEXTA
Definition: shlobj.h:1236
#define BFFM_SETSELECTIONA
Definition: shlobj.h:1238
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1661
#define WM_SIZE
Definition: winuser.h:1611
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
#define WM_GETMINMAXINFO
Definition: winuser.h:1640
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
struct tagMINMAXINFO * LPMINMAXINFO
#define WM_DESTROY
Definition: winuser.h:1609
char * LPSTR
Definition: xmlstorage.h:182

Referenced by SHBrowseForFolderW().

◆ FillTreeView() [1/2]

static void FillTreeView ( browse_info ,
LPSHELLFOLDER  ,
LPITEMIDLIST  ,
HTREEITEM  ,
IEnumIDList  
)
static

◆ FillTreeView() [2/2]

static void FillTreeView ( browse_info info,
IShellFolder lpsf,
LPITEMIDLIST  pidl,
HTREEITEM  hParent,
IEnumIDList lpe 
)
static

Definition at line 427 of file brsfolder.c.

429{
430 LPITEMIDLIST pidlTemp = 0;
431 ULONG ulFetched;
432 HRESULT hr;
433 HWND hwnd = GetParent( info->hwndTreeView );
434
435 TRACE("%p %p %p %p\n",lpsf, pidl, hParent, lpe);
436
437 /* No IEnumIDList -> No children */
438 if (!lpe) return;
439
440 SetCapture( hwnd );
442
443 while (S_OK == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))
444 {
445 ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER;
446 IEnumIDList* pEnumIL = NULL;
447 IShellFolder* pSFChild = NULL;
448 IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulAttrs);
449 if (ulAttrs & SFGAO_FOLDER)
450 {
451 hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild);
452 if (SUCCEEDED(hr))
453 {
454 DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
455 hr = IShellFolder_EnumObjects(pSFChild, hwnd, flags, &pEnumIL);
456 if (hr == S_OK)
457 {
458 if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) ||
459 FAILED(IEnumIDList_Reset(pEnumIL)))
460 {
461 IEnumIDList_Release(pEnumIL);
462 pEnumIL = NULL;
463 }
464 }
465 IShellFolder_Release(pSFChild);
466 }
467 }
468#ifdef __REACTOS__
469 if (ulAttrs != (ulAttrs & SFGAO_FOLDER))
470 {
471 if (!InsertTreeViewItem(info, lpsf, pidlTemp, pidl, pEnumIL, hParent))
472 goto done;
473 }
474#else
475
476 if (!InsertTreeViewItem(info, lpsf, pidlTemp, pidl, pEnumIL, hParent))
477 goto done;
478#endif
479 SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */
480 pidlTemp=NULL;
481 }
482
483done:
486 SHFree(pidlTemp);
487}
uint32_t ULONG
Definition: typedefs.h:59
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
HWND WINAPI SetCapture(_In_ HWND hWnd)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define IDC_ARROW
Definition: winuser.h:687
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2105
HWND WINAPI GetParent(_In_ HWND)
#define IDC_WAIT
Definition: winuser.h:689
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2090

◆ GetIcon()

static int GetIcon ( LPCITEMIDLIST  lpi,
UINT  uFlags 
)
static

Definition at line 300 of file brsfolder.c.

301{
302 SHFILEINFOW sfi;
303 SHGetFileInfoW((LPCWSTR)lpi, 0 ,&sfi, sizeof(SHFILEINFOW), uFlags);
304 return sfi.iIcon;
305}
UINT uFlags
Definition: api.c:59

Referenced by DECLARE_INTERFACE_(), and GetNormalAndSelectedIcons().

◆ GetName()

static BOOL GetName ( LPSHELLFOLDER  lpsf,
LPCITEMIDLIST  lpi,
DWORD  dwFlags,
LPWSTR  lpFriendlyName 
)
static

Definition at line 345 of file brsfolder.c.

346{
348 STRRET str;
349
350 TRACE("%p %p %x %p\n", lpsf, lpi, dwFlags, lpFriendlyName);
351 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(lpsf, lpi, dwFlags, &str)))
352 bSuccess = StrRetToStrNW(lpFriendlyName, MAX_PATH, &str, lpi);
353 else
354 bSuccess = FALSE;
355
356 TRACE("-- %s\n", debugstr_w(lpFriendlyName));
357 return bSuccess;
358}
static BOOLEAN bSuccess
Definition: drive.cpp:433
const WCHAR * str
BOOL WINAPI StrRetToStrNW(LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
Definition: shellstring.c:85
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by BrsFolder_Treeview_Changed(), and InsertTreeViewItem().

◆ GetNormalAndSelectedIcons()

static void GetNormalAndSelectedIcons ( LPITEMIDLIST  lpifq,
LPTVITEMW  lpTV_ITEM 
)
static

Definition at line 307 of file brsfolder.c.

308{
309 LPITEMIDLIST pidlDesktop = NULL;
310 DWORD flags;
311
312 TRACE("%p %p\n",lpifq, lpTV_ITEM);
313
314 if (!lpifq)
315 {
316 pidlDesktop = _ILCreateDesktop();
317 lpifq = pidlDesktop;
318 }
319
321 lpTV_ITEM->iImage = GetIcon( lpifq, flags );
322
324 lpTV_ITEM->iSelectedImage = GetIcon( lpifq, flags );
325
326 if (pidlDesktop)
327 ILFree( pidlDesktop );
328}
static int GetIcon(LPCITEMIDLIST lpi, UINT uFlags)
Definition: brsfolder.c:300
#define SHGFI_OPENICON
Definition: shellapi.h:178
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:171
#define SHGFI_SMALLICON
Definition: shellapi.h:176
int iImage
Definition: commctrl.h:3322
int iSelectedImage
Definition: commctrl.h:3323

Referenced by InsertTreeViewItem().

◆ InitializeTreeView()

static void InitializeTreeView ( browse_info info)
static

Definition at line 207 of file brsfolder.c.

208{
209 LPITEMIDLIST pidlParent, pidlChild;
210 HIMAGELIST hImageList;
211 HRESULT hr;
212 IShellFolder *lpsfParent, *lpsfRoot;
213 IEnumIDList * pEnumChildren = NULL;
215 DWORD flags;
216 LPCITEMIDLIST root = info->lpBrowseInfo->pidlRoot;
217
218 TRACE("%p\n", info );
219
220 Shell_GetImageLists(NULL, &hImageList);
221
222 if (hImageList)
223 SendMessageW( info->hwndTreeView, TVM_SETIMAGELIST, 0, (LPARAM)hImageList );
224
225 /* We want to call InsertTreeViewItem down the code, in order to insert
226 * the root item of the treeview. Due to InsertTreeViewItem's signature,
227 * we need the following to do this:
228 *
229 * + An ITEMIDLIST corresponding to _the parent_ of root.
230 * + An ITEMIDLIST, which is a relative path from root's parent to root
231 * (containing a single SHITEMID).
232 * + An IShellFolder interface pointer of root's parent folder.
233 *
234 * If root is 'Desktop', then root's parent is also 'Desktop'.
235 */
236
237 pidlParent = ILClone(root);
238 ILRemoveLastID(pidlParent);
239 pidlChild = ILClone(ILFindLastID(root));
240
241 if (_ILIsDesktop(pidlParent)) {
242 hr = SHGetDesktopFolder(&lpsfParent);
243 } else {
244 IShellFolder *lpsfDesktop;
245 hr = SHGetDesktopFolder(&lpsfDesktop);
246 if (FAILED(hr)) {
247 WARN("SHGetDesktopFolder failed! hr = %08x\n", hr);
248 ILFree(pidlChild);
249 ILFree(pidlParent);
250 return;
251 }
252 hr = IShellFolder_BindToObject(lpsfDesktop, pidlParent, 0, &IID_IShellFolder, (LPVOID*)&lpsfParent);
253 IShellFolder_Release(lpsfDesktop);
254 }
255
256 if (FAILED(hr)) {
257 WARN("Could not bind to parent shell folder! hr = %08x\n", hr);
258 ILFree(pidlChild);
259 ILFree(pidlParent);
260 return;
261 }
262
263 if (!_ILIsEmpty(pidlChild)) {
264 hr = IShellFolder_BindToObject(lpsfParent, pidlChild, 0, &IID_IShellFolder, (LPVOID*)&lpsfRoot);
265 } else {
266 lpsfRoot = lpsfParent;
267 hr = IShellFolder_AddRef(lpsfParent);
268 }
269
270 if (FAILED(hr)) {
271 WARN("Could not bind to root shell folder! hr = %08x\n", hr);
272 IShellFolder_Release(lpsfParent);
273 ILFree(pidlChild);
274 ILFree(pidlParent);
275 return;
276 }
277
278 flags = BrowseFlagsToSHCONTF( info->lpBrowseInfo->ulFlags );
279 hr = IShellFolder_EnumObjects( lpsfRoot, info->hWnd, flags, &pEnumChildren );
280 if (FAILED(hr)) {
281 WARN("Could not get child iterator! hr = %08x\n", hr);
282 IShellFolder_Release(lpsfParent);
283 IShellFolder_Release(lpsfRoot);
284 ILFree(pidlChild);
285 ILFree(pidlParent);
286 return;
287 }
288
289 SendMessageW( info->hwndTreeView, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT );
290 item = InsertTreeViewItem( info, lpsfParent, pidlChild,
291 pidlParent, pEnumChildren, TVI_ROOT );
292 SendMessageW( info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)item );
293
294 ILFree(pidlChild);
295 ILFree(pidlParent);
296 IShellFolder_Release(lpsfRoot);
297 IShellFolder_Release(lpsfParent);
298}
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:683
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:198
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:221
#define TVM_SETIMAGELIST
Definition: commctrl.h:3446

Referenced by BrsFolder_OnCreate().

◆ InsertTreeViewItem()

static HTREEITEM InsertTreeViewItem ( browse_info info,
IShellFolder lpsf,
LPCITEMIDLIST  pidl,
LPCITEMIDLIST  pidlParent,
IEnumIDList pEnumIL,
HTREEITEM  hParent 
)
static

Definition at line 375 of file brsfolder.c.

378{
379 TVITEMW tvi;
380 TVINSERTSTRUCTW tvins;
381 WCHAR szBuff[MAX_PATH];
382 LPTV_ITEMDATA lptvid=0;
383
385
386 tvi.cChildren= pEnumIL ? 1 : 0;
387 tvi.mask |= TVIF_CHILDREN;
388
389 if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff))
390 return NULL;
391
392 lptvid = SHAlloc( sizeof(TV_ITEMDATA) );
393 if (!lptvid)
394 return NULL;
395
396 tvi.pszText = szBuff;
397 tvi.cchTextMax = MAX_PATH;
398 tvi.lParam = (LPARAM)lptvid;
399
400 IShellFolder_AddRef(lpsf);
401 lptvid->lpsfParent = lpsf;
402 lptvid->lpi = ILClone(pidl);
403 lptvid->lpifq = pidlParent ? ILCombine(pidlParent, pidl) : ILClone(pidl);
404 lptvid->pEnumIL = pEnumIL;
405 GetNormalAndSelectedIcons(lptvid->lpifq, &tvi);
406
407 tvins.u.item = tvi;
408 tvins.hInsertAfter = NULL;
409 tvins.hParent = hParent;
410
411 return TreeView_InsertItem( info->hwndTreeView, &tvins );
412}
static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
Definition: brsfolder.c:307
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:712
#define TVIF_IMAGE
Definition: commctrl.h:3267
#define TVIF_CHILDREN
Definition: commctrl.h:3272
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3412
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3271
HTREEITEM hParent
Definition: commctrl.h:3393
HTREEITEM hInsertAfter
Definition: commctrl.h:3394
UINT mask
Definition: commctrl.h:3316
int cchTextMax
Definition: commctrl.h:3321
int cChildren
Definition: commctrl.h:3324

Referenced by BrsFolder_NewFolder(), FillTreeView(), and InitializeTreeView().

◆ LayoutInit()

static LAYOUT_DATA * LayoutInit ( HWND  hwnd,
const LAYOUT_INFO layout_info,
int  layout_count 
)
static

Definition at line 135 of file brsfolder.c.

136{
138 RECT rcWnd;
139 int i;
140
141 GetClientRect(hwnd, &rcWnd);
142 data = SHAlloc(sizeof(LAYOUT_DATA)*layout_count);
143 for (i = 0; i < layout_count; i++)
144 {
145 RECT r;
146 HWND hItem = GetDlgItem(hwnd, layout_info[i].iItemId);
147
148 if (hItem == NULL)
149 ERR("Item %d not found\n", i);
152
153 data[i].left = r.left;
154 data[i].right = rcWnd.right - r.right;
155 data[i].width = r.right - r.left;
156
157 data[i].top = r.top;
158 data[i].bottom = rcWnd.bottom - r.bottom;
159 data[i].height = r.bottom - r.top;
160 }
161 return data;
162}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
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 HWND_DESKTOP
Definition: winuser.h:1209

Referenced by BrsFolder_OnCreate().

◆ LayoutUpdate()

static void LayoutUpdate ( HWND  hwnd,
LAYOUT_DATA data,
const LAYOUT_INFO layout_info,
int  layout_count 
)
static

Definition at line 164 of file brsfolder.c.

165{
166 RECT rcWnd;
167 int i;
168
169 GetClientRect(hwnd, &rcWnd);
170 for (i = 0; i < layout_count; i++)
171 {
172 RECT r;
173 HWND hItem = GetDlgItem(hwnd, layout_info[i].iItemId);
174
177
178 if (layout_info[i].dwAnchor & BF_RIGHT)
179 {
180 r.right = rcWnd.right - data[i].right;
181 if (!(layout_info[i].dwAnchor & BF_LEFT))
182 r.left = r.right - data[i].width;
183 }
184
185 if (layout_info[i].dwAnchor & BF_BOTTOM)
186 {
187 r.bottom = rcWnd.bottom - data[i].bottom;
188 if (!(layout_info[i].dwAnchor & BF_TOP))
189 r.top = r.bottom - data[i].height;
190 }
191
192 SetWindowPos(hItem, NULL, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER);
193 }
194}
#define BF_LEFT
Definition: winuser.h:454
#define BF_BOTTOM
Definition: winuser.h:457
#define BF_TOP
Definition: winuser.h:455
#define BF_RIGHT
Definition: winuser.h:456
#define SWP_NOZORDER
Definition: winuser.h:1247

Referenced by BrsFolderDlgProc().

◆ PIDLIsType()

static BOOL PIDLIsType ( LPCITEMIDLIST  pidl,
PIDLTYPE  type 
)
inlinestatic

Definition at line 489 of file brsfolder.c.

490{
492 if (!data)
493 return FALSE;
494 return (data->type == type);
495}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2231

Referenced by BrsFolder_CheckValidSelection().

◆ SHBrowseForFolderA()

LPITEMIDLIST WINAPI SHBrowseForFolderA ( LPBROWSEINFOA  lpbi)

Definition at line 1370 of file brsfolder.c.

1371{
1372 BROWSEINFOW bi;
1373 LPITEMIDLIST lpid;
1374 INT len;
1375 LPWSTR title;
1376
1377 TRACE("%p\n", lpbi);
1378
1379 bi.hwndOwner = lpbi->hwndOwner;
1380 bi.pidlRoot = lpbi->pidlRoot;
1381 if (lpbi->pszDisplayName)
1382 bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) );
1383 else
1384 bi.pszDisplayName = NULL;
1385
1386 if (lpbi->lpszTitle)
1387 {
1388 len = MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, NULL, 0 );
1389 title = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
1390 MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, title, len );
1391 }
1392 else
1393 title = NULL;
1394
1395 bi.lpszTitle = title;
1396 bi.ulFlags = lpbi->ulFlags;
1397 bi.lpfn = lpbi->lpfn;
1398 bi.lParam = lpbi->lParam;
1399 bi.iImage = lpbi->iImage;
1400 lpid = SHBrowseForFolderW( &bi );
1401 if (bi.pszDisplayName)
1402 {
1404 lpbi->pszDisplayName, MAX_PATH, 0, NULL);
1406 }
1408 lpbi->iImage = bi.iImage;
1409 return lpid;
1410}
#define WideCharToMultiByte
Definition: compat.h:111
LPITEMIDLIST WINAPI SHBrowseForFolderW(LPBROWSEINFOW lpbi)
Definition: brsfolder.c:1419
static char title[]
Definition: ps.c:92
LPCSTR lpszTitle
Definition: shlobj.h:1185
PCIDLIST_ABSOLUTE pidlRoot
Definition: shlobj.h:1183
BFFCALLBACK lpfn
Definition: shlobj.h:1187
HWND hwndOwner
Definition: shlobj.h:1182
LPSTR pszDisplayName
Definition: shlobj.h:1184
UINT ulFlags
Definition: shlobj.h:1186
LPARAM lParam
Definition: shlobj.h:1188
PCIDLIST_ABSOLUTE pidlRoot
Definition: shlobj.h:1194
HWND hwndOwner
Definition: shlobj.h:1193

Referenced by test_click_make_new_folder_button(), and test_selection().

◆ SHBrowseForFolderW()

LPITEMIDLIST WINAPI SHBrowseForFolderW ( LPBROWSEINFOW  lpbi)

Definition at line 1419 of file brsfolder.c.

1420{
1422 DWORD r;
1423 HRESULT hr;
1424#ifdef __REACTOS__
1425 WORD wDlgId;
1426#else
1427 const WCHAR * templateName;
1429#endif
1430
1431 info.hWnd = 0;
1432 info.pidlRet = NULL;
1433 info.lpBrowseInfo = lpbi;
1434 info.hwndTreeView = NULL;
1435
1436#ifdef __REACTOS__
1437 info.layout = NULL;
1438#else
1439 icex.dwSize = sizeof( icex );
1441 InitCommonControlsEx( &icex );
1442#endif
1443
1445
1446#ifdef __REACTOS__
1447 if (lpbi->ulFlags & BIF_USENEWUI)
1448#else
1449 if (lpbi->ulFlags & BIF_NEWDIALOGSTYLE)
1450#endif
1452 else
1453 wDlgId = IDD_BROWSE_FOR_FOLDER;
1456 if (SUCCEEDED(hr))
1458 if (!r)
1459 {
1460 ILFree(info.pidlRet);
1461 return NULL;
1462 }
1463
1464 return info.pidlRet;
1465}
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
static INT_PTR CALLBACK BrsFolderDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: brsfolder.c:1293
unsigned short WORD
Definition: ntddk_ex.h:93
#define ICC_TREEVIEW_CLASSES
Definition: commctrl.h:59
#define IDD_BROWSE_FOR_FOLDER_NEW
Definition: shresdef.h:432
#define IDD_BROWSE_FOR_FOLDER
Definition: shresdef.h:431
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by CBandSiteMenu::_CreateNewISFBand(), BtrfsSend::AddClone(), CShellDispatch::BrowseForFolder(), BtrfsSend::BrowseParent(), ChooseFolder(), CHSourceDlgProc(), FileExtractDialogWndProc(), CZipExtract::CExtractSettingsPage::OnBrowse(), SHBrowseForFolderA(), SHBrowseForFolderWrapW(), and WelcomeDlgProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ g_layout_info