diff --git a/reactos/dll/win32/comctl32/comctl32.h b/reactos/dll/win32/comctl32/comctl32.h index 5917a9b2cf484..5e74a1600b6b9 100644 --- a/reactos/dll/win32/comctl32/comctl32.h +++ b/reactos/dll/win32/comctl32/comctl32.h @@ -153,8 +153,6 @@ BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc); BOOL Str_SetPtrWtoA (LPSTR *lppDest, LPCWSTR lpSrc); #define COMCTL32_VERSION_MINOR 81 -#define WINE_FILEVERSION 5, COMCTL32_VERSION_MINOR, 4704, 1100 -#define WINE_FILEVERSIONSTR "5.81" /* Our internal stack structure of the window procedures to subclass */ typedef struct _SUBCLASSPROCS { diff --git a/reactos/dll/win32/comctl32/comctl32.rbuild b/reactos/dll/win32/comctl32/comctl32.rbuild index f06a306c773fe..c14e60451d15e 100644 --- a/reactos/dll/win32/comctl32/comctl32.rbuild +++ b/reactos/dll/win32/comctl32/comctl32.rbuild @@ -1,4 +1,4 @@ - + . @@ -9,12 +9,6 @@ 0x600 0x501 0x501 - - - wine user32 gdi32 diff --git a/reactos/dll/win32/comctl32/comctl32_ros.diff b/reactos/dll/win32/comctl32/comctl32_ros.diff index 608efdad3f6fc..78de6d348f52d 100644 --- a/reactos/dll/win32/comctl32/comctl32_ros.diff +++ b/reactos/dll/win32/comctl32/comctl32_ros.diff @@ -1,3 +1,16 @@ +Index: commctrl.c +=================================================================== +--- commctrl.c (revision 23123) ++++ commctrl.c (working copy) +@@ -1620,7 +1620,7 @@ + * + * Draw text with shadow. + */ ++int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, const RECT *rect, DWORD dwFlags, +-int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, RECT *rect, DWORD dwFlags, + COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset) + { + FIXME("(%p, %s, %d, %p, %d, 0x%08x, 0x%08x, %d, %d): stub\n", hdc, debugstr_w(pszText), cch, rect, dwFlags, Index: listview.c =================================================================== --- listview.c (revision 23123) @@ -102,7 +115,7 @@ Index: tooltips.c =================================================================== --- tooltips.c (revision 25790) +++ tooltips.c (working copy) -@@ -2437,7 +2437,34 @@ +@@ -2471,7 +2471,34 @@ TOOLTIPS_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam) { FIXME ("hwnd=%p wParam=%lx lParam=%lx\n", hwnd, wParam, lParam); @@ -141,7 +154,7 @@ Index: treeview.c =================================================================== --- treeview.c (revision 27134) +++ treeview.c (working copy) -@@ -2839,8 +2839,6 @@ +@@ -2844,8 +2844,6 @@ } } diff --git a/reactos/dll/win32/comctl32/comctl_Fr.rc b/reactos/dll/win32/comctl32/comctl_Fr.rc index 1bf8e230b02ab..df56339f4c67f 100644 --- a/reactos/dll/win32/comctl32/comctl_Fr.rc +++ b/reactos/dll/win32/comctl32/comctl_Fr.rc @@ -31,7 +31,7 @@ BEGIN PUSHBUTTON "Annuler", IDCANCEL,58,122,50,14 PUSHBUTTON "&Appliquer", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED PUSHBUTTON "Aide", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP - CONTROL "onglet", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 + CONTROL "Onglet", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 END diff --git a/reactos/dll/win32/comctl32/comctl_No.rc b/reactos/dll/win32/comctl32/comctl_No.rc index b90632f510ff5..77b9ec8da70f0 100644 --- a/reactos/dll/win32/comctl32/comctl_No.rc +++ b/reactos/dll/win32/comctl32/comctl_No.rc @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL +LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE diff --git a/reactos/dll/win32/comctl32/comctl_Pt.rc b/reactos/dll/win32/comctl32/comctl_Pt.rc index 0d8de92cc8e99..3ab75fda59630 100644 --- a/reactos/dll/win32/comctl32/comctl_Pt.rc +++ b/reactos/dll/win32/comctl32/comctl_Pt.rc @@ -1,6 +1,6 @@ /* * Copyright 2003 Marcelo Duarte - * Copyright 2006 Américo José Melo + * Copyright 2006-2007 Américo José Melo * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,7 @@ BEGIN PUSHBUTTON "Cancelar", IDCANCEL,58,122,50,14 PUSHBUTTON "&Aplicar", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED PUSHBUTTON "Ajuda", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP - CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 + CONTROL "Separador", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 END diff --git a/reactos/dll/win32/comctl32/comctl_Ru.rc b/reactos/dll/win32/comctl32/comctl_Ru.rc index afad77e6d211b..2bbb513a09cdd 100644 --- a/reactos/dll/win32/comctl32/comctl_Ru.rc +++ b/reactos/dll/win32/comctl32/comctl_Ru.rc @@ -22,7 +22,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE -CAPTION "Ñâîéñòâà: %s" +CAPTION "Ñâîéñòâà äëÿ %s" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP diff --git a/reactos/dll/win32/comctl32/comctl_Uk.rc b/reactos/dll/win32/comctl32/comctl_Uk.rc index cd13ef35e3f14..95e502dd4710c 100644 --- a/reactos/dll/win32/comctl32/comctl_Uk.rc +++ b/reactos/dll/win32/comctl32/comctl_Uk.rc @@ -2,7 +2,6 @@ * comctl (Ukrainian resources) * * Copyright 2004 Ilya Korniyko - * 2007 Artem Reznikov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,7 +26,7 @@ CAPTION " FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP - PUSHBUTTON "&Ñêàñóâàòè", IDCANCEL,58,122,50,14 + PUSHBUTTON "&³äì³íà", IDCANCEL,58,122,50,14 PUSHBUTTON "&Çàñòîñóâàòè", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED PUSHBUTTON "&Äîâ³äêà", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 @@ -42,7 +41,7 @@ BEGIN PUSHBUTTON "< &Íàçàä", IDC_BACK_BUTTON,71,138,50,14 DEFPUSHBUTTON "&Äàë³ >", IDC_NEXT_BUTTON,121,138,50,14 DEFPUSHBUTTON "&Çàâåðøèòè", IDC_FINISH_BUTTON,121,138,50,14 - PUSHBUTTON "&Ñêàñóâàòè", IDCANCEL,178,138,50,14 + PUSHBUTTON "&³äì³íà", IDCANCEL,178,138,50,14 PUSHBUTTON "&Äîâ³äêà", IDHELP,235,138,50,14,WS_GROUP LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5 diff --git a/reactos/dll/win32/comctl32/commctrl.c b/reactos/dll/win32/comctl32/commctrl.c index c09bc04e44585..5fe4835339f54 100644 --- a/reactos/dll/win32/comctl32/commctrl.c +++ b/reactos/dll/win32/comctl32/commctrl.c @@ -71,6 +71,58 @@ WINE_DEFAULT_DEBUG_CHANNEL(commctrl); + +#define NAME "microsoft.windows.common-controls" +#define FILE "comctl32.dll" +#define VERSION "6.0.0.0" +#define PUBLIC_KEY "6595b64144ccf1df" + +#ifdef __i386__ +#define ARCH "x86" +#elif defined __x86_64__ +#define ARCH "amd64" +#else +#define ARCH "none" +#endif + +static const char manifest[] = + "\n" + "\n" + " \n" + " \n" + " Button\n" + " ButtonListBox\n" + " ComboBoxEx32\n" + " ComboLBox\n" + " Combobox\n" + " Edit\n" + " Listbox\n" + " NativeFontCtl\n" + " ReBarWindow32\n" + " ScrollBar\n" + " Static\n" + " SysAnimate32\n" + " SysDateTimePick32\n" + " SysHeader32\n" + " SysIPAddress32\n" + " SysLink\n" + " SysListView32\n" + " SysMonthCal32\n" + " SysPager\n" + " SysTabControl32\n" + " SysTreeView32\n" + " ToolbarWindow32\n" + " msctls_hotkey32\n" + " msctls_progress32\n" + " msctls_statusbar32\n" + " msctls_trackbar32\n" + " msctls_updown32\n" + " tooltips_class32\n" + " \n" + "\n"; + +static const char manifest_filename[] = ARCH "_" NAME "_" PUBLIC_KEY "_" VERSION "_none_deadbeef.manifest"; + LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LPWSTR COMCTL32_wSubclass = NULL; @@ -91,6 +143,47 @@ static const WCHAR strCC32SubclassInfo[] = { 'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0 }; +static BOOL create_manifest( BOOL install ) +{ + static const WCHAR winsxsW[] = {'\\','w','i','n','s','x','s',0}; + static const WCHAR manifestsW[] = {'\\','m','a','n','i','f','e','s','t','s','\\',0}; + + DWORD len, written; + WCHAR *buffer; + HANDLE file; + BOOL ret = FALSE; + + len = MultiByteToWideChar( CP_UTF8, 0, manifest_filename, sizeof(manifest_filename), NULL, 0 ); + len += GetWindowsDirectoryW( NULL, 0 ); + len += lstrlenW(winsxsW); + len += lstrlenW(manifestsW); + if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE; + GetWindowsDirectoryW( buffer, len ); + lstrcatW( buffer, winsxsW ); + CreateDirectoryW( buffer, NULL ); + lstrcatW( buffer, manifestsW ); + CreateDirectoryW( buffer, NULL ); + MultiByteToWideChar( CP_UTF8, 0, manifest_filename, sizeof(manifest_filename), + buffer + lstrlenW(buffer), len ); + if (install) + { + file = CreateFileW( buffer, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL ); + if (file != INVALID_HANDLE_VALUE) + { + ret = (WriteFile( file, manifest, sizeof(manifest)-1, &written, NULL ) && + written == sizeof(manifest)-1); + CloseHandle( file ); + if (!ret) DeleteFileW( buffer ); + else TRACE("created %s\n", debugstr_w(buffer)); + } + } + else ret = DeleteFileW( buffer ); + + HeapFree( GetProcessHeap(), 0, buffer ); + return ret; +} + + /*********************************************************************** * DllMain [Internal] * @@ -917,10 +1010,9 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi) */ HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline) { - FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE", - debugstr_w(cmdline)); - - return S_OK; + TRACE("(%u, %s): stub\n", bInstall, debugstr_w(cmdline)); + if (!create_manifest( bInstall )) return HRESULT_FROM_WIN32(GetLastError()); + return S_OK; } /*********************************************************************** @@ -1528,12 +1620,10 @@ LRESULT WINAPI SetPathWordBreakProc(HWND hwnd, BOOL bSet) * * Draw text with shadow. */ -int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, const RECT *pRect, DWORD dwFlags, +int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, const RECT *rect, DWORD dwFlags, COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset) { - RECT rect = *pRect; - - FIXME("(%p, %s, %d, %p, %d, 0x%08x, 0x%08x, %d, %d): stub\n", hdc, debugstr_w(pszText), cch, pRect, dwFlags, + FIXME("(%p, %s, %d, %p, %d, 0x%08x, 0x%08x, %d, %d): stub\n", hdc, debugstr_w(pszText), cch, rect, dwFlags, crText, crShadow, ixOffset, iyOffset); - return DrawTextW(hdc, pszText, cch, &rect, DT_LEFT); + return DrawTextW(hdc, pszText, cch, rect, DT_LEFT); } diff --git a/reactos/dll/win32/comctl32/listview.c b/reactos/dll/win32/comctl32/listview.c index 0899690311bf5..8e43751f395d5 100644 --- a/reactos/dll/win32/comctl32/listview.c +++ b/reactos/dll/win32/comctl32/listview.c @@ -6658,7 +6658,16 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, ZeroMemory(&hdi, sizeof(HDITEMW)); column_fill_hditem(infoPtr, &hdi, nColumn, lpColumn, isW); - + + /* + * A mask not including LVCF_WIDTH turns into a mask of width, width 10 + * (can be seen in SPY) otherwise column never gets added. + */ + if (!(lpColumn->mask & LVCF_WIDTH)) { + hdi.mask |= HDI_WIDTH; + hdi.cxy = 10; + } + /* * when the iSubItem is available Windows copies it to the header lParam. It seems * to happen only in LVM_INSERTCOLUMN - not in LVM_SETCOLUMN diff --git a/reactos/dll/win32/comctl32/rsrc.rc b/reactos/dll/win32/comctl32/rsrc.rc index e76912352c8bf..19bbb777e95ae 100644 --- a/reactos/dll/win32/comctl32/rsrc.rc +++ b/reactos/dll/win32/comctl32/rsrc.rc @@ -27,6 +27,13 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#define WINE_FILEDESCRIPTION_STR "Wine Common Controls" +#define WINE_FILENAME_STR "comctl32.dll" +#define WINE_FILEVERSION COMCTL32_VERSION, COMCTL32_VERSION_MINOR, 4704, 1100 +#define WINE_FILEVERSIONSTR "5.81" +#define WINE_PRODUCTVERSION WINE_FILEVERSION +#define WINE_PRODUCTVERSION_STR WINE_FILEVERSIONSTR + #include "wine/wine_common_ver.rc" /* BINRES idt_check.bmp */ diff --git a/reactos/dll/win32/comctl32/tab.c b/reactos/dll/win32/comctl32/tab.c index 830bc7e3b235e..d3cf0fd0c2624 100644 --- a/reactos/dll/win32/comctl32/tab.c +++ b/reactos/dll/win32/comctl32/tab.c @@ -255,6 +255,7 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem) else { if (infoPtr->iSelected != iItem) { infoPtr->iSelected=iItem; + infoPtr->uFocus=iItem; TAB_EnsureSelectionVisible(infoPtr); TAB_InvalidateTabArea(infoPtr); } diff --git a/reactos/dll/win32/comctl32/toolbar.c b/reactos/dll/win32/comctl32/toolbar.c index 275d3d5fdc3f3..8ca4e6b27518b 100644 --- a/reactos/dll/win32/comctl32/toolbar.c +++ b/reactos/dll/win32/comctl32/toolbar.c @@ -44,7 +44,7 @@ * - TBN_GETOBJECT * - TBN_SAVE * - Button wrapping (under construction). - * - Fix TB_SETROWS. + * - Fix TB_SETROWS and Separators. * - iListGap custom draw support. * * Testing: @@ -3637,10 +3637,7 @@ TOOLBAR_GetRows (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); - if (infoPtr->dwStyle & TBSTYLE_WRAPABLE) - return infoPtr->nRows; - else - return 1; + return infoPtr->nRows; } @@ -4947,20 +4944,107 @@ TOOLBAR_SetRows (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); LPRECT lprc = (LPRECT)lParam; + int rows = LOWORD(wParam); + BOOL bLarger = HIWORD(wParam); TRACE("\n"); - if (LOWORD(wParam) > 1) { - FIXME("multiple rows not supported!\n"); - } + TRACE("Setting rows to %d (%d)\n", rows, bLarger); - if(infoPtr->nRows != LOWORD(wParam)) + if(infoPtr->nRows != rows) { - infoPtr->nRows = LOWORD(wParam); + TBUTTON_INFO *btnPtr = infoPtr->buttons; + int curColumn = 0; /* Current column */ + int curRow = 0; /* Current row */ + int hidden = 0; /* Number of hidden buttons */ + int seps = 0; /* Number of separators */ + int idealWrap = 0; /* Ideal wrap point */ + int i; + BOOL wrap; + + /* + Calculate new size and wrap points - Under windows, setrows will + change the dimensions if needed to show the number of requested + rows (if CCS_NORESIZE is set), or will take up the whole window + (if no CCS_NORESIZE). + + Basic algorithum - If N buttons, and y rows requested, each row + contains N/y buttons. + + FIXME: Handling of separators not obvious from testing results + FIXME: Take width of window into account? + */ + + /* Loop through the buttons one by one counting key items */ + for (i = 0; i < infoPtr->nNumButtons; i++ ) + { + btnPtr[i].fsState &= ~TBSTATE_WRAP; + if (btnPtr[i].fsState & TBSTATE_HIDDEN) + hidden++; + else if (btnPtr[i].fsStyle & BTNS_SEP) + seps++; + } + + /* FIXME: Separators make this quite complex */ + if (seps) FIXME("Separators unhandled\n"); + + /* Round up so more per line, ie less rows */ + idealWrap = (infoPtr->nNumButtons - hidden + (rows-1)) / rows; + + /* Calculate ideal wrap point if we are allowed to grow, but cannot + achieve the requested number of rows. */ + if (bLarger && idealWrap > 1) + { + int resRows = (infoPtr->nNumButtons + (idealWrap-1)) / idealWrap; + int moreRows = (infoPtr->nNumButtons + (idealWrap-2)) / (idealWrap-1); + + if (resRows < rows && moreRows > rows) + { + idealWrap--; + TRACE("Changing idealWrap due to bLarger (now %d)\n", idealWrap); + } + } + + curColumn = curRow = 0; + wrap = FALSE; + TRACE("Trying to wrap at %d (%d,%d,%d)\n", idealWrap, + infoPtr->nNumButtons, hidden, rows); + + for (i = 0; i < infoPtr->nNumButtons; i++ ) + { + if (btnPtr[i].fsState & TBSTATE_HIDDEN) + continue; + + /* Step on, wrap if necessary or flag next to wrap */ + if (!wrap) { + curColumn++; + } else { + wrap = FALSE; + curColumn = 1; + curRow++; + } + + if (curColumn > (idealWrap-1)) { + wrap = TRUE; + btnPtr[i].fsState |= TBSTATE_WRAP; + } + } + + TRACE("Result - %d rows\n", curRow + 1); /* recalculate toolbar */ TOOLBAR_CalcToolbar (hwnd); + /* Resize if necessary (Only if NORESIZE is set - odd, but basically + if NORESIZE is NOT set, then the toolbar will always be resized to + take up the whole window. With it set, sizing needs to be manual. */ + if (infoPtr->dwStyle & CCS_NORESIZE) { + SetWindowPos(hwnd, NULL, 0, 0, + infoPtr->rcBound.right - infoPtr->rcBound.left, + infoPtr->rcBound.bottom - infoPtr->rcBound.top, + SWP_NOMOVE); + } + /* repaint toolbar */ InvalidateRect(hwnd, NULL, TRUE); } diff --git a/reactos/dll/win32/comctl32/tooltips.c b/reactos/dll/win32/comctl32/tooltips.c index 0e5a7bde75cab..41d96a1686083 100644 --- a/reactos/dll/win32/comctl32/tooltips.c +++ b/reactos/dll/win32/comctl32/tooltips.c @@ -314,7 +314,7 @@ static void TOOLTIPS_GetDispInfoA(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOA)); ttnmdi.hdr.hwndFrom = hwnd; ttnmdi.hdr.idFrom = toolPtr->uId; - ttnmdi.hdr.code = TTN_GETDISPINFOA; + ttnmdi.hdr.code = TTN_GETDISPINFOA; /* == TTN_NEEDTEXTA */ ttnmdi.lpszText = (LPSTR)&ttnmdi.szText; ttnmdi.uFlags = toolPtr->uFlags; ttnmdi.lParam = toolPtr->lParam; @@ -332,7 +332,6 @@ static void TOOLTIPS_GetDispInfoA(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO } } else if (ttnmdi.lpszText == 0) { - /* no text available */ infoPtr->szTipText[0] = '\0'; } else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) { @@ -347,6 +346,22 @@ static void TOOLTIPS_GetDispInfoA(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO ERR("recursive text callback!\n"); infoPtr->szTipText[0] = '\0'; } + + /* no text available - try calling parent instead as per native */ + /* FIXME: Unsure if SETITEM should save the value or not */ + if (infoPtr->szTipText[0] == 0x00) { + + SendMessageW(GetParent(toolPtr->hwnd), WM_NOTIFY, + (WPARAM)toolPtr->uId, (LPARAM)&ttnmdi); + + if (IS_INTRESOURCE(ttnmdi.lpszText)) { + LoadStringW(ttnmdi.hinst, LOWORD(ttnmdi.lpszText), + infoPtr->szTipText, INFOTIPSIZE); + } else if (ttnmdi.lpszText && + ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) { + Str_GetPtrAtoW(ttnmdi.lpszText, infoPtr->szTipText, INFOTIPSIZE); + } + } } static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr) @@ -357,7 +372,7 @@ static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOW)); ttnmdi.hdr.hwndFrom = hwnd; ttnmdi.hdr.idFrom = toolPtr->uId; - ttnmdi.hdr.code = TTN_GETDISPINFOW; + ttnmdi.hdr.code = TTN_GETDISPINFOW; /* == TTN_NEEDTEXTW */ ttnmdi.lpszText = (LPWSTR)&ttnmdi.szText; ttnmdi.uFlags = toolPtr->uFlags; ttnmdi.lParam = toolPtr->lParam; @@ -375,7 +390,6 @@ static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO } } else if (ttnmdi.lpszText == 0) { - /* no text available */ infoPtr->szTipText[0] = '\0'; } else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) { @@ -390,6 +404,23 @@ static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO ERR("recursive text callback!\n"); infoPtr->szTipText[0] = '\0'; } + + /* no text available - try calling parent instead as per native */ + /* FIXME: Unsure if SETITEM should save the value or not */ + if (infoPtr->szTipText[0] == 0x00) { + + SendMessageW(GetParent(toolPtr->hwnd), WM_NOTIFY, + (WPARAM)toolPtr->uId, (LPARAM)&ttnmdi); + + if (IS_INTRESOURCE(ttnmdi.lpszText)) { + LoadStringW(ttnmdi.hinst, LOWORD(ttnmdi.lpszText), + infoPtr->szTipText, INFOTIPSIZE); + } else if (ttnmdi.lpszText && + ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) { + Str_GetPtrW(ttnmdi.lpszText, infoPtr->szTipText, INFOTIPSIZE); + } + } + } static void @@ -538,15 +569,18 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr) if (style & TTS_BALLOON) { ptfx = rc.left + ((rc.right - rc.left) / 2); - if(rect.top - size.cy >= 0) + + /* CENTERTIP ballon tooltips default to below the field + if they fit on the screen */ + if(rc.bottom + size.cy > GetSystemMetrics(SM_CYSCREEN)) { - rect.top -= size.cy; + rect.top = rc.top - size.cy; infoPtr->bToolBelow = FALSE; } else { infoPtr->bToolBelow = TRUE; - rect.top += 20; + rect.top = rc.bottom; } rect.left = max(0, rect.left - BALLOON_STEMINDENT); } diff --git a/reactos/dll/win32/comctl32/treeview.c b/reactos/dll/win32/comctl32/treeview.c index 87f4a5f49980b..e99b46803232d 100644 --- a/reactos/dll/win32/comctl32/treeview.c +++ b/reactos/dll/win32/comctl32/treeview.c @@ -946,6 +946,8 @@ TREEVIEW_RecalculateVisibleOrder(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *start) for (item = start; item != NULL; item = TREEVIEW_GetNextListItem(infoPtr, item)) { + if (!ISVISIBLE(item) && order > 0) + TREEVIEW_ComputeItemInternalMetrics(infoPtr, item); item->visibleOrder = order; order += item->iIntegral; } @@ -2031,7 +2033,10 @@ TREEVIEW_GetItemRect(const TREEVIEW_INFO *infoPtr, BOOL fTextRect, LPRECT lpRect lpRect->bottom = wineItem->rect.bottom; lpRect->left = wineItem->textOffset; - lpRect->right = wineItem->textOffset + wineItem->textWidth; + if (!wineItem->textWidth) + TREEVIEW_ComputeTextWidth(infoPtr, wineItem, 0); + + lpRect->right = wineItem->textOffset + wineItem->textWidth + 4; } else {