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 "../../include/formfiller/FormFiller.h" | 7 #include "../../include/formfiller/FormFiller.h" |
8 #include "../../include/formfiller/FFL_FormFiller.h" | 8 #include "../../include/formfiller/FFL_FormFiller.h" |
9 #include "../../include/formfiller/FFL_RadioButton.h" | 9 #include "../../include/formfiller/FFL_RadioButton.h" |
10 //#include "../include/FFL_Undo.h" | 10 //#include "../include/FFL_Undo.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 { | 24 { |
25 CPWL_RadioButton* pWnd = new CPWL_RadioButton(); | 25 CPWL_RadioButton* pWnd = new CPWL_RadioButton(); |
26 pWnd->Create(cp); | 26 pWnd->Create(cp); |
27 | 27 |
28 ASSERT(m_pWidget != NULL); | 28 ASSERT(m_pWidget != NULL); |
29 pWnd->SetCheck(m_pWidget->IsChecked()); | 29 pWnd->SetCheck(m_pWidget->IsChecked()); |
30 | 30 |
31 return pWnd; | 31 return pWnd; |
32 } | 32 } |
33 | 33 |
34 FX_BOOL»CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_
UINT nFlags) | 34 bool» CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_
UINT nFlags) |
35 { | 35 { |
36 switch (nKeyCode) | 36 switch (nKeyCode) |
37 { | 37 { |
38 case FWL_VKEY_Return: | 38 case FWL_VKEY_Return: |
39 case FWL_VKEY_Space: | 39 case FWL_VKEY_Space: |
40 » » return TRUE; | 40 » » return true; |
41 default: | 41 default: |
42 return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags); | 42 return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 FX_BOOL»CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n
Flags) | 46 bool» CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n
Flags) |
47 { | 47 { |
48 switch (nChar) | 48 switch (nChar) |
49 { | 49 { |
50 case FWL_VKEY_Return: | 50 case FWL_VKEY_Return: |
51 case FWL_VKEY_Space: | 51 case FWL_VKEY_Space: |
52 { | 52 { |
53 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(
); | 53 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(
); |
54 ASSERT(pIFormFiller != NULL); | 54 ASSERT(pIFormFiller != NULL); |
55 | 55 |
56 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 56 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
57 ASSERT(pPageView != NULL); | 57 ASSERT(pPageView != NULL); |
58 | 58 |
59 » » » FX_BOOL bReset = FALSE; | 59 » » » bool bReset = false; |
60 » » » FX_BOOL bExit = FALSE; | 60 » » » bool bExit = false; |
61 | 61 |
62 pIFormFiller->OnButtonUp(m_pWidget, pPageView, bReset, b
Exit,nFlags); | 62 pIFormFiller->OnButtonUp(m_pWidget, pPageView, bReset, b
Exit,nFlags); |
63 | 63 |
64 » » » if (bReset) return TRUE; | 64 » » » if (bReset) return true; |
65 » » » if (bExit) return TRUE; | 65 » » » if (bExit) return true; |
66 | 66 |
67 CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); | 67 CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); |
68 | 68 |
69 » » » if (CPWL_RadioButton * pWnd = (CPWL_RadioButton*)GetPDFW
indow(pPageView, TRUE)) | 69 » » » if (CPWL_RadioButton * pWnd = (CPWL_RadioButton*)GetPDFW
indow(pPageView, true)) |
70 » » » » pWnd->SetCheck(TRUE); | 70 » » » » pWnd->SetCheck(true); |
71 CommitData(pPageView,nFlags); | 71 CommitData(pPageView,nFlags); |
72 » » » return TRUE; | 72 » » » return true; |
73 } | 73 } |
74 default: | 74 default: |
75 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); | 75 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 FX_BOOL»CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 79 bool» CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
80 { | 80 { |
81 CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); | 81 CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); |
82 | 82 |
83 if (IsValid()) | 83 if (IsValid()) |
84 { | 84 { |
85 » » if (CPWL_RadioButton * pWnd = (CPWL_RadioButton*)GetPDFWindow(pP
ageView, TRUE)) | 85 » » if (CPWL_RadioButton * pWnd = (CPWL_RadioButton*)GetPDFWindow(pP
ageView, true)) |
86 » » » pWnd->SetCheck(TRUE); | 86 » » » pWnd->SetCheck(true); |
87 | 87 |
88 » » if (!CommitData(pPageView,nFlags)) return FALSE; | 88 » » if (!CommitData(pPageView,nFlags)) return false; |
89 } | 89 } |
90 | 90 |
91 » return TRUE; | 91 » return true; |
92 } | 92 } |
93 | 93 |
94 FX_BOOL»CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) | 94 bool» CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) |
95 { | 95 { |
96 ASSERT(m_pWidget != NULL); | 96 ASSERT(m_pWidget != NULL); |
97 | 97 |
98 » if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView,
FALSE)) | 98 » if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView,
false)) |
99 { | 99 { |
100 return pWnd->IsChecked() != m_pWidget->IsChecked(); | 100 return pWnd->IsChecked() != m_pWidget->IsChecked(); |
101 } | 101 } |
102 | 102 |
103 » return FALSE; | 103 » return false; |
104 } | 104 } |
105 | 105 |
106 void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) | 106 void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) |
107 { | 107 { |
108 ASSERT(m_pWidget != NULL); | 108 ASSERT(m_pWidget != NULL); |
109 | 109 |
110 » if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView,
FALSE)) | 110 » if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView,
false)) |
111 { | 111 { |
112 | 112 |
113 » » FX_BOOL bNewChecked = pWnd->IsChecked(); | 113 » » bool bNewChecked = pWnd->IsChecked(); |
114 | 114 |
115 if (bNewChecked) | 115 if (bNewChecked) |
116 { | 116 { |
117 CPDF_FormField* pField = m_pWidget->GetFormField(); | 117 CPDF_FormField* pField = m_pWidget->GetFormField(); |
118 ASSERT(pField != NULL); | 118 ASSERT(pField != NULL); |
119 | 119 |
120 for (int32_t i=0,sz=pField->CountControls(); i<sz; i++) | 120 for (int32_t i=0,sz=pField->CountControls(); i<sz; i++) |
121 { | 121 { |
122 if (CPDF_FormControl* pCtrl = pField->GetControl
(i)) | 122 if (CPDF_FormControl* pCtrl = pField->GetControl
(i)) |
123 { | 123 { |
124 if (pCtrl->IsChecked()) | 124 if (pCtrl->IsChecked()) |
125 { | 125 { |
126 break; | 126 break; |
127 } | 127 } |
128 } | 128 } |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 » » m_pWidget->SetCheck(bNewChecked, FALSE); | 132 » » m_pWidget->SetCheck(bNewChecked, false); |
133 m_pWidget->UpdateField(); | 133 m_pWidget->UpdateField(); |
134 SetChangeMark(); | 134 SetChangeMark(); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
OLD | NEW |