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

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

Issue 2029923002: Replace FWL_HLISTITEM with class IFWL_ListItem {} (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Remove redundant casts, hItem -> pItem Created 4 years, 6 months 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/lightwidget/cfwl_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/basewidget/ifwl_edit.h" 9 #include "xfa/fwl/basewidget/ifwl_edit.h"
10 #include "xfa/fwl/core/fwl_noteimp.h" 10 #include "xfa/fwl/core/fwl_noteimp.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; 49 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
50 if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { 50 if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
51 dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection; 51 dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection;
52 } 52 }
53 dwExtendedStyle |= GetAlignment(); 53 dwExtendedStyle |= GetAlignment();
54 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); 54 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
55 CFX_Int32Array iSelArray; 55 CFX_Int32Array iSelArray;
56 m_pDataAcc->GetSelectedItems(iSelArray); 56 m_pDataAcc->GetSelectedItems(iSelArray);
57 int32_t iSelCount = iSelArray.GetSize(); 57 int32_t iSelCount = iSelArray.GetSize();
58 for (int32_t j = 0; j < iSelCount; j++) { 58 for (int32_t j = 0; j < iSelCount; j++) {
59 FWL_HLISTITEM item = pListBox->GetItem(iSelArray[j]); 59 IFWL_ListItem* item = pListBox->GetItem(iSelArray[j]);
60 pListBox->SetSelItem(item, TRUE); 60 pListBox->SetSelItem(item, TRUE);
61 } 61 }
62 m_pNormalWidget->UnlockUpdate(); 62 m_pNormalWidget->UnlockUpdate();
63 return CXFA_FFField::LoadWidget(); 63 return CXFA_FFField::LoadWidget();
64 } 64 }
65 65
66 FX_BOOL CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) { 66 FX_BOOL CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) {
67 if (!ProcessCommittedData()) 67 if (!ProcessCommittedData())
68 UpdateFWLData(); 68 UpdateFWLData();
69 CXFA_FFField::OnKillFocus(pNewFocus); 69 CXFA_FFField::OnKillFocus(pNewFocus);
(...skipping 13 matching lines...) Expand all
83 FX_BOOL CXFA_FFListBox::IsDataChanged() { 83 FX_BOOL CXFA_FFListBox::IsDataChanged() {
84 CFX_Int32Array iSelArray; 84 CFX_Int32Array iSelArray;
85 m_pDataAcc->GetSelectedItems(iSelArray); 85 m_pDataAcc->GetSelectedItems(iSelArray);
86 int32_t iOldSels = iSelArray.GetSize(); 86 int32_t iOldSels = iSelArray.GetSize();
87 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; 87 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget;
88 int32_t iSels = pListBox->CountSelItems(); 88 int32_t iSels = pListBox->CountSelItems();
89 if (iOldSels != iSels) 89 if (iOldSels != iSels)
90 return TRUE; 90 return TRUE;
91 91
92 for (int32_t i = 0; i < iSels; ++i) { 92 for (int32_t i = 0; i < iSels; ++i) {
93 FWL_HLISTITEM hlistItem = pListBox->GetItem(iSelArray[i]); 93 IFWL_ListItem* hlistItem = pListBox->GetItem(iSelArray[i]);
94 if (!(pListBox->GetItemStates(hlistItem) && FWL_ITEMSTATE_LTB_Selected)) 94 if (!(pListBox->GetItemStates(hlistItem) && FWL_ITEMSTATE_LTB_Selected))
95 return TRUE; 95 return TRUE;
96 } 96 }
97 return FALSE; 97 return FALSE;
98 } 98 }
99 99
100 uint32_t CXFA_FFListBox::GetAlignment() { 100 uint32_t CXFA_FFListBox::GetAlignment() {
101 uint32_t dwExtendedStyle = 0; 101 uint32_t dwExtendedStyle = 0;
102 if (CXFA_Para para = m_pDataAcc->GetPara()) { 102 if (CXFA_Para para = m_pDataAcc->GetPara()) {
103 int32_t iHorz = para.GetHorizontalAlign(); 103 int32_t iHorz = para.GetHorizontalAlign();
(...skipping 15 matching lines...) Expand all
119 break; 119 break;
120 } 120 }
121 } 121 }
122 return dwExtendedStyle; 122 return dwExtendedStyle;
123 } 123 }
124 FX_BOOL CXFA_FFListBox::UpdateFWLData() { 124 FX_BOOL CXFA_FFListBox::UpdateFWLData() {
125 if (!m_pNormalWidget) { 125 if (!m_pNormalWidget) {
126 return FALSE; 126 return FALSE;
127 } 127 }
128 CFWL_ListBox* pListBox = ((CFWL_ListBox*)m_pNormalWidget); 128 CFWL_ListBox* pListBox = ((CFWL_ListBox*)m_pNormalWidget);
129 CFX_ArrayTemplate<FWL_HLISTITEM> selItemArray; 129 CFX_ArrayTemplate<IFWL_ListItem*> selItemArray;
130 CFX_Int32Array iSelArray; 130 CFX_Int32Array iSelArray;
131 m_pDataAcc->GetSelectedItems(iSelArray); 131 m_pDataAcc->GetSelectedItems(iSelArray);
132 int32_t iSelCount = iSelArray.GetSize(); 132 int32_t iSelCount = iSelArray.GetSize();
133 for (int32_t j = 0; j < iSelCount; j++) { 133 for (int32_t j = 0; j < iSelCount; j++) {
134 FWL_HLISTITEM lpItemSel = pListBox->GetSelItem(iSelArray[j]); 134 IFWL_ListItem* lpItemSel = pListBox->GetSelItem(iSelArray[j]);
135 selItemArray.Add(lpItemSel); 135 selItemArray.Add(lpItemSel);
136 } 136 }
137 pListBox->SetSelItem(pListBox->GetSelItem(-1), FALSE); 137 pListBox->SetSelItem(pListBox->GetSelItem(-1), FALSE);
138 for (int32_t i = 0; i < iSelCount; i++) { 138 for (int32_t i = 0; i < iSelCount; i++) {
139 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(selItemArray[i], TRUE); 139 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(selItemArray[i], TRUE);
140 } 140 }
141 m_pNormalWidget->Update(); 141 m_pNormalWidget->Update();
142 return TRUE; 142 return TRUE;
143 } 143 }
144 void CXFA_FFListBox::OnSelectChanged(IFWL_Widget* pWidget, 144 void CXFA_FFListBox::OnSelectChanged(IFWL_Widget* pWidget,
145 const CFX_Int32Array& arrSels) { 145 const CFX_Int32Array& arrSels) {
146 CXFA_EventParam eParam; 146 CXFA_EventParam eParam;
147 eParam.m_eType = XFA_EVENT_Change; 147 eParam.m_eType = XFA_EVENT_Change;
148 eParam.m_pTarget = m_pDataAcc; 148 eParam.m_pTarget = m_pDataAcc;
149 m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw); 149 m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw);
150 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; 150 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget;
151 int32_t iSels = pListBox->CountSelItems(); 151 int32_t iSels = pListBox->CountSelItems();
152 if (iSels > 0) { 152 if (iSels > 0) {
153 pListBox->GetItemText(pListBox->GetSelItem(0), eParam.m_wsNewText); 153 pListBox->GetItemText(pListBox->GetSelItem(0), eParam.m_wsNewText);
154 } 154 }
155 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); 155 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
156 } 156 }
157 void CXFA_FFListBox::SetItemState(int32_t nIndex, FX_BOOL bSelected) { 157 void CXFA_FFListBox::SetItemState(int32_t nIndex, FX_BOOL bSelected) {
158 FWL_HLISTITEM item = ((CFWL_ListBox*)m_pNormalWidget)->GetSelItem(nIndex); 158 IFWL_ListItem* item = ((CFWL_ListBox*)m_pNormalWidget)->GetSelItem(nIndex);
159 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(item, bSelected); 159 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(item, bSelected);
160 m_pNormalWidget->Update(); 160 m_pNormalWidget->Update();
161 AddInvalidateRect(); 161 AddInvalidateRect();
162 } 162 }
163 void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel, 163 void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel,
164 int32_t nIndex) { 164 int32_t nIndex) {
165 CFX_WideString wsTemp(wsLabel); 165 CFX_WideString wsTemp(wsLabel);
166 ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp.AsStringC()); 166 ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp.AsStringC());
167 m_pNormalWidget->Update(); 167 m_pNormalWidget->Update();
168 AddInvalidateRect(); 168 AddInvalidateRect();
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 default: 523 default:
524 break; 524 break;
525 } 525 }
526 m_pOldDelegate->OnProcessEvent(pEvent); 526 m_pOldDelegate->OnProcessEvent(pEvent);
527 } 527 }
528 528
529 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, 529 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics,
530 const CFX_Matrix* pMatrix) { 530 const CFX_Matrix* pMatrix) {
531 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); 531 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
532 } 532 }
OLDNEW
« no previous file with comments | « xfa/fwl/lightwidget/cfwl_listbox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698