# HG changeset patch # User Frank Benoit # Date 1205121489 -3600 # Node ID 811e926196d61ec40b3ab58b09bfcdd8139e3f53 # Parent 772f75da6a52a46e1aa11f93ae54c563bfeacd1a# Parent 52c185ec49e889de848eda594614c71b108cb307 merge diff -r 772f75da6a52 -r 811e926196d6 dwt/internal/win32/OS.d --- a/dwt/internal/win32/OS.d Sun Mar 09 11:03:57 2008 +0100 +++ b/dwt/internal/win32/OS.d Mon Mar 10 04:58:09 2008 +0100 @@ -3994,6 +3994,7 @@ // Unicode/Ansi alias version(ANSI) { alias WINAPI.AddFontResourceExA AddFontResourceEx; + alias WINAPI.AssocQueryStringA AssocQueryString; alias WINAPI.CallWindowProcA CallWindowProc; alias WINAPI.CharLowerA CharLower; alias WINAPI.CharUpperA CharUpper; @@ -4095,6 +4096,7 @@ alias WINAPI.VkKeyScanA VkKeyScan; }else{ alias WINAPI.AddFontResourceExW AddFontResourceEx; + alias WINAPI.AssocQueryStringW AssocQueryString; alias WINAPI.CallWindowProcW CallWindowProc; alias WINAPI.CharLowerW CharLower; alias WINAPI.CharUpperW CharUpper; diff -r 772f75da6a52 -r 811e926196d6 dwt/internal/win32/WINAPI.d --- a/dwt/internal/win32/WINAPI.d Sun Mar 09 11:03:57 2008 +0100 +++ b/dwt/internal/win32/WINAPI.d Mon Mar 10 04:58:09 2008 +0100 @@ -13,6 +13,9 @@ extern(Windows) { + HRESULT AssocQueryStringA(ASSOCF flags, int str, LPCTSTR pszAssoc, LPCTSTR pszExtra, LPTSTR pszOut, DWORD *pcchOut); + HRESULT AssocQueryStringW(ASSOCF flags, int str, LPCTSTR pszAssoc, LPCTSTR pszExtra, LPTSTR pszOut, DWORD *pcchOut); + // BOOL GetWindowInfo(HWND, PWINDOWINFO); // BOOL EnumDisplayMonitors(HDC, RECT*, MONITORENUMPROC, LPARAM); // BOOL GetMonitorInfoA(HMONITOR, LPMONITORINFO); diff -r 772f75da6a52 -r 811e926196d6 dwt/internal/win32/WINTYPES.d --- a/dwt/internal/win32/WINTYPES.d Sun Mar 09 11:03:57 2008 +0100 +++ b/dwt/internal/win32/WINTYPES.d Mon Mar 10 04:58:09 2008 +0100 @@ -201,6 +201,20 @@ // BYTE[8] Data4; // } +enum {ASSOCF_INIT_BYEXENAME, + ASSOCF_OPEN_BYEXENAME, + ASSOCF_INIT_DEFAULTTOSTAR, + ASSOCF_INIT_DEFAULTTOFOLDER, + ASSOCF_NOUSERSETTINGS, + ASSOCF_NOTRUNCATE, + ASSOCF_VERIFY, + ASSOCF_REMAPRUNDLL, + ASSOCF_NOFIXUPS, + ASSOCF_IGNOREBASECLASS +}; + +alias DWORD ASSOCF; + enum { AclRevisionInformation = 1, AclSizeInformation, }; alias ACL_INFORMATION_CLASS _ACL_INFORMATION_CLASS; alias int MEDIA_TYPE; diff -r 772f75da6a52 -r 811e926196d6 dwt/widgets/DirectoryDialog.d --- a/dwt/widgets/DirectoryDialog.d Sun Mar 09 11:03:57 2008 +0100 +++ b/dwt/widgets/DirectoryDialog.d Mon Mar 10 04:58:09 2008 +0100 @@ -12,22 +12,17 @@ *******************************************************************************/ module dwt.widgets.DirectoryDialog; +import dwt.widgets.Display; import dwt.widgets.Dialog; import dwt.widgets.Shell; -class DirectoryDialog : Dialog { - public this (Shell parent, int style) { - super (parent, style); - } -} - -/++ import dwt.DWT; import dwt.DWTException; -import dwt.internal.Callback; -import dwt.internal.win32.BROWSEINFO; import dwt.internal.win32.OS; -import dwt.internal.win32.TCHAR; +import dwt.internal.C; + +import dwt.dwthelper.utils; +static import tango.text.Text; /** * Instances of this class allow the user to navigate @@ -44,9 +39,10 @@ *

*/ -public class DirectoryDialog extends Dialog { - String message = "", filterPath = ""; //$NON-NLS-1$//$NON-NLS-2$ - String directoryPath; +public class DirectoryDialog : Dialog { + static char[] message = ""; + static char[] filterPath = ""; //$NON-NLS-1$//$NON-NLS-2$ + static char[] directoryPath; /** * Constructs a new instance of this class given only its parent. @@ -61,7 +57,7 @@ *
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public DirectoryDialog (Shell parent) { +public this (Shell parent) { this (parent, DWT.PRIMARY_MODAL); } @@ -89,33 +85,35 @@ *
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public DirectoryDialog (Shell parent, int style) { +public this (Shell parent, int style) { super (parent, style); checkSubclass (); } -int BrowseCallbackProc (int hwnd, int uMsg, int lParam, int lpData) { +extern(Windows)static int BrowseCallbackProc (HWND hwnd, uint uMsg, int lParam, int lpData) { + DirectoryDialog pThis = cast(DirectoryDialog)cast(void*)lpData; switch (uMsg) { case OS.BFFM_INITIALIZED: - if (filterPath !is null && filterPath.length () !is 0) { + if (pThis.filterPath !is null && pThis.filterPath.length !is 0) { /* Use the character encoding for the default locale */ - TCHAR buffer = new TCHAR (0, filterPath.replace ('/', '\\'), true); - OS.SendMessage (hwnd, OS.BFFM_SETSELECTION, 1, buffer); + TCHAR[] buffer = StrToTCHARs (0, pThis.filterPath.replace ('/', '\\'), true); + OS.SendMessage (hwnd, OS.BFFM_SETSELECTION, 1, buffer.ptr); } - if (title !is null && title.length () !is 0) { + if (pThis.title !is null && pThis.title.length !is 0) { /* Use the character encoding for the default locale */ - TCHAR buffer = new TCHAR (0, title, true); - OS.SetWindowText (hwnd, buffer); + TCHAR[] buffer = StrToTCHARs (0, pThis.title, true); + OS.SetWindowText (hwnd, buffer.ptr); } break; case OS.BFFM_VALIDATEFAILEDA: case OS.BFFM_VALIDATEFAILEDW: /* Use the character encoding for the default locale */ - int length = OS.IsUnicode ? OS.wcslen (lParam) : OS.strlen (lParam); - TCHAR buffer = new TCHAR (0, length); - int byteCount = buffer.length () * TCHAR.sizeof; - OS.MoveMemory (buffer, lParam, byteCount); - directoryPath = buffer.toString (0, length); +// int length = OS.IsUnicode ? OS.wcslen (lParam) : OS.strlen (lParam); +// TCHAR buffer = new TCHAR (0, length); +// int byteCount = buffer.length * TCHAR.sizeof; +// OS.MoveMemory (buffer, lParam, byteCount); +// directoryPath = buffer.toString (0, length); + pThis.directoryPath = TCHARzToStr( cast(TCHAR*)lParam ); break; default: } @@ -130,7 +128,7 @@ * * @see #setFilterPath */ -public String getFilterPath () { +public char[] getFilterPath () { return filterPath; } @@ -141,7 +139,7 @@ * * @return the message */ -public String getMessage () { +public char[] getMessage () { return message; } @@ -157,21 +155,21 @@ *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog
  • * */ -public String open () { +public char[] open () { if (OS.IsWinCE) DWT.error (DWT.ERROR_NOT_IMPLEMENTED); - int hHeap = OS.GetProcessHeap (); + auto hHeap = OS.GetProcessHeap (); /* Get the owner HWND for the dialog */ - int hwndOwner = 0; + HWND hwndOwner; if (parent !is null) hwndOwner = parent.handle; /* Copy the message to OS memory */ - int lpszTitle = 0; - if (message.length () !is 0) { - String string = message; + TCHAR* lpszTitle; + if (message.length !is 0) { + char[] string = message; if (string.indexOf ('&') !is -1) { - int length = string.length (); + int length = string.length; char [] buffer = new char [length * 2]; int index = 0; for (int i=0; iERROR_NULL_ARGUMENT - if the string is null * */ -public void setMessage (String string) { +public void setMessage (char[] string) { if (string is null) error (DWT.ERROR_NULL_ARGUMENT); message = string; } } -++/ \ No newline at end of file