Index: xfa/fwl/core/ifwl_combolist.cpp |
diff --git a/xfa/fwl/core/ifwl_combolist.cpp b/xfa/fwl/core/ifwl_combolist.cpp |
index 0fdc5ac6d9973853bf5bc037852ffa5126e69167..5a2ade96de4bccaa33f37889bcf5c84c896f16b1 100644 |
--- a/xfa/fwl/core/ifwl_combolist.cpp |
+++ b/xfa/fwl/core/ifwl_combolist.cpp |
@@ -15,7 +15,6 @@ IFWL_ComboList::IFWL_ComboList(const IFWL_App* app, |
IFWL_Widget* pOuter) |
: IFWL_ListBox(app, properties, pOuter), m_bNotifyOwner(TRUE) { |
ASSERT(pOuter); |
- SetDelegate(pdfium::MakeUnique<CFWL_ComboListImpDelegate>(this)); |
} |
int32_t IFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) { |
@@ -92,10 +91,7 @@ void IFWL_ComboList::SetFocus(FX_BOOL bSet) { |
IFWL_Widget::SetFocus(bSet); |
} |
-CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(IFWL_ComboList* pOwner) |
- : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {} |
- |
-void CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
+void IFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) { |
if (!pMessage) |
return; |
@@ -106,14 +102,13 @@ void CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
OnDropListFocusChanged(pMessage, dwHashCode == CFWL_MessageType::SetFocus); |
} else if (dwHashCode == CFWL_MessageType::Mouse) { |
CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
- if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { |
+ if (IsShowScrollBar(TRUE) && m_pVertScrollBar) { |
CFX_RectF rect; |
- m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); |
+ m_pVertScrollBar->GetWidgetRect(rect); |
if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { |
pMsg->m_fx -= rect.left; |
pMsg->m_fy -= rect.top; |
- m_pOwner->m_pVertScrollBar->GetCurrentDelegate()->OnProcessMessage( |
- pMsg); |
+ m_pVertScrollBar->GetDelegate()->OnProcessMessage(pMsg); |
return; |
} |
} |
@@ -140,87 +135,86 @@ void CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage)); |
} |
if (backDefault) |
- CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); |
+ IFWL_ListBox::OnProcessMessage(pMessage); |
} |
-void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg, |
- FX_BOOL bSet) { |
- if (!bSet) { |
- CFWL_MsgKillFocus* pKill = static_cast<CFWL_MsgKillFocus*>(pMsg); |
- IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter); |
- if (pKill->m_pSetFocus == m_pOwner->m_pOuter || |
- pKill->m_pSetFocus == pOuter->m_pEdit.get()) { |
- pOuter->ShowDropList(FALSE); |
- } |
+void IFWL_ComboList::OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { |
+ if (bSet) |
+ return; |
+ |
+ CFWL_MsgKillFocus* pKill = static_cast<CFWL_MsgKillFocus*>(pMsg); |
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter); |
+ if (pKill->m_pSetFocus == m_pOuter || |
+ pKill->m_pSetFocus == pOuter->GetComboEdit()) { |
+ pOuter->ShowDropList(FALSE); |
} |
} |
-int32_t CFWL_ComboListImpDelegate::OnDropListMouseMove(CFWL_MsgMouse* pMsg) { |
- if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) { |
- if (m_pOwner->m_bNotifyOwner) { |
- m_pOwner->m_bNotifyOwner = FALSE; |
+int32_t IFWL_ComboList::OnDropListMouseMove(CFWL_MsgMouse* pMsg) { |
+ if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) { |
+ if (m_bNotifyOwner) { |
+ m_bNotifyOwner = FALSE; |
} |
- if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { |
+ if (IsShowScrollBar(TRUE) && m_pVertScrollBar) { |
CFX_RectF rect; |
- m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); |
+ m_pVertScrollBar->GetWidgetRect(rect); |
if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { |
return 1; |
} |
} |
- IFWL_ListItem* hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
+ IFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
if (hItem) { |
- if (!m_pOwner->m_pProperties->m_pDataProvider) |
+ if (!m_pProperties->m_pDataProvider) |
return 0; |
- IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>( |
- m_pOwner->m_pProperties->m_pDataProvider); |
- int32_t iSel = pData->GetItemIndex(m_pOwner, hItem); |
+ IFWL_ListBoxDP* pData = |
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); |
+ int32_t iSel = pData->GetItemIndex(this, hItem); |
CFWL_EvtCmbHoverChanged event; |
- event.m_pSrcTarget = m_pOwner->m_pOuter; |
+ event.m_pSrcTarget = m_pOuter; |
event.m_iCurHover = iSel; |
- m_pOwner->DispatchEvent(&event); |
- m_pOwner->ChangeSelected(iSel); |
+ DispatchEvent(&event); |
+ ChangeSelected(iSel); |
} |
- } else if (m_pOwner->m_bNotifyOwner) { |
- m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy); |
- IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter); |
+ } else if (m_bNotifyOwner) { |
+ ClientToOuter(pMsg->m_fx, pMsg->m_fy); |
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter); |
pOuter->GetDelegate()->OnProcessMessage(pMsg); |
} |
return 1; |
} |
-int32_t CFWL_ComboListImpDelegate::OnDropListLButtonDown(CFWL_MsgMouse* pMsg) { |
- if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) { |
+int32_t IFWL_ComboList::OnDropListLButtonDown(CFWL_MsgMouse* pMsg) { |
+ if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) |
return 0; |
- } |
- IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter); |
+ |
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter); |
pOuter->ShowDropList(FALSE); |
return 1; |
} |
-int32_t CFWL_ComboListImpDelegate::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) { |
- IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter); |
- if (m_pOwner->m_bNotifyOwner) { |
- m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy); |
+int32_t IFWL_ComboList::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) { |
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter); |
+ if (m_bNotifyOwner) { |
+ ClientToOuter(pMsg->m_fx, pMsg->m_fy); |
pOuter->GetDelegate()->OnProcessMessage(pMsg); |
} else { |
- if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { |
+ if (IsShowScrollBar(TRUE) && m_pVertScrollBar) { |
CFX_RectF rect; |
- m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); |
+ m_pVertScrollBar->GetWidgetRect(rect); |
if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { |
return 1; |
} |
} |
pOuter->ShowDropList(FALSE); |
- IFWL_ListItem* hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
- if (hItem) { |
+ IFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
+ if (hItem) |
pOuter->ProcessSelChanged(TRUE); |
- } |
} |
return 1; |
} |
-int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { |
- IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter); |
+int32_t IFWL_ComboList::OnDropListKey(CFWL_MsgKey* pKey) { |
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter); |
FX_BOOL bPropagate = FALSE; |
if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) { |
uint32_t dwKeyCode = pKey->m_dwKeyCode; |
@@ -242,34 +236,35 @@ int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { |
bPropagate = TRUE; |
} |
if (bPropagate) { |
- pKey->m_pDstTarget = m_pOwner->m_pOuter; |
+ pKey->m_pDstTarget = m_pOuter; |
pOuter->GetDelegate()->OnProcessMessage(pKey); |
return 1; |
} |
return 0; |
} |
-void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) { |
+void IFWL_ComboList::OnDropListKeyDown(CFWL_MsgKey* pKey) { |
uint32_t dwKeyCode = pKey->m_dwKeyCode; |
switch (dwKeyCode) { |
case FWL_VKEY_Up: |
case FWL_VKEY_Down: |
case FWL_VKEY_Home: |
case FWL_VKEY_End: { |
- IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter); |
- IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>( |
- m_pOwner->m_pProperties->m_pDataProvider); |
- IFWL_ListItem* hItem = pData->GetItem(m_pOwner, pOuter->m_iCurSel); |
- hItem = m_pOwner->GetItem(hItem, dwKeyCode); |
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter); |
+ IFWL_ListBoxDP* pData = |
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); |
+ IFWL_ListItem* hItem = |
+ pData->GetItem(this, pOuter->GetCurrentSelection()); |
+ hItem = GetItem(hItem, dwKeyCode); |
if (!hItem) { |
break; |
} |
- m_pOwner->SetSelection(hItem, hItem, TRUE); |
- m_pOwner->ScrollToVisible(hItem); |
+ SetSelection(hItem, hItem, TRUE); |
+ ScrollToVisible(hItem); |
CFX_RectF rtInvalidate; |
- rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width, |
- m_pOwner->m_pProperties->m_rtWidget.height); |
- m_pOwner->Repaint(&rtInvalidate); |
+ rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, |
+ m_pProperties->m_rtWidget.height); |
+ Repaint(&rtInvalidate); |
break; |
} |
default: |