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/fxfa/app/xfa_ffchoicelist.h" | 7 #include "xfa/fxfa/app/xfa_ffchoicelist.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_combobox.h" | 9 #include "xfa/fwl/core/cfwl_combobox.h" |
10 #include "xfa/fwl/core/cfwl_evtselectchanged.h" | 10 #include "xfa/fwl/core/cfwl_evtselectchanged.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; | 59 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; |
60 if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { | 60 if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { |
61 dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection; | 61 dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection; |
62 } | 62 } |
63 dwExtendedStyle |= GetAlignment(); | 63 dwExtendedStyle |= GetAlignment(); |
64 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); | 64 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); |
65 CFX_Int32Array iSelArray; | 65 CFX_Int32Array iSelArray; |
66 m_pDataAcc->GetSelectedItems(iSelArray); | 66 m_pDataAcc->GetSelectedItems(iSelArray); |
67 int32_t iSelCount = iSelArray.GetSize(); | 67 int32_t iSelCount = iSelArray.GetSize(); |
68 for (int32_t j = 0; j < iSelCount; j++) { | 68 for (int32_t j = 0; j < iSelCount; j++) { |
69 CFWL_ListItem* item = pListBox->GetItem(iSelArray[j]); | 69 CFWL_ListItem* item = pListBox->GetItem(nullptr, iSelArray[j]); |
70 pListBox->SetSelItem(item, true); | 70 pListBox->SetSelItem(item, true); |
71 } | 71 } |
72 m_pNormalWidget->UnlockUpdate(); | 72 m_pNormalWidget->UnlockUpdate(); |
73 return CXFA_FFField::LoadWidget(); | 73 return CXFA_FFField::LoadWidget(); |
74 } | 74 } |
75 | 75 |
76 bool CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) { | 76 bool CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) { |
77 if (!ProcessCommittedData()) | 77 if (!ProcessCommittedData()) |
78 UpdateFWLData(); | 78 UpdateFWLData(); |
79 CXFA_FFField::OnKillFocus(pNewFocus); | 79 CXFA_FFField::OnKillFocus(pNewFocus); |
(...skipping 13 matching lines...) Expand all Loading... | |
93 bool CXFA_FFListBox::IsDataChanged() { | 93 bool CXFA_FFListBox::IsDataChanged() { |
94 CFX_Int32Array iSelArray; | 94 CFX_Int32Array iSelArray; |
95 m_pDataAcc->GetSelectedItems(iSelArray); | 95 m_pDataAcc->GetSelectedItems(iSelArray); |
96 int32_t iOldSels = iSelArray.GetSize(); | 96 int32_t iOldSels = iSelArray.GetSize(); |
97 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; | 97 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; |
98 int32_t iSels = pListBox->CountSelItems(); | 98 int32_t iSels = pListBox->CountSelItems(); |
99 if (iOldSels != iSels) | 99 if (iOldSels != iSels) |
100 return true; | 100 return true; |
101 | 101 |
102 for (int32_t i = 0; i < iSels; ++i) { | 102 for (int32_t i = 0; i < iSels; ++i) { |
103 CFWL_ListItem* hlistItem = pListBox->GetItem(iSelArray[i]); | 103 CFWL_ListItem* hlistItem = pListBox->GetItem(nullptr, iSelArray[i]); |
104 if (!(pListBox->GetItemStates(hlistItem) & FWL_ITEMSTATE_LTB_Selected)) | 104 if (!(pListBox->GetItemStates(hlistItem) & FWL_ITEMSTATE_LTB_Selected)) |
105 return true; | 105 return true; |
106 } | 106 } |
107 return false; | 107 return false; |
108 } | 108 } |
109 | 109 |
110 uint32_t CXFA_FFListBox::GetAlignment() { | 110 uint32_t CXFA_FFListBox::GetAlignment() { |
111 uint32_t dwExtendedStyle = 0; | 111 uint32_t dwExtendedStyle = 0; |
112 if (CXFA_Para para = m_pDataAcc->GetPara()) { | 112 if (CXFA_Para para = m_pDataAcc->GetPara()) { |
113 int32_t iHorz = para.GetHorizontalAlign(); | 113 int32_t iHorz = para.GetHorizontalAlign(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 } | 153 } |
154 void CXFA_FFListBox::OnSelectChanged(IFWL_Widget* pWidget, | 154 void CXFA_FFListBox::OnSelectChanged(IFWL_Widget* pWidget, |
155 const CFX_Int32Array& arrSels) { | 155 const CFX_Int32Array& arrSels) { |
156 CXFA_EventParam eParam; | 156 CXFA_EventParam eParam; |
157 eParam.m_eType = XFA_EVENT_Change; | 157 eParam.m_eType = XFA_EVENT_Change; |
158 eParam.m_pTarget = m_pDataAcc; | 158 eParam.m_pTarget = m_pDataAcc; |
159 m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw); | 159 m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw); |
160 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; | 160 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; |
161 int32_t iSels = pListBox->CountSelItems(); | 161 int32_t iSels = pListBox->CountSelItems(); |
162 if (iSels > 0) { | 162 if (iSels > 0) { |
163 pListBox->GetItemText(pListBox->GetSelItem(0), eParam.m_wsNewText); | 163 pListBox->GetItemText(nullptr, pListBox->GetSelItem(0), eParam.m_wsNewText); |
npm
2016/11/22 16:36:16
It's unclear to me why this is the same.
dsinclair
2016/11/22 16:42:15
pListBox had two GetItemText() methods. First firs
npm
2016/11/22 16:52:13
Original:
if (GetWidget()) ToListBox(GetWidget())-
dsinclair
2016/11/22 16:53:49
Right, but if you look at GetItemText in ListBox,
| |
164 } | 164 } |
165 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); | 165 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); |
166 } | 166 } |
167 void CXFA_FFListBox::SetItemState(int32_t nIndex, bool bSelected) { | 167 void CXFA_FFListBox::SetItemState(int32_t nIndex, bool bSelected) { |
168 CFWL_ListItem* item = ((CFWL_ListBox*)m_pNormalWidget)->GetSelItem(nIndex); | 168 CFWL_ListItem* item = ((CFWL_ListBox*)m_pNormalWidget)->GetSelItem(nIndex); |
169 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(item, bSelected); | 169 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(item, bSelected); |
170 m_pNormalWidget->Update(); | 170 m_pNormalWidget->Update(); |
171 AddInvalidateRect(); | 171 AddInvalidateRect(); |
172 } | 172 } |
173 void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel, | 173 void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel, |
174 int32_t nIndex) { | 174 int32_t nIndex) { |
175 CFX_WideString wsTemp(wsLabel); | 175 CFX_WideString wsTemp(wsLabel); |
176 ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp.AsStringC()); | 176 ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp.AsStringC()); |
177 m_pNormalWidget->Update(); | 177 m_pNormalWidget->Update(); |
178 AddInvalidateRect(); | 178 AddInvalidateRect(); |
179 } | 179 } |
180 void CXFA_FFListBox::DeleteItem(int32_t nIndex) { | 180 void CXFA_FFListBox::DeleteItem(int32_t nIndex) { |
181 if (nIndex < 0) { | 181 if (nIndex < 0) { |
182 ((CFWL_ListBox*)m_pNormalWidget)->DeleteAll(); | 182 ((CFWL_ListBox*)m_pNormalWidget)->DeleteAll(); |
183 } else { | 183 } else { |
184 ((CFWL_ListBox*)m_pNormalWidget) | 184 ((CFWL_ListBox*)m_pNormalWidget) |
185 ->DeleteString(((CFWL_ListBox*)m_pNormalWidget)->GetItem(nIndex)); | 185 ->DeleteString( |
186 ((CFWL_ListBox*)m_pNormalWidget)->GetItem(nullptr, nIndex)); | |
186 } | 187 } |
187 m_pNormalWidget->Update(); | 188 m_pNormalWidget->Update(); |
188 AddInvalidateRect(); | 189 AddInvalidateRect(); |
189 } | 190 } |
190 | 191 |
191 void CXFA_FFListBox::OnProcessMessage(CFWL_Message* pMessage) { | 192 void CXFA_FFListBox::OnProcessMessage(CFWL_Message* pMessage) { |
192 m_pOldDelegate->OnProcessMessage(pMessage); | 193 m_pOldDelegate->OnProcessMessage(pMessage); |
193 } | 194 } |
194 | 195 |
195 void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) { | 196 void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) { |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 default: | 535 default: |
535 break; | 536 break; |
536 } | 537 } |
537 m_pOldDelegate->OnProcessEvent(pEvent); | 538 m_pOldDelegate->OnProcessEvent(pEvent); |
538 } | 539 } |
539 | 540 |
540 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, | 541 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, |
541 const CFX_Matrix* pMatrix) { | 542 const CFX_Matrix* pMatrix) { |
542 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 543 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
543 } | 544 } |
OLD | NEW |