Chromium Code Reviews| Index: xfa/fwl/basewidget/fwl_comboboximp.cpp |
| diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp |
| index b7d85d3174fd5fe2f722a6bdcb1ff1c8736b8785..d08f83ae12cb9b066899174c2b1255c3ff5367d4 100644 |
| --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp |
| +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp |
| @@ -141,23 +141,25 @@ CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties, |
| CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner) |
| : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} |
| + |
| int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| if (!pMessage) |
| return 0; |
| - uint32_t dwMsgCode = pMessage->GetClassID(); |
| + |
| + CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
| FX_BOOL backDefault = TRUE; |
| switch (dwMsgCode) { |
| - case FWL_MSGHASH_SetFocus: |
| - case FWL_MSGHASH_KillFocus: { |
| - if (dwMsgCode == FWL_MSGHASH_SetFocus) { |
| + case CFWL_MessageType::SetFocus: |
|
Tom Sepez
2016/04/19 18:46:11
nit: same thing here.
dsinclair
2016/04/19 19:11:25
Done.
|
| + case CFWL_MessageType::KillFocus: { |
| + if (dwMsgCode == CFWL_MessageType::SetFocus) |
| m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; |
| - } else { |
| + else |
| m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; |
| - } |
| + |
| backDefault = FALSE; |
| break; |
| } |
| - case FWL_MSGHASH_Mouse: { |
| + case CFWL_MessageType::Mouse: { |
| CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| if ((pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) && |
| ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) { |
| @@ -166,13 +168,14 @@ int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| } |
| break; |
| } |
| - default: {} |
| + default: |
| + break; |
| } |
| - if (!backDefault) { |
| + if (!backDefault) |
| return 1; |
| - } |
| return CFWL_EditImpDelegate::OnProcessMessage(pMessage); |
| } |
| + |
| void CFWL_ComboEditImp::ClearSelected() { |
| ClearSelections(); |
| Repaint(&m_rtClient); |
| @@ -281,17 +284,20 @@ void CFWL_ComboListImp::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) { |
| void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) { |
| CFWL_WidgetImp::SetFocus(bSet); |
| } |
| + |
| CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner) |
| : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {} |
| + |
| int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| if (!pMessage) |
| return 0; |
| - uint32_t dwHashCode = pMessage->GetClassID(); |
| + |
| + CFWL_MessageType dwHashCode = pMessage->GetClassID(); |
| FX_BOOL backDefault = TRUE; |
| - if (dwHashCode == FWL_MSGHASH_SetFocus || |
| - dwHashCode == FWL_MSGHASH_KillFocus) { |
| - OnDropListFocusChanged(pMessage, dwHashCode == FWL_MSGHASH_SetFocus); |
| - } else if (dwHashCode == FWL_MSGHASH_Mouse) { |
| + if (dwHashCode == CFWL_MessageType::SetFocus || |
| + dwHashCode == CFWL_MessageType::KillFocus) { |
| + 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) { |
| CFX_RectF rect; |
| @@ -323,14 +329,14 @@ int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| } |
| default: {} |
| } |
| - } else if (dwHashCode == FWL_MSGHASH_Key) { |
| + } else if (dwHashCode == CFWL_MessageType::Key) { |
| backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage)); |
| } |
| - if (!backDefault) { |
| + if (!backDefault) |
| return 1; |
| - } |
| return CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); |
| } |
| + |
| void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg, |
| FX_BOOL bSet) { |
| if (!bSet) { |
| @@ -1357,23 +1363,26 @@ void CFWL_ComboBoxImp::DisForm_Layout() { |
| m_pEdit->Update(); |
| } |
| } |
| + |
| CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner) |
| : m_pOwner(pOwner) {} |
| + |
| int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| - if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { |
| + if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) |
| return DisForm_OnProcessMessage(pMessage); |
| - } |
| + |
| if (!pMessage) |
| return 0; |
| - uint32_t dwMsgCode = pMessage->GetClassID(); |
| + |
| + CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
| FX_BOOL iRet = 1; |
| switch (dwMsgCode) { |
| - case FWL_MSGHASH_SetFocus: |
| - case FWL_MSGHASH_KillFocus: { |
| - OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); |
| + case CFWL_MessageType::SetFocus: |
| + case CFWL_MessageType::KillFocus: { |
| + OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); |
|
Tom Sepez
2016/04/19 18:46:11
and here.
dsinclair
2016/04/19 19:11:25
Done.
|
| break; |
| } |
| - case FWL_MSGHASH_Mouse: { |
| + case CFWL_MessageType::Mouse: { |
| CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| uint32_t dwCmd = pMsg->m_dwCmd; |
| switch (dwCmd) { |
| @@ -1393,22 +1402,28 @@ int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| OnMouseLeave(pMsg); |
| break; |
| } |
| - default: {} |
| + default: |
| + break; |
| } |
| break; |
| } |
| - case FWL_MSGHASH_Key: { |
| + case CFWL_MessageType::Key: { |
| OnKey(static_cast<CFWL_MsgKey*>(pMessage)); |
| break; |
| } |
| - default: { iRet = 0; } |
| + default: { |
| + iRet = 0; |
| + break; |
| + } |
| } |
| + |
| CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| return iRet; |
| } |
| + |
| FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
| - uint32_t dwFlag = pEvent->GetClassID(); |
| - if (dwFlag == FWL_EVTHASH_LTB_DrawItem) { |
| + CFWL_EventType dwFlag = pEvent->GetClassID(); |
| + if (dwFlag == CFWL_EventType::DrawItem) { |
| CFWL_EvtLtbDrawItem* pDrawItemEvent = |
| static_cast<CFWL_EvtLtbDrawItem*>(pEvent); |
| CFWL_EvtCmbDrawItem pTemp; |
| @@ -1417,14 +1432,14 @@ FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
| pTemp.m_index = pDrawItemEvent->m_index; |
| pTemp.m_rtItem = pDrawItemEvent->m_rect; |
| m_pOwner->DispatchEvent(&pTemp); |
| - } else if (dwFlag == FWL_EVTHASH_Scroll) { |
| + } else if (dwFlag == CFWL_EventType::Scroll) { |
| CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); |
| CFWL_EvtScroll pScrollEv; |
| pScrollEv.m_pSrcTarget = m_pOwner->m_pInterface; |
| pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode; |
| pScrollEv.m_fPos = pScrollEvent->m_fPos; |
| m_pOwner->DispatchEvent(&pScrollEv); |
| - } else if (dwFlag == FWL_EVTHASH_EDT_TextChanged) { |
| + } else if (dwFlag == CFWL_EventType::TextChanged) { |
| CFWL_EvtEdtTextChanged* pTextChangedEvent = |
| static_cast<CFWL_EvtEdtTextChanged*>(pEvent); |
| CFWL_EvtCmbEditChanged pTemp; |
| @@ -1436,6 +1451,7 @@ FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
| } |
| return FWL_ERR_Succeeded; |
| } |
| + |
| FWL_ERR CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| const CFX_Matrix* pMatrix) { |
| return m_pOwner->DrawWidget(pGraphics, pMatrix); |
| @@ -1588,16 +1604,17 @@ int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( |
| CFWL_Message* pMessage) { |
| if (!pMessage) |
| return 0; |
| - uint32_t dwMsgCode = pMessage->GetClassID(); |
| + |
| + CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
| FX_BOOL backDefault = TRUE; |
| switch (dwMsgCode) { |
| - case FWL_MSGHASH_SetFocus: |
| - case FWL_MSGHASH_KillFocus: { |
| + case CFWL_MessageType::SetFocus: |
| + case CFWL_MessageType::KillFocus: { |
| backDefault = FALSE; |
| - DisForm_OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); |
| + DisForm_OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); |
| break; |
| } |
| - case FWL_MSGHASH_Mouse: { |
| + case CFWL_MessageType::Mouse: { |
| backDefault = FALSE; |
| CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| uint32_t dwCmd = pMsg->m_dwCmd; |
| @@ -1610,16 +1627,16 @@ int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( |
| OnLButtonUp(pMsg); |
| break; |
| } |
| - default: {} |
| + default: |
| + break; |
| } |
| break; |
| } |
| - case FWL_MSGHASH_Key: { |
| + case CFWL_MessageType::Key: { |
| backDefault = FALSE; |
| CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
| - if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyUp) { |
| + if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyUp) |
| break; |
| - } |
| if (m_pOwner->DisForm_IsDropListShowed() && |
| pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { |
| uint32_t dwKeyCode = pKey->m_dwKeyCode; |
| @@ -1636,13 +1653,14 @@ int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( |
| DisForm_OnKey(pKey); |
| break; |
| } |
| - default: {} |
| + default: |
| + break; |
| } |
| - if (!backDefault) { |
| + if (!backDefault) |
| return 1; |
| - } |
| return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| } |
| + |
| void CFWL_ComboBoxImpDelegate::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) { |
| FX_BOOL bDropDown = m_pOwner->DisForm_IsDropListShowed(); |
| CFX_RectF& rtBtn = bDropDown ? m_pOwner->m_rtBtn : m_pOwner->m_rtClient; |
| @@ -1726,6 +1744,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) { |
| pDelegate->OnProcessMessage(pMsg); |
| } |
| } |
| + |
| CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate( |
| IFWL_Form* pForm, |
| CFWL_ComboBoxImp* pComboBox) |
| @@ -1734,11 +1753,13 @@ CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate( |
| m_fStartPos(0), |
| m_pForm(pForm), |
| m_pComboBox(pComboBox) {} |
| + |
| int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| if (!pMessage) |
| return 0; |
| - uint32_t dwMsgCode = pMessage->GetClassID(); |
| - if (dwMsgCode == FWL_MSGHASH_Mouse) { |
| + |
| + CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
| + if (dwMsgCode == CFWL_MessageType::Mouse) { |
| CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| uint32_t dwCmd = pMsg->m_dwCmd; |
| switch (dwCmd) { |
| @@ -1754,18 +1775,20 @@ int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| OnMouseMove(pMsg); |
| break; |
| } |
| - default: {} |
| + default: |
| + break; |
| } |
| } |
| - if (dwMsgCode == FWL_MSGHASH_Deactivate) { |
| + if (dwMsgCode == CFWL_MessageType::Deactivate) |
| OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage)); |
| - } |
| - if (dwMsgCode == FWL_MSGHASH_KillFocus || dwMsgCode == FWL_MSGHASH_SetFocus) { |
| + if (dwMsgCode == CFWL_MessageType::KillFocus || |
|
Tom Sepez
2016/04/19 18:46:11
nit: else if, also maybe handle as two separate if
dsinclair
2016/04/19 19:11:25
Done.
|
| + dwMsgCode == CFWL_MessageType::SetFocus) { |
| OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), |
| - dwMsgCode == FWL_MSGHASH_SetFocus); |
| + dwMsgCode == CFWL_MessageType::SetFocus); |
| } |
| return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| } |
| + |
| FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| const CFX_Matrix* pMatrix) { |
| m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); |