- Sync comctl32 (without listview.c), comdlg32 with Wine 1.1.21

svn path=/trunk/; revision=40847
This commit is contained in:
Dmitry Chapyshev 2009-05-09 09:20:57 +00:00
parent edd881cea2
commit 9618348ab6
6 changed files with 194 additions and 22 deletions

View file

@ -772,7 +772,7 @@ InitCommonControlsEx (const INITCOMMONCONTROLSEX *lpInitCtrls)
HWND WINAPI HWND WINAPI
CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps, CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons, HINSTANCE hBMInst, UINT_PTR wBMID, LPCTBBUTTON lpButtons,
INT iNumButtons, INT dxButton, INT dyButton, INT iNumButtons, INT dxButton, INT dyButton,
INT dxBitmap, INT dyBitmap, UINT uStructSize) INT dxBitmap, INT dyBitmap, UINT uStructSize)
{ {

View file

@ -1664,6 +1664,7 @@ HEADER_LButtonUp (HWND hwnd, LPARAM lParam)
else else
InvalidateRect(hwnd, &infoPtr->items[infoPtr->iMoveItem].rect, FALSE); InvalidateRect(hwnd, &infoPtr->items[infoPtr->iMoveItem].rect, FALSE);
infoPtr->bDragging = FALSE;
HEADER_SetHotDivider(hwnd, FALSE, -1); HEADER_SetHotDivider(hwnd, FALSE, -1);
} }
else if (!(dwStyle&HDS_DRAGDROP) || !HEADER_IsDragDistance(infoPtr, &pt)) else if (!(dwStyle&HDS_DRAGDROP) || !HEADER_IsDragDistance(infoPtr, &pt))

View file

@ -1841,7 +1841,9 @@ TOOLBAR_InternalInsertButtonsT(TOOLBAR_INFO *infoPtr, INT iIndex, UINT nAddButto
btnPtr->fsState = lpTbb[iButton].fsState; btnPtr->fsState = lpTbb[iButton].fsState;
btnPtr->fsStyle = lpTbb[iButton].fsStyle; btnPtr->fsStyle = lpTbb[iButton].fsStyle;
btnPtr->dwData = lpTbb[iButton].dwData; btnPtr->dwData = lpTbb[iButton].dwData;
if(HIWORD(lpTbb[iButton].iString) && lpTbb[iButton].iString != -1) if (btnPtr->fsStyle & BTNS_SEP)
btnPtr->iString = -1;
else if(HIWORD(lpTbb[iButton].iString) && lpTbb[iButton].iString != -1)
{ {
if (fUnicode) if (fUnicode)
Str_SetPtrW((LPWSTR*)&btnPtr->iString, (LPWSTR)lpTbb[iButton].iString ); Str_SetPtrW((LPWSTR*)&btnPtr->iString, (LPWSTR)lpTbb[iButton].iString );
@ -3433,9 +3435,6 @@ TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT nIndex; INT nIndex;
LPWSTR lpText; LPWSTR lpText;
if (lParam == 0)
return -1;
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1) if (nIndex == -1)
return -1; return -1;
@ -3443,7 +3442,7 @@ TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
lpText = TOOLBAR_GetText(infoPtr,&infoPtr->buttons[nIndex]); lpText = TOOLBAR_GetText(infoPtr,&infoPtr->buttons[nIndex]);
return WideCharToMultiByte( CP_ACP, 0, lpText, -1, return WideCharToMultiByte( CP_ACP, 0, lpText, -1,
(LPSTR)lParam, 0x7fffffff, NULL, NULL ) - 1; (LPSTR)lParam, lParam ? 0x7fffffff : 0, NULL, NULL ) - 1;
} }

View file

@ -37,7 +37,6 @@
* FIXME: add to recent docs * FIXME: add to recent docs
* *
* FIXME: flags not implemented: OFN_DONTADDTORECENT, * FIXME: flags not implemented: OFN_DONTADDTORECENT,
* OFN_ENABLESIZING,
* OFN_NODEREFERENCELINKS, OFN_NOREADONLYRETURN, * OFN_NODEREFERENCELINKS, OFN_NOREADONLYRETURN,
* OFN_NOTESTFILECREATE, OFN_USEMONIKERS * OFN_NOTESTFILECREATE, OFN_USEMONIKERS
* *
@ -82,7 +81,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(commdlg); WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
#define UNIMPLEMENTED_FLAGS \ #define UNIMPLEMENTED_FLAGS \
(OFN_DONTADDTORECENT | OFN_ENABLESIZING |\ (OFN_DONTADDTORECENT |\
OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\ OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\
OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/) OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/)
@ -271,6 +270,13 @@ static BOOL GetFileName95(FileOpenDlgInfos *fodInfos)
return FALSE; return FALSE;
} }
if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
{
((LPDLGTEMPLATEW)template)->style |= WS_SIZEBOX;
fodInfos->sizedlg.cx = fodInfos->sizedlg.cy = 0;
fodInfos->initial_size.x = fodInfos->initial_size.y = 0;
}
/* old style hook messages */ /* old style hook messages */
if (IsHooked(fodInfos)) if (IsHooked(fodInfos))
{ {
@ -978,6 +984,125 @@ static INT_PTR FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM
return TRUE; return TRUE;
} }
/***********************************************************************
* FILEDLG95_OnWMGetMMI
*
* WM_GETMINMAXINFO message handler for resizable dialogs
*/
static LRESULT FILEDLG95_OnWMGetMMI( HWND hwnd, LPMINMAXINFO mmiptr)
{
FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr);
if( !(fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)) return FALSE;
if( fodInfos->initial_size.x || fodInfos->initial_size.y)
{
mmiptr->ptMinTrackSize = fodInfos->initial_size;
}
return TRUE;
}
/***********************************************************************
* FILEDLG95_OnWMSize
*
* WM_SIZE message handler, resize the dialog. Re-arrange controls.
*
* FIXME: this could be made more elaborate. Now use a simple scheme
* where the file view is enlarged and the controls are either moved
* vertically or horizontally to get out of the way. Only the "grip"
* is moved in both directions to stay in the corner.
*/
static LRESULT FILEDLG95_OnWMSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
RECT rc, rcview;
int chgx, chgy;
HWND ctrl;
HDWP hdwp;
FileOpenDlgInfos *fodInfos;
if( wParam != SIZE_RESTORED) return FALSE;
fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr);
if( !(fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)) return FALSE;
/* get the new dialog rectangle */
GetWindowRect( hwnd, &rc);
/* not initialized yet */
if( (fodInfos->sizedlg.cx == 0 && fodInfos->sizedlg.cy == 0) ||
((fodInfos->sizedlg.cx == rc.right -rc.left) && /* no change */
(fodInfos->sizedlg.cy == rc.bottom -rc.top)))
return FALSE;
chgx = rc.right - rc.left - fodInfos->sizedlg.cx;
chgy = rc.bottom - rc.top - fodInfos->sizedlg.cy;
fodInfos->sizedlg.cx = rc.right - rc.left;
fodInfos->sizedlg.cy = rc.bottom - rc.top;
/* change the size of the view window */
GetWindowRect( fodInfos->ShellInfos.hwndView, &rcview);
MapWindowPoints( NULL, hwnd, (LPPOINT) &rcview, 2);
hdwp = BeginDeferWindowPos( 10);
DeferWindowPos( hdwp, fodInfos->ShellInfos.hwndView, NULL, 0, 0,
rcview.right - rcview.left + chgx,
rcview.bottom - rcview.top + chgy,
SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
/* change position and sizes of the controls */
for( ctrl = GetWindow( hwnd, GW_CHILD); ctrl ; ctrl = GetWindow( ctrl, GW_HWNDNEXT))
{
GetWindowRect( ctrl, &rc);
MapWindowPoints( NULL, hwnd, (LPPOINT) &rc, 2);
if( ctrl == fodInfos->DlgInfos.hwndGrip)
{
DeferWindowPos( hdwp, ctrl, NULL, rc.left + chgx, rc.top + chgy,
0, 0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
}
else if( rc.top > rcview.bottom)
{
/* if it was below the shell view
* move to bottom */
DeferWindowPos( hdwp, ctrl, NULL, rc.left, rc.top + chgy,
rc.right - rc.left, rc.bottom - rc.top,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
}
else if( rc.left > rcview.right)
{
/* if it was to the right of the shell view
* move to right */
DeferWindowPos( hdwp, ctrl, NULL, rc.left + chgx, rc.top,
rc.right - rc.left, rc.bottom - rc.top,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
}
}
if(fodInfos->DlgInfos.hwndCustomDlg &&
(fodInfos->ofnInfos->Flags & (OFN_ENABLETEMPLATE | OFN_ENABLETEMPLATEHANDLE)))
{
GetClientRect(hwnd, &rc);
DeferWindowPos( hdwp,fodInfos->DlgInfos.hwndCustomDlg, NULL,
0, 0, rc.right, rc.bottom, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
for( ctrl = GetWindow( fodInfos->DlgInfos.hwndCustomDlg, GW_CHILD);
ctrl ; ctrl = GetWindow( ctrl, GW_HWNDNEXT))
{
GetWindowRect( ctrl, &rc);
MapWindowPoints( NULL, hwnd, (LPPOINT) &rc, 2);
if( rc.top > rcview.bottom)
{
/* if it was below the shell view
* move to bottom */
DeferWindowPos( hdwp, ctrl, NULL, rc.left, rc.top + chgy,
rc.right - rc.left, rc.bottom - rc.top,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
}
else if( rc.left > rcview.right)
{
/* if it was to the right of the shell view
* move to right */
DeferWindowPos( hdwp, ctrl, NULL, rc.left + chgx, rc.top,
rc.right - rc.left, rc.bottom - rc.top,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
}
}
}
EndDeferWindowPos( hdwp);
/* should not be needed */
RedrawWindow( hwnd, NULL, 0, RDW_ALLCHILDREN | RDW_INVALIDATE );
return TRUE;
}
/*********************************************************************** /***********************************************************************
* FileOpenDlgProc95 * FileOpenDlgProc95
* *
@ -994,6 +1119,9 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
FileOpenDlgInfos * fodInfos = (FileOpenDlgInfos *)lParam; FileOpenDlgInfos * fodInfos = (FileOpenDlgInfos *)lParam;
RECT rc;
int gripx = GetSystemMetrics( SM_CYHSCROLL);
int gripy = GetSystemMetrics( SM_CYVSCROLL);
/* Adds the FileOpenDlgInfos in the property list of the dialog /* Adds the FileOpenDlgInfos in the property list of the dialog
so it will be easily accessible through a GetPropA(...) */ so it will be easily accessible through a GetPropA(...) */
@ -1001,17 +1129,49 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
FILEDLG95_InitControls(hwnd); FILEDLG95_InitControls(hwnd);
if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
{
GetWindowRect( hwnd, &rc);
fodInfos->DlgInfos.hwndGrip =
CreateWindowExA( 0, "SCROLLBAR", NULL,
WS_CHILD | WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS |
SBS_SIZEGRIP | SBS_SIZEBOXBOTTOMRIGHTALIGN,
rc.right - gripx, rc.bottom - gripy,
gripx, gripy, hwnd, (HMENU) -1, COMDLG32_hInstance, NULL);
}
fodInfos->DlgInfos.hwndCustomDlg = fodInfos->DlgInfos.hwndCustomDlg =
CreateTemplateDialog((FileOpenDlgInfos *)lParam, hwnd); CreateTemplateDialog((FileOpenDlgInfos *)lParam, hwnd);
FILEDLG95_ResizeControls(hwnd, wParam, lParam); FILEDLG95_ResizeControls(hwnd, wParam, lParam);
FILEDLG95_FillControls(hwnd, wParam, lParam); FILEDLG95_FillControls(hwnd, wParam, lParam);
if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
{
GetWindowRect( hwnd, &rc);
/* FIXME: should remember sizes of last invocation */
fodInfos->sizedlg.cx = rc.right - rc.left;
fodInfos->sizedlg.cy = rc.bottom - rc.top;
fodInfos->initial_size.x = fodInfos->sizedlg.cx;
fodInfos->initial_size.y = fodInfos->sizedlg.cy;
GetClientRect( hwnd, &rc);
SetWindowPos( fodInfos->DlgInfos.hwndGrip, NULL,
rc.right - gripx, rc.bottom - gripy,
0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
}
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
{
SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE); SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE); SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE);
SendCustomDlgNotificationMessage(hwnd,CDN_SELCHANGE); SendCustomDlgNotificationMessage(hwnd,CDN_SELCHANGE);
}
return 0; return 0;
} }
case WM_SIZE:
return FILEDLG95_OnWMSize(hwnd, wParam, lParam);
case WM_GETMINMAXINFO:
return FILEDLG95_OnWMGetMMI( hwnd, (LPMINMAXINFO)lParam);
case WM_COMMAND: case WM_COMMAND:
return FILEDLG95_OnWMCommand(hwnd, wParam, lParam); return FILEDLG95_OnWMCommand(hwnd, wParam, lParam);
case WM_DRAWITEM: case WM_DRAWITEM:
@ -1592,10 +1752,11 @@ static BOOL FILEDLG95_SendFileOK( HWND hwnd, FileOpenDlgInfos *fodInfos )
/* ask the hook if we can close */ /* ask the hook if we can close */
if(IsHooked(fodInfos)) if(IsHooked(fodInfos))
{ {
LRESULT retval; LRESULT retval = 0;
TRACE("---\n"); TRACE("---\n");
/* First send CDN_FILEOK as MSDN doc says */ /* First send CDN_FILEOK as MSDN doc says */
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
retval = SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK); retval = SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK);
if (GetWindowLongPtrW(fodInfos->DlgInfos.hwndCustomDlg, DWLP_MSGRESULT)) if (GetWindowLongPtrW(fodInfos->DlgInfos.hwndCustomDlg, DWLP_MSGRESULT))
{ {
@ -1991,7 +2152,8 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
IPersistFolder2_Release(ppf2); IPersistFolder2_Release(ppf2);
if( ! COMDLG32_PIDL_ILIsEqual(pidlCurrent, fodInfos->ShellInfos.pidlAbsCurrent)) if( ! COMDLG32_PIDL_ILIsEqual(pidlCurrent, fodInfos->ShellInfos.pidlAbsCurrent))
{ {
if (SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidlCurrent, SBSP_ABSOLUTE))) if (SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidlCurrent, SBSP_ABSOLUTE))
&& fodInfos->ofnInfos->Flags & OFN_EXPLORER)
{ {
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE); SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
} }
@ -2294,6 +2456,7 @@ static BOOL FILEDLG95_SHELL_UpFolder(HWND hwnd)
NULL, NULL,
SBSP_PARENT))) SBSP_PARENT)))
{ {
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE); SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
return TRUE; return TRUE;
} }
@ -2316,6 +2479,7 @@ static BOOL FILEDLG95_SHELL_BrowseToDesktop(HWND hwnd)
SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidl); SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidl);
hres = IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidl, SBSP_ABSOLUTE); hres = IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidl, SBSP_ABSOLUTE);
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE); SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
COMDLG32_SHFree(pidl); COMDLG32_SHFree(pidl);
return SUCCEEDED(hres); return SUCCEEDED(hres);
@ -2494,6 +2658,7 @@ static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode)
len = lstrlenW(lpstrFilter)+1; len = lstrlenW(lpstrFilter)+1;
fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc( len * sizeof(WCHAR) ); fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc( len * sizeof(WCHAR) );
lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter); lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(hwnd,CDN_TYPECHANGE); SendCustomDlgNotificationMessage(hwnd,CDN_TYPECHANGE);
} }
@ -2798,6 +2963,7 @@ static BOOL FILEDLG95_LOOKIN_OnCommand(HWND hwnd, WORD wNotifyCode)
tmpFolder->pidlItem, tmpFolder->pidlItem,
SBSP_ABSOLUTE))) SBSP_ABSOLUTE)))
{ {
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE); SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
return TRUE; return TRUE;
} }
@ -3472,6 +3638,7 @@ static BOOL BrowseSelectedFolder(HWND hwnd)
MessageBoxW( hwnd, notexist, fodInfos->title, MB_OK | MB_ICONEXCLAMATION ); MessageBoxW( hwnd, notexist, fodInfos->title, MB_OK | MB_ICONEXCLAMATION );
} }
bBrowseSelFolder = TRUE; bBrowseSelFolder = TRUE;
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE); SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE);
} }
COMDLG32_SHFree( pidlSelection ); COMDLG32_SHFree( pidlSelection );

View file

@ -785,6 +785,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDl
if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) ) if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )
{ {
hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE); hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(This->hwndOwner, CDN_FOLDERCHANGE); SendCustomDlgNotificationMessage(This->hwndOwner, CDN_FOLDERCHANGE);
} }
else else
@ -960,6 +961,7 @@ static HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *if
FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner); FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner);
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE); SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
return S_OK; return S_OK;
} }

View file

@ -58,6 +58,8 @@ typedef struct
LPCWSTR defext; LPCWSTR defext;
LPCWSTR filter; LPCWSTR filter;
LPCWSTR customfilter; LPCWSTR customfilter;
SIZE sizedlg; /* remember the size of the dialog */
POINT initial_size; /* remember the initial size of the dialog */
struct { struct {
IShellBrowser *FOIShellBrowser; IShellBrowser *FOIShellBrowser;
IShellFolder *FOIShellFolder; IShellFolder *FOIShellFolder;
@ -78,6 +80,7 @@ typedef struct
HWND hwndLookInCB; HWND hwndLookInCB;
HWND hwndFileName; HWND hwndFileName;
HWND hwndTB; HWND hwndTB;
HWND hwndGrip;
HWND hwndCustomDlg; HWND hwndCustomDlg;
DWORD dwDlgProp; DWORD dwDlgProp;
} DlgInfos; } DlgInfos;