< prev index next >

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

Print this page




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


< prev index next >