bool CXFA_FFComboBox::LoadWidget() { CFWL_ComboBox* pComboBox = new CFWL_ComboBox(GetFWLApp()); pComboBox->Initialize(); m_pNormalWidget = (CFWL_Widget*)pComboBox; m_pNormalWidget->SetLayoutItem(this); IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(pWidget, pWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); CFX_WideStringArray wsLabelArray; m_pDataAcc->GetChoiceListItems(wsLabelArray, false); int32_t iItems = wsLabelArray.GetSize(); for (int32_t i = 0; i < iItems; i++) { pComboBox->AddString(wsLabelArray[i].AsStringC()); } CFX_Int32Array iSelArray; m_pDataAcc->GetSelectedItems(iSelArray); int32_t iSelCount = iSelArray.GetSize(); if (iSelCount > 0) { pComboBox->SetCurSel(iSelArray[0]); } else { CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); pComboBox->SetEditText(wsText); } UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }
bool CXFA_FFDateTimeEdit::LoadWidget() { CFWL_DateTimePicker* pWidget = new CFWL_DateTimePicker(GetFWLApp()); pWidget->Initialize(); m_pNormalWidget = pWidget; m_pNormalWidget->SetLayoutItem(this); IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); pWidget->SetEditText(wsText); if (CXFA_Value value = m_pDataAcc->GetFormValue()) { switch (value.GetChildValueClassID()) { case XFA_Element::Date: { if (!wsText.IsEmpty()) { CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); CFX_Unitime date = lcValue.GetDate(); if ((FX_UNITIME)date != 0) { pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay()); } } } break; default: break; } } UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }
bool CXFA_FFPushButton::LoadWidget() { ASSERT(!m_pNormalWidget); CFWL_PushButton* pPushButton = new CFWL_PushButton(GetFWLApp()); m_pOldDelegate = pPushButton->GetDelegate(); pPushButton->SetDelegate(this); m_pNormalWidget = pPushButton; m_pNormalWidget->SetLayoutItem(this); CFWL_NoteDriver* pNoteDriver = m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pNormalWidget->LockUpdate(); UpdateWidgetProperty(); LoadHighlightCaption(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }
bool CXFA_FFTextEdit::LoadWidget() { auto pNewWidget = pdfium::MakeUnique<CFWL_Edit>( GetFWLApp(), pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr); CFWL_Edit* pFWLEdit = pNewWidget.get(); m_pNormalWidget = std::move(pNewWidget); m_pNormalWidget->SetLayoutItem(this); CFWL_NoteDriver* pNoteDriver = m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(), m_pNormalWidget.get()); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); UpdateWidgetProperty(); pFWLEdit->SetText(m_pNode->GetValue(XFA_VALUEPICTURE_Display)); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }
bool CXFA_FFBarcode::LoadWidget() { CFWL_Barcode* pFWLBarcode = new CFWL_Barcode(GetFWLApp()); m_pNormalWidget = pFWLBarcode; m_pNormalWidget->SetLayoutItem(this); CFWL_NoteDriver* pNoteDriver = m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); pFWLBarcode->SetText(wsText); UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }
bool CXFA_FFPasswordEdit::LoadWidget() { CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp()); pWidget->Initialize(); m_pNormalWidget = pWidget; m_pNormalWidget->SetLayoutItem(this); IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); pWidget->SetText(wsText); UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }
bool CXFA_FFCheckButton::LoadWidget() { auto pNew = pdfium::MakeUnique<CFWL_CheckBox>(GetFWLApp()); CFWL_CheckBox* pCheckBox = pNew.get(); m_pNormalWidget = std::move(pNew); m_pNormalWidget->SetLayoutItem(this); CFWL_NoteDriver* pNoteDriver = m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(), m_pNormalWidget.get()); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); if (m_pNode->IsRadioButton()) pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF); m_pNormalWidget->LockUpdate(); UpdateWidgetProperty(); SetFWLCheckState(m_pNode->GetCheckState()); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }
bool CXFA_FFCheckButton::LoadWidget() { CFWL_CheckBox* pCheckBox = new CFWL_CheckBox(GetFWLApp()); pCheckBox->Initialize(); m_pNormalWidget = pCheckBox; m_pNormalWidget->SetLayoutItem(this); IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(pWidget, pWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); if (m_pDataAcc->IsRadioButton()) pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF); m_pNormalWidget->LockUpdate(); UpdateWidgetProperty(); SetFWLCheckState(m_pDataAcc->GetCheckState()); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }
bool CXFA_FFListBox::LoadWidget() { CFWL_ListBox* pListBox = new CFWL_ListBox(GetFWLApp()); pListBox->Initialize(); pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground, 0xFFFFFFFF); m_pNormalWidget = (CFWL_Widget*)pListBox; m_pNormalWidget->SetLayoutItem(this); IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(pWidget, pWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); CFX_WideStringArray wsLabelArray; m_pDataAcc->GetChoiceListItems(wsLabelArray, false); int32_t iItems = wsLabelArray.GetSize(); for (int32_t i = 0; i < iItems; i++) { pListBox->AddString(wsLabelArray[i].AsStringC()); } uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection; } dwExtendedStyle |= GetAlignment(); m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); CFX_Int32Array iSelArray; m_pDataAcc->GetSelectedItems(iSelArray); int32_t iSelCount = iSelArray.GetSize(); for (int32_t j = 0; j < iSelCount; j++) { CFWL_ListItem* item = pListBox->GetItem(iSelArray[j]); pListBox->SetSelItem(item, true); } m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }