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

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

Issue 2459423003: Rename IFWL_Widget::SetDelegate (Closed)
Patch Set: Review feedback 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/fxfa/app/xfa_ffpushbutton.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_fftextedit.h" 7 #include "xfa/fxfa/app/xfa_fftextedit.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 27 matching lines...) Expand all
38 38
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 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 48
49 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
50 m_pNormalWidget->SetCurrentDelegate(this);
49 m_pNormalWidget->LockUpdate(); 51 m_pNormalWidget->LockUpdate();
52
50 UpdateWidgetProperty(); 53 UpdateWidgetProperty();
51 CFX_WideString wsText; 54 CFX_WideString wsText;
52 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 55 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
53 pFWLEdit->SetText(wsText); 56 pFWLEdit->SetText(wsText);
54 m_pNormalWidget->UnlockUpdate(); 57 m_pNormalWidget->UnlockUpdate();
55 return CXFA_FFField::LoadWidget(); 58 return CXFA_FFField::LoadWidget();
56 } 59 }
57 void CXFA_FFTextEdit::UpdateWidgetProperty() { 60 void CXFA_FFTextEdit::UpdateWidgetProperty() {
58 CFWL_Edit* pWidget = (CFWL_Edit*)m_pNormalWidget; 61 CFWL_Edit* pWidget = (CFWL_Edit*)m_pNormalWidget;
59 if (!pWidget) { 62 if (!pWidget) {
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {} 443 CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {}
441 FX_BOOL CXFA_FFNumericEdit::LoadWidget() { 444 FX_BOOL CXFA_FFNumericEdit::LoadWidget() {
442 CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp()); 445 CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp());
443 pWidget->Initialize(); 446 pWidget->Initialize();
444 m_pNormalWidget = pWidget; 447 m_pNormalWidget = pWidget;
445 448
446 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 449 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
447 m_pNormalWidget->SetLayoutItem(this); 450 m_pNormalWidget->SetLayoutItem(this);
448 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); 451 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
449 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); 452 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
450 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 453
454 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
455 m_pNormalWidget->SetCurrentDelegate(this);
451 m_pNormalWidget->LockUpdate(); 456 m_pNormalWidget->LockUpdate();
457
452 CFX_WideString wsText; 458 CFX_WideString wsText;
453 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 459 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
454 pWidget->SetText(wsText); 460 pWidget->SetText(wsText);
455 UpdateWidgetProperty(); 461 UpdateWidgetProperty();
456 m_pNormalWidget->UnlockUpdate(); 462 m_pNormalWidget->UnlockUpdate();
457 return CXFA_FFField::LoadWidget(); 463 return CXFA_FFField::LoadWidget();
458 } 464 }
459 void CXFA_FFNumericEdit::UpdateWidgetProperty() { 465 void CXFA_FFNumericEdit::UpdateWidgetProperty() {
460 CFWL_Edit* pWidget = (CFWL_Edit*)m_pNormalWidget; 466 CFWL_Edit* pWidget = (CFWL_Edit*)m_pNormalWidget;
461 if (!pWidget) { 467 if (!pWidget) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 523
518 FX_BOOL CXFA_FFPasswordEdit::LoadWidget() { 524 FX_BOOL CXFA_FFPasswordEdit::LoadWidget() {
519 CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp()); 525 CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp());
520 pWidget->Initialize(); 526 pWidget->Initialize();
521 m_pNormalWidget = pWidget; 527 m_pNormalWidget = pWidget;
522 m_pNormalWidget->SetLayoutItem(this); 528 m_pNormalWidget->SetLayoutItem(this);
523 529
524 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 530 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
525 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); 531 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
526 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); 532 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
527 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 533
534 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
535 m_pNormalWidget->SetCurrentDelegate(this);
528 m_pNormalWidget->LockUpdate(); 536 m_pNormalWidget->LockUpdate();
537
529 CFX_WideString wsText; 538 CFX_WideString wsText;
530 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 539 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
531 pWidget->SetText(wsText); 540 pWidget->SetText(wsText);
532 UpdateWidgetProperty(); 541 UpdateWidgetProperty();
533 m_pNormalWidget->UnlockUpdate(); 542 m_pNormalWidget->UnlockUpdate();
534 return CXFA_FFField::LoadWidget(); 543 return CXFA_FFField::LoadWidget();
535 } 544 }
536 void CXFA_FFPasswordEdit::UpdateWidgetProperty() { 545 void CXFA_FFPasswordEdit::UpdateWidgetProperty() {
537 CFWL_Edit* pWidget = (CFWL_Edit*)m_pNormalWidget; 546 CFWL_Edit* pWidget = (CFWL_Edit*)m_pNormalWidget;
538 if (!pWidget) { 547 if (!pWidget) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 return FALSE; 592 return FALSE;
584 } 593 }
585 FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() { 594 FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() {
586 CFWL_DateTimePicker* pWidget = new CFWL_DateTimePicker(GetFWLApp()); 595 CFWL_DateTimePicker* pWidget = new CFWL_DateTimePicker(GetFWLApp());
587 pWidget->Initialize(); 596 pWidget->Initialize();
588 m_pNormalWidget = pWidget; 597 m_pNormalWidget = pWidget;
589 m_pNormalWidget->SetLayoutItem(this); 598 m_pNormalWidget->SetLayoutItem(this);
590 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 599 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
591 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); 600 CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
592 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); 601 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
593 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 602
603 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
604 m_pNormalWidget->SetCurrentDelegate(this);
594 m_pNormalWidget->LockUpdate(); 605 m_pNormalWidget->LockUpdate();
606
595 CFX_WideString wsText; 607 CFX_WideString wsText;
596 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 608 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
597 pWidget->SetEditText(wsText); 609 pWidget->SetEditText(wsText);
598 if (CXFA_Value value = m_pDataAcc->GetFormValue()) { 610 if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
599 switch (value.GetChildValueClassID()) { 611 switch (value.GetChildValueClassID()) {
600 case XFA_Element::Date: { 612 case XFA_Element::Date: {
601 if (!wsText.IsEmpty()) { 613 if (!wsText.IsEmpty()) {
602 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); 614 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
603 CFX_Unitime date = lcValue.GetDate(); 615 CFX_Unitime date = lcValue.GetDate();
604 if ((FX_UNITIME)date != 0) { 616 if ((FX_UNITIME)date != 0) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 801
790 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { 802 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) {
791 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { 803 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) {
792 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; 804 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent;
793 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, 805 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth,
794 event->iDay); 806 event->iDay);
795 return; 807 return;
796 } 808 }
797 CXFA_FFTextEdit::OnProcessEvent(pEvent); 809 CXFA_FFTextEdit::OnProcessEvent(pEvent);
798 } 810 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffpushbutton.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698