summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa/fwl/core/cfwl_widget.cpp12
-rw-r--r--xfa/fwl/core/cfwl_widget.h4
-rw-r--r--xfa/fwl/core/cfwl_widgetmgr.cpp13
-rw-r--r--xfa/fwl/core/fwl_noteimp.cpp17
-rw-r--r--xfa/fwl/core/ifwl_combobox.cpp25
-rw-r--r--xfa/fwl/core/ifwl_combolist.cpp6
-rw-r--r--xfa/fwl/core/ifwl_datetimecalendar.cpp3
-rw-r--r--xfa/fwl/core/ifwl_datetimeedit.cpp3
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.cpp13
-rw-r--r--xfa/fwl/core/ifwl_form.cpp7
-rw-r--r--xfa/fwl/core/ifwl_formproxy.cpp3
-rw-r--r--xfa/fwl/core/ifwl_listbox.cpp8
-rw-r--r--xfa/fwl/core/ifwl_widget.cpp22
-rw-r--r--xfa/fwl/core/ifwl_widget.h4
-rw-r--r--xfa/fxfa/app/xfa_ffbarcode.cpp5
-rw-r--r--xfa/fxfa/app/xfa_ffcheckbutton.cpp9
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.cpp10
-rw-r--r--xfa/fxfa/app/xfa_ffimageedit.cpp5
-rw-r--r--xfa/fxfa/app/xfa_ffpushbutton.cpp4
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp20
20 files changed, 97 insertions, 96 deletions
diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp
index 9aeb127e9e..d277f26a76 100644
--- a/xfa/fwl/core/cfwl_widget.cpp
+++ b/xfa/fwl/core/cfwl_widget.cpp
@@ -20,7 +20,6 @@
CFWL_Widget::CFWL_Widget(const IFWL_App* app)
: m_pApp(app),
- m_pDelegate(nullptr),
m_pWidgetMgr(app->GetWidgetMgr()),
m_pProperties(new CFWL_WidgetProperties) {
ASSERT(m_pWidgetMgr);
@@ -131,10 +130,11 @@ FWL_Error CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics,
return m_pIface->DrawWidget(pGraphics, pMatrix);
}
-IFWL_WidgetDelegate* CFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
- if (!m_pIface)
- return nullptr;
+IFWL_WidgetDelegate* CFWL_Widget::GetCurrentDelegate() {
+ return m_pIface ? m_pIface->GetCurrentDelegate() : nullptr;
+}
- m_pDelegate = m_pIface->SetDelegate(pDelegate);
- return m_pDelegate;
+void CFWL_Widget::SetCurrentDelegate(IFWL_WidgetDelegate* pDelegate) {
+ if (m_pIface)
+ m_pIface->SetCurrentDelegate(pDelegate);
}
diff --git a/xfa/fwl/core/cfwl_widget.h b/xfa/fwl/core/cfwl_widget.h
index 64e6dc66fa..28a76661ef 100644
--- a/xfa/fwl/core/cfwl_widget.h
+++ b/xfa/fwl/core/cfwl_widget.h
@@ -51,14 +51,14 @@ class CFWL_Widget {
FWL_Error DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr);
- IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
+ IFWL_WidgetDelegate* GetCurrentDelegate();
+ void SetCurrentDelegate(IFWL_WidgetDelegate*);
protected:
void Initialize();
const IFWL_App* m_pApp;
std::unique_ptr<IFWL_Widget> m_pIface;
- IFWL_WidgetDelegate* m_pDelegate;
CFWL_WidgetMgr* const m_pWidgetMgr;
std::unique_ptr<CFWL_WidgetProperties> m_pProperties;
};
diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp
index bcbc394884..1008defcab 100644
--- a/xfa/fwl/core/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/core/cfwl_widgetmgr.cpp
@@ -613,21 +613,18 @@ void CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget,
#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ || \
_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_
- IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(nullptr);
- pDelegate->OnDrawWidget(pTemp, pMatrix);
+ pWidget->GetCurrentDelegate()->OnDrawWidget(pTemp, pMatrix);
pGraphics->GetClipRect(clipBounds);
clipCopy = clipBounds;
#elif _FX_OS_ == _FX_MACOSX_
if (m_pWidgetMgr->IsFormDisabled()) {
- IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(nullptr);
- pDelegate->OnDrawWidget(pTemp, pMatrix);
+ pWidget->GetCurrentDelegate()->OnDrawWidget(pTemp, pMatrix);
pGraphics->GetClipRect(clipBounds);
clipCopy = clipBounds;
} else {
clipBounds.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d);
const_cast<CFX_Matrix*>(pMatrix)->SetIdentity(); // FIXME: const cast.
- IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(nullptr);
- pDelegate->OnDrawWidget(pTemp, pMatrix);
+ pWidget->GetCurrentDelegate()->OnDrawWidget(pTemp, pMatrix);
}
#endif // _FX_OS_ == _FX_MACOSX_
@@ -680,8 +677,8 @@ void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent,
pGraphics->SetClipRect(clipBounds);
}
widgetMatrix.Translate(rtWidget.left, rtWidget.top, TRUE);
- IFWL_WidgetDelegate* pDelegate = child->SetDelegate(nullptr);
- if (pDelegate) {
+
+ if (IFWL_WidgetDelegate* pDelegate = child->GetCurrentDelegate()) {
if (m_pWidgetMgr->IsFormDisabled() ||
IsNeedRepaint(child, &widgetMatrix, rtClip)) {
pDelegate->OnDrawWidget(pGraphics, &widgetMatrix);
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index 318fd9f6fc..22579571d4 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -144,10 +144,8 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) {
if (bNotify) {
ms.m_dwExtend = 1;
}
- IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(nullptr);
- if (pDelegate) {
+ if (IFWL_WidgetDelegate* pDelegate = pPrev->GetCurrentDelegate())
pDelegate->OnProcessMessage(&ms);
- }
}
if (pFocus) {
IFWL_Widget* pWidget =
@@ -161,10 +159,9 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) {
if (bNotify) {
ms.m_dwExtend = 1;
}
- IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(nullptr);
- if (pDelegate) {
+
+ if (IFWL_WidgetDelegate* pDelegate = pFocus->GetCurrentDelegate())
pDelegate->OnProcessMessage(&ms);
- }
}
return TRUE;
}
@@ -363,10 +360,10 @@ FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage,
}
}
if (bRet) {
- IFWL_WidgetDelegate* pDelegate =
- pMessage->m_pDstTarget->SetDelegate(nullptr);
- if (pDelegate)
+ if (IFWL_WidgetDelegate* pDelegate =
+ pMessage->m_pDstTarget->GetCurrentDelegate()) {
pDelegate->OnProcessMessage(pMessage);
+ }
}
return bRet;
}
@@ -710,7 +707,7 @@ int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource,
}
FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) {
- IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(nullptr);
+ IFWL_WidgetDelegate* pDelegate = m_pListener->GetCurrentDelegate();
if (!pDelegate)
return FALSE;
if (m_eventSources.GetCount() == 0) {
diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp
index dcd2cf850e..123dc9bea9 100644
--- a/xfa/fwl/core/ifwl_combobox.cpp
+++ b/xfa/fwl/core/ifwl_combobox.cpp
@@ -718,7 +718,7 @@ void IFWL_ComboBox::InitProxyForm() {
m_pForm->Initialize();
m_pListBox->SetParent(m_pForm);
m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this);
- m_pForm->SetDelegate(m_pListProxyDelegate);
+ m_pForm->SetCurrentDelegate(m_pListProxyDelegate);
}
void IFWL_ComboBox::DisForm_InitComboList() {
@@ -1158,10 +1158,8 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) {
return;
}
FX_BOOL bDropDown = m_pOwner->IsDropDownStyle();
- if (bDropDown) {
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMsg);
- }
+ if (bDropDown)
+ m_pOwner->m_pEdit->GetCurrentDelegate()->OnProcessMessage(pMsg);
}
void CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage(
@@ -1210,9 +1208,8 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage(
pKey->m_dwKeyCode == FWL_VKEY_Return ||
pKey->m_dwKeyCode == FWL_VKEY_Escape;
if (bListKey) {
- IFWL_WidgetDelegate* pDelegate =
- m_pOwner->m_pListBox->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMessage);
+ m_pOwner->m_pListBox->GetCurrentDelegate()->OnProcessMessage(
+ pMessage);
break;
}
}
@@ -1252,8 +1249,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
CFWL_MsgSetFocus msg;
msg.m_pDstTarget = m_pOwner->m_pEdit.get();
msg.m_pSrcTarget = nullptr;
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(&msg);
+ m_pOwner->m_pEdit->GetCurrentDelegate()->OnProcessMessage(&msg);
}
} else {
m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
@@ -1261,8 +1257,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
CFWL_MsgKillFocus msg;
msg.m_pDstTarget = nullptr;
msg.m_pSrcTarget = m_pOwner->m_pEdit.get();
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(&msg);
+ m_pOwner->m_pEdit->GetCurrentDelegate()->OnProcessMessage(&msg);
}
}
@@ -1305,10 +1300,8 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) {
m_pOwner->SynchrEditText(m_pOwner->m_iCurSel);
return;
}
- if (m_pOwner->m_pEdit) {
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMsg);
- }
+ if (m_pOwner->m_pEdit)
+ m_pOwner->m_pEdit->GetCurrentDelegate()->OnProcessMessage(pMsg);
}
CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate(IFWL_Form* pForm,
diff --git a/xfa/fwl/core/ifwl_combolist.cpp b/xfa/fwl/core/ifwl_combolist.cpp
index 6538bff20d..23392a5c70 100644
--- a/xfa/fwl/core/ifwl_combolist.cpp
+++ b/xfa/fwl/core/ifwl_combolist.cpp
@@ -124,9 +124,8 @@ void CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
pMsg->m_fx -= rect.left;
pMsg->m_fy -= rect.top;
- IFWL_WidgetDelegate* pDelegate =
- m_pOwner->m_pVertScrollBar->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMsg);
+ m_pOwner->m_pVertScrollBar->GetCurrentDelegate()->OnProcessMessage(
+ pMsg);
return;
}
}
@@ -246,7 +245,6 @@ int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) {
case FWL_VKEY_Up:
case FWL_VKEY_Down: {
OnDropListKeyDown(pKey);
- pOuter->SetDelegate(nullptr);
pOuter->ProcessSelChanged(FALSE);
return 1;
}
diff --git a/xfa/fwl/core/ifwl_datetimecalendar.cpp b/xfa/fwl/core/ifwl_datetimecalendar.cpp
index e85bdfb606..ee04bf4978 100644
--- a/xfa/fwl/core/ifwl_datetimecalendar.cpp
+++ b/xfa/fwl/core/ifwl_datetimecalendar.cpp
@@ -42,8 +42,7 @@ void CFWL_DateTimeCalendarImpDelegate::OnProcessMessage(
if (dwCode == CFWL_MessageType::SetFocus ||
dwCode == CFWL_MessageType::KillFocus) {
IFWL_Widget* pOuter = m_pOwner->GetOuter();
- IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMessage);
+ pOuter->GetCurrentDelegate()->OnProcessMessage(pMessage);
return;
}
if (dwCode == CFWL_MessageType::Mouse) {
diff --git a/xfa/fwl/core/ifwl_datetimeedit.cpp b/xfa/fwl/core/ifwl_datetimeedit.cpp
index 9d0a08bed6..6a7fd26214 100644
--- a/xfa/fwl/core/ifwl_datetimeedit.cpp
+++ b/xfa/fwl/core/ifwl_datetimeedit.cpp
@@ -42,8 +42,7 @@ void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
if (dwHashCode == CFWL_MessageType::SetFocus ||
dwHashCode == CFWL_MessageType::KillFocus) {
IFWL_Widget* pOuter = m_pOwner->GetOuter();
- IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMessage);
+ pOuter->GetCurrentDelegate()->OnProcessMessage(pMessage);
}
}
diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp
index 9292a5acfa..148a85cfe6 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.cpp
+++ b/xfa/fwl/core/ifwl_datetimepicker.cpp
@@ -545,8 +545,7 @@ void IFWL_DateTimePicker::DisForm_ShowMonthCalendar(FX_BOOL bActivate) {
CFWL_MsgSetFocus msg;
msg.m_pDstTarget = m_pMonthCal.get();
msg.m_pSrcTarget = m_pEdit.get();
- IFWL_WidgetDelegate* pDelegate = m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(&msg);
+ m_pEdit->GetCurrentDelegate()->OnProcessMessage(&msg);
}
CFX_RectF rtInvalidate, rtCal;
rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width,
@@ -712,9 +711,7 @@ void CFWL_DateTimePickerImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
}
case CFWL_MessageType::Key: {
if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) {
- IFWL_WidgetDelegate* pDelegate =
- m_pOwner->m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMessage);
+ m_pOwner->m_pEdit->GetCurrentDelegate()->OnProcessMessage(pMessage);
return;
}
break;
@@ -817,8 +814,7 @@ void CFWL_DateTimePickerImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
}
rtInvalidate = m_pOwner->m_rtBtn;
pMsg->m_pDstTarget = m_pOwner->m_pEdit.get();
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMsg);
+ m_pOwner->m_pEdit->GetCurrentDelegate()->OnProcessMessage(pMsg);
} else {
m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
m_pOwner->m_rtBtn.Set(0, 0, 0, 0);
@@ -827,8 +823,7 @@ void CFWL_DateTimePickerImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
}
if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) {
pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get();
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMsg);
+ m_pOwner->m_pEdit->GetCurrentDelegate()->OnProcessMessage(pMsg);
}
}
rtInvalidate.Inflate(2, 2);
diff --git a/xfa/fwl/core/ifwl_form.cpp b/xfa/fwl/core/ifwl_form.cpp
index e46328b634..2ded30e6d6 100644
--- a/xfa/fwl/core/ifwl_form.cpp
+++ b/xfa/fwl/core/ifwl_form.cpp
@@ -830,10 +830,11 @@ void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
if (pSubFocus == pDriver->GetFocus()) {
pDriver->SetFocus(nullptr);
} else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) {
- CFWL_MsgKillFocus ms;
- IFWL_WidgetDelegate* pDelegate = pSubFocus->SetDelegate(nullptr);
- if (pDelegate)
+ if (IFWL_WidgetDelegate* pDelegate =
+ pSubFocus->GetCurrentDelegate()) {
+ CFWL_MsgKillFocus ms;
pDelegate->OnProcessMessage(&ms);
+ }
}
}
m_pOwner->Repaint(&m_pOwner->m_rtRelative);
diff --git a/xfa/fwl/core/ifwl_formproxy.cpp b/xfa/fwl/core/ifwl_formproxy.cpp
index 16cd90813d..f79e915378 100644
--- a/xfa/fwl/core/ifwl_formproxy.cpp
+++ b/xfa/fwl/core/ifwl_formproxy.cpp
@@ -50,6 +50,5 @@ CFWL_FormProxyImpDelegate::CFWL_FormProxyImpDelegate(IFWL_FormProxy* pOwner)
: m_pOwner(pOwner) {}
void CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pOuter->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMessage);
+ m_pOwner->m_pOuter->GetCurrentDelegate()->OnProcessMessage(pMessage);
}
diff --git a/xfa/fwl/core/ifwl_listbox.cpp b/xfa/fwl/core/ifwl_listbox.cpp
index 05cc64bb90..7cd4c53ff3 100644
--- a/xfa/fwl/core/ifwl_listbox.cpp
+++ b/xfa/fwl/core/ifwl_listbox.cpp
@@ -1075,12 +1075,8 @@ void CFWL_ListBoxImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
}
void CFWL_ListBoxImpDelegate::OnMouseWheel(CFWL_MsgMouseWheel* pMsg) {
- if (!m_pOwner->IsShowScrollBar(TRUE)) {
- return;
- }
- IFWL_WidgetDelegate* pDelegate =
- m_pOwner->m_pVertScrollBar->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMsg);
+ if (m_pOwner->IsShowScrollBar(TRUE))
+ m_pOwner->m_pVertScrollBar->GetCurrentDelegate()->OnProcessMessage(pMsg);
}
void CFWL_ListBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
diff --git a/xfa/fwl/core/ifwl_widget.cpp b/xfa/fwl/core/ifwl_widget.cpp
index eb8b1281e9..da90c4892d 100644
--- a/xfa/fwl/core/ifwl_widget.cpp
+++ b/xfa/fwl/core/ifwl_widget.cpp
@@ -100,10 +100,9 @@ FWL_Error IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
ev.m_pSrcTarget = this;
ev.m_rtOld = rtOld;
ev.m_rtNew = rect;
- IFWL_WidgetDelegate* pDelegate = SetDelegate(nullptr);
- if (pDelegate) {
+
+ if (IFWL_WidgetDelegate* pDelegate = GetCurrentDelegate())
pDelegate->OnProcessEvent(&ev);
- }
}
return FWL_Error::Succeeded;
}
@@ -353,16 +352,14 @@ FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
return FWL_Error::Succeeded;
}
-IFWL_WidgetDelegate* IFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
- if (!m_pCurDelegate) {
+IFWL_WidgetDelegate* IFWL_Widget::GetCurrentDelegate() {
+ if (!m_pCurDelegate)
m_pCurDelegate = m_pDelegate;
- }
- if (!pDelegate) {
- return m_pCurDelegate;
- }
- IFWL_WidgetDelegate* pOldDelegate = m_pCurDelegate;
+ return m_pCurDelegate;
+}
+
+void IFWL_Widget::SetCurrentDelegate(IFWL_WidgetDelegate* pDelegate) {
m_pCurDelegate = pDelegate;
- return pOldDelegate;
}
const IFWL_App* IFWL_Widget::GetOwnerApp() const {
@@ -727,8 +724,7 @@ void IFWL_Widget::DispatchKeyEvent(CFWL_MsgKey* pNote) {
void IFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
if (m_pOuter) {
- IFWL_WidgetDelegate* pDelegate = m_pOuter->SetDelegate(nullptr);
- pDelegate->OnProcessEvent(pEvent);
+ m_pOuter->GetCurrentDelegate()->OnProcessEvent(pEvent);
return;
}
const IFWL_App* pApp = GetOwnerApp();
diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h
index 38a8d337f6..2b385abc0e 100644
--- a/xfa/fwl/core/ifwl_widget.h
+++ b/xfa/fwl/core/ifwl_widget.h
@@ -113,7 +113,9 @@ class IFWL_Widget {
virtual IFWL_ThemeProvider* GetThemeProvider();
virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
- virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
+
+ IFWL_WidgetDelegate* GetCurrentDelegate();
+ void SetCurrentDelegate(IFWL_WidgetDelegate* pDelegate);
const IFWL_App* GetOwnerApp() const;
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp
index efe9912f02..cd172c5a4d 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -131,8 +131,11 @@ FX_BOOL CXFA_FFBarcode::LoadWidget() {
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
- m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
+
+ m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
+ m_pNormalWidget->SetCurrentDelegate(this);
m_pNormalWidget->LockUpdate();
+
CFX_WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
pFWLBarcode->SetText(wsText);
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index 829900fa22..9dfb12fa78 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -35,10 +35,13 @@ FX_BOOL CXFA_FFCheckButton::LoadWidget() {
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
- m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
- if (m_pDataAcc->IsRadioButton()) {
+
+ m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
+ m_pNormalWidget->SetCurrentDelegate(this);
+
+ if (m_pDataAcc->IsRadioButton())
pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF);
- }
+
m_pNormalWidget->LockUpdate();
UpdateWidgetProperty();
SetFWLCheckState(m_pDataAcc->GetCheckState());
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
index 0c6c22c815..06bbc38eb9 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -42,8 +42,11 @@ FX_BOOL CXFA_FFListBox::LoadWidget() {
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
- m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
+
+ m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
+ m_pNormalWidget->SetCurrentDelegate(this);
m_pNormalWidget->LockUpdate();
+
CFX_WideStringArray wsLabelArray;
m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE);
int32_t iItems = wsLabelArray.GetSize();
@@ -238,8 +241,11 @@ FX_BOOL CXFA_FFComboBox::LoadWidget() {
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
- m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
+
+ m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
+ m_pNormalWidget->SetCurrentDelegate(this);
m_pNormalWidget->LockUpdate();
+
CFX_WideStringArray wsLabelArray;
m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE);
int32_t iItems = wsLabelArray.GetSize();
diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp
index 9624ee2fbb..9e29119671 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -31,7 +31,10 @@ FX_BOOL CXFA_FFImageEdit::LoadWidget() {
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
- m_pOldDelegate = pPictureBox->SetDelegate(this);
+
+ m_pOldDelegate = pPictureBox->GetCurrentDelegate();
+ pPictureBox->SetCurrentDelegate(this);
+
CXFA_FFField::LoadWidget();
if (m_pDataAcc->GetImageEditImage()) {
return TRUE;
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp
index 527cfbc239..e648581011 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -55,7 +55,9 @@ FX_BOOL CXFA_FFPushButton::LoadWidget() {
CFWL_PushButton* pPushButton = new CFWL_PushButton(GetFWLApp());
pPushButton->Initialize();
- m_pOldDelegate = pPushButton->SetDelegate(this);
+ m_pOldDelegate = pPushButton->GetCurrentDelegate();
+ pPushButton->SetCurrentDelegate(this);
+
m_pNormalWidget = pPushButton;
m_pNormalWidget->SetLayoutItem(this);
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index 1546641a7f..e268f1c4ec 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -45,8 +45,11 @@ FX_BOOL CXFA_FFTextEdit::LoadWidget() {
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
- m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
+
+ m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
+ m_pNormalWidget->SetCurrentDelegate(this);
m_pNormalWidget->LockUpdate();
+
UpdateWidgetProperty();
CFX_WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
@@ -447,8 +450,11 @@ FX_BOOL CXFA_FFNumericEdit::LoadWidget() {
m_pNormalWidget->SetLayoutItem(this);
CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
- m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
+
+ m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
+ m_pNormalWidget->SetCurrentDelegate(this);
m_pNormalWidget->LockUpdate();
+
CFX_WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
pWidget->SetText(wsText);
@@ -524,8 +530,11 @@ FX_BOOL CXFA_FFPasswordEdit::LoadWidget() {
IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
- m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
+
+ m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
+ m_pNormalWidget->SetCurrentDelegate(this);
m_pNormalWidget->LockUpdate();
+
CFX_WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
pWidget->SetText(wsText);
@@ -590,8 +599,11 @@ FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() {
IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
- m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
+
+ m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
+ m_pNormalWidget->SetCurrentDelegate(this);
m_pNormalWidget->LockUpdate();
+
CFX_WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
pWidget->SetEditText(wsText);