Index: xfa/fwl/core/ifwl_combolist.cpp |
diff --git a/xfa/fwl/core/ifwl_combolist.cpp b/xfa/fwl/core/ifwl_combolist.cpp |
index d021088ebbdb2540a6feaa019be6e50d4455ea2a..e0677a84b3ffef413134fed3b9eb9fc779e47c73 100644 |
--- a/xfa/fwl/core/ifwl_combolist.cpp |
+++ b/xfa/fwl/core/ifwl_combolist.cpp |
@@ -19,11 +19,11 @@ IFWL_ComboList::IFWL_ComboList( |
} |
int32_t IFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) { |
- if (wsMatch.IsEmpty()) { |
+ if (wsMatch.IsEmpty()) |
return -1; |
- } |
if (!m_pProperties->m_pDataProvider) |
return -1; |
+ |
IFWL_ListBoxDP* pData = |
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); |
int32_t iCount = pData->CountItems(this); |
@@ -32,9 +32,8 @@ int32_t IFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) { |
CFX_WideString wsText; |
pData->GetItemText(this, hItem, wsText); |
FX_STRSIZE pos = wsText.Find(wsMatch.c_str()); |
- if (!pos) { |
+ if (!pos) |
return i; |
- } |
} |
return -1; |
} |
@@ -42,6 +41,7 @@ int32_t IFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) { |
void IFWL_ComboList::ChangeSelected(int32_t iSel) { |
if (!m_pProperties->m_pDataProvider) |
return; |
+ |
IFWL_ListBoxDP* pData = |
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); |
CFWL_ListItem* hItem = pData->GetItem(this, iSel); |
@@ -49,9 +49,9 @@ void IFWL_ComboList::ChangeSelected(int32_t iSel) { |
rtInvalidate.Reset(); |
CFWL_ListItem* hOld = GetSelItem(0); |
int32_t iOld = pData->GetItemIndex(this, hOld); |
- if (iOld == iSel) { |
+ if (iOld == iSel) |
return; |
- } else if (iOld > -1) { |
+ if (iOld > -1) { |
GetItemRect(iOld, rtInvalidate); |
SetSelItem(hOld, false); |
} |
@@ -62,9 +62,8 @@ void IFWL_ComboList::ChangeSelected(int32_t iSel) { |
CFWL_ListItem* hSel = pData->GetItem(this, iSel); |
SetSelItem(hSel, true); |
} |
- if (!rtInvalidate.IsEmpty()) { |
+ if (!rtInvalidate.IsEmpty()) |
Repaint(&rtInvalidate); |
- } |
} |
int32_t IFWL_ComboList::CountItems() { |
@@ -88,10 +87,6 @@ void IFWL_ComboList::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) { |
pOwner->TransformTo(m_pOuter, fx, fy); |
} |
-void IFWL_ComboList::SetFocus(bool bSet) { |
- IFWL_Widget::SetFocus(bSet); |
-} |
- |
void IFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) { |
if (!pMessage) |
return; |
@@ -154,30 +149,31 @@ void IFWL_ComboList::OnDropListFocusChanged(CFWL_Message* pMsg, bool bSet) { |
int32_t IFWL_ComboList::OnDropListMouseMove(CFWL_MsgMouse* pMsg) { |
if (GetRTClient().Contains(pMsg->m_fx, pMsg->m_fy)) { |
- if (m_bNotifyOwner) { |
+ if (m_bNotifyOwner) |
m_bNotifyOwner = false; |
- } |
+ |
IFWL_ScrollBar* vertSB = GetVertScrollBar(); |
if (IsShowScrollBar(true) && vertSB) { |
CFX_RectF rect; |
vertSB->GetWidgetRect(rect); |
- if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { |
+ if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) |
return 1; |
- } |
} |
+ |
CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
- if (hItem) { |
- if (!m_pProperties->m_pDataProvider) |
- return 0; |
- 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_pOuter; |
- event.m_iCurHover = iSel; |
- DispatchEvent(&event); |
- ChangeSelected(iSel); |
- } |
+ if (!hItem) |
+ return 1; |
+ if (!m_pProperties->m_pDataProvider) |
+ return 0; |
+ |
+ 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_pOuter; |
+ event.m_iCurHover = iSel; |
+ DispatchEvent(&event); |
+ ChangeSelected(iSel); |
} else if (m_bNotifyOwner) { |
ClientToOuter(pMsg->m_fx, pMsg->m_fy); |
IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter); |
@@ -200,20 +196,22 @@ int32_t IFWL_ComboList::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) { |
if (m_bNotifyOwner) { |
ClientToOuter(pMsg->m_fx, pMsg->m_fy); |
pOuter->GetDelegate()->OnProcessMessage(pMsg); |
- } else { |
- IFWL_ScrollBar* vertSB = GetVertScrollBar(); |
- if (IsShowScrollBar(true) && vertSB) { |
- CFX_RectF rect; |
- vertSB->GetWidgetRect(rect); |
- if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { |
- return 1; |
- } |
- } |
- pOuter->ShowDropList(false); |
- CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
- if (hItem) |
- pOuter->ProcessSelChanged(true); |
+ return 1; |
+ } |
+ |
+ IFWL_ScrollBar* vertSB = GetVertScrollBar(); |
+ if (IsShowScrollBar(true) && vertSB) { |
+ CFX_RectF rect; |
+ vertSB->GetWidgetRect(rect); |
+ if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) |
+ return 1; |
} |
+ pOuter->ShowDropList(false); |
+ |
+ CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
+ if (hItem) |
+ pOuter->ProcessSelChanged(true); |
+ |
return 1; |
npm
2016/11/16 18:37:57
So this always returns 1?
dsinclair
2016/11/16 18:57:14
Nice catch. Not anymore.
|
} |
@@ -234,7 +232,10 @@ int32_t IFWL_ComboList::OnDropListKey(CFWL_MsgKey* pKey) { |
pOuter->ProcessSelChanged(false); |
return 1; |
} |
- default: { bPropagate = true; } |
+ default: { |
+ bPropagate = true; |
+ break; |
+ } |
} |
} else if (pKey->m_dwCmd == FWL_KeyCommand::Char) { |
bPropagate = true; |
@@ -260,9 +261,9 @@ void IFWL_ComboList::OnDropListKeyDown(CFWL_MsgKey* pKey) { |
CFWL_ListItem* hItem = |
pData->GetItem(this, pOuter->GetCurrentSelection()); |
hItem = GetItem(hItem, dwKeyCode); |
- if (!hItem) { |
+ if (!hItem) |
break; |
- } |
+ |
SetSelection(hItem, hItem, true); |
ScrollToVisible(hItem); |
CFX_RectF rtInvalidate; |