Ignore:
Timestamp:
Mar 17, 2000, 6:13:26 PM (25 years ago)
Author:
cbratschi
Message:

trackbar buddy fix, tooltip enhancements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/toolbar.cpp

    r2875 r3145  
    1 /* $Id: toolbar.cpp,v 1.1 2000-02-23 17:09:48 cbratschi Exp $ */
     1/* $Id: toolbar.cpp,v 1.2 2000-03-17 17:13:24 cbratschi Exp $ */
    22/*
    33 * Toolbar control
     
    16131613}
    16141614
    1615 //WINE version - not currently used
    1616 #if 0
    1617 static BOOL WINAPI
    1618 TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    1619 {
    1620     TOOLBAR_INFO *infoPtr = (TOOLBAR_INFO *)GetWindowLongA (hwnd, DWL_USER);
    1621     static HDSA hDsa = NULL;
    1622 
    1623     switch (uMsg)
    1624     {
    1625         case WM_INITDIALOG:
    1626             infoPtr = (TOOLBAR_INFO *)lParam;
    1627             SetWindowLongA (hwnd, DWL_USER, (DWORD)infoPtr);
    1628 
    1629             hDsa = DSA_Create (sizeof(TBUTTON_INFO), 5);
    1630 
    1631             if (infoPtr)
    1632             {
    1633                 TBUTTON_INFO *btnPtr;
    1634                 INT i;
    1635 
    1636                 /* insert 'virtual' separator button into 'available buttons' list */
    1637                 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)"");
    1638 
    1639                 /* copy all buttons and append them to the right listbox */
    1640                 btnPtr = infoPtr->buttons;
    1641                 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++)
    1642                 {
    1643                     DSA_InsertItem (hDsa, i, btnPtr);
    1644 
    1645                     /* FIXME: hidden buttons appear in the 'toolbar buttons' list too */
    1646                     if (btnPtr->fsState & TBSTATE_HIDDEN)
    1647                     {
    1648                         SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)"");
    1649                     }
    1650                     else
    1651                     {
    1652                         SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)"");
    1653                     }
    1654                 }
    1655 
    1656                 /* append 'virtual' separator button to the 'toolbar buttons' list */
    1657                 /* TODO */
    1658             }
    1659             return TRUE;
    1660 
    1661         case WM_CLOSE:
    1662             EndDialog(hwnd, FALSE);
    1663             return TRUE;
    1664 
    1665         case WM_COMMAND:
    1666             switch (LOWORD(wParam))
    1667             {
    1668                 case IDCANCEL:
    1669                     EndDialog(hwnd, FALSE);
    1670                     break;
    1671             }
    1672             return TRUE;
    1673 
    1674         case WM_DESTROY:
    1675             if (hDsa)
    1676                 DSA_Destroy (hDsa);
    1677             return TRUE;
    1678 
    1679         case WM_DRAWITEM:
    1680             if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX)
    1681             {
    1682                 LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;
    1683                 TBUTTON_INFO btnPtr;
    1684                 RECT rcButton;
    1685                 RECT rcText;
    1686                 HPEN hOldPen;
    1687                 HBRUSH hOldBrush;
    1688                 COLORREF oldText = 0;
    1689                 COLORREF oldBk = 0;
    1690 
    1691                 FIXME("action: %x itemState: %x\n",
    1692                       lpdis->itemAction, lpdis->itemState);
    1693 
    1694                 DSA_GetItem (hDsa, 0 /*lpdis->itemID*/, &btnPtr);
    1695 
    1696                 if (lpdis->itemState & ODS_FOCUS)
    1697                 {
    1698                     oldBk = SetBkColor (lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT));
    1699                     oldText = SetTextColor (lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
    1700                 }
    1701 
    1702                 hOldPen = SelectObject (lpdis->hDC, GetSysColorPen ((lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW));
    1703                 hOldBrush = SelectObject (lpdis->hDC, GetSysColorBrush ((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW));
    1704 
    1705                 /* fill background rectangle */
    1706                 Rectangle (lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
    1707                            lpdis->rcItem.right, lpdis->rcItem.bottom);
    1708 
    1709                 /* calculate button and text rectangles */
    1710                 CopyRect (&rcButton, &lpdis->rcItem);
    1711                 InflateRect (&rcButton, -1, -1);
    1712                 CopyRect (&rcText, &rcButton);
    1713                 rcButton.right = rcButton.left + infoPtr->nBitmapWidth + 6;
    1714                 rcText.left = rcButton.right + 2;
    1715 
    1716                 /* draw focus rectangle */
    1717                 if (lpdis->itemState & ODS_FOCUS)
    1718                     DrawFocusRect (lpdis->hDC, &lpdis->rcItem);
    1719 
    1720                 /* draw button */
    1721                 DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT);
    1722 
    1723                 /* draw image and text */
    1724                 if (wParam == IDC_AVAILBTN_LBOX && lpdis->itemID == 0)
    1725                 {
    1726                     /* virtual separator in the 'available' list */
    1727                     DrawTextA (lpdis->hDC, "Separator", -1, &rcText,
    1728                                DT_LEFT | DT_VCENTER | DT_SINGLELINE);
    1729                 }
    1730                 else
    1731                 {
    1732                     /* real button */
    1733 
    1734                     ImageList_Draw (infoPtr->himlDef, btnPtr.iBitmap, lpdis->hDC,
    1735                                     rcButton.left+1, rcButton.top+1, ILD_NORMAL);
    1736 //AH: TODO: Find out why this happens!!!
    1737 if ((infoPtr->strings == NULL) || (infoPtr->strings[btnPtr.iString] == NULL))
    1738   dprintf(("COMCTL32:TOOLBAR:CustomizeDialog - Error drawing string - pointer not found!\n"));
    1739 else
    1740                     DrawTextW (lpdis->hDC,  infoPtr->strings[btnPtr.iString], -1, &rcText,
    1741                                DT_LEFT | DT_VCENTER | DT_SINGLELINE);
    1742 
    1743                 }
    1744 
    1745                 if (lpdis->itemState & ODS_FOCUS)
    1746                 {
    1747                     SetBkColor (lpdis->hDC, oldBk);
    1748                     SetTextColor (lpdis->hDC, oldText);
    1749                 }
    1750 
    1751                 SelectObject (lpdis->hDC, hOldBrush);
    1752                 SelectObject (lpdis->hDC, hOldPen);
    1753 
    1754                 return TRUE;
    1755             }
    1756             return FALSE;
    1757 
    1758         case WM_MEASUREITEM:
    1759             if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX)
    1760             {
    1761                 MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*)lParam;
    1762 
    1763                 if (infoPtr)
    1764                     lpmis->itemHeight = infoPtr->nBitmapHeight + 8;
    1765                 else
    1766                     lpmis->itemHeight = 16 + 8; /* default height */
    1767 
    1768                 return TRUE;
    1769             }
    1770             return FALSE;
    1771 
    1772         default:
    1773             return FALSE;
    1774     }
    1775 }
    1776 #endif
    1777 
    1778 
    17791615/***********************************************************************
    17801616 * TOOLBAR_AddBitmap:  Add the bitmaps to the default image list.
Note: See TracChangeset for help on using the changeset viewer.