Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Side by Side Diff: fpdfsdk/formfiller/cffl_radiobutton.cpp

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/formfiller/cffl_radiobutton.h ('k') | fpdfsdk/formfiller/cffl_textfield.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cpdfsdk_formfillenvironment.h" 9 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
10 #include "fpdfsdk/cpdfsdk_widget.h" 10 #include "fpdfsdk/cpdfsdk_widget.h"
(...skipping 10 matching lines...) Expand all
21 CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp, 21 CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp,
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 bool CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot,
32 uint32_t nKeyCode, 32 uint32_t nKeyCode,
33 uint32_t 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 bool CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot,
44 uint32_t nChar, 44 uint32_t nChar,
45 uint32_t 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 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); 49 CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
50 ASSERT(pPageView); 50 ASSERT(pPageView);
51 51
52 FX_BOOL bReset = FALSE; 52 bool bReset = false;
53 FX_BOOL bExit = FALSE; 53 bool bExit = false;
54 CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); 54 CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget);
55 m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp( 55 m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp(
56 &pObserved, pPageView, bReset, bExit, nFlags); 56 &pObserved, pPageView, bReset, bExit, nFlags);
57 if (!pObserved || bReset || bExit) 57 if (!pObserved || bReset || bExit)
58 return TRUE; 58 return true;
59 59
60 CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); 60 CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
61 if (CPWL_RadioButton* pWnd = 61 if (CPWL_RadioButton* pWnd =
62 (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE)) 62 (CPWL_RadioButton*)GetPDFWindow(pPageView, true))
63 pWnd->SetCheck(TRUE); 63 pWnd->SetCheck(true);
64 CommitData(pPageView, nFlags); 64 CommitData(pPageView, nFlags);
65 return TRUE; 65 return true;
66 } 66 }
67 default: 67 default:
68 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); 68 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
69 } 69 }
70 } 70 }
71 71
72 FX_BOOL CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView, 72 bool CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView,
73 CPDFSDK_Annot* pAnnot, 73 CPDFSDK_Annot* pAnnot,
74 uint32_t nFlags, 74 uint32_t nFlags,
75 const CFX_FloatPoint& point) { 75 const CFX_FloatPoint& point) {
76 CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); 76 CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point);
77 77
78 if (IsValid()) { 78 if (IsValid()) {
79 if (CPWL_RadioButton* pWnd = 79 if (CPWL_RadioButton* pWnd =
80 (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE)) 80 (CPWL_RadioButton*)GetPDFWindow(pPageView, true))
81 pWnd->SetCheck(TRUE); 81 pWnd->SetCheck(true);
82 82
83 if (!CommitData(pPageView, nFlags)) 83 if (!CommitData(pPageView, nFlags))
84 return FALSE; 84 return false;
85 } 85 }
86 86
87 return TRUE; 87 return true;
88 } 88 }
89 89
90 FX_BOOL CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) { 90 bool CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) {
91 if (CPWL_RadioButton* pWnd = 91 if (CPWL_RadioButton* pWnd =
92 (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) { 92 (CPWL_RadioButton*)GetPDFWindow(pPageView, false)) {
93 return pWnd->IsChecked() != m_pWidget->IsChecked(); 93 return pWnd->IsChecked() != m_pWidget->IsChecked();
94 } 94 }
95 95
96 return FALSE; 96 return false;
97 } 97 }
98 98
99 void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) { 99 void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) {
100 if (CPWL_RadioButton* pWnd = 100 if (CPWL_RadioButton* pWnd =
101 (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) { 101 (CPWL_RadioButton*)GetPDFWindow(pPageView, false)) {
102 bool bNewChecked = pWnd->IsChecked(); 102 bool bNewChecked = pWnd->IsChecked();
103 103
104 if (bNewChecked) { 104 if (bNewChecked) {
105 CPDF_FormField* pField = m_pWidget->GetFormField(); 105 CPDF_FormField* pField = m_pWidget->GetFormField();
106 for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) { 106 for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) {
107 if (CPDF_FormControl* pCtrl = pField->GetControl(i)) { 107 if (CPDF_FormControl* pCtrl = pField->GetControl(i)) {
108 if (pCtrl->IsChecked()) { 108 if (pCtrl->IsChecked()) {
109 break; 109 break;
110 } 110 }
111 } 111 }
112 } 112 }
113 } 113 }
114 114
115 m_pWidget->SetCheck(bNewChecked, false); 115 m_pWidget->SetCheck(bNewChecked, false);
116 m_pWidget->UpdateField(); 116 m_pWidget->UpdateField();
117 SetChangeMark(); 117 SetChangeMark();
118 } 118 }
119 } 119 }
OLDNEW
« no previous file with comments | « fpdfsdk/formfiller/cffl_radiobutton.h ('k') | fpdfsdk/formfiller/cffl_textfield.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698