| 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 "fpdfsdk/formfiller/cffl_radiobutton.h" | 7 #include "fpdfsdk/formfiller/cffl_radiobutton.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/formfiller/cffl_formfiller.h" | 9 #include "fpdfsdk/formfiller/cffl_formfiller.h" |
| 10 #include "fpdfsdk/include/cpdfsdk_environment.h" | 10 #include "fpdfsdk/include/cpdfsdk_environment.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 CPDFSDK_PageView* pPageView) { | 22 CPDFSDK_PageView* pPageView) { |
| 23 CPWL_RadioButton* pWnd = new CPWL_RadioButton(); | 23 CPWL_RadioButton* pWnd = new CPWL_RadioButton(); |
| 24 pWnd->Create(cp); | 24 pWnd->Create(cp); |
| 25 | 25 |
| 26 pWnd->SetCheck(m_pWidget->IsChecked()); | 26 pWnd->SetCheck(m_pWidget->IsChecked()); |
| 27 | 27 |
| 28 return pWnd; | 28 return pWnd; |
| 29 } | 29 } |
| 30 | 30 |
| 31 FX_BOOL CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot, | 31 FX_BOOL CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot, |
| 32 FX_UINT nKeyCode, | 32 uint32_t nKeyCode, |
| 33 FX_UINT nFlags) { | 33 uint32_t nFlags) { |
| 34 switch (nKeyCode) { | 34 switch (nKeyCode) { |
| 35 case FWL_VKEY_Return: | 35 case FWL_VKEY_Return: |
| 36 case FWL_VKEY_Space: | 36 case FWL_VKEY_Space: |
| 37 return TRUE; | 37 return TRUE; |
| 38 default: | 38 default: |
| 39 return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags); | 39 return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 FX_BOOL CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, | 43 FX_BOOL CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, |
| 44 FX_UINT nChar, | 44 uint32_t nChar, |
| 45 FX_UINT nFlags) { | 45 uint32_t nFlags) { |
| 46 switch (nChar) { | 46 switch (nChar) { |
| 47 case FWL_VKEY_Return: | 47 case FWL_VKEY_Return: |
| 48 case FWL_VKEY_Space: { | 48 case FWL_VKEY_Space: { |
| 49 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); | 49 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); |
| 50 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 50 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
| 51 ASSERT(pPageView); | 51 ASSERT(pPageView); |
| 52 | 52 |
| 53 FX_BOOL bReset = FALSE; | 53 FX_BOOL bReset = FALSE; |
| 54 FX_BOOL bExit = FALSE; | 54 FX_BOOL bExit = FALSE; |
| 55 | 55 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 68 CommitData(pPageView, nFlags); | 68 CommitData(pPageView, nFlags); |
| 69 return TRUE; | 69 return TRUE; |
| 70 } | 70 } |
| 71 default: | 71 default: |
| 72 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); | 72 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 FX_BOOL CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView, | 76 FX_BOOL CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 77 CPDFSDK_Annot* pAnnot, | 77 CPDFSDK_Annot* pAnnot, |
| 78 FX_UINT nFlags, | 78 uint32_t nFlags, |
| 79 const CFX_FloatPoint& point) { | 79 const CFX_FloatPoint& point) { |
| 80 CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); | 80 CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); |
| 81 | 81 |
| 82 if (IsValid()) { | 82 if (IsValid()) { |
| 83 if (CPWL_RadioButton* pWnd = | 83 if (CPWL_RadioButton* pWnd = |
| 84 (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE)) | 84 (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE)) |
| 85 pWnd->SetCheck(TRUE); | 85 pWnd->SetCheck(TRUE); |
| 86 | 86 |
| 87 if (!CommitData(pPageView, nFlags)) | 87 if (!CommitData(pPageView, nFlags)) |
| 88 return FALSE; | 88 return FALSE; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 m_pWidget->SetCheck(bNewChecked, false); | 119 m_pWidget->SetCheck(bNewChecked, false); |
| 120 m_pWidget->UpdateField(); | 120 m_pWidget->UpdateField(); |
| 121 SetChangeMark(); | 121 SetChangeMark(); |
| 122 } | 122 } |
| 123 } | 123 } |
| OLD | NEW |