shell32: Start implementing BIF_USENEWUI.

This commit is contained in:
Lei Zhang 2007-06-07 14:55:09 -07:00 committed by Alexandre Julliard
parent 4e27a7d81c
commit 7318ae2411
3 changed files with 69 additions and 2 deletions

View File

@ -18,6 +18,9 @@
* FIXME: * FIXME:
* - many memory leaks * - many memory leaks
* - many flags unimplemented * - many flags unimplemented
* - implement new dialog style "make new folder" button
* - implement editbox
* - implement new dialog style resizing
*/ */
#include <stdlib.h> #include <stdlib.h>
@ -56,6 +59,8 @@ typedef struct tagTV_ITEMDATA
BIF_BROWSEFORCOMPUTER | \ BIF_BROWSEFORCOMPUTER | \
BIF_RETURNFSANCESTORS | \ BIF_RETURNFSANCESTORS | \
BIF_RETURNONLYFSDIRS | \ BIF_RETURNONLYFSDIRS | \
BIF_NONEWFOLDERBUTTON | \
BIF_NEWDIALOGSTYLE | \
BIF_BROWSEINCLUDEFILES) BIF_BROWSEINCLUDEFILES)
static void FillTreeView(browse_info*, LPSHELLFOLDER, static void FillTreeView(browse_info*, LPSHELLFOLDER,
@ -494,6 +499,8 @@ static BOOL BrsFolder_OnCreate( HWND hWnd, browse_info *info )
info->hWnd = hWnd; info->hWnd = hWnd;
SetPropW( hWnd, szBrowseFolderInfo, info ); SetPropW( hWnd, szBrowseFolderInfo, info );
if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
FIXME("flags BIF_NEWDIALOGSTYLE partially implemented\n");
if (lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS) if (lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS)
FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS); FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS);
@ -502,12 +509,37 @@ static BOOL BrsFolder_OnCreate( HWND hWnd, browse_info *info )
else else
ShowWindow( GetDlgItem(hWnd, IDD_TITLE), SW_HIDE ); ShowWindow( GetDlgItem(hWnd, IDD_TITLE), SW_HIDE );
if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT)) if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT)
|| (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
ShowWindow( GetDlgItem(hWnd, IDD_STATUS), SW_HIDE ); ShowWindow( GetDlgItem(hWnd, IDD_STATUS), SW_HIDE );
/* Hide "Make New Folder" Button? */
if ((lpBrowseInfo->ulFlags & BIF_NONEWFOLDERBUTTON)
|| !(lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
ShowWindow( GetDlgItem(hWnd, IDD_MAKENEWFOLDER), SW_HIDE );
/* Hide the editbox? */
if (!(lpBrowseInfo->ulFlags & BIF_EDITBOX))
{
ShowWindow( GetDlgItem(hWnd, IDD_FOLDER), SW_HIDE );
ShowWindow( GetDlgItem(hWnd, IDD_FOLDERTEXT), SW_HIDE );
}
info->hwndTreeView = GetDlgItem( hWnd, IDD_TREEVIEW ); info->hwndTreeView = GetDlgItem( hWnd, IDD_TREEVIEW );
if (info->hwndTreeView) if (info->hwndTreeView)
{
InitializeTreeView( info ); InitializeTreeView( info );
/* Resize the treeview if there's not editbox */
if ((lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
&& !(lpBrowseInfo->ulFlags & BIF_EDITBOX))
{
RECT rc;
GetClientRect(info->hwndTreeView, &rc);
SetWindowPos(info->hwndTreeView, HWND_TOP, 0, 0,
rc.right, rc.bottom + 40, SWP_NOMOVE);
}
}
else else
ERR("treeview control missing!\n"); ERR("treeview control missing!\n");
@ -536,6 +568,10 @@ static BOOL BrsFolder_OnCommand( browse_info *info, UINT id )
case IDCANCEL: case IDCANCEL:
EndDialog( info->hWnd, 0 ); EndDialog( info->hWnd, 0 );
return TRUE; return TRUE;
case IDD_MAKENEWFOLDER:
FIXME("make new folder not implemented\n");
return TRUE;
} }
return FALSE; return FALSE;
} }
@ -703,6 +739,8 @@ static INT_PTR CALLBACK BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
static const WCHAR swBrowseTemplateName[] = { static const WCHAR swBrowseTemplateName[] = {
'S','H','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0}; 'S','H','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0};
static const WCHAR swNewBrowseTemplateName[] = {
'S','H','N','E','W','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0};
/************************************************************************* /*************************************************************************
* SHBrowseForFolderA [SHELL32.@] * SHBrowseForFolderA [SHELL32.@]
@ -765,6 +803,7 @@ LPITEMIDLIST WINAPI SHBrowseForFolderW (LPBROWSEINFOW lpbi)
browse_info info; browse_info info;
DWORD r; DWORD r;
HRESULT hr; HRESULT hr;
const WCHAR * templateName;
info.hWnd = 0; info.hWnd = 0;
info.pidlRet = NULL; info.pidlRet = NULL;
@ -772,7 +811,12 @@ LPITEMIDLIST WINAPI SHBrowseForFolderW (LPBROWSEINFOW lpbi)
info.hwndTreeView = NULL; info.hwndTreeView = NULL;
hr = OleInitialize(NULL); hr = OleInitialize(NULL);
r = DialogBoxParamW( shell32_hInstance, swBrowseTemplateName, lpbi->hwndOwner,
if (lpbi->ulFlags & BIF_NEWDIALOGSTYLE)
templateName = swNewBrowseTemplateName;
else
templateName = swBrowseTemplateName;
r = DialogBoxParamW( shell32_hInstance, templateName, lpbi->hwndOwner,
BrsFolderDlgProc, (LPARAM)&info ); BrsFolderDlgProc, (LPARAM)&info );
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
OleUninitialize(); OleUninitialize();

View File

@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "shresdef.h"
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
MENU_001 MENU DISCARDABLE MENU_001 MENU DISCARDABLE
@ -104,6 +106,24 @@ FONT 8, "MS Shell Dlg"
4, 40, 180, 120 4, 40, 180, 120
} }
SHNEWBRSFORFOLDER_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 15, 40, 218, 196
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU | DS_MODALFRAME | DS_SETFONT | DS_3DLOOK
CAPTION "Browse for Folder"
FONT 8, "MS Shell Dlg"
{
LTEXT "", IDD_TITLE, 10, 8, 198, 24
LTEXT "", IDD_STATUS, 10, 25, 198, 12
LTEXT "Folder:", IDD_FOLDER, 10, 156, 40, 12
CONTROL "", IDD_TREEVIEW, "SysTreeView32",
TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT |
WS_BORDER | WS_TABSTOP,
12, 38, 194, 105
EDITTEXT IDD_FOLDERTEXT, 46, 150, 160, 14, WS_BORDER | WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Make New Folder", IDD_MAKENEWFOLDER, 12, 174, 70, 14, WS_GROUP | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 102, 174, 50, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 156, 174, 50, 14, WS_GROUP | WS_TABSTOP
}
SHELL_YESTOALL_MSGBOX DIALOG 200, 100, 280, 90 SHELL_YESTOALL_MSGBOX DIALOG 200, 100, 280, 90
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Message" CAPTION "Message"

View File

@ -103,6 +103,9 @@
/* these IDs are the same as on native */ /* these IDs are the same as on native */
#define IDD_YESTOALL 0x3207 #define IDD_YESTOALL 0x3207
/* browse for folder dialog box */ /* browse for folder dialog box */
#define IDD_MAKENEWFOLDER 0x3746
#define IDD_FOLDERTEXT 0x3745
#define IDD_FOLDER 0x3744
#define IDD_STATUS 0x3743 #define IDD_STATUS 0x3743
#define IDD_TITLE 0x3742 #define IDD_TITLE 0x3742
#define IDD_TREEVIEW 0x3741 #define IDD_TREEVIEW 0x3741