< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_List.cpp

Print this page




 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.




 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 && item >= 0 && item < (LONG)GetCount()) {
 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.


< prev index next >