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