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

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

Issue 1862123003: Rename both As{Byte,Wide}StringC() helpers to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, fix new usage. Created 4 years, 8 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/fxfa/app/xfa_ffbarcode.cpp ('k') | xfa/fxfa/app/xfa_ffdocview.cpp » ('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 "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/ifwl_app.h" 10 #include "xfa/fwl/core/ifwl_app.h"
(...skipping 26 matching lines...) Expand all
37 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); 37 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
38 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); 38 m_pNormalWidget->SetPrivateData(pWidget, this, NULL);
39 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 39 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
40 pNoteDriver->RegisterEventTarget(pWidget, pWidget); 40 pNoteDriver->RegisterEventTarget(pWidget, pWidget);
41 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 41 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
42 m_pNormalWidget->LockUpdate(); 42 m_pNormalWidget->LockUpdate();
43 CFX_WideStringArray wsLabelArray; 43 CFX_WideStringArray wsLabelArray;
44 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); 44 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE);
45 int32_t iItems = wsLabelArray.GetSize(); 45 int32_t iItems = wsLabelArray.GetSize();
46 for (int32_t i = 0; i < iItems; i++) { 46 for (int32_t i = 0; i < iItems; i++) {
47 pListBox->AddString(wsLabelArray[i].AsWideStringC()); 47 pListBox->AddString(wsLabelArray[i].AsStringC());
48 } 48 }
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();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 void CXFA_FFListBox::SetItemState(int32_t nIndex, FX_BOOL bSelected) { 160 void CXFA_FFListBox::SetItemState(int32_t nIndex, FX_BOOL bSelected) {
161 FWL_HLISTITEM item = ((CFWL_ListBox*)m_pNormalWidget)->GetSelItem(nIndex); 161 FWL_HLISTITEM item = ((CFWL_ListBox*)m_pNormalWidget)->GetSelItem(nIndex);
162 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(item, bSelected); 162 ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(item, bSelected);
163 m_pNormalWidget->Update(); 163 m_pNormalWidget->Update();
164 AddInvalidateRect(); 164 AddInvalidateRect();
165 } 165 }
166 void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel, 166 void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel,
167 int32_t nIndex) { 167 int32_t nIndex) {
168 CFX_WideString wsTemp(wsLabel); 168 CFX_WideString wsTemp(wsLabel);
169 ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp.AsWideStringC()); 169 ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp.AsStringC());
170 m_pNormalWidget->Update(); 170 m_pNormalWidget->Update();
171 AddInvalidateRect(); 171 AddInvalidateRect();
172 } 172 }
173 void CXFA_FFListBox::DeleteItem(int32_t nIndex) { 173 void CXFA_FFListBox::DeleteItem(int32_t nIndex) {
174 if (nIndex < 0) { 174 if (nIndex < 0) {
175 ((CFWL_ListBox*)m_pNormalWidget)->DeleteAll(); 175 ((CFWL_ListBox*)m_pNormalWidget)->DeleteAll();
176 } else { 176 } else {
177 ((CFWL_ListBox*)m_pNormalWidget) 177 ((CFWL_ListBox*)m_pNormalWidget)
178 ->DeleteString(((CFWL_ListBox*)m_pNormalWidget)->GetItem(nIndex)); 178 ->DeleteString(((CFWL_ListBox*)m_pNormalWidget)->GetItem(nIndex));
179 } 179 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); 233 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
234 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); 234 m_pNormalWidget->SetPrivateData(pWidget, this, NULL);
235 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 235 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
236 pNoteDriver->RegisterEventTarget(pWidget, pWidget); 236 pNoteDriver->RegisterEventTarget(pWidget, pWidget);
237 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 237 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
238 m_pNormalWidget->LockUpdate(); 238 m_pNormalWidget->LockUpdate();
239 CFX_WideStringArray wsLabelArray; 239 CFX_WideStringArray wsLabelArray;
240 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); 240 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE);
241 int32_t iItems = wsLabelArray.GetSize(); 241 int32_t iItems = wsLabelArray.GetSize();
242 for (int32_t i = 0; i < iItems; i++) { 242 for (int32_t i = 0; i < iItems; i++) {
243 pComboBox->AddString(wsLabelArray[i].AsWideStringC()); 243 pComboBox->AddString(wsLabelArray[i].AsStringC());
244 } 244 }
245 CFX_Int32Array iSelArray; 245 CFX_Int32Array iSelArray;
246 m_pDataAcc->GetSelectedItems(iSelArray); 246 m_pDataAcc->GetSelectedItems(iSelArray);
247 int32_t iSelCount = iSelArray.GetSize(); 247 int32_t iSelCount = iSelArray.GetSize();
248 if (iSelCount > 0) { 248 if (iSelCount > 0) {
249 pComboBox->SetCurSel(iSelArray[0]); 249 pComboBox->SetCurSel(iSelArray[0]);
250 } else { 250 } else {
251 CFX_WideString wsText; 251 CFX_WideString wsText;
252 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); 252 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
253 pComboBox->SetEditText(wsText.AsWideStringC()); 253 pComboBox->SetEditText(wsText.AsStringC());
254 } 254 }
255 UpdateWidgetProperty(); 255 UpdateWidgetProperty();
256 m_pNormalWidget->UnlockUpdate(); 256 m_pNormalWidget->UnlockUpdate();
257 return CXFA_FFField::LoadWidget(); 257 return CXFA_FFField::LoadWidget();
258 } 258 }
259 void CXFA_FFComboBox::UpdateWidgetProperty() { 259 void CXFA_FFComboBox::UpdateWidgetProperty() {
260 CFWL_ComboBox* pComboBox = (CFWL_ComboBox*)m_pNormalWidget; 260 CFWL_ComboBox* pComboBox = (CFWL_ComboBox*)m_pNormalWidget;
261 if (!pComboBox) { 261 if (!pComboBox) {
262 return; 262 return;
263 } 263 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 375 }
376 CFX_Int32Array iSelArray; 376 CFX_Int32Array iSelArray;
377 m_pDataAcc->GetSelectedItems(iSelArray); 377 m_pDataAcc->GetSelectedItems(iSelArray);
378 int32_t iSelCount = iSelArray.GetSize(); 378 int32_t iSelCount = iSelArray.GetSize();
379 if (iSelCount > 0) { 379 if (iSelCount > 0) {
380 ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(iSelArray[0]); 380 ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(iSelArray[0]);
381 } else { 381 } else {
382 CFX_WideString wsText; 382 CFX_WideString wsText;
383 ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(-1); 383 ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(-1);
384 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); 384 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
385 ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText.AsWideStringC()); 385 ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText.AsStringC());
386 } 386 }
387 m_pNormalWidget->Update(); 387 m_pNormalWidget->Update();
388 return TRUE; 388 return TRUE;
389 } 389 }
390 FX_BOOL CXFA_FFComboBox::CanUndo() { 390 FX_BOOL CXFA_FFComboBox::CanUndo() {
391 return m_pDataAcc->IsChoiceListAllowTextEntry() && 391 return m_pDataAcc->IsChoiceListAllowTextEntry() &&
392 ((CFWL_ComboBox*)m_pNormalWidget)->EditCanUndo(); 392 ((CFWL_ComboBox*)m_pNormalWidget)->EditCanUndo();
393 } 393 }
394 FX_BOOL CXFA_FFComboBox::CanRedo() { 394 FX_BOOL CXFA_FFComboBox::CanRedo() {
395 return m_pDataAcc->IsChoiceListAllowTextEntry() && 395 return m_pDataAcc->IsChoiceListAllowTextEntry() &&
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 break; 522 break;
523 } 523 }
524 default: {} 524 default: {}
525 } 525 }
526 return m_pOldDelegate->OnProcessEvent(pEvent); 526 return m_pOldDelegate->OnProcessEvent(pEvent);
527 } 527 }
528 FWL_ERR CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, 528 FWL_ERR CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics,
529 const CFX_Matrix* pMatrix) { 529 const CFX_Matrix* pMatrix) {
530 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); 530 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
531 } 531 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffbarcode.cpp ('k') | xfa/fxfa/app/xfa_ffdocview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698