| 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/cfwl_checkbox.h" | 7 #include "xfa/fwl/core/cfwl_checkbox.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "third_party/base/ptr_util.h" | 13 #include "third_party/base/ptr_util.h" |
| 14 #include "xfa/fde/tto/fde_textout.h" | 14 #include "xfa/fde/tto/fde_textout.h" |
| 15 #include "xfa/fwl/core/cfwl_app.h" | 15 #include "xfa/fwl/core/cfwl_app.h" |
| 16 #include "xfa/fwl/core/cfwl_evtcheckstatechanged.h" | 16 #include "xfa/fwl/core/cfwl_event.h" |
| 17 #include "xfa/fwl/core/cfwl_msgkey.h" | 17 #include "xfa/fwl/core/cfwl_msgkey.h" |
| 18 #include "xfa/fwl/core/cfwl_msgmouse.h" | 18 #include "xfa/fwl/core/cfwl_msgmouse.h" |
| 19 #include "xfa/fwl/core/cfwl_notedriver.h" | 19 #include "xfa/fwl/core/cfwl_notedriver.h" |
| 20 #include "xfa/fwl/core/cfwl_themebackground.h" | 20 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 21 #include "xfa/fwl/core/cfwl_themetext.h" | 21 #include "xfa/fwl/core/cfwl_themetext.h" |
| 22 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 22 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
| 23 #include "xfa/fwl/core/ifwl_themeprovider.h" | 23 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 m_pProperties->m_dwStates |= FWL_STATE_CKB_Neutral; | 332 m_pProperties->m_dwStates |= FWL_STATE_CKB_Neutral; |
| 333 else | 333 else |
| 334 m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked; | 334 m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked; |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 | 337 |
| 338 Repaint(&m_rtClient); | 338 Repaint(&m_rtClient); |
| 339 if (dwFirststate == m_pProperties->m_dwStates) | 339 if (dwFirststate == m_pProperties->m_dwStates) |
| 340 return; | 340 return; |
| 341 | 341 |
| 342 CFWL_EvtCheckStateChanged wmCheckBoxState; | 342 CFWL_Event wmCheckBoxState(CFWL_EventType::CheckStateChanged); |
| 343 wmCheckBoxState.m_pSrcTarget = this; | 343 wmCheckBoxState.m_pSrcTarget = this; |
| 344 DispatchEvent(&wmCheckBoxState); | 344 DispatchEvent(&wmCheckBoxState); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void CFWL_CheckBox::OnProcessMessage(CFWL_Message* pMessage) { | 347 void CFWL_CheckBox::OnProcessMessage(CFWL_Message* pMessage) { |
| 348 if (!pMessage) | 348 if (!pMessage) |
| 349 return; | 349 return; |
| 350 | 350 |
| 351 switch (pMessage->GetClassID()) { | 351 switch (pMessage->GetClassID()) { |
| 352 case CFWL_MessageType::SetFocus: | 352 case CFWL_MessageType::SetFocus: |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 void CFWL_CheckBox::OnMouseLeave() { | 467 void CFWL_CheckBox::OnMouseLeave() { |
| 468 if (m_bBtnDown) | 468 if (m_bBtnDown) |
| 469 m_pProperties->m_dwStates |= FWL_STATE_CKB_Hovered; | 469 m_pProperties->m_dwStates |= FWL_STATE_CKB_Hovered; |
| 470 else | 470 else |
| 471 m_pProperties->m_dwStates &= ~FWL_STATE_CKB_Hovered; | 471 m_pProperties->m_dwStates &= ~FWL_STATE_CKB_Hovered; |
| 472 | 472 |
| 473 Repaint(&m_rtBox); | 473 Repaint(&m_rtBox); |
| 474 } | 474 } |
| 475 | 475 |
| 476 void CFWL_CheckBox::OnKeyDown(CFWL_MsgKey* pMsg) { | 476 void CFWL_CheckBox::OnKeyDown(CFWL_MsgKey* pMsg) { |
| 477 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 477 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) |
| 478 DispatchKeyEvent(pMsg); | |
| 479 return; | 478 return; |
| 480 } | |
| 481 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || | 479 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || |
| 482 pMsg->m_dwKeyCode == FWL_VKEY_Space) { | 480 pMsg->m_dwKeyCode == FWL_VKEY_Space) { |
| 483 NextStates(); | 481 NextStates(); |
| 484 } | 482 } |
| 485 } | 483 } |
| OLD | NEW |