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 if (HIWORD(item) == 0) {
485 item = LOWORD(item);
486 if (item >= 0 && item < count) {
487 if (isMultiSelect) {
488 if (IsItemSelected(item)) {
489 Deselect(item);
490 } else {
491 Select(item);
492 }
493 } else {
494 Select(item);
495 }
496 }
497 }
498 }
499 delete msg;
500 return mrConsume;
501 }
502 if (msg->message == WM_KEYDOWN && msg->wParam == VK_RETURN) {
503 WmNotify(LBN_DBLCLK);
504 }
505 return AwtComponent::HandleEvent(msg, synthetic);
506 }
507
508 // Fix for 4665745.
509 // Override WmPrint to catch when the list control (not wrapper) should
510 // operate WM_PRINT to be compatible with the "smooth scrolling" feature.
511 MsgRouting AwtList::WmPrint(HDC hDC, LPARAM flags)
512 {
513 if (!isWrapperPrint &&
514 (flags & PRF_CLIENT) &&
515 (GetStyleEx() & WS_EX_CLIENTEDGE))
516 {
|