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/fwl/core/ifwl_combobox.h" | 7 #include "xfa/fwl/core/ifwl_combobox.h" |
8 | 8 |
9 #include "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
10 #include "xfa/fde/cfde_txtedtengine.h" | 10 #include "xfa/fde/cfde_txtedtengine.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 int32_t IFWL_ComboBox::GetEditTextLength() const { | 279 int32_t IFWL_ComboBox::GetEditTextLength() const { |
280 if (!m_pEdit) | 280 if (!m_pEdit) |
281 return -1; | 281 return -1; |
282 return m_pEdit->GetTextLength(); | 282 return m_pEdit->GetTextLength(); |
283 } | 283 } |
284 | 284 |
285 FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText, | 285 FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText, |
286 int32_t nStart, | 286 int32_t nStart, |
287 int32_t nCount) const { | 287 int32_t nCount) const { |
288 if (m_pEdit) { | 288 if (m_pEdit) { |
289 return m_pEdit->GetText(wsText, nStart, nCount); | 289 m_pEdit->GetText(wsText, nStart, nCount); |
290 return FWL_Error::Succeeded; | |
290 } else if (m_pListBox) { | 291 } else if (m_pListBox) { |
Tom Sepez
2016/11/10 17:00:25
nit: else after return.
dsinclair
2016/11/10 17:22:39
Will get in a formatting followup.
| |
291 IFWL_ComboBoxDP* pData = | 292 IFWL_ComboBoxDP* pData = |
292 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 293 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
293 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); | 294 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); |
294 m_pListBox->GetItemText(hItem, wsText); | 295 m_pListBox->GetItemText(hItem, wsText); |
295 return FWL_Error::Succeeded; | 296 return FWL_Error::Succeeded; |
296 } | 297 } |
297 return FWL_Error::Indefinite; | 298 return FWL_Error::Indefinite; |
298 } | 299 } |
299 | 300 |
300 FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { | 301 FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { |
(...skipping 12 matching lines...) Expand all Loading... | |
313 | 314 |
314 int32_t IFWL_ComboBox::GetEditLimit() { | 315 int32_t IFWL_ComboBox::GetEditLimit() { |
315 if (!m_pEdit) | 316 if (!m_pEdit) |
316 return -1; | 317 return -1; |
317 return m_pEdit->GetLimit(); | 318 return m_pEdit->GetLimit(); |
318 } | 319 } |
319 | 320 |
320 FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) { | 321 FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) { |
321 if (!m_pEdit) | 322 if (!m_pEdit) |
322 return FWL_Error::Indefinite; | 323 return FWL_Error::Indefinite; |
323 return m_pEdit->SetLimit(nLimit); | 324 m_pEdit->SetLimit(nLimit); |
324 } | 325 return FWL_Error::Succeeded; |
325 | |
326 FWL_Error IFWL_ComboBox::EditDoClipboard(int32_t iCmd) { | |
327 if (!m_pEdit) | |
328 return FWL_Error::Indefinite; | |
329 return m_pEdit->DoClipboard(iCmd); | |
330 } | 326 } |
331 | 327 |
332 bool IFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) { | 328 bool IFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) { |
333 return m_pEdit && m_pEdit->Redo(pRecord); | 329 return m_pEdit && m_pEdit->Redo(pRecord); |
334 } | 330 } |
335 | 331 |
336 bool IFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) { | 332 bool IFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) { |
337 return m_pEdit && m_pEdit->Undo(pRecord); | 333 return m_pEdit && m_pEdit->Undo(pRecord); |
338 } | 334 } |
339 | 335 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
395 | 391 |
396 bool IFWL_ComboBox::EditCut(CFX_WideString& wsCut) { | 392 bool IFWL_ComboBox::EditCut(CFX_WideString& wsCut) { |
397 return m_pEdit->Cut(wsCut); | 393 return m_pEdit->Cut(wsCut); |
398 } | 394 } |
399 | 395 |
400 bool IFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) { | 396 bool IFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) { |
401 return m_pEdit->Paste(wsPaste); | 397 return m_pEdit->Paste(wsPaste); |
402 } | 398 } |
403 | 399 |
404 bool IFWL_ComboBox::EditSelectAll() { | 400 bool IFWL_ComboBox::EditSelectAll() { |
405 return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded; | 401 m_pEdit->AddSelRange(0); |
402 return true; | |
npm
2016/11/09 23:41:26
Nit: make these three void as well.
dsinclair
2016/11/10 01:15:29
Will do that when I do the rest of the ifwl_combob
| |
406 } | 403 } |
407 | 404 |
408 bool IFWL_ComboBox::EditDelete() { | 405 bool IFWL_ComboBox::EditDelete() { |
409 return m_pEdit->ClearText() == FWL_Error::Succeeded; | 406 m_pEdit->ClearText(); |
407 return true; | |
410 } | 408 } |
411 | 409 |
412 bool IFWL_ComboBox::EditDeSelect() { | 410 bool IFWL_ComboBox::EditDeSelect() { |
413 return m_pEdit->ClearSelections() == FWL_Error::Succeeded; | 411 m_pEdit->ClearSelections(); |
412 return true; | |
414 } | 413 } |
415 | 414 |
416 FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) { | 415 FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) { |
417 if (m_pWidgetMgr->IsFormDisabled()) { | 416 if (m_pWidgetMgr->IsFormDisabled()) { |
418 return DisForm_GetBBox(rect); | 417 return DisForm_GetBBox(rect); |
419 } | 418 } |
420 rect = m_pProperties->m_rtWidget; | 419 rect = m_pProperties->m_rtWidget; |
421 if (m_pListBox && IsDropListShowed()) { | 420 if (m_pListBox && IsDropListShowed()) { |
422 CFX_RectF rtList; | 421 CFX_RectF rtList; |
423 m_pListBox->GetWidgetRect(rtList); | 422 m_pListBox->GetWidgetRect(rtList); |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1252 else | 1251 else |
1253 iCurSel++; | 1252 iCurSel++; |
1254 } | 1253 } |
1255 m_iCurSel = iCurSel; | 1254 m_iCurSel = iCurSel; |
1256 SynchrEditText(m_iCurSel); | 1255 SynchrEditText(m_iCurSel); |
1257 return; | 1256 return; |
1258 } | 1257 } |
1259 if (m_pEdit) | 1258 if (m_pEdit) |
1260 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); | 1259 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); |
1261 } | 1260 } |
OLD | NEW |