- 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
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 dxBitmap, INT dyBitmap, UINT uStructSize)
{

View file

@ -1663,7 +1663,8 @@ HEADER_LButtonUp (HWND hwnd, LPARAM lParam)
}
else
InvalidateRect(hwnd, &infoPtr->items[infoPtr->iMoveItem].rect, FALSE);
infoPtr->bDragging = FALSE;
HEADER_SetHotDivider(hwnd, FALSE, -1);
}
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->fsStyle = lpTbb[iButton].fsStyle;
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)
Str_SetPtrW((LPWSTR*)&btnPtr->iString, (LPWSTR)lpTbb[iButton].iString );
@ -3433,9 +3435,6 @@ TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT nIndex;
LPWSTR lpText;
if (lParam == 0)
return -1;
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1)
return -1;
@ -3443,7 +3442,7 @@ TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
lpText = TOOLBAR_GetText(infoPtr,&infoPtr->buttons[nIndex]);
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: flags not implemented: OFN_DONTADDTORECENT,
* OFN_ENABLESIZING,
* OFN_NODEREFERENCELINKS, OFN_NOREADONLYRETURN,
* OFN_NOTESTFILECREATE, OFN_USEMONIKERS
*
@ -82,7 +81,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
#define UNIMPLEMENTED_FLAGS \
(OFN_DONTADDTORECENT | OFN_ENABLESIZING |\
(OFN_DONTADDTORECENT |\
OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\
OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/)
@ -271,6 +270,13 @@ static BOOL GetFileName95(FileOpenDlgInfos *fodInfos)
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 */
if (IsHooked(fodInfos))
{
@ -978,6 +984,125 @@ static INT_PTR FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM
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
*
@ -994,6 +1119,9 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
case WM_INITDIALOG:
{
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
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);
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 =
CreateTemplateDialog((FileOpenDlgInfos *)lParam, hwnd);
FILEDLG95_ResizeControls(hwnd, wParam, lParam);
FILEDLG95_FillControls(hwnd, wParam, lParam);
SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE);
SendCustomDlgNotificationMessage(hwnd,CDN_SELCHANGE);
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_FOLDERCHANGE);
SendCustomDlgNotificationMessage(hwnd,CDN_SELCHANGE);
}
return 0;
}
case WM_SIZE:
return FILEDLG95_OnWMSize(hwnd, wParam, lParam);
case WM_GETMINMAXINFO:
return FILEDLG95_OnWMGetMMI( hwnd, (LPMINMAXINFO)lParam);
case WM_COMMAND:
return FILEDLG95_OnWMCommand(hwnd, wParam, lParam);
case WM_DRAWITEM:
@ -1592,11 +1752,12 @@ static BOOL FILEDLG95_SendFileOK( HWND hwnd, FileOpenDlgInfos *fodInfos )
/* ask the hook if we can close */
if(IsHooked(fodInfos))
{
LRESULT retval;
LRESULT retval = 0;
TRACE("---\n");
/* First send CDN_FILEOK as MSDN doc says */
retval = SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK);
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
retval = SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK);
if (GetWindowLongPtrW(fodInfos->DlgInfos.hwndCustomDlg, DWLP_MSGRESULT))
{
TRACE("canceled\n");
@ -1991,7 +2152,8 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
IPersistFolder2_Release(ppf2);
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);
}
@ -2294,7 +2456,8 @@ static BOOL FILEDLG95_SHELL_UpFolder(HWND hwnd)
NULL,
SBSP_PARENT)))
{
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
return TRUE;
}
return FALSE;
@ -2316,7 +2479,8 @@ static BOOL FILEDLG95_SHELL_BrowseToDesktop(HWND hwnd)
SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidl);
hres = IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidl, SBSP_ABSOLUTE);
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
COMDLG32_SHFree(pidl);
return SUCCEEDED(hres);
}
@ -2494,7 +2658,8 @@ static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode)
len = lstrlenW(lpstrFilter)+1;
fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc( len * sizeof(WCHAR) );
lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
SendCustomDlgNotificationMessage(hwnd,CDN_TYPECHANGE);
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(hwnd,CDN_TYPECHANGE);
}
/* Refresh the actual view to display the included items*/
@ -2798,7 +2963,8 @@ static BOOL FILEDLG95_LOOKIN_OnCommand(HWND hwnd, WORD wNotifyCode)
tmpFolder->pidlItem,
SBSP_ABSOLUTE)))
{
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
return TRUE;
}
break;
@ -3472,7 +3638,8 @@ static BOOL BrowseSelectedFolder(HWND hwnd)
MessageBoxW( hwnd, notexist, fodInfos->title, MB_OK | MB_ICONEXCLAMATION );
}
bBrowseSelFolder = TRUE;
SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE);
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE);
}
COMDLG32_SHFree( pidlSelection );
}

View file

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

View file

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