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_fftextedit.h" | 7 #include "xfa/fxfa/app/xfa_fftextedit.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 FX_BOOL CXFA_FFTextEdit::LoadWidget() { | 39 FX_BOOL CXFA_FFTextEdit::LoadWidget() { |
40 CFWL_Edit* pFWLEdit = new CFWL_Edit(GetFWLApp()); | 40 CFWL_Edit* pFWLEdit = new CFWL_Edit(GetFWLApp()); |
41 pFWLEdit->Initialize(); | 41 pFWLEdit->Initialize(); |
42 m_pNormalWidget = pFWLEdit; | 42 m_pNormalWidget = pFWLEdit; |
43 m_pNormalWidget->SetLayoutItem(this); | 43 m_pNormalWidget->SetLayoutItem(this); |
44 | 44 |
45 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 45 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
46 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); | 46 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); |
47 pNoteDriver->RegisterEventTarget(pWidget, pWidget); | 47 pNoteDriver->RegisterEventTarget(pWidget, pWidget); |
48 | 48 |
49 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate(); | 49 m_pOldDelegate = m_pNormalWidget->GetDelegate(); |
50 m_pNormalWidget->SetCurrentDelegate(this); | 50 m_pNormalWidget->SetDelegate(this); |
51 m_pNormalWidget->LockUpdate(); | 51 m_pNormalWidget->LockUpdate(); |
52 | 52 |
53 UpdateWidgetProperty(); | 53 UpdateWidgetProperty(); |
54 CFX_WideString wsText; | 54 CFX_WideString wsText; |
55 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); | 55 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); |
56 pFWLEdit->SetText(wsText); | 56 pFWLEdit->SetText(wsText); |
57 m_pNormalWidget->UnlockUpdate(); | 57 m_pNormalWidget->UnlockUpdate(); |
58 return CXFA_FFField::LoadWidget(); | 58 return CXFA_FFField::LoadWidget(); |
59 } | 59 } |
60 void CXFA_FFTextEdit::UpdateWidgetProperty() { | 60 void CXFA_FFTextEdit::UpdateWidgetProperty() { |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 FX_BOOL CXFA_FFNumericEdit::LoadWidget() { | 444 FX_BOOL CXFA_FFNumericEdit::LoadWidget() { |
445 CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp()); | 445 CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp()); |
446 pWidget->Initialize(); | 446 pWidget->Initialize(); |
447 m_pNormalWidget = pWidget; | 447 m_pNormalWidget = pWidget; |
448 | 448 |
449 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); | 449 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); |
450 m_pNormalWidget->SetLayoutItem(this); | 450 m_pNormalWidget->SetLayoutItem(this); |
451 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); | 451 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); |
452 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); | 452 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); |
453 | 453 |
454 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate(); | 454 m_pOldDelegate = m_pNormalWidget->GetDelegate(); |
455 m_pNormalWidget->SetCurrentDelegate(this); | 455 m_pNormalWidget->SetDelegate(this); |
456 m_pNormalWidget->LockUpdate(); | 456 m_pNormalWidget->LockUpdate(); |
457 | 457 |
458 CFX_WideString wsText; | 458 CFX_WideString wsText; |
459 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); | 459 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); |
460 pWidget->SetText(wsText); | 460 pWidget->SetText(wsText); |
461 UpdateWidgetProperty(); | 461 UpdateWidgetProperty(); |
462 m_pNormalWidget->UnlockUpdate(); | 462 m_pNormalWidget->UnlockUpdate(); |
463 return CXFA_FFField::LoadWidget(); | 463 return CXFA_FFField::LoadWidget(); |
464 } | 464 } |
465 void CXFA_FFNumericEdit::UpdateWidgetProperty() { | 465 void CXFA_FFNumericEdit::UpdateWidgetProperty() { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 FX_BOOL CXFA_FFPasswordEdit::LoadWidget() { | 524 FX_BOOL CXFA_FFPasswordEdit::LoadWidget() { |
525 CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp()); | 525 CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp()); |
526 pWidget->Initialize(); | 526 pWidget->Initialize(); |
527 m_pNormalWidget = pWidget; | 527 m_pNormalWidget = pWidget; |
528 m_pNormalWidget->SetLayoutItem(this); | 528 m_pNormalWidget->SetLayoutItem(this); |
529 | 529 |
530 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); | 530 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); |
531 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); | 531 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); |
532 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); | 532 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); |
533 | 533 |
534 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate(); | 534 m_pOldDelegate = m_pNormalWidget->GetDelegate(); |
535 m_pNormalWidget->SetCurrentDelegate(this); | 535 m_pNormalWidget->SetDelegate(this); |
536 m_pNormalWidget->LockUpdate(); | 536 m_pNormalWidget->LockUpdate(); |
537 | 537 |
538 CFX_WideString wsText; | 538 CFX_WideString wsText; |
539 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); | 539 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); |
540 pWidget->SetText(wsText); | 540 pWidget->SetText(wsText); |
541 UpdateWidgetProperty(); | 541 UpdateWidgetProperty(); |
542 m_pNormalWidget->UnlockUpdate(); | 542 m_pNormalWidget->UnlockUpdate(); |
543 return CXFA_FFField::LoadWidget(); | 543 return CXFA_FFField::LoadWidget(); |
544 } | 544 } |
545 void CXFA_FFPasswordEdit::UpdateWidgetProperty() { | 545 void CXFA_FFPasswordEdit::UpdateWidgetProperty() { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 } | 593 } |
594 FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() { | 594 FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() { |
595 CFWL_DateTimePicker* pWidget = new CFWL_DateTimePicker(GetFWLApp()); | 595 CFWL_DateTimePicker* pWidget = new CFWL_DateTimePicker(GetFWLApp()); |
596 pWidget->Initialize(); | 596 pWidget->Initialize(); |
597 m_pNormalWidget = pWidget; | 597 m_pNormalWidget = pWidget; |
598 m_pNormalWidget->SetLayoutItem(this); | 598 m_pNormalWidget->SetLayoutItem(this); |
599 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); | 599 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); |
600 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); | 600 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); |
601 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); | 601 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); |
602 | 602 |
603 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate(); | 603 m_pOldDelegate = m_pNormalWidget->GetDelegate(); |
604 m_pNormalWidget->SetCurrentDelegate(this); | 604 m_pNormalWidget->SetDelegate(this); |
605 m_pNormalWidget->LockUpdate(); | 605 m_pNormalWidget->LockUpdate(); |
606 | 606 |
607 CFX_WideString wsText; | 607 CFX_WideString wsText; |
608 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); | 608 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); |
609 pWidget->SetEditText(wsText); | 609 pWidget->SetEditText(wsText); |
610 if (CXFA_Value value = m_pDataAcc->GetFormValue()) { | 610 if (CXFA_Value value = m_pDataAcc->GetFormValue()) { |
611 switch (value.GetChildValueClassID()) { | 611 switch (value.GetChildValueClassID()) { |
612 case XFA_Element::Date: { | 612 case XFA_Element::Date: { |
613 if (!wsText.IsEmpty()) { | 613 if (!wsText.IsEmpty()) { |
614 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); | 614 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 | 801 |
802 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { | 802 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { |
803 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { | 803 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { |
804 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; | 804 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; |
805 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, | 805 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, |
806 event->iDay); | 806 event->iDay); |
807 return; | 807 return; |
808 } | 808 } |
809 CXFA_FFTextEdit::OnProcessEvent(pEvent); | 809 CXFA_FFTextEdit::OnProcessEvent(pEvent); |
810 } | 810 } |
OLD | NEW |