Changeset 3351 for trunk/src/comctl32/listview.cpp
- Timestamp:
- Apr 8, 2000, 8:32:55 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/listview.cpp
r3285 r3351 1 /*$Id: listview.cpp,v 1.1 0 2000-03-31 14:44:20cbratschi Exp $*/1 /*$Id: listview.cpp,v 1.11 2000-04-08 18:32:54 cbratschi Exp $*/ 2 2 /* 3 3 * Listview control … … 51 51 #include "listview.h" 52 52 #include "comctl32.h" 53 #include "header.h" 53 54 #include "ctype.h" 54 55 … … 119 120 static BOOL LISTVIEW_GetItemPosition(HWND, INT, LPPOINT); 120 121 static LRESULT LISTVIEW_GetItemRect(HWND hwnd,INT nItem,LPRECT lprc,INT code); 121 static LRESULT LISTVIEW_GetItemRect(HWND, INT, LPRECT);122 122 static INT LISTVIEW_GetItemWidth(HWND); 123 123 static INT LISTVIEW_GetLabelWidth(HWND, INT); … … 180 180 } 181 181 182 static VOID LISTVIEW_RefreshItem(HWND hwnd,INT nItem )182 static VOID LISTVIEW_RefreshItem(HWND hwnd,INT nItem,BOOL wholeItem) 183 183 { 184 184 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); … … 186 186 187 187 if (infoPtr->internalFlags & IF_NOREDRAW) return; 188 LISTVIEW_GetItemRect(hwnd,nItem,&rect, LVIR_SELECTBOUNDS);188 LISTVIEW_GetItemRect(hwnd,nItem,&rect,wholeItem ? LVIR_BOUNDS:LVIR_SELECTBOUNDS); 189 189 190 190 if ((infoPtr->uView == LVS_REPORT) && !(infoPtr->dwStyle & LVS_NOCOLUMNHEADER)) … … 192 192 RECT header; 193 193 INT headerH; 194 194 RECT rect2; 195 196 //clip header control 195 197 GetWindowRect(infoPtr->hwndHeader,&header); 196 198 headerH = rect.bottom-rect.top; 197 199 if (rect.bottom <= headerH) return; 198 200 if (rect.top < headerH) rect.top = headerH; 201 //clip width 202 HEADER_GetItemRect(infoPtr->hwndHeader,(WPARAM)0,(LPARAM)&rect2); 203 if (rect.right > rect2.right) rect.right = rect2.right; 199 204 } 200 205 … … 205 210 { 206 211 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 207 RECT rect, header;212 RECT rect,column; 208 213 INT xOffset = infoPtr->lefttop.x*infoPtr->scrollStep.x; 209 214 210 215 if (infoPtr->internalFlags & IF_NOREDRAW) return; 216 if (infoPtr->uView != LVS_REPORT) return; 211 217 LISTVIEW_GetItemRect(hwnd,nItem,&rect,LVIR_SELECTBOUNDS); 212 218 213 //get headerrect214 H eader_GetItemRect(infoPtr->hwndHeader,nSubItem,&header);215 rect.left = header.left+REPORT_MARGINX;216 rect.right = max( header.left,header.right-REPORT_MARGINX);219 //get column rect 220 HEADER_GetItemRect(infoPtr->hwndHeader,(WPARAM)nSubItem,(LPARAM)&column); 221 rect.left = column.left+REPORT_MARGINX; 222 rect.right = max(column.left,column.right-REPORT_MARGINX); 217 223 218 224 if (!(infoPtr->dwStyle & LVS_NOCOLUMNHEADER)) 219 225 { 226 RECT header; 220 227 INT headerH; 221 228 229 //clip header control 222 230 GetWindowRect(infoPtr->hwndHeader,&header); 223 231 headerH = rect.bottom-rect.top; … … 1181 1189 for (i = nFirst;i < nLast;i++) 1182 1190 { 1183 rcItem.left = LVIR_SELECTBOUNDS; 1184 if (LISTVIEW_GetItemRect(hwnd,i,&rcItem) && PtInRect(&rcItem,pt)) 1191 if (LISTVIEW_GetItemRect(hwnd,i,&rcItem,LVIR_SELECTBOUNDS) && PtInRect(&rcItem,pt)) 1185 1192 return i; 1186 1193 } … … 1305 1312 * 1306 1313 * RETURN: 1307 * SUCCCESS : TRUE (EQUAL) 1308 * FAILURE : FALSE (NOT EQUAL) 1314 * LVIF_* flags 1309 1315 */ 1310 1316 static UINT LISTVIEW_GetItemChanges(LISTVIEW_ITEM *lpItem,LPLVITEMW lpLVItem,BOOL unicode) … … 1412 1418 if (lpItem->pszText) 1413 1419 { 1414 LPWSTR textW = HEAP_strdupAtoW(GetProcessHeap(),0,(LPSTR)lpLVItem->pszText); 1415 1416 //CB: need a lstrcmpAtoW 1417 if (lstrcmpW(textW,lpItem->pszText) != 0) 1420 if (lstrcmpAtoW((LPSTR)lpLVItem->pszText,lpItem->pszText) != 0) 1418 1421 { 1419 1422 uChanged |= LVIF_TEXT; 1420 1423 } 1421 HeapFree(GetProcessHeap(),0,textW);1422 1424 } 1423 1425 else … … 1438 1440 } 1439 1441 } 1442 1440 1443 return uChanged; 1441 1444 } … … 2831 2834 * FAILURE : FALSE 2832 2835 */ 2833 //CB: unicode parameter not used, edit doesn't use unicode chars2834 2836 static HWND LISTVIEW_EditLabel(HWND hwnd, INT nItem,BOOL unicode) 2835 2837 { … … 2893 2895 return 0; 2894 2896 2895 rect.left = LVIR_LABEL; 2896 if (!LISTVIEW_GetItemRect(hwnd, nItem, &rect)) 2897 if (!LISTVIEW_GetItemRect(hwnd, nItem, &rect,LVIR_LABEL)) 2897 2898 return 0; 2898 2899 … … 2945 2946 /* ALWAYS bPartial == FALSE, FOR NOW! */ 2946 2947 2947 rcItem.left = LVIR_BOUNDS; 2948 if (LISTVIEW_GetItemRect(hwnd, nItem, &rcItem)) 2948 if (LISTVIEW_GetItemRect(hwnd, nItem, &rcItem,LVIR_BOUNDS)) 2949 2949 { 2950 2950 if (rcItem.left < infoPtr->rcList.left) … … 3483 3483 { 3484 3484 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3485 INT nColumnWidth = 0;3486 HDITEMA hdi;3487 3485 3488 3486 if (infoPtr->uView == LVS_LIST) 3489 3487 { 3490 nColumnWidth = infoPtr->nItemWidth; 3491 } 3492 else if (infoPtr->uView == LVS_REPORT) 3493 { 3488 return infoPtr->nItemWidth; 3489 } else if (infoPtr->uView == LVS_REPORT) 3490 { 3491 HDITEMA hdi; 3492 3494 3493 /* get column width from header */ 3495 3494 ZeroMemory(&hdi, sizeof(HDITEMA)); 3496 3495 hdi.mask = HDI_WIDTH; 3497 if (Header_GetItemW(infoPtr->hwndHeader, nColumn, &hdi) != FALSE)3498 { 3499 nColumnWidth =hdi.cxy;3500 } 3501 } 3502 3503 return nColumnWidth;3496 if (Header_GetItemW(infoPtr->hwndHeader, nColumn, &hdi)) 3497 { 3498 return hdi.cxy; 3499 } 3500 } 3501 3502 return 0; 3504 3503 } 3505 3504 … … 4087 4086 INT nCountPerColumn; 4088 4087 INT nRow; 4089 //CB: lefttop position not used!!! 4090 if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr)) && 4091 (lpptPosition != NULL)) 4088 4089 if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr)) && lpptPosition) 4092 4090 { 4093 4091 if (infoPtr->uView == LVS_LIST) … … 4142 4140 } 4143 4141 4144 //same as ListView_GetItemRect, but direct call4145 static LRESULT LISTVIEW_GetItemRect(HWND hwnd,INT nItem,LPRECT lprc,INT code)4146 {4147 if (lprc) lprc->left = code;4148 return LISTVIEW_GetItemRect(hwnd,nItem,lprc);4149 }4150 4151 4142 /*** 4152 4143 * DESCRIPTION: … … 4162 4153 * FAILURE : FALSE 4163 4154 */ 4164 static LRESULT LISTVIEW_GetItemRect(HWND hwnd, INT nItem, LPRECT lprc)4155 static LRESULT LISTVIEW_GetItemRect(HWND hwnd,INT nItem,LPRECT lprc,INT code) 4165 4156 { 4166 4157 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); … … 4173 4164 INT nLabelWidth; 4174 4165 TEXTMETRICA tm; 4175 //CB: todo: LVS_REPORT view: clip text rect to header item width! 4176 // large icon view: text rect is wrong! 4177 if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr)) && (lprc != NULL)) 4166 4167 if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr)) && lprc) 4178 4168 { 4179 4169 if (LISTVIEW_GetItemPosition(hwnd, nItem, &ptItem) != FALSE) 4180 4170 { 4181 switch(lprc->left) 4182 { 4183 case LVIR_ICON: 4184 if (infoPtr->uView == LVS_ICON) 4185 { 4186 if (infoPtr->himlNormal != NULL) 4171 switch(code) 4172 { 4173 case LVIR_ICON: 4174 if (infoPtr->uView == LVS_ICON) 4187 4175 { 4188 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE) 4176 if (infoPtr->himlNormal) 4177 { 4178 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin)) 4179 { 4180 bResult = TRUE; 4181 lprc->left = ptItem.x + ptOrigin.x; 4182 lprc->top = ptItem.y + ptOrigin.y; 4183 lprc->right = lprc->left + infoPtr->iconSize.cx; 4184 lprc->bottom = (lprc->top + infoPtr->iconSize.cy + 4185 ICON_BOTTOM_PADDING + ICON_TOP_PADDING); 4186 } 4187 } 4188 } 4189 else if (infoPtr->uView == LVS_SMALLICON) 4190 { 4191 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin)) 4189 4192 { 4190 4193 bResult = TRUE; 4191 4194 lprc->left = ptItem.x + ptOrigin.x; 4192 4195 lprc->top = ptItem.y + ptOrigin.y; 4193 lprc->right = lprc->left + infoPtr->iconSize.cx; 4194 lprc->bottom = (lprc->top + infoPtr->iconSize.cy + 4195 ICON_BOTTOM_PADDING + ICON_TOP_PADDING); 4196 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4197 4198 if (infoPtr->himlState) 4199 lprc->left += infoPtr->iconSize.cx; 4200 4201 if (infoPtr->himlSmall) 4202 lprc->right = lprc->left + infoPtr->iconSize.cx; 4203 else 4204 lprc->right = lprc->left; 4196 4205 } 4197 }4198 }4199 else if (infoPtr->uView == LVS_SMALLICON)4200 {4201 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE)4202 {4203 bResult = TRUE;4204 lprc->left = ptItem.x + ptOrigin.x;4205 lprc->top = ptItem.y + ptOrigin.y;4206 lprc->bottom = lprc->top + infoPtr->nItemHeight;4207 4208 if (infoPtr->himlState != NULL)4209 lprc->left += infoPtr->iconSize.cx;4210 4211 if (infoPtr->himlSmall != NULL)4212 lprc->right = lprc->left + infoPtr->iconSize.cx;4213 else4214 lprc->right = lprc->left;4215 }4216 }4217 else4218 {4219 bResult = TRUE;4220 lprc->left = ptItem.x;4221 lprc->top = ptItem.y;4222 lprc->bottom = lprc->top + infoPtr->nItemHeight;4223 4224 if (infoPtr->himlState != NULL)4225 {4226 lprc->left += infoPtr->iconSize.cx;4227 }4228 4229 if (infoPtr->himlSmall != NULL)4230 {4231 lprc->right = lprc->left + infoPtr->iconSize.cx;4232 4206 } 4233 4207 else 4234 4208 { 4235 lprc->right = lprc->left; 4209 bResult = TRUE; 4210 lprc->left = ptItem.x; 4211 lprc->top = ptItem.y; 4212 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4213 4214 if (infoPtr->himlState) 4215 { 4216 lprc->left += infoPtr->iconSize.cx; 4217 } 4218 4219 if (infoPtr->himlSmall != NULL) 4220 { 4221 lprc->right = lprc->left + infoPtr->iconSize.cx; 4222 } 4223 else 4224 { 4225 lprc->right = lprc->left; 4226 } 4236 4227 } 4237 } 4238 break; 4239 4240 case LVIR_LABEL: 4241 if (infoPtr->uView == LVS_ICON) 4242 { 4243 if (infoPtr->himlNormal != NULL) 4228 break; 4229 4230 case LVIR_LABEL: 4231 if (infoPtr->uView == LVS_ICON) 4244 4232 { 4245 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE) 4233 if (infoPtr->himlNormal) 4234 { 4235 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin)) 4236 { 4237 bResult = TRUE; 4238 lprc->left = ptItem.x + ptOrigin.x; 4239 lprc->top = (ptItem.y + ptOrigin.y + infoPtr->iconSize.cy + 4240 ICON_BOTTOM_PADDING + ICON_TOP_PADDING); 4241 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 4242 if (infoPtr->iconSpacing.cx - nLabelWidth > 1) 4243 { 4244 lprc->left += (infoPtr->iconSpacing.cx - nLabelWidth) / 2; 4245 lprc->right = lprc->left + nLabelWidth; 4246 } 4247 else 4248 { 4249 lprc->left += 1; 4250 lprc->right = lprc->left + infoPtr->iconSpacing.cx - 1; 4251 } 4252 4253 hdc = GetDC(hwnd); 4254 hOldFont = SelectObject(hdc, infoPtr->hFont); 4255 GetTextMetricsA(hdc, &tm); 4256 lprc->bottom = lprc->top + tm.tmHeight + HEIGHT_PADDING; 4257 SelectObject(hdc, hOldFont); 4258 ReleaseDC(hwnd, hdc); 4259 } 4260 } 4261 } 4262 else if (infoPtr->uView == LVS_SMALLICON) 4263 { 4264 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin)) 4246 4265 { 4247 4266 bResult = TRUE; 4248 lprc->left = ptItem.x + ptOrigin.x; 4249 lprc->top = (ptItem.y + ptOrigin.y + infoPtr->iconSize.cy + 4250 ICON_BOTTOM_PADDING + ICON_TOP_PADDING); 4267 nLeftPos = lprc->left = ptItem.x + ptOrigin.x; 4268 lprc->top = ptItem.y + ptOrigin.y; 4269 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4270 4271 if (infoPtr->himlState) 4272 { 4273 lprc->left += infoPtr->iconSize.cx; 4274 } 4275 4276 if (infoPtr->himlSmall) 4277 { 4278 lprc->left += infoPtr->iconSize.cx; 4279 } 4280 4251 4281 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 4252 if ( infoPtr->iconSpacing.cx - nLabelWidth > 1)4282 if (lprc->left + nLabelWidth < nLeftPos + infoPtr->nItemWidth) 4253 4283 { 4254 lprc->left += (infoPtr->iconSpacing.cx - nLabelWidth) / 2;4255 4284 lprc->right = lprc->left + nLabelWidth; 4256 4285 } 4257 4286 else 4258 4287 { 4259 lprc->left += 1; 4260 lprc->right = lprc->left + infoPtr->iconSpacing.cx - 1; 4288 lprc->right = nLeftPos + infoPtr->nItemWidth; 4261 4289 } 4262 4263 hdc = GetDC(hwnd);4264 hOldFont = SelectObject(hdc, infoPtr->hFont);4265 GetTextMetricsA(hdc, &tm);4266 lprc->bottom = lprc->top + tm.tmHeight + HEIGHT_PADDING;4267 SelectObject(hdc, hOldFont);4268 ReleaseDC(hwnd, hdc);4269 4290 } 4270 4291 } 4271 } 4272 else if (infoPtr->uView == LVS_SMALLICON) 4273 { 4274 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE) 4292 else 4275 4293 { 4276 4294 bResult = TRUE; 4277 nLeftPos = lprc->left = ptItem.x + ptOrigin.x;4278 lprc->top = ptItem.y + ptOrigin.y;4295 nLeftPos = lprc->left = ptItem.x; 4296 lprc->top = ptItem.y; 4279 4297 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4280 4298 4281 if (infoPtr->himlState != NULL)4299 if (infoPtr->himlState) 4282 4300 { 4283 4301 lprc->left += infoPtr->iconSize.cx; 4284 4302 } 4285 4303 4286 if (infoPtr->himlSmall != NULL)4304 if (infoPtr->himlSmall) 4287 4305 { 4288 4306 lprc->left += infoPtr->iconSize.cx; … … 4299 4317 } 4300 4318 } 4301 } 4302 else 4303 { 4304 bResult = TRUE; 4305 nLeftPos = lprc->left = ptItem.x; 4306 lprc->top = ptItem.y; 4307 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4308 4309 if (infoPtr->himlState != NULL) 4319 break; 4320 4321 case LVIR_BOUNDS: 4322 if (infoPtr->uView == LVS_ICON) 4310 4323 { 4311 lprc->left += infoPtr->iconSize.cx; 4324 if (infoPtr->himlNormal) 4325 { 4326 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin)) 4327 { 4328 bResult = TRUE; 4329 hdc = GetDC(hwnd); 4330 hOldFont = SelectObject(hdc,infoPtr->hFont); 4331 GetTextMetricsA(hdc,&tm); 4332 SelectObject(hdc,hOldFont); 4333 ReleaseDC(hwnd,hdc); 4334 lprc->left = ptItem.x + ptOrigin.x; 4335 lprc->top = ptItem.y + ptOrigin.y; 4336 lprc->right = lprc->left + infoPtr->iconSpacing.cx; 4337 lprc->bottom = lprc->top+infoPtr->iconSpacing.cy+ICON_BOTTOM_PADDING+tm.tmHeight+HEIGHT_PADDING; 4338 } 4339 } 4312 4340 } 4313 4314 if (infoPtr->himlSmall != NULL) 4341 else if (infoPtr->uView == LVS_SMALLICON) 4315 4342 { 4316 lprc->left += infoPtr->iconSize.cx; 4317 } 4318 4319 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 4320 if (lprc->left + nLabelWidth < nLeftPos + infoPtr->nItemWidth) 4321 { 4322 lprc->right = lprc->left + nLabelWidth; 4343 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin)) 4344 { 4345 bResult = TRUE; 4346 lprc->left = ptItem.x + ptOrigin.x; 4347 lprc->right = lprc->left; 4348 lprc->top = ptItem.y + ptOrigin.y; 4349 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4350 if (infoPtr->himlState) 4351 lprc->right += infoPtr->iconSize.cx; 4352 if (infoPtr->himlSmall) 4353 lprc->right += infoPtr->iconSize.cx; 4354 lprc->right += LISTVIEW_GetLabelWidth(hwnd, nItem); 4355 } 4323 4356 } 4324 4357 else 4325 4358 { 4326 lprc->right = nLeftPos + infoPtr->nItemWidth; 4327 } 4328 } 4329 break; 4330 4331 case LVIR_BOUNDS: 4332 if (infoPtr->uView == LVS_ICON) 4333 { 4334 if (infoPtr->himlNormal != NULL) 4335 { 4336 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE) 4359 bResult = TRUE; 4360 lprc->left = ptItem.x; 4361 lprc->right = lprc->left; 4362 lprc->top = ptItem.y; 4363 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4364 4365 if (infoPtr->himlState) 4337 4366 { 4338 bResult = TRUE; 4339 lprc->left = ptItem.x + ptOrigin.x; 4340 lprc->top = ptItem.y + ptOrigin.y; 4341 lprc->right = lprc->left + infoPtr->iconSpacing.cx; 4342 lprc->bottom = lprc->top + infoPtr->iconSpacing.cy; 4367 lprc->right += infoPtr->iconSize.cx; 4343 4368 } 4344 } 4345 } 4346 else if (infoPtr->uView == LVS_SMALLICON) 4347 { 4348 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE) 4349 { 4350 bResult = TRUE; 4351 lprc->left = ptItem.x + ptOrigin.x; 4352 lprc->right = lprc->left; 4353 lprc->top = ptItem.y + ptOrigin.y; 4354 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4355 if (infoPtr->himlState != NULL) 4369 4370 if (infoPtr->himlSmall) 4371 { 4356 4372 lprc->right += infoPtr->iconSize.cx; 4357 if (infoPtr->himlSmall != NULL) 4358 lprc->right += infoPtr->iconSize.cx; 4359 lprc->right += LISTVIEW_GetLabelWidth(hwnd, nItem); 4360 } 4361 } 4362 else 4363 { 4364 bResult = TRUE; 4365 lprc->left = ptItem.x; 4366 lprc->right = lprc->left; 4367 lprc->top = ptItem.y; 4368 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4369 4370 if (infoPtr->himlState != NULL) 4371 { 4372 lprc->right += infoPtr->iconSize.cx; 4373 } 4374 4375 if (infoPtr->himlSmall != NULL) 4376 { 4377 lprc->right += infoPtr->iconSize.cx; 4378 } 4373 } 4379 4374 4380 4375 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); … … 4387 4382 lprc->right = lprc->left + infoPtr->nItemWidth; 4388 4383 } 4389 } 4390 break; 4391 4392 case LVIR_SELECTBOUNDS: 4393 if (infoPtr->uView == LVS_ICON) 4394 { 4395 if (infoPtr->himlNormal != NULL) 4384 } 4385 break; 4386 4387 case LVIR_SELECTBOUNDS: 4388 if (infoPtr->uView == LVS_ICON) 4396 4389 { 4397 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE) 4390 if (infoPtr->himlNormal) 4391 { 4392 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin)) 4393 { 4394 bResult = TRUE; 4395 hdc = GetDC(hwnd); 4396 hOldFont = SelectObject(hdc,infoPtr->hFont); 4397 GetTextMetricsA(hdc,&tm); 4398 SelectObject(hdc,hOldFont); 4399 ReleaseDC(hwnd,hdc); 4400 lprc->left = ptItem.x + ptOrigin.x; 4401 lprc->top = ptItem.y + ptOrigin.y; 4402 lprc->right = lprc->left + infoPtr->iconSpacing.cx; 4403 lprc->bottom = lprc->top+infoPtr->iconSpacing.cy+ICON_BOTTOM_PADDING+tm.tmHeight+HEIGHT_PADDING; 4404 } 4405 } 4406 } 4407 else if (infoPtr->uView == LVS_SMALLICON) 4408 { 4409 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin)) 4398 4410 { 4399 4411 bResult = TRUE; 4400 lprc->left = ptItem.x + ptOrigin.x;4412 nLeftPos= lprc->left = ptItem.x + ptOrigin.x; 4401 4413 lprc->top = ptItem.y + ptOrigin.y; 4402 lprc->right = lprc->left + infoPtr->iconSpacing.cx; 4403 lprc->bottom = lprc->top + infoPtr->iconSpacing.cy; 4414 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4415 4416 if (infoPtr->himlState) 4417 { 4418 lprc->left += infoPtr->iconSize.cx; 4419 } 4420 4421 lprc->right = lprc->left; 4422 4423 if (infoPtr->himlSmall) 4424 { 4425 lprc->right += infoPtr->iconSize.cx; 4426 } 4427 4428 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 4429 if (lprc->right + nLabelWidth < lprc->left + infoPtr->nItemWidth) 4430 { 4431 lprc->right += nLabelWidth; 4432 } 4433 else 4434 { 4435 lprc->right = lprc->left + infoPtr->nItemWidth; 4436 } 4404 4437 } 4405 4438 } 4406 } 4407 else if (infoPtr->uView == LVS_SMALLICON) 4408 { 4409 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE) 4439 else 4410 4440 { 4411 4441 bResult = TRUE; 4412 nLeftPos = lprc->left = ptItem.x + ptOrigin.x;4413 lprc->top = ptItem.y + ptOrigin.y;4442 nLeftPos = lprc->left = ptItem.x; 4443 lprc->top = ptItem.y; 4414 4444 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4415 4445 4416 if (infoPtr->himlState != NULL)4446 if (infoPtr->himlState) 4417 4447 { 4418 4448 lprc->left += infoPtr->iconSize.cx; … … 4421 4451 lprc->right = lprc->left; 4422 4452 4423 if (infoPtr->himlSmall != NULL)4453 if (infoPtr->himlSmall) 4424 4454 { 4425 4455 lprc->right += infoPtr->iconSize.cx; 4426 4456 } 4427 4457 4428 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 4429 if (lprc->right + nLabelWidth < lprc->left + infoPtr->nItemWidth) 4430 { 4431 lprc->right += nLabelWidth; 4458 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 4459 if (lprc->right + nLabelWidth < nLeftPos + infoPtr->nItemWidth) 4460 { 4461 lprc->right += nLabelWidth; 4462 } 4463 else 4464 { 4465 lprc->right = nLeftPos + infoPtr->nItemWidth; 4466 } 4432 4467 } 4433 else 4434 { 4435 lprc->right = lprc->left + infoPtr->nItemWidth; 4436 } 4437 } 4438 } 4439 else 4440 { 4441 bResult = TRUE; 4442 nLeftPos = lprc->left = ptItem.x; 4443 lprc->top = ptItem.y; 4444 lprc->bottom = lprc->top + infoPtr->nItemHeight; 4445 4446 if (infoPtr->himlState != NULL) 4447 { 4448 lprc->left += infoPtr->iconSize.cx; 4449 } 4450 4451 lprc->right = lprc->left; 4452 4453 if (infoPtr->himlSmall != NULL) 4454 { 4455 lprc->right += infoPtr->iconSize.cx; 4456 } 4457 4458 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 4459 if (lprc->right + nLabelWidth < nLeftPos + infoPtr->nItemWidth) 4460 { 4461 lprc->right += nLabelWidth; 4462 } 4463 else 4464 { 4465 lprc->right = nLeftPos + infoPtr->nItemWidth; 4466 } 4467 } 4468 break; 4468 break; 4469 4469 } 4470 4470 } … … 4589 4589 lpLVItem->mask = LVIF_TEXT; 4590 4590 lpLVItem->iItem = nItem; 4591 if (LISTVIEW_GetItem(hwnd,lpLVItem,unicode,FALSE) != FALSE) //CB: todo4591 if (LISTVIEW_GetItem(hwnd,lpLVItem,unicode,FALSE) != FALSE) 4592 4592 { 4593 4593 nLength = unicode ? lstrlenW(lpLVItem->pszText):lstrlenA((LPSTR)lpLVItem->pszText); … … 4920 4920 INT i; 4921 4921 4922 // TRACE("(hwnd=%x, x=%ld, y=%ld)\n", hwnd, lpHitTestInfo->pt.x, 4923 // lpHitTestInfo->pt.y); 4924 4922 //CB: very slow! 4925 4923 for (i = 0; i < GETITEMCOUNT(infoPtr); i++) 4926 4924 { 4927 rcItem.left = LVIR_BOUNDS; 4928 if (LISTVIEW_GetItemRect(hwnd, i, &rcItem) != FALSE) 4929 { 4930 if (PtInRect(&rcItem, lpHitTestInfo->pt) != FALSE) 4931 { 4932 rcItem.left = LVIR_ICON; 4933 if (LISTVIEW_GetItemRect(hwnd, i, &rcItem) != FALSE) 4925 if (LISTVIEW_GetItemRect(hwnd, i, &rcItem,LVIR_BOUNDS)) 4926 { 4927 if (PtInRect(&rcItem, lpHitTestInfo->pt)) 4928 { 4929 if (LISTVIEW_GetItemRect(hwnd, i, &rcItem,LVIR_ICON)) 4934 4930 { 4935 if (PtInRect(&rcItem, lpHitTestInfo->pt) != FALSE)4931 if (PtInRect(&rcItem, lpHitTestInfo->pt)) 4936 4932 { 4937 4933 lpHitTestInfo->flags = LVHT_ONITEMICON; … … 4942 4938 } 4943 4939 4944 rcItem.left = LVIR_LABEL; 4945 if (LISTVIEW_GetItemRect(hwnd, i, &rcItem) != FALSE) 4940 if (LISTVIEW_GetItemRect(hwnd, i, &rcItem,LVIR_LABEL)) 4946 4941 { 4947 if (PtInRect(&rcItem, lpHitTestInfo->pt) != FALSE)4942 if (PtInRect(&rcItem, lpHitTestInfo->pt)) 4948 4943 { 4949 4944 lpHitTestInfo->flags = LVHT_ONITEMLABEL; … … 5100 5095 /* insert item in header control */ 5101 5096 if (unicode) 5102 nNewColumn = SendMessageA(infoPtr->hwndHeader,HDM_INSERTITEMW,(WPARAM)nColumn,(LPARAM)&hdi);5097 nNewColumn = Header_InsertItemW(infoPtr->hwndHeader,nColumn,&hdi); 5103 5098 else 5104 nNewColumn = SendMessageA(infoPtr->hwndHeader,HDM_INSERTITEMA,(WPARAM)nColumn,(LPARAM)&hdi);5099 nNewColumn = Header_InsertItemA(infoPtr->hwndHeader,nColumn,&hdi); 5105 5100 5106 5101 /* Need to reset the item width when inserting a new column */ … … 5454 5449 } 5455 5450 5456 /* LISTVIEW_SetColumnW */5457 5458 5451 /*** 5459 5452 * DESCRIPTION: … … 5511 5504 return (FALSE); 5512 5505 5513 // FIXME: currently ignoring LVSCW_AUTOSIZE (-1) and 5514 // LVSCV_AUTOSIZE_USEHEADER (-2) 5506 if (cx == LVSCW_AUTOSIZE_USEHEADER) 5507 { 5508 cx = HEADER_GetExpandedColumnTextWidth(infoPtr->hwndHeader,iCol); 5509 } else if (cx == LVSCW_AUTOSIZE) 5510 { 5511 cx = HEADER_GetExpandedColumnTextWidth(infoPtr->hwndHeader,iCol); 5512 5513 //CB: todo 5514 } 5515 5515 5516 if (cx < 0) 5516 5517 return (FALSE); … … 5686 5687 sendNotify(hwnd,LVN_ITEMCHANGED,&nmlv.hdr); 5687 5688 5688 LISTVIEW_RefreshItem(hwnd,lpLVItem->iItem );5689 LISTVIEW_RefreshItem(hwnd,lpLVItem->iItem,TRUE); 5689 5690 } else 5690 5691 bResult = TRUE; … … 6809 6810 /* redraw the selected items */ 6810 6811 if (infoPtr->nFocusedItem != -1) 6811 LISTVIEW_RefreshItem(hwnd,infoPtr->nFocusedItem );6812 LISTVIEW_RefreshItem(hwnd,infoPtr->nFocusedItem,FALSE); 6812 6813 6813 6814 return 0; … … 6869 6870 POINT ptPosition; 6870 6871 INT nItem; 6871 //CB: selecting last items in a large list -> high cpu usage! 6872 6872 6873 /* send NM_RELEASEDCAPTURE notification */ 6873 6874 sendNotify(hwnd,NM_RELEASEDCAPTURE); … … 7246 7247 7247 7248 if (infoPtr->nFocusedItem != -1) 7248 LISTVIEW_RefreshItem(hwnd,infoPtr->nFocusedItem );7249 LISTVIEW_RefreshItem(hwnd,infoPtr->nFocusedItem,FALSE); 7249 7250 7250 7251 return 0; … … 7517 7518 7518 7519 /* invalidate client area + erase background */ 7519 LISTVIEW_Refresh(hwnd); //CB:todo7520 LISTVIEW_Refresh(hwnd); 7520 7521 7521 7522 /* print the list of unsupported window styles */ … … 7807 7808 return LISTVIEW_GetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,TRUE); 7808 7809 7809 7810 7810 case LVM_GETCOLUMNORDERARRAY: 7811 7811 return LISTVIEW_GetColumnOrderArray(hwnd, (INT)wParam, (LPINT)lParam); … … 7844 7844 return LISTVIEW_GetItem(hwnd,(LPLVITEMW)lParam,TRUE,FALSE); 7845 7845 7846 7847 7846 case LVM_GETITEMCOUNT: 7848 7847 return LISTVIEW_GetItemCount(hwnd); … … 7852 7851 7853 7852 case LVM_GETITEMRECT: 7854 return LISTVIEW_GetItemRect(hwnd, (INT)wParam, (LPRECT)lParam);7853 return LISTVIEW_GetItemRect(hwnd,(INT)wParam,(LPRECT)lParam,lParam ? ((LPRECT)lParam)->left:0); 7855 7854 7856 7855 case LVM_GETITEMSPACING: … … 7867 7866 LISTVIEW_GetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,TRUE); 7868 7867 break; 7869 7870 7868 7871 7869 case LVM_GETNEXTITEM:
Note:
See TracChangeset
for help on using the changeset viewer.