Changeset 233 for trunk/src/helpers/cctl_toolbar.c
- Timestamp:
- Dec 8, 2002, 8:54:46 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/cctl_toolbar.c
r232 r233 65 65 #include "helpers\linklist.h" 66 66 #include "helpers\standards.h" 67 #include "helpers\stringh.h" 67 68 #include "helpers\winh.h" 69 #include "helpers\xstring.h" 68 70 69 71 #include "helpers\comctl.h" … … 102 104 DEFWINDATA dwd; 103 105 104 HWND hwndControlsOwner; 106 HWND hwndControlsOwner, 107 hwndToolTip; // != NULLHANDLE if TBS_TOOLTIPS is set 105 108 106 109 LONG lSpacing, … … 111 114 ULONG flReformat; 112 115 #define RFFL_HEIGHT 0x0001 // height changed, needs complete resize 116 117 XSTRING strToolTipBuf; 113 118 114 119 } TOOLBARDATA, *PTOOLBARDATA; … … 169 174 *@@changed V0.9.20 (2002-08-04) [umoeller]: fixed button offset, depressed color 170 175 *@@changed V1.0.1 (2002-11-30) [umoeller]: moved this here from comctl.c, renamed 176 *@@changed V1.0.1 (2002-12-08) [umoeller]: added support for WS_DISABLED 171 177 */ 172 178 … … 212 218 lRight = G_lcol3DDark; 213 219 214 if (!lBorder) 215 if (pbs->fMouseOver) 216 lBorder = 1; 220 if ( (!lBorder) 221 && (pbs->fMouseOver) 222 && (fl & TBBS_HILITE) 223 ) 224 lBorder = 1; 217 225 } 218 226 … … 310 318 0, 311 319 0, 312 DBM_NORMAL); 320 (fl & WS_DISABLED) 321 ? DBM_HALFTONE 322 : DBM_NORMAL); 313 323 else 324 { 325 ULONG fl2 = DP_NORMAL; // 0x0000 326 327 if (!(fl & TBBS_BIGICON)) 328 fl2 = DP_MINI; 329 if (fl & WS_DISABLED) // V1.0.1 (2002-12-08) [umoeller] 330 fl2 |= DP_HALFTONED; // I love this... DBM_HALFTONE, but DP_HALFTONED! 331 // PM is just so half-toned itself... 314 332 WinDrawPointer(hps, 315 // center this in remaining rectl316 333 ptl.x, 317 334 ptl.y, 318 335 pbd->hptr, 319 (fl & TBBS_BIGICON) 320 ? DP_NORMAL 321 : DP_MINI); 336 fl2); 337 } 322 338 323 339 rclTemp.yTop -= pbd->szlIconOrBitmap.cy; … … 747 763 { 748 764 pData->bs.fMouseOver = fMouseOver; 749 WinInvalidateRect(hwndButton, NULL, FALSE); 765 766 if (winhQueryWindowStyle(hwndButton) & TBBS_HILITE) 767 WinInvalidateRect(hwndButton, NULL, FALSE); 750 768 } 751 769 } … … 763 781 gpihSwitchToRGB(hps); 764 782 ctlPaintTBButton(hps, 765 winhQueryWindowStyle(hwndButton) | TBBS_BACKGROUND, 783 winhQueryWindowStyle(hwndButton) 784 | TBBS_BACKGROUND, 766 785 &pData->bd, 767 786 &pData->bs); … … 865 884 { 866 885 *px += pControl->cx + pData->lSpacing; 886 887 if (pData->hwndToolTip) 888 { 889 TOOLINFO ti = {0}; 890 ti.ulFlags = TTF_CENTER_X_ON_TOOL | TTF_POS_Y_BELOW_TOOL | TTF_SUBCLASS; 891 ti.hwndToolOwner = pData->dwd.hwnd; 892 ti.pszText = PSZ_TEXTCALLBACK; 893 ti.hwndTool = hwndControl; 894 WinSendMsg(pData->hwndToolTip, 895 TTM_ADDTOOL, 896 (MPARAM)0, 897 &ti); 898 } 867 899 } 868 900 … … 1085 1117 lstInit(&pData->llControls, FALSE); 1086 1118 1119 xstrInit(&pData->strToolTipBuf, 0); 1120 1121 if (((PCREATESTRUCT)mp2)->flStyle & TBS_TOOLTIPS) 1122 { 1123 pData->hwndToolTip = WinCreateWindow(HWND_DESKTOP, 1124 WC_CCTL_TOOLTIP, 1125 NULL, 1126 TTS_ALWAYSTIP, 1127 0, 0, 0, 0, // window pos and size, ignored 1128 hwndToolBar, 1129 NULLHANDLE, // hwndInsertBehind, ignored 1130 0, 1131 NULL, // control data 1132 NULL); // presparams 1133 } 1134 1087 1135 if ( (ptbcd->cControls) 1088 1136 && (ptbcd->patbc) … … 1109 1157 { 1110 1158 PLISTNODE pNode; 1159 1160 if (pData->hwndToolTip) 1161 WinDestroyWindow(pData->hwndToolTip); 1162 1111 1163 FOR_ALL_NODES(&pData->llControls, pNode) 1112 1164 { … … 1114 1166 } 1115 1167 lstClear(&pData->llControls); 1168 1169 xstrClear(&pData->strToolTipBuf); 1170 1116 1171 free(pData); 1117 1172 } … … 1171 1226 break; 1172 1227 1228 case WM_CONTROL: 1229 if ( (pData = (PTOOLBARDATA)WinQueryWindowPtr(hwndToolBar, QWL_USER + 1)) 1230 && (pData->hwndToolTip) 1231 && (SHORT2FROMMP(mp1) == TTN_NEEDTEXT) 1232 ) 1233 { 1234 PTOOLTIPTEXT pttt = (PTOOLTIPTEXT)mp2; 1235 PSZ psz; 1236 xstrClear(&pData->strToolTipBuf); 1237 1238 if (psz = winhQueryWindowText(pttt->hwndTool)) 1239 xstrset(&pData->strToolTipBuf, psz); 1240 1241 pttt->ulFormat = TTFMT_PSZ; 1242 pttt->pszText = pData->strToolTipBuf.psz; 1243 } 1244 break; 1245 1173 1246 case WM_PAINT: 1174 1247 { … … 1286 1359 NULL); 1287 1360 } 1361
Note:
See TracChangeset
for help on using the changeset viewer.