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

Side by Side Diff: xfa/fxfa/app/xfa_ffchoicelist.cpp

Issue 2487943003: Rename IFWL_ListItem to CFWL_ListItem (Closed)
Patch Set: cleanup 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 | « xfa/fwl/core/ifwl_listbox.cpp ('k') | no next file » | 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 "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_listbox.h" 10 #include "xfa/fwl/core/cfwl_listbox.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; 56 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
57 if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { 57 if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
58 dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection; 58 dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection;
59 } 59 }
60 dwExtendedStyle |= GetAlignment(); 60 dwExtendedStyle |= GetAlignment();
61 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); 61 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
62 CFX_Int32Array iSelArray; 62 CFX_Int32Array iSelArray;
63 m_pDataAcc->GetSelectedItems(iSelArray); 63 m_pDataAcc->GetSelectedItems(iSelArray);
64 int32_t iSelCount = iSelArray.GetSize(); 64 int32_t iSelCount = iSelArray.GetSize();
65 for (int32_t j = 0; j < iSelCount; j++) { 65 for (int32_t j = 0; j < iSelCount; j++) {
66 IFWL_ListItem* item = pListBox->GetItem(iSelArray[j]); 66 CFWL_ListItem* item = pListBox->GetItem(iSelArray[j]);
67 pListBox->SetSelItem(item, true); 67 pListBox->SetSelItem(item, true);
68 } 68 }
69 m_pNormalWidget->UnlockUpdate(); 69 m_pNormalWidget->UnlockUpdate();
70 return CXFA_FFField::LoadWidget(); 70 return CXFA_FFField::LoadWidget();
71 } 71 }
72 72
73 bool CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) { 73 bool CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) {
74 if (!ProcessCommittedData()) 74 if (!ProcessCommittedData())
75 UpdateFWLData(); 75 UpdateFWLData();
76 CXFA_FFField::OnKillFocus(pNewFocus); 76 CXFA_FFField::OnKillFocus(pNewFocus);
(...skipping 13 matching lines...) Expand all
90 bool CXFA_FFListBox::IsDataChanged() { 90 bool CXFA_FFListBox::IsDataChanged() {
91 CFX_Int32Array iSelArray; 91 CFX_Int32Array iSelArray;
92 m_pDataAcc->GetSelectedItems(iSelArray); 92 m_pDataAcc->GetSelectedItems(iSelArray);
93 int32_t iOldSels = iSelArray.GetSize(); 93 int32_t iOldSels = iSelArray.GetSize();
94 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; 94 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget;
95 int32_t iSels = pListBox->CountSelItems(); 95 int32_t iSels = pListBox->CountSelItems();
96 if (iOldSels != iSels) 96 if (iOldSels != iSels)
97 return true; 97 return true;
98 98
99 for (int32_t i = 0; i < iSels; ++i) { 99 for (int32_t i = 0; i < iSels; ++i) {
100 IFWL_ListItem* hlistItem = pListBox->GetItem(iSelArray[i]); 100 CFWL_ListItem* hlistItem = pListBox->GetItem(iSelArray[i]);
101 if (!(pListBox->GetItemStates(hlistItem) & FWL_ITEMSTATE_LTB_Selected)) 101 if (!(pListBox->GetItemStates(hlistItem) & FWL_ITEMSTATE_LTB_Selected))
102 return true; 102 return true;
103 } 103 }
104 return false; 104 return false;
105 } 105 }
106 106
107 uint32_t CXFA_FFListBox::GetAlignment() { 107 uint32_t CXFA_FFListBox::GetAlignment() {
108 uint32_t dwExtendedStyle = 0; 108 uint32_t dwExtendedStyle = 0;
109 if (CXFA_Para para = m_pDataAcc->GetPara()) { 109 if (CXFA_Para para = m_pDataAcc->GetPara()) {
110 int32_t iHorz = para.GetHorizontalAlign(); 110 int32_t iHorz = para.GetHorizontalAlign();
(...skipping 15 matching lines...) Expand all
126 break; 126 break;
127 } 127 }
128 } 128 }
129 return dwExtendedStyle; 129 return dwExtendedStyle;
130 } 130 }
131 bool CXFA_FFListBox::UpdateFWLData() { 131 bool CXFA_FFListBox::UpdateFWLData() {
132 if (!m_pNormalWidget) { 132 if (!m_pNormalWidget) {
133 return false; 133 return false;
134 } 134 }
135 CFWL_ListBox* pListBox = ((CFWL_ListBox*)m_pNormalWidget); 135 CFWL_ListBox* pListBox = ((CFWL_ListBox*)m_pNormalWidget);
136 CFX_ArrayTemplate<IFWL_ListItem*> selItemArray; 136 CFX_ArrayTemplate<CFWL_ListItem*> selItemArray;
137 CFX_Int32Array iSelArray; 137 CFX_Int32Array iSelArray;
138 m_pDataAcc->GetSelectedItems(iSelArray); 138 m_pDataAcc->GetSelectedItems(iSelArray);
139 int32_t iSelCount = iSelArray.GetSize(); 139 int32_t iSelCount = iSelArray.GetSize();
140 for (int32_t j = 0; j < iSelCount; j++) { 140 for (int32_t j = 0; j < iSelCount; j++) {
141 IFWL_ListItem* lpItemSel = pListBox->GetSelItem(iSelArray[j]); 141 CFWL_ListItem* lpItemSel = pListBox->GetSelItem(iSelArray[j]);
142 selItemArray.Add(lpItemSel); 142 selItemArray.Add(lpItemSel);
143 } 143 }
144 pListBox->SetSelItem(pListBox->GetSelItem(-1), false); 144 pListBox->SetSelItem(pListBox->GetSelItem(-1), false);
145 for (int32_t i = 0; i < iSelCount; i++) { 145 for (int32_t i = 0; i < iSelCount; i++) {
146 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(selItemArray[i], true); 146 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(selItemArray[i], true);
147 } 147 }
148 m_pNormalWidget->Update(); 148 m_pNormalWidget->Update();
149 return true; 149 return true;
150 } 150 }
151 void CXFA_FFListBox::OnSelectChanged(IFWL_Widget* pWidget, 151 void CXFA_FFListBox::OnSelectChanged(IFWL_Widget* pWidget,
152 const CFX_Int32Array& arrSels) { 152 const CFX_Int32Array& arrSels) {
153 CXFA_EventParam eParam; 153 CXFA_EventParam eParam;
154 eParam.m_eType = XFA_EVENT_Change; 154 eParam.m_eType = XFA_EVENT_Change;
155 eParam.m_pTarget = m_pDataAcc; 155 eParam.m_pTarget = m_pDataAcc;
156 m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw); 156 m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw);
157 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; 157 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget;
158 int32_t iSels = pListBox->CountSelItems(); 158 int32_t iSels = pListBox->CountSelItems();
159 if (iSels > 0) { 159 if (iSels > 0) {
160 pListBox->GetItemText(pListBox->GetSelItem(0), eParam.m_wsNewText); 160 pListBox->GetItemText(pListBox->GetSelItem(0), eParam.m_wsNewText);
161 } 161 }
162 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); 162 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
163 } 163 }
164 void CXFA_FFListBox::SetItemState(int32_t nIndex, bool bSelected) { 164 void CXFA_FFListBox::SetItemState(int32_t nIndex, bool bSelected) {
165 IFWL_ListItem* item = ((CFWL_ListBox*)m_pNormalWidget)->GetSelItem(nIndex); 165 CFWL_ListItem* item = ((CFWL_ListBox*)m_pNormalWidget)->GetSelItem(nIndex);
166 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(item, bSelected); 166 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(item, bSelected);
167 m_pNormalWidget->Update(); 167 m_pNormalWidget->Update();
168 AddInvalidateRect(); 168 AddInvalidateRect();
169 } 169 }
170 void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel, 170 void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel,
171 int32_t nIndex) { 171 int32_t nIndex) {
172 CFX_WideString wsTemp(wsLabel); 172 CFX_WideString wsTemp(wsLabel);
173 ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp.AsStringC()); 173 ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp.AsStringC());
174 m_pNormalWidget->Update(); 174 m_pNormalWidget->Update();
175 AddInvalidateRect(); 175 AddInvalidateRect();
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 default: 532 default:
533 break; 533 break;
534 } 534 }
535 m_pOldDelegate->OnProcessEvent(pEvent); 535 m_pOldDelegate->OnProcessEvent(pEvent);
536 } 536 }
537 537
538 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, 538 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics,
539 const CFX_Matrix* pMatrix) { 539 const CFX_Matrix* pMatrix) {
540 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); 540 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
541 } 541 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_listbox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698