[PATCH] shell32: start implementing BIF_USENEWUI
Lei Zhang
thestig at google.com
Thu Jun 7 17:02:07 CDT 2007
Hi,
This patch adds the editbox and "make new folder" botton for
SHBrowseForFolder's new style. The newly added UI elements are not
functional yet.
-------------- next part --------------
From 15c6b1a37d8f50536cf5c554991d3bd1fdec5d20 Mon Sep 17 00:00:00 2001
From: Lei Zhang <thestig at google.com>
Date: Thu, 7 Jun 2007 14:55:09 -0700
Subject: [PATCH] shell32: start implementing BIF_USENEWUI
---
dlls/shell32/brsfolder.c | 48 ++++++++++++++++++++++++++++++++++++++++++--
dlls/shell32/shell32_En.rc | 20 ++++++++++++++++++
dlls/shell32/shresdef.h | 3 +++
3 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c
index e478078..ff5c1f0 100644
--- a/dlls/shell32/brsfolder.c
+++ b/dlls/shell32/brsfolder.c
@@ -18,6 +18,9 @@
* FIXME:
* - many memory leaks
* - many flags unimplemented
+ * - implement new dialog style "make new folder" button
+ * - implement editbox
+ * - implement new dialog style resizing
*/
#include <stdlib.h>
@@ -56,6 +59,8 @@ #define SUPPORTEDFLAGS (BIF_STATUSTEXT |
BIF_BROWSEFORCOMPUTER | \
BIF_RETURNFSANCESTORS | \
BIF_RETURNONLYFSDIRS | \
+ BIF_NONEWFOLDERBUTTON | \
+ BIF_NEWDIALOGSTYLE | \
BIF_BROWSEINCLUDEFILES)
static void FillTreeView(browse_info*, LPSHELLFOLDER,
@@ -494,6 +499,8 @@ static BOOL BrsFolder_OnCreate( HWND hWn
info->hWnd = hWnd;
SetPropW( hWnd, szBrowseFolderInfo, info );
+ if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
+ FIXME("flags BIF_NEWDIALOGSTYLE partially implemented\n");
if (lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS)
FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS);
@@ -502,12 +509,37 @@ static BOOL BrsFolder_OnCreate( HWND hWn
else
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 );
+ /* 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 );
if (info->hwndTreeView)
+ {
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
ERR("treeview control missing!\n");
@@ -536,6 +568,10 @@ static BOOL BrsFolder_OnCommand( browse_
case IDCANCEL:
EndDialog( info->hWnd, 0 );
return TRUE;
+
+ case IDD_MAKENEWFOLDER:
+ FIXME("make new folder not implemented\n");
+ return TRUE;
}
return FALSE;
}
@@ -703,6 +739,8 @@ static INT_PTR CALLBACK BrsFolderDlgProc
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};
+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.@]
@@ -765,6 +803,7 @@ LPITEMIDLIST WINAPI SHBrowseForFolderW (
browse_info info;
DWORD r;
HRESULT hr;
+ const WCHAR * templateName;
info.hWnd = 0;
info.pidlRet = NULL;
@@ -772,7 +811,12 @@ LPITEMIDLIST WINAPI SHBrowseForFolderW (
info.hwndTreeView = 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 );
if (SUCCEEDED(hr))
OleUninitialize();
diff --git a/dlls/shell32/shell32_En.rc b/dlls/shell32/shell32_En.rc
index 0613b41..4610395 100644
--- a/dlls/shell32/shell32_En.rc
+++ b/dlls/shell32/shell32_En.rc
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include "shresdef.h"
+
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
MENU_001 MENU DISCARDABLE
@@ -104,6 +106,24 @@ FONT 8, "MS Shell Dlg"
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
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Message"
diff --git a/dlls/shell32/shresdef.h b/dlls/shell32/shresdef.h
index 3619353..1e5c76f 100644
--- a/dlls/shell32/shresdef.h
+++ b/dlls/shell32/shresdef.h
@@ -103,6 +103,9 @@ #define IDD_MESSAGE 0x4301
/* these IDs are the same as on native */
#define IDD_YESTOALL 0x3207
/* browse for folder dialog box */
+#define IDD_MAKENEWFOLDER 0x3746
+#define IDD_FOLDERTEXT 0x3745
+#define IDD_FOLDER 0x3744
#define IDD_STATUS 0x3743
#define IDD_TITLE 0x3742
#define IDD_TREEVIEW 0x3741
--
1.4.1
More information about the wine-patches
mailing list