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 |
417 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); | |
416 int32_t iRet = 1; | 418 int32_t iRet = 1; |
417 switch (dwMsgCode) { | 419 switch (dwMsgCode) { |
418 case FWL_MSGHASH_Activate: { | 420 case CFWL_MessageType::Activate: { |
419 OnActivate(pMessage); | 421 OnActivate(pMessage); |
420 break; | 422 break; |
421 } | 423 } |
422 case FWL_MSGHASH_SetFocus: | 424 case CFWL_MessageType::SetFocus: |
Tom Sepez
2016/04/19 18:46:11
nit: If we split these out into separate calls wit
dsinclair
2016/04/19 19:11:25
Done.
| |
423 case FWL_MSGHASH_KillFocus: { | 425 case CFWL_MessageType::KillFocus: { |
424 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 426 OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); |
425 break; | 427 break; |
426 } | 428 } |
427 case FWL_MSGHASH_Mouse: { | 429 case CFWL_MessageType::Mouse: { |
428 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 430 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
429 uint32_t dwCmd = pMsg->m_dwCmd; | 431 uint32_t dwCmd = pMsg->m_dwCmd; |
430 switch (dwCmd) { | 432 switch (dwCmd) { |
431 case FWL_MSGMOUSECMD_LButtonDown: { | 433 case FWL_MSGMOUSECMD_LButtonDown: { |
432 OnLButtonDown(pMsg); | 434 OnLButtonDown(pMsg); |
433 break; | 435 break; |
434 } | 436 } |
435 case FWL_MSGMOUSECMD_LButtonUp: { | 437 case FWL_MSGMOUSECMD_LButtonUp: { |
436 OnLButtonUp(pMsg); | 438 OnLButtonUp(pMsg); |
437 break; | 439 break; |
438 } | 440 } |
439 case FWL_MSGMOUSECMD_MouseMove: { | 441 case FWL_MSGMOUSECMD_MouseMove: { |
440 OnMouseMove(pMsg); | 442 OnMouseMove(pMsg); |
441 break; | 443 break; |
442 } | 444 } |
443 case FWL_MSGMOUSECMD_MouseLeave: { | 445 case FWL_MSGMOUSECMD_MouseLeave: { |
444 OnMouseLeave(pMsg); | 446 OnMouseLeave(pMsg); |
445 break; | 447 break; |
446 } | 448 } |
447 default: {} | 449 default: |
450 break; | |
448 } | 451 } |
449 break; | 452 break; |
450 } | 453 } |
451 case FWL_MSGHASH_Key: { | 454 case CFWL_MessageType::Key: { |
452 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 455 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
453 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { | 456 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) |
454 OnKeyDown(pKey); | 457 OnKeyDown(pKey); |
455 } | |
456 break; | 458 break; |
457 } | 459 } |
458 default: { iRet = 0; } | 460 default: { |
461 iRet = 0; | |
462 break; | |
463 } | |
459 } | 464 } |
465 | |
460 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 466 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
461 return iRet; | 467 return iRet; |
462 } | 468 } |
463 FWL_ERR CFWL_CheckBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 469 FWL_ERR CFWL_CheckBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
464 const CFX_Matrix* pMatrix) { | 470 const CFX_Matrix* pMatrix) { |
465 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 471 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
466 } | 472 } |
467 void CFWL_CheckBoxImpDelegate::OnActivate(CFWL_Message* pMsg) { | 473 void CFWL_CheckBoxImpDelegate::OnActivate(CFWL_Message* pMsg) { |
468 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 474 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
469 m_pOwner->Repaint(&(m_pOwner->m_rtClient)); | 475 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) { | 555 void CFWL_CheckBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { |
550 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 556 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { |
551 m_pOwner->DispatchKeyEvent(pMsg); | 557 m_pOwner->DispatchKeyEvent(pMsg); |
552 return; | 558 return; |
553 } | 559 } |
554 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || | 560 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || |
555 pMsg->m_dwKeyCode == FWL_VKEY_Space) { | 561 pMsg->m_dwKeyCode == FWL_VKEY_Space) { |
556 m_pOwner->NextStates(); | 562 m_pOwner->NextStates(); |
557 } | 563 } |
558 } | 564 } |
OLD | NEW |