diff --git a/reactos/lib/comctl32/listview.c b/reactos/lib/comctl32/listview.c index 6799434d182..b9e23413e5e 100644 --- a/reactos/lib/comctl32/listview.c +++ b/reactos/lib/comctl32/listview.c @@ -8954,6 +8954,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /* case LVM_GETTILEVIEWINFO: */ case LVM_GETTOOLTIPS: + if( !infoPtr->hwndToolTip ) + infoPtr->hwndToolTip = COMCTL32_CreateToolTip( hwnd ); return (LRESULT)infoPtr->hwndToolTip; case LVM_GETTOPINDEX: diff --git a/reactos/lib/comctl32/propsheet.c b/reactos/lib/comctl32/propsheet.c index 29f61b9963d..808ef88ba95 100644 --- a/reactos/lib/comctl32/propsheet.c +++ b/reactos/lib/comctl32/propsheet.c @@ -2490,6 +2490,133 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) } } +/****************************************************************************** + * PROPSHEET_InsertPage + */ +static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage) +{ + if (!HIWORD(hpageInsertAfter)) + FIXME("(%p, %d, %p): stub\n", hwndDlg, LOWORD(hpageInsertAfter), hpage); + else + FIXME("(%p, %p, %p): stub\n", hwndDlg, hpageInsertAfter, hpage); + return FALSE; +} + +/****************************************************************************** + * PROPSHEET_SetHeaderTitleW + */ +static void PROPSHEET_SetHeaderTitleW(HWND hwndDlg, int iPageIndex, LPCWSTR pszHeaderTitle) +{ + FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_w(pszHeaderTitle)); +} + +/****************************************************************************** + * PROPSHEET_SetHeaderTitleA + */ +static void PROPSHEET_SetHeaderTitleA(HWND hwndDlg, int iPageIndex, LPCSTR pszHeaderTitle) +{ + FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_a(pszHeaderTitle)); +} + +/****************************************************************************** + * PROPSHEET_SetHeaderSubTitleW + */ +static void PROPSHEET_SetHeaderSubTitleW(HWND hwndDlg, int iPageIndex, LPCWSTR pszHeaderSubTitle) +{ + FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_w(pszHeaderSubTitle)); +} + +/****************************************************************************** + * PROPSHEET_SetHeaderSubTitleA + */ +static void PROPSHEET_SetHeaderSubTitleA(HWND hwndDlg, int iPageIndex, LPCSTR pszHeaderSubTitle) +{ + FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_a(pszHeaderSubTitle)); +} + +/****************************************************************************** + * PROPSHEET_HwndToIndex + */ +static LRESULT PROPSHEET_HwndToIndex(HWND hwndDlg, HWND hPageDlg) +{ + int index; + PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg, + PropSheetInfoStr); + + TRACE("(%p, %p)\n", hwndDlg, hPageDlg); + + for (index = 0; index < psInfo->nPages; index++) + if (psInfo->proppage[index].hwndPage == hPageDlg) + return index; + + WARN("%p not found\n", hPageDlg); + + return -1; +} + +/****************************************************************************** + * PROPSHEET_IndexToHwnd + */ +static LRESULT PROPSHEET_IndexToHwnd(HWND hwndDlg, int iPageIndex) +{ + FIXME("(%p, %d): stub\n", hwndDlg, iPageIndex); + return 0; +} + +/****************************************************************************** + * PROPSHEET_PageToIndex + */ +static LRESULT PROPSHEET_PageToIndex(HWND hwndDlg, HPROPSHEETPAGE hPage) +{ + FIXME("(%p, %p): stub\n", hwndDlg, hPage); + return -1; +} + +/****************************************************************************** + * PROPSHEET_IndexToPage + */ +static LRESULT PROPSHEET_IndexToPage(HWND hwndDlg, int iPageIndex) +{ + FIXME("(%p, %d): stub\n", hwndDlg, iPageIndex); + return 0; +} + +/****************************************************************************** + * PROPSHEET_IdToIndex + */ +static LRESULT PROPSHEET_IdToIndex(HWND hwndDlg, int iPageId) +{ + FIXME("(%p, %d): stub\n", hwndDlg, iPageId); + return -1; +} + +/****************************************************************************** + * PROPSHEET_IndexToId + */ +static LRESULT PROPSHEET_IndexToId(HWND hwndDlg, int iPageIndex) +{ + FIXME("(%p, %d): stub\n", hwndDlg, iPageIndex); + return 0; +} + +/****************************************************************************** + * PROPSHEET_GetResult + */ +static LRESULT PROPSHEET_GetResult(HWND hwndDlg) +{ + FIXME("(%p): stub\n", hwndDlg); + return -1; +} + +/****************************************************************************** + * PROPSHEET_RecalcPageSizes + */ +static BOOL PROPSHEET_RecalcPageSizes(HWND hwndDlg) +{ + FIXME("(%p): stub\n", hwndDlg); + return FALSE; +} + /****************************************************************************** * PROPSHEET_GetPageIndex * @@ -3348,6 +3475,85 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) PROPSHEET_SetFinishTextW(hwnd, (LPCWSTR) lParam); return FALSE; + case PSM_INSERTPAGE: + { + BOOL msgResult = PROPSHEET_InsertPage(hwnd, (HPROPSHEETPAGE)wParam, (HPROPSHEETPAGE)lParam); + SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + return TRUE; + } + + case PSM_SETHEADERTITLEW: + PROPSHEET_SetHeaderTitleW(hwnd, (int)wParam, (LPCWSTR)lParam); + return TRUE; + + case PSM_SETHEADERTITLEA: + PROPSHEET_SetHeaderTitleA(hwnd, (int)wParam, (LPCSTR)lParam); + return TRUE; + + case PSM_SETHEADERSUBTITLEW: + PROPSHEET_SetHeaderSubTitleW(hwnd, (int)wParam, (LPCWSTR)lParam); + return TRUE; + + case PSM_SETHEADERSUBTITLEA: + PROPSHEET_SetHeaderSubTitleA(hwnd, (int)wParam, (LPCSTR)lParam); + return TRUE; + + case PSM_HWNDTOINDEX: + { + LRESULT msgResult = PROPSHEET_HwndToIndex(hwnd, (HWND)wParam); + SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + return TRUE; + } + + case PSM_INDEXTOHWND: + { + LRESULT msgResult = PROPSHEET_IndexToHwnd(hwnd, (int)wParam); + SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + return TRUE; + } + + case PSM_PAGETOINDEX: + { + LRESULT msgResult = PROPSHEET_PageToIndex(hwnd, (HPROPSHEETPAGE)wParam); + SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + return TRUE; + } + + case PSM_INDEXTOPAGE: + { + LRESULT msgResult = PROPSHEET_IndexToPage(hwnd, (int)wParam); + SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + return TRUE; + } + + case PSM_IDTOINDEX: + { + LRESULT msgResult = PROPSHEET_IdToIndex(hwnd, (int)lParam); + SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + return TRUE; + } + + case PSM_INDEXTOID: + { + LRESULT msgResult = PROPSHEET_IndexToId(hwnd, (int)wParam); + SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + return TRUE; + } + + case PSM_GETRESULT: + { + LRESULT msgResult = PROPSHEET_GetResult(hwnd); + SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + return TRUE; + } + + case PSM_RECALCPAGESIZES: + { + LRESULT msgResult = PROPSHEET_RecalcPageSizes(hwnd); + SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + return TRUE; + } + default: return FALSE; } diff --git a/reactos/lib/comctl32/tab.c b/reactos/lib/comctl32/tab.c index bef38ca5bef..011b629a0d9 100644 --- a/reactos/lib/comctl32/tab.c +++ b/reactos/lib/comctl32/tab.c @@ -1145,7 +1145,7 @@ static void TAB_SetItemBounds (HWND hwnd) /* Set the leftmost position of the tab. */ infoPtr->items[curItem].rect.left = curItemLeftPos; - if (lStyle & TCS_FIXEDWIDTH) + if ((lStyle & TCS_FIXEDWIDTH) || !infoPtr->items[curItem].pszText) { infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left + max(infoPtr->tabWidth, icon_width); @@ -1682,8 +1682,11 @@ TAB_DrawItemInterior rcText.left = rcText.top = rcText.right = rcText.bottom = 0; /* get the rectangle that the text fits in */ - DrawTextW(hdc, infoPtr->items[iItem].pszText, -1, - &rcText, DT_CALCRECT); + if (infoPtr->items[iItem].pszText) + { + DrawTextW(hdc, infoPtr->items[iItem].pszText, -1, + &rcText, DT_CALCRECT); + } /* * If not owner draw, then do the drawing ourselves. * @@ -1824,14 +1827,17 @@ TAB_DrawItemInterior hFont = CreateFontIndirectA(&logfont); SelectObject(hdc, hFont); - ExtTextOutW(hdc, - (lStyle & TCS_BOTTOM) ? drawRect->right : drawRect->left, - (!(lStyle & TCS_BOTTOM)) ? drawRect->bottom : drawRect->top, - ETO_CLIPPED, - drawRect, - infoPtr->items[iItem].pszText, - lstrlenW(infoPtr->items[iItem].pszText), - 0); + if (infoPtr->items[iItem].pszText) + { + ExtTextOutW(hdc, + (lStyle & TCS_BOTTOM) ? drawRect->right : drawRect->left, + (!(lStyle & TCS_BOTTOM)) ? drawRect->bottom : drawRect->top, + ETO_CLIPPED, + drawRect, + infoPtr->items[iItem].pszText, + lstrlenW(infoPtr->items[iItem].pszText), + 0); + } DeleteObject(hFont); } @@ -1841,14 +1847,17 @@ TAB_DrawItemInterior debugstr_w(infoPtr->items[iItem].pszText), center_offset_h, center_offset_v, drawRect->left, drawRect->top, drawRect->right, drawRect->bottom, (rcText.right-rcText.left)); - DrawTextW - ( - hdc, - infoPtr->items[iItem].pszText, - lstrlenW(infoPtr->items[iItem].pszText), - drawRect, - DT_LEFT | DT_SINGLELINE + if (infoPtr->items[iItem].pszText) + { + DrawTextW + ( + hdc, + infoPtr->items[iItem].pszText, + lstrlenW(infoPtr->items[iItem].pszText), + drawRect, + DT_LEFT | DT_SINGLELINE ); + } } *drawRect = rcTemp; /* restore drawRect */ diff --git a/reactos/lib/comctl32/toolbar.c b/reactos/lib/comctl32/toolbar.c index f97fe29e88d..3677de73400 100644 --- a/reactos/lib/comctl32/toolbar.c +++ b/reactos/lib/comctl32/toolbar.c @@ -407,7 +407,7 @@ TOOLBAR_GetImageListForDrawing (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, IMA if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { if (btnPtr->iBitmap == I_IMAGENONE) return NULL; - ERR("index %d,%d is not valid, max %d\n", + ERR("bitmap for ID %d, index %d is not valid, number of bitmaps in imagelist: %d\n", HIWORD(btnPtr->iBitmap), LOWORD(btnPtr->iBitmap), infoPtr->nNumBitmaps); return NULL; } @@ -634,61 +634,53 @@ TOOLBAR_DrawPattern (LPRECT lpRect, NMTBCUSTOMDRAW *tbcd) INT cy = lpRect->bottom - lpRect->top; clrTextOld = SetTextColor(hdc, tbcd->clrBtnHighlight); clrBkOld = SetBkColor(hdc, tbcd->clrBtnFace); - PatBlt (hdc, lpRect->left, lpRect->top, cx, cy, PATCOPY); + PatBlt (hdc, lpRect->left + 2, lpRect->top + 2, cx - 4, cy - 4, PATCOPY); SetBkColor(hdc, clrBkOld); SetTextColor(hdc, clrTextOld); SelectObject (hdc, hbr); } -static void TOOLBAR_DrawMasked(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, - HDC hdc, INT x, INT y) +static void TOOLBAR_DrawMasked(HIMAGELIST himl, int index, HDC hdc, INT x, INT y, UINT draw_flags) { - int index; - HIMAGELIST himl = - TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index); + INT cx, cy; + HBITMAP hbmMask, hbmImage; + HDC hdcMask, hdcImage; - if (himl) - { - INT cx, cy; - HBITMAP hbmMask, hbmImage; - HDC hdcMask, hdcImage; + ImageList_GetIconSize(himl, &cx, &cy); - ImageList_GetIconSize(himl, &cx, &cy); + /* Create src image */ + hdcImage = CreateCompatibleDC(hdc); + hbmImage = CreateBitmap(cx, cy, GetDeviceCaps(hdc,PLANES), + GetDeviceCaps(hdc,BITSPIXEL), NULL); + SelectObject(hdcImage, hbmImage); + ImageList_DrawEx(himl, index, hdcImage, 0, 0, cx, cy, + RGB(0xff, 0xff, 0xff), RGB(0,0,0), draw_flags); - /* Create src image */ - hdcImage = CreateCompatibleDC(hdc); - hbmImage = CreateBitmap(cx, cy, GetDeviceCaps(hdc,PLANES), - GetDeviceCaps(hdc,BITSPIXEL), NULL); - SelectObject(hdcImage, hbmImage); - ImageList_DrawEx(himl, index, hdcImage, 0, 0, cx, cy, - RGB(0xff, 0xff, 0xff), RGB(0,0,0), ILD_NORMAL); + /* Create Mask */ + hdcMask = CreateCompatibleDC(0); + hbmMask = CreateBitmap(cx, cy, 1, 1, NULL); + SelectObject(hdcMask, hbmMask); - /* Create Mask */ - hdcMask = CreateCompatibleDC(0); - hbmMask = CreateBitmap(cx, cy, 1, 1, NULL); - SelectObject(hdcMask, hbmMask); + /* Remove the background and all white pixels */ + SetBkColor(hdcImage, ImageList_GetBkColor(himl)); + BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, SRCCOPY); + SetBkColor(hdcImage, RGB(0xff, 0xff, 0xff)); + BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, NOTSRCERASE); - /* Remove the background and all white pixels */ - SetBkColor(hdcImage, ImageList_GetBkColor(himl)); - BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, SRCCOPY); - SetBkColor(hdcImage, RGB(0xff, 0xff, 0xff)); - BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, NOTSRCERASE); + /* draw the new mask 'etched' to hdc */ + SetBkColor(hdc, RGB(255, 255, 255)); + SelectObject(hdc, GetSysColorBrush(COLOR_3DHILIGHT)); + /* E20746 op code is (Dst ^ (Src & (Pat ^ Dst))) */ + BitBlt(hdc, x + 1, y + 1, cx, cy, hdcMask, 0, 0, 0xE20746); + SelectObject(hdc, GetSysColorBrush(COLOR_3DSHADOW)); + BitBlt(hdc, x, y, cx, cy, hdcMask, 0, 0, 0xE20746); - /* draw the new mask 'etched' to hdc */ - SetBkColor(hdc, RGB(255, 255, 255)); - SelectObject(hdc, GetSysColorBrush(COLOR_3DHILIGHT)); - /* E20746 op code is (Dst ^ (Src & (Pat ^ Dst))) */ - BitBlt(hdc, x + 1, y + 1, cx, cy, hdcMask, 0, 0, 0xE20746); - SelectObject(hdc, GetSysColorBrush(COLOR_3DSHADOW)); - BitBlt(hdc, x, y, cx, cy, hdcMask, 0, 0, 0xE20746); - - /* Cleanup */ - DeleteObject(hbmImage); - DeleteDC(hdcImage); - DeleteObject (hbmMask); - DeleteDC(hdcMask); - } + /* Cleanup */ + DeleteObject(hbmImage); + DeleteDC(hdcImage); + DeleteObject (hbmMask); + DeleteDC(hdcMask); } @@ -721,7 +713,10 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top { himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DISABLED, &index); if (!himl) - draw_masked = TRUE; + { + himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index); + draw_masked = TRUE; + } } else if ((tbcd->nmcd.uItemState & CDIS_HOT) && (infoPtr->dwStyle & TBSTYLE_FLAT)) { @@ -734,6 +729,9 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top else himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index); + if (!himl) + return; + if (!(infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) && (tbcd->nmcd.uItemState & (CDIS_SELECTED | CDIS_CHECKED))) offset = 1; @@ -746,8 +744,8 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top index, himl, left, top, offset); if (draw_masked) - TOOLBAR_DrawMasked (infoPtr, btnPtr, tbcd->nmcd.hdc, left + offset, top + offset); - else if (himl) + TOOLBAR_DrawMasked (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags); + else ImageList_Draw (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags); } @@ -5313,6 +5311,8 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) NMTOOLBARA nmtb; BOOL bDragKeyPressed; + TRACE("\n"); + if (infoPtr->dwStyle & TBSTYLE_ALTDRAG) bDragKeyPressed = (GetKeyState(VK_MENU) < 0); else diff --git a/reactos/lib/comctl32/tooltips.c b/reactos/lib/comctl32/tooltips.c index 6e659259c4f..a88e50fde3a 100644 --- a/reactos/lib/comctl32/tooltips.c +++ b/reactos/lib/comctl32/tooltips.c @@ -130,6 +130,12 @@ typedef struct #define TOOLTIPS_GetInfoPtr(hWindow) ((TOOLTIPS_INFO *)GetWindowLongA (hWindow, 0)) +/* offsets from window edge to start of text */ +#define NORMAL_TEXT_MARGIN 2 +#define BALLOON_TEXT_MARGIN (NORMAL_TEXT_MARGIN+10) +/* value used for CreateRoundRectRgn that specifies how much + * each corner is curved */ +#define BALLOON_ROUNDEDNESS 20 LRESULT CALLBACK TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR dwRef); @@ -144,6 +150,8 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc) HFONT hOldFont; HBRUSH hBrush; UINT uFlags = DT_EXTERNALLEADING; + HRGN hRgn = NULL; + DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE); if (infoPtr->nMaxTipWidth > -1) uFlags |= DT_WORDBREAK; @@ -151,25 +159,63 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc) uFlags |= DT_NOPREFIX; GetClientRect (hwnd, &rc); - /* fill the background */ - hBrush = CreateSolidBrush (infoPtr->clrBk); - FillRect (hdc, &rc, hBrush); - DeleteObject (hBrush); + hBrush = CreateSolidBrush(infoPtr->clrBk); - /* calculate text rectangle */ - rc.left += (2 + infoPtr->rcMargin.left); - rc.top += (2 + infoPtr->rcMargin.top); - rc.right -= (2 + infoPtr->rcMargin.right); - rc.bottom -= (2 + infoPtr->rcMargin.bottom); + if (dwStyle & TTS_BALLOON) + { + /* create a region to store result into */ + hRgn = CreateRectRgn(0, 0, 0, 0); - /* draw text */ + GetWindowRgn(hwnd, hRgn); + + /* fill the background */ + FillRgn(hdc, hRgn, hBrush); + DeleteObject(hBrush); + hBrush = NULL; + + /* calculate text rectangle */ + rc.left += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.left); + rc.top += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.top); + rc.right -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.right); + rc.bottom -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.bottom); + } + else + { + /* fill the background */ + FillRect(hdc, &rc, hBrush); + DeleteObject(hBrush); + hBrush = NULL; + + /* calculate text rectangle */ + rc.left += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.left); + rc.top += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.top); + rc.right -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.right); + rc.bottom -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.bottom); + } + + /* already drawn the background; don't need to draw it again + * when drawing text */ oldBkMode = SetBkMode (hdc, TRANSPARENT); SetTextColor (hdc, infoPtr->clrText); hOldFont = SelectObject (hdc, infoPtr->hFont); + /* draw text */ DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags); + /* be polite and reset the things we changed in the dc */ SelectObject (hdc, hOldFont); - if (oldBkMode != TRANSPARENT) - SetBkMode (hdc, oldBkMode); + SetBkMode (hdc, oldBkMode); + + if (dwStyle & TTS_BALLOON) + { + /* frame region because default window proc doesn't do it */ + INT width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE); + INT height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE); + + hBrush = GetSysColorBrush(COLOR_WINDOWFRAME); + FrameRgn(hdc, hRgn, hBrush, width, height); + } + + if (hRgn) + DeleteObject(hRgn); } static void TOOLTIPS_GetDispInfoA(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr) @@ -322,10 +368,20 @@ TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize) SelectObject (hdc, hOldFont); ReleaseDC (hwnd, hdc); - lpSize->cx = rc.right - rc.left + 4 + - infoPtr->rcMargin.left + infoPtr->rcMargin.right; - lpSize->cy = rc.bottom - rc.top + 4 + - infoPtr->rcMargin.bottom + infoPtr->rcMargin.top; + if (GetWindowLongW(hwnd, GWL_STYLE) & TTS_BALLOON) + { + lpSize->cx = rc.right - rc.left + 2*BALLOON_TEXT_MARGIN + + infoPtr->rcMargin.left + infoPtr->rcMargin.right; + lpSize->cy = rc.bottom - rc.top + 2*BALLOON_TEXT_MARGIN + + infoPtr->rcMargin.bottom + infoPtr->rcMargin.top; + } + else + { + lpSize->cx = rc.right - rc.left + 2*NORMAL_TEXT_MARGIN + + infoPtr->rcMargin.left + infoPtr->rcMargin.right; + lpSize->cy = rc.bottom - rc.top + 2*NORMAL_TEXT_MARGIN + + infoPtr->rcMargin.bottom + infoPtr->rcMargin.top; + } } @@ -412,6 +468,18 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr) AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE), FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE)); + if (GetWindowLongW(hwnd, GWL_STYLE) & TTS_BALLOON) + { + HRGN hRgn; + + /* FIXME: need to add pointy bit using CreatePolyRgn & CombinRgn */ + hRgn = CreateRoundRectRgn(0, 0, rect.right - rect.left, rect.bottom - rect.top, BALLOON_ROUNDEDNESS, BALLOON_ROUNDEDNESS); + + SetWindowRgn(hwnd, hRgn, FALSE); + /* we don't free the region handle as the system deletes it when + * it is no longer needed */ + } + SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_SHOWWINDOW | SWP_NOACTIVATE); @@ -531,6 +599,18 @@ TOOLTIPS_TrackShow (HWND hwnd, TOOLTIPS_INFO *infoPtr) AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE), FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE)); + if (GetWindowLongW(hwnd, GWL_STYLE) & TTS_BALLOON) + { + HRGN hRgn; + + /* FIXME: need to add pointy bit using CreatePolyRgn & CombinRgn */ + hRgn = CreateRoundRectRgn(0, 0, rect.right - rect.left, rect.bottom - rect.top, BALLOON_ROUNDEDNESS, BALLOON_ROUNDEDNESS); + + SetWindowRgn(hwnd, hRgn, FALSE); + /* we don't free the region handle as the system deletes it when + * it is no longer needed */ + } + SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_SHOWWINDOW | SWP_NOACTIVATE ); @@ -2024,22 +2104,6 @@ TOOLTIPS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) } -static LRESULT -TOOLTIPS_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); - RECT rect; - HBRUSH hBrush; - - hBrush = CreateSolidBrush (infoPtr->clrBk); - GetClientRect (hwnd, &rect); - FillRect ((HDC)wParam, &rect, hBrush); - DeleteObject (hBrush); - - return FALSE; -} - - static LRESULT TOOLTIPS_GetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) { @@ -2068,6 +2132,11 @@ TOOLTIPS_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) dwStyle &= 0x0000FFFF; dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS); + + /* WS_BORDER only draws a border round the window rect, not the + * window region, therefore it is useless to us in balloon mode */ + if (dwStyle & TTS_BALLOON) dwStyle &= ~WS_BORDER; + SetWindowLongA (hwnd, GWL_STYLE, dwStyle); dwExStyle |= WS_EX_TOOLWINDOW; @@ -2405,7 +2474,8 @@ TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TOOLTIPS_Destroy (hwnd, wParam, lParam); case WM_ERASEBKGND: - return TOOLTIPS_EraseBackground (hwnd, wParam, lParam); + /* we draw the background in WM_PAINT */ + return 0; case WM_GETFONT: return TOOLTIPS_GetFont (hwnd, wParam, lParam); diff --git a/reactos/lib/comctl32/winehq2ros.patch b/reactos/lib/comctl32/winehq2ros.patch index 7df31fffcaa..24eff0d36b0 100644 --- a/reactos/lib/comctl32/winehq2ros.patch +++ b/reactos/lib/comctl32/winehq2ros.patch @@ -4,7 +4,7 @@ RCS file: /home/wine/wine/dlls/comctl32/comctl32.spec,v retrieving revision 1.44 diff -u -r1.44 comctl32.spec --- comctl32.spec 17 May 2004 20:51:27 -0000 1.44 -+++ comctl32.spec 16 Jun 2004 06:51:02 -0000 ++++ comctl32.spec 8 Aug 2004 13:10:59 -0000 @@ -106,13 +106,13 @@ 412 stdcall RemoveWindowSubclass(long ptr long) 413 stdcall DefSubclassProc(long long long long) @@ -26,34 +26,13 @@ diff -u -r1.44 comctl32.spec # Functions imported by name -Index: imagelist.c -=================================================================== -RCS file: /home/wine/wine/dlls/comctl32/imagelist.c,v -retrieving revision 1.85 -diff -u -r1.85 imagelist.c ---- imagelist.c 27 Feb 2004 04:40:08 -0000 1.85 -+++ imagelist.c 16 Jun 2004 06:51:02 -0000 -@@ -1146,11 +1146,13 @@ - PatBlt(hBlendMaskDC, 0, 0, cx, cy, PATCOPY); - SelectObject(hBlendMaskDC, hOldBrush); - -+#if 0 - /* Modify the blend mask if an Image Mask exist */ - if(himl->hbmMask) { - BitBlt(hBlendMaskDC, 0, 0, cx, cy, hMaskListDC, lx, ly, 0x220326); /* NOTSRCAND */ - BitBlt(hBlendMaskDC, 0, 0, cx, cy, hBlendMaskDC, 0, 0, NOTSRCCOPY); - } -+#endif - - /* now apply blend to the current image given the BlendMask */ - if (clrBlend == CLR_DEFAULT) clrBlend = GetSysColor (COLOR_HIGHLIGHT); Index: listview.c =================================================================== RCS file: /home/wine/wine/dlls/comctl32/listview.c,v -retrieving revision 1.389 -diff -u -r1.389 listview.c ---- listview.c 4 Jun 2004 17:58:29 -0000 1.389 -+++ listview.c 16 Jun 2004 06:51:06 -0000 +retrieving revision 1.390 +diff -u -r1.390 listview.c +--- listview.c 6 Jul 2004 21:27:34 -0000 1.390 ++++ listview.c 8 Aug 2004 13:11:03 -0000 @@ -147,6 +147,7 @@ #include #include @@ -62,13 +41,33 @@ diff -u -r1.389 listview.c #include #include #include +@@ -2023,7 +2024,8 @@ + infoPtr->iconSize.cy + ICON_BOTTOM_PADDING; + Label.right = Label.left + labelSize.cx; + Label.bottom = Label.top + infoPtr->nItemHeight; +- if (!oversizedBox && labelSize.cy > infoPtr->ntmHeight) ++ if (!oversizedBox && labelSize.cy > infoPtr->ntmHeight && ++ infoPtr->ntmHeight) + { + labelSize.cy = min(Box.bottom - Label.top, labelSize.cy); + labelSize.cy /= infoPtr->ntmHeight; +@@ -9517,7 +9519,8 @@ + hOldFont = SelectObject(hdc, infoPtr->hFont); + + /*Get String Length in pixels */ +- GetTextExtentPoint32W(hdc, text, lstrlenW(text), &sz); ++ if(!GetTextExtentPoint32W(hdc, text, lstrlenW(text), &sz)) ++ sz.cx = 0; + + /*Add Extra spacing for the next character */ + GetTextMetricsW(hdc, &textMetric); Index: string.c =================================================================== RCS file: /home/wine/wine/dlls/comctl32/string.c,v retrieving revision 1.4 diff -u -r1.4 string.c --- string.c 17 May 2004 20:51:27 -0000 1.4 -+++ string.c 16 Jun 2004 06:51:06 -0000 ++++ string.c 8 Aug 2004 13:11:03 -0000 @@ -254,7 +254,7 @@ { TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));