| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fwl/basewidget/fwl_checkboximp.h" | 7 #include "xfa/fwl/basewidget/fwl_checkboximp.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 Repaint(&m_rtClient); | 402 Repaint(&m_rtClient); |
| 403 uint32_t dwLaststate = m_pProperties->m_dwStates; | 403 uint32_t dwLaststate = m_pProperties->m_dwStates; |
| 404 if (dwFirststate != dwLaststate) { | 404 if (dwFirststate != dwLaststate) { |
| 405 CFWL_EvtCkbCheckStateChanged wmCheckBoxState; | 405 CFWL_EvtCkbCheckStateChanged wmCheckBoxState; |
| 406 wmCheckBoxState.m_pSrcTarget = m_pInterface; | 406 wmCheckBoxState.m_pSrcTarget = m_pInterface; |
| 407 DispatchEvent(&wmCheckBoxState); | 407 DispatchEvent(&wmCheckBoxState); |
| 408 } | 408 } |
| 409 } | 409 } |
| 410 CFWL_CheckBoxImpDelegate::CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner) | 410 CFWL_CheckBoxImpDelegate::CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner) |
| 411 : m_pOwner(pOwner) {} | 411 : m_pOwner(pOwner) {} |
| 412 |
| 412 int32_t CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 413 int32_t CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 413 if (!pMessage) | 414 if (!pMessage) |
| 414 return 0; | 415 return 0; |
| 415 uint32_t dwMsgCode = pMessage->GetClassID(); | 416 |
| 416 int32_t iRet = 1; | 417 int32_t iRet = 1; |
| 417 switch (dwMsgCode) { | 418 switch (pMessage->GetClassID()) { |
| 418 case FWL_MSGHASH_Activate: { | 419 case CFWL_MessageType::Activate: { |
| 419 OnActivate(pMessage); | 420 OnActivate(pMessage); |
| 420 break; | 421 break; |
| 421 } | 422 } |
| 422 case FWL_MSGHASH_SetFocus: | 423 case CFWL_MessageType::SetFocus: { |
| 423 case FWL_MSGHASH_KillFocus: { | 424 OnFocusChanged(pMessage, TRUE); |
| 424 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | |
| 425 break; | 425 break; |
| 426 } | 426 } |
| 427 case FWL_MSGHASH_Mouse: { | 427 case CFWL_MessageType::KillFocus: { |
| 428 OnFocusChanged(pMessage, FALSE); |
| 429 break; |
| 430 } |
| 431 case CFWL_MessageType::Mouse: { |
| 428 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 432 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 429 uint32_t dwCmd = pMsg->m_dwCmd; | 433 uint32_t dwCmd = pMsg->m_dwCmd; |
| 430 switch (dwCmd) { | 434 switch (dwCmd) { |
| 431 case FWL_MSGMOUSECMD_LButtonDown: { | 435 case FWL_MSGMOUSECMD_LButtonDown: { |
| 432 OnLButtonDown(pMsg); | 436 OnLButtonDown(pMsg); |
| 433 break; | 437 break; |
| 434 } | 438 } |
| 435 case FWL_MSGMOUSECMD_LButtonUp: { | 439 case FWL_MSGMOUSECMD_LButtonUp: { |
| 436 OnLButtonUp(pMsg); | 440 OnLButtonUp(pMsg); |
| 437 break; | 441 break; |
| 438 } | 442 } |
| 439 case FWL_MSGMOUSECMD_MouseMove: { | 443 case FWL_MSGMOUSECMD_MouseMove: { |
| 440 OnMouseMove(pMsg); | 444 OnMouseMove(pMsg); |
| 441 break; | 445 break; |
| 442 } | 446 } |
| 443 case FWL_MSGMOUSECMD_MouseLeave: { | 447 case FWL_MSGMOUSECMD_MouseLeave: { |
| 444 OnMouseLeave(pMsg); | 448 OnMouseLeave(pMsg); |
| 445 break; | 449 break; |
| 446 } | 450 } |
| 447 default: {} | 451 default: |
| 452 break; |
| 448 } | 453 } |
| 449 break; | 454 break; |
| 450 } | 455 } |
| 451 case FWL_MSGHASH_Key: { | 456 case CFWL_MessageType::Key: { |
| 452 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 457 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
| 453 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { | 458 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) |
| 454 OnKeyDown(pKey); | 459 OnKeyDown(pKey); |
| 455 } | |
| 456 break; | 460 break; |
| 457 } | 461 } |
| 458 default: { iRet = 0; } | 462 default: { |
| 463 iRet = 0; |
| 464 break; |
| 465 } |
| 459 } | 466 } |
| 467 |
| 460 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 468 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| 461 return iRet; | 469 return iRet; |
| 462 } | 470 } |
| 463 FWL_ERR CFWL_CheckBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 471 FWL_ERR CFWL_CheckBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 464 const CFX_Matrix* pMatrix) { | 472 const CFX_Matrix* pMatrix) { |
| 465 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 473 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
| 466 } | 474 } |
| 467 void CFWL_CheckBoxImpDelegate::OnActivate(CFWL_Message* pMsg) { | 475 void CFWL_CheckBoxImpDelegate::OnActivate(CFWL_Message* pMsg) { |
| 468 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 476 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
| 469 m_pOwner->Repaint(&(m_pOwner->m_rtClient)); | 477 m_pOwner->Repaint(&(m_pOwner->m_rtClient)); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 void CFWL_CheckBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { | 557 void CFWL_CheckBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { |
| 550 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 558 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { |
| 551 m_pOwner->DispatchKeyEvent(pMsg); | 559 m_pOwner->DispatchKeyEvent(pMsg); |
| 552 return; | 560 return; |
| 553 } | 561 } |
| 554 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || | 562 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || |
| 555 pMsg->m_dwKeyCode == FWL_VKEY_Space) { | 563 pMsg->m_dwKeyCode == FWL_VKEY_Space) { |
| 556 m_pOwner->NextStates(); | 564 m_pOwner->NextStates(); |
| 557 } | 565 } |
| 558 } | 566 } |
| OLD | NEW |