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

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

Issue 2010923002: Add opaque "layout item" to widgets for caller's use. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Cast to FFWidget. 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/fxfa/app/xfa_ffpushbutton.cpp ('k') | xfa/fxfa/app/xfa_fwladapter.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_fftextedit.h" 7 #include "xfa/fxfa/app/xfa_fftextedit.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 if (m_pNormalWidget) { 31 if (m_pNormalWidget) {
32 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); 32 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
33 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 33 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
34 pNoteDriver->UnregisterEventTarget(pWidget); 34 pNoteDriver->UnregisterEventTarget(pWidget);
35 } 35 }
36 } 36 }
37 FX_BOOL CXFA_FFTextEdit::LoadWidget() { 37 FX_BOOL CXFA_FFTextEdit::LoadWidget() {
38 CFWL_Edit* pFWLEdit = CFWL_Edit::Create(); 38 CFWL_Edit* pFWLEdit = CFWL_Edit::Create();
39 pFWLEdit->Initialize(); 39 pFWLEdit->Initialize();
40 m_pNormalWidget = pFWLEdit; 40 m_pNormalWidget = pFWLEdit;
41 m_pNormalWidget->SetLayoutItem(this);
41 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); 42 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
42 m_pNormalWidget->SetPrivateData(pWidget, this, NULL);
43 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 43 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
44 pNoteDriver->RegisterEventTarget(pWidget, pWidget); 44 pNoteDriver->RegisterEventTarget(pWidget, pWidget);
45 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 45 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
46 m_pNormalWidget->LockUpdate(); 46 m_pNormalWidget->LockUpdate();
47 UpdateWidgetProperty(); 47 UpdateWidgetProperty();
48 CFX_WideString wsText; 48 CFX_WideString wsText;
49 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 49 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
50 pFWLEdit->SetText(wsText); 50 pFWLEdit->SetText(wsText);
51 m_pNormalWidget->UnlockUpdate(); 51 m_pNormalWidget->UnlockUpdate();
52 return CXFA_FFField::LoadWidget(); 52 return CXFA_FFField::LoadWidget();
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_FFPageView* pPageView, 444 CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_FFPageView* pPageView,
445 CXFA_WidgetAcc* pDataAcc) 445 CXFA_WidgetAcc* pDataAcc)
446 : CXFA_FFTextEdit(pPageView, pDataAcc) {} 446 : CXFA_FFTextEdit(pPageView, pDataAcc) {}
447 CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {} 447 CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {}
448 FX_BOOL CXFA_FFNumericEdit::LoadWidget() { 448 FX_BOOL CXFA_FFNumericEdit::LoadWidget() {
449 CFWL_Edit* pWidget = CFWL_Edit::Create(); 449 CFWL_Edit* pWidget = CFWL_Edit::Create();
450 pWidget->Initialize(); 450 pWidget->Initialize();
451 m_pNormalWidget = (CFWL_Widget*)pWidget; 451 m_pNormalWidget = (CFWL_Widget*)pWidget;
452 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 452 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
453 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL); 453 m_pNormalWidget->SetLayoutItem(this);
454 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 454 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
455 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); 455 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
456 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 456 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
457 m_pNormalWidget->LockUpdate(); 457 m_pNormalWidget->LockUpdate();
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();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 m_pDataAcc->GetLocal()); 516 m_pDataAcc->GetLocal());
517 } 517 }
518 CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView, 518 CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView,
519 CXFA_WidgetAcc* pDataAcc) 519 CXFA_WidgetAcc* pDataAcc)
520 : CXFA_FFTextEdit(pPageView, pDataAcc) {} 520 : CXFA_FFTextEdit(pPageView, pDataAcc) {}
521 CXFA_FFPasswordEdit::~CXFA_FFPasswordEdit() {} 521 CXFA_FFPasswordEdit::~CXFA_FFPasswordEdit() {}
522 FX_BOOL CXFA_FFPasswordEdit::LoadWidget() { 522 FX_BOOL CXFA_FFPasswordEdit::LoadWidget() {
523 CFWL_Edit* pWidget = CFWL_Edit::Create(); 523 CFWL_Edit* pWidget = CFWL_Edit::Create();
524 pWidget->Initialize(); 524 pWidget->Initialize();
525 m_pNormalWidget = (CFWL_Widget*)pWidget; 525 m_pNormalWidget = (CFWL_Widget*)pWidget;
526 m_pNormalWidget->SetLayoutItem(this);
526 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 527 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
527 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL);
528 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 528 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
529 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); 529 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
530 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 530 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
531 m_pNormalWidget->LockUpdate(); 531 m_pNormalWidget->LockUpdate();
532 CFX_WideString wsText; 532 CFX_WideString wsText;
533 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 533 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
534 pWidget->SetText(wsText); 534 pWidget->SetText(wsText);
535 UpdateWidgetProperty(); 535 UpdateWidgetProperty();
536 m_pNormalWidget->UnlockUpdate(); 536 m_pNormalWidget->UnlockUpdate();
537 return CXFA_FFField::LoadWidget(); 537 return CXFA_FFField::LoadWidget();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 ((CFWL_DateTimePicker*)m_pNormalWidget)->GetBBox(rtWidget); 582 ((CFWL_DateTimePicker*)m_pNormalWidget)->GetBBox(rtWidget);
583 if (rtWidget.Contains(fx, fy)) { 583 if (rtWidget.Contains(fx, fy)) {
584 return TRUE; 584 return TRUE;
585 } 585 }
586 return FALSE; 586 return FALSE;
587 } 587 }
588 FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() { 588 FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() {
589 CFWL_DateTimePicker* pWidget = CFWL_DateTimePicker::Create(); 589 CFWL_DateTimePicker* pWidget = CFWL_DateTimePicker::Create();
590 pWidget->Initialize(); 590 pWidget->Initialize();
591 m_pNormalWidget = (CFWL_Widget*)pWidget; 591 m_pNormalWidget = (CFWL_Widget*)pWidget;
592 m_pNormalWidget->SetLayoutItem(this);
592 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 593 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
593 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL);
594 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 594 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
595 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); 595 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
596 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 596 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
597 m_pNormalWidget->LockUpdate(); 597 m_pNormalWidget->LockUpdate();
598 CFX_WideString wsText; 598 CFX_WideString wsText;
599 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 599 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
600 pWidget->SetEditText(wsText); 600 pWidget->SetEditText(wsText);
601 if (CXFA_Value value = m_pDataAcc->GetFormValue()) { 601 if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
602 switch (value.GetChildValueClassID()) { 602 switch (value.GetChildValueClassID()) {
603 case XFA_ELEMENT_Date: { 603 case XFA_ELEMENT_Date: {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 792
793 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { 793 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) {
794 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { 794 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) {
795 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; 795 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent;
796 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, 796 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth,
797 event->iDay); 797 event->iDay);
798 return; 798 return;
799 } 799 }
800 CXFA_FFTextEdit::OnProcessEvent(pEvent); 800 CXFA_FFTextEdit::OnProcessEvent(pEvent);
801 } 801 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffpushbutton.cpp ('k') | xfa/fxfa/app/xfa_fwladapter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698