| 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/core/ifwl_checkbox.h" | 7 #include "xfa/fwl/core/ifwl_checkbox.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 wmCheckBoxState.m_pSrcTarget = this; | 367 wmCheckBoxState.m_pSrcTarget = this; |
| 368 DispatchEvent(&wmCheckBoxState); | 368 DispatchEvent(&wmCheckBoxState); |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 | 371 |
| 372 void IFWL_CheckBox::OnProcessMessage(CFWL_Message* pMessage) { | 372 void IFWL_CheckBox::OnProcessMessage(CFWL_Message* pMessage) { |
| 373 if (!pMessage) | 373 if (!pMessage) |
| 374 return; | 374 return; |
| 375 | 375 |
| 376 switch (pMessage->GetClassID()) { | 376 switch (pMessage->GetClassID()) { |
| 377 case CFWL_MessageType::Activate: | |
| 378 OnActivate(pMessage); | |
| 379 break; | |
| 380 case CFWL_MessageType::SetFocus: | 377 case CFWL_MessageType::SetFocus: |
| 381 OnFocusChanged(pMessage, true); | 378 OnFocusChanged(pMessage, true); |
| 382 break; | 379 break; |
| 383 case CFWL_MessageType::KillFocus: | 380 case CFWL_MessageType::KillFocus: |
| 384 OnFocusChanged(pMessage, false); | 381 OnFocusChanged(pMessage, false); |
| 385 break; | 382 break; |
| 386 case CFWL_MessageType::Mouse: { | 383 case CFWL_MessageType::Mouse: { |
| 387 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 384 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 388 switch (pMsg->m_dwCmd) { | 385 switch (pMsg->m_dwCmd) { |
| 389 case FWL_MouseCommand::LeftButtonDown: | 386 case FWL_MouseCommand::LeftButtonDown: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 414 } | 411 } |
| 415 | 412 |
| 416 IFWL_Widget::OnProcessMessage(pMessage); | 413 IFWL_Widget::OnProcessMessage(pMessage); |
| 417 } | 414 } |
| 418 | 415 |
| 419 void IFWL_CheckBox::OnDrawWidget(CFX_Graphics* pGraphics, | 416 void IFWL_CheckBox::OnDrawWidget(CFX_Graphics* pGraphics, |
| 420 const CFX_Matrix* pMatrix) { | 417 const CFX_Matrix* pMatrix) { |
| 421 DrawWidget(pGraphics, pMatrix); | 418 DrawWidget(pGraphics, pMatrix); |
| 422 } | 419 } |
| 423 | 420 |
| 424 void IFWL_CheckBox::OnActivate(CFWL_Message* pMsg) { | |
| 425 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | |
| 426 Repaint(&(m_rtClient)); | |
| 427 } | |
| 428 | |
| 429 void IFWL_CheckBox::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { | 421 void IFWL_CheckBox::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { |
| 430 if (bSet) | 422 if (bSet) |
| 431 m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; | 423 m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; |
| 432 else | 424 else |
| 433 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; | 425 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; |
| 434 | 426 |
| 435 Repaint(&(m_rtClient)); | 427 Repaint(&(m_rtClient)); |
| 436 } | 428 } |
| 437 | 429 |
| 438 void IFWL_CheckBox::OnLButtonDown(CFWL_MsgMouse* pMsg) { | 430 void IFWL_CheckBox::OnLButtonDown(CFWL_MsgMouse* pMsg) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 void IFWL_CheckBox::OnKeyDown(CFWL_MsgKey* pMsg) { | 502 void IFWL_CheckBox::OnKeyDown(CFWL_MsgKey* pMsg) { |
| 511 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 503 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { |
| 512 DispatchKeyEvent(pMsg); | 504 DispatchKeyEvent(pMsg); |
| 513 return; | 505 return; |
| 514 } | 506 } |
| 515 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || | 507 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || |
| 516 pMsg->m_dwKeyCode == FWL_VKEY_Space) { | 508 pMsg->m_dwKeyCode == FWL_VKEY_Space) { |
| 517 NextStates(); | 509 NextStates(); |
| 518 } | 510 } |
| 519 } | 511 } |
| OLD | NEW |