461
462 MsgRouting
463 AwtList::WmCtlColor(HDC hDC, HWND hCtrl, UINT ctlColor, HBRUSH& retBrush)
464 {
465 DASSERT(ctlColor == CTLCOLOR_LISTBOX);
466 DASSERT(hCtrl == GetListHandle());
467 ::SetBkColor(hDC, GetBackgroundColor());
468 ::SetTextColor(hDC, GetColor());
469 retBrush = GetBackgroundBrush();
470 return mrConsume;
471 }
472
473 BOOL AwtList::IsFocusingMouseMessage(MSG *pMsg)
474 {
475 return pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONDBLCLK;
476 }
477
478 MsgRouting AwtList::HandleEvent(MSG *msg, BOOL synthetic)
479 {
480 if (IsFocusingMouseMessage(msg)) {
481 LONG item = static_cast<LONG>(SendListMessage(LB_ITEMFROMPOINT, 0, msg->lParam));
482 if (item != LB_ERR) {
483 if (isMultiSelect) {
484 if (IsItemSelected(item)) {
485 Deselect(item);
486 } else {
487 Select(item);
488 }
489 } else {
490 Select(item);
491 }
492 }
493 delete msg;
494 return mrConsume;
495 }
496 if (msg->message == WM_KEYDOWN && msg->wParam == VK_RETURN) {
497 WmNotify(LBN_DBLCLK);
498 }
499 return AwtComponent::HandleEvent(msg, synthetic);
500 }
501
502 // Fix for 4665745.
503 // Override WmPrint to catch when the list control (not wrapper) should
504 // operate WM_PRINT to be compatible with the "smooth scrolling" feature.
505 MsgRouting AwtList::WmPrint(HDC hDC, LPARAM flags)
506 {
507 if (!isWrapperPrint &&
508 (flags & PRF_CLIENT) &&
509 (GetStyleEx() & WS_EX_CLIENTEDGE))
510 {
|
461
462 MsgRouting
463 AwtList::WmCtlColor(HDC hDC, HWND hCtrl, UINT ctlColor, HBRUSH& retBrush)
464 {
465 DASSERT(ctlColor == CTLCOLOR_LISTBOX);
466 DASSERT(hCtrl == GetListHandle());
467 ::SetBkColor(hDC, GetBackgroundColor());
468 ::SetTextColor(hDC, GetColor());
469 retBrush = GetBackgroundBrush();
470 return mrConsume;
471 }
472
473 BOOL AwtList::IsFocusingMouseMessage(MSG *pMsg)
474 {
475 return pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONDBLCLK;
476 }
477
478 MsgRouting AwtList::HandleEvent(MSG *msg, BOOL synthetic)
479 {
480 if (IsFocusingMouseMessage(msg)) {
481 LONG count = GetCount();
482 if (count > 0) {
483 LONG item = static_cast<LONG>(SendListMessage(LB_ITEMFROMPOINT, 0, msg->lParam));
484 item = LOWORD(item);
485 if (SendListMessage(LB_GETTOPINDEX, 0, 0) > item) {
486 item = (count / max_index) * max_index + item + 1;
487 }
488 if (item < count) {
489 if (isMultiSelect) {
490 if (IsItemSelected(item)) {
491 Deselect(item);
492 } else {
493 Select(item);
494 }
495 } else {
496 Select(item);
497 }
498 }
499 }
500 delete msg;
501 return mrConsume;
502 }
503 if (msg->message == WM_KEYDOWN && msg->wParam == VK_RETURN) {
504 WmNotify(LBN_DBLCLK);
505 }
506 return AwtComponent::HandleEvent(msg, synthetic);
507 }
508
509 // Fix for 4665745.
510 // Override WmPrint to catch when the list control (not wrapper) should
511 // operate WM_PRINT to be compatible with the "smooth scrolling" feature.
512 MsgRouting AwtList::WmPrint(HDC hDC, LPARAM flags)
513 {
514 if (!isWrapperPrint &&
515 (flags & PRF_CLIENT) &&
516 (GetStyleEx() & WS_EX_CLIENTEDGE))
517 {
|