diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-21 13:12:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-21 13:12:06 -0700 |
commit | 5d9da0c1255a75dd9b7b2005f8b7d6ae4948feaf (patch) | |
tree | df40bedc2582cab695e7bf4b2056bfddd4969908 /xfa/fwl/basewidget | |
parent | 0f6425fff33e4096b4e1fbfb954edae1349c0145 (diff) | |
download | pdfium-5d9da0c1255a75dd9b7b2005f8b7d6ae4948feaf.tar.xz |
Remove CFWL_Note.
This CL removes the CFWL_Note class. The two subclasses, CFWL_Event and
CFWL_Message are distinct types and should not be related by the subclass. The
code has been updated to pass the correct types as needed.
The various FWL_EVTHASH and FWL_MSGHASH defines have all been removed and turned
into an FWL_EventType and FWL_MessageType enum classes.
BUG=pdfium:474
Review URL: https://codereview.chromium.org/1901183002
Diffstat (limited to 'xfa/fwl/basewidget')
-rw-r--r-- | xfa/fwl/basewidget/fwl_barcodeimp.cpp | 5 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_checkboximp.cpp | 32 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_comboboximp.cpp | 195 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_datetimepickerimp.cpp | 71 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_editimp.cpp | 39 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_listboximp.cpp | 40 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_monthcalendarimp.cpp | 25 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_pushbuttonimp.cpp | 31 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_scrollbarimp.cpp | 15 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_spinbuttonimp.cpp | 28 | ||||
-rw-r--r-- | xfa/fwl/basewidget/ifwl_checkbox.h | 5 | ||||
-rw-r--r-- | xfa/fwl/basewidget/ifwl_combobox.h | 24 | ||||
-rw-r--r-- | xfa/fwl/basewidget/ifwl_datetimepicker.h | 16 | ||||
-rw-r--r-- | xfa/fwl/basewidget/ifwl_edit.h | 21 | ||||
-rw-r--r-- | xfa/fwl/basewidget/ifwl_listbox.h | 7 | ||||
-rw-r--r-- | xfa/fwl/basewidget/ifwl_monthcalendar.h | 7 | ||||
-rw-r--r-- | xfa/fwl/basewidget/ifwl_spinbutton.h | 4 |
17 files changed, 319 insertions, 246 deletions
diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/basewidget/fwl_barcodeimp.cpp index 8238d6af04..cc0bd62257 100644 --- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp +++ b/xfa/fwl/basewidget/fwl_barcodeimp.cpp @@ -217,11 +217,12 @@ FX_BOOL CFWL_BarcodeImp::IsProtectedType() { } return FALSE; } + CFWL_BarcodeImpDelegate::CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner) : CFWL_EditImpDelegate(pOwner) {} + FWL_ERR CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { - uint32_t dwFlag = pEvent->GetClassID(); - if (dwFlag == FWL_EVTHASH_EDT_TextChanged) { + if (pEvent->GetClassID() == CFWL_EventType::TextChanged) { CFWL_BarcodeImp* pOwner = static_cast<CFWL_BarcodeImp*>(m_pOwner); pOwner->ReleaseBarcodeEngine(); pOwner->m_dwStatus = XFA_BCS_NeedUpdate; diff --git a/xfa/fwl/basewidget/fwl_checkboximp.cpp b/xfa/fwl/basewidget/fwl_checkboximp.cpp index 9ed2f0b8ed..e511b8e444 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.cpp +++ b/xfa/fwl/basewidget/fwl_checkboximp.cpp @@ -409,22 +409,26 @@ void CFWL_CheckBoxImp::NextStates() { } CFWL_CheckBoxImpDelegate::CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner) : m_pOwner(pOwner) {} + int32_t CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return 0; - uint32_t dwMsgCode = pMessage->GetClassID(); + int32_t iRet = 1; - switch (dwMsgCode) { - case FWL_MSGHASH_Activate: { + switch (pMessage->GetClassID()) { + case CFWL_MessageType::Activate: { OnActivate(pMessage); break; } - case FWL_MSGHASH_SetFocus: - case FWL_MSGHASH_KillFocus: { - OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); + case CFWL_MessageType::SetFocus: { + OnFocusChanged(pMessage, TRUE); break; } - case FWL_MSGHASH_Mouse: { + case CFWL_MessageType::KillFocus: { + OnFocusChanged(pMessage, FALSE); + break; + } + case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); uint32_t dwCmd = pMsg->m_dwCmd; switch (dwCmd) { @@ -444,19 +448,23 @@ int32_t CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { OnMouseLeave(pMsg); break; } - default: {} + default: + break; } break; } - case FWL_MSGHASH_Key: { + case CFWL_MessageType::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); - if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { + if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) OnKeyDown(pKey); - } break; } - default: { iRet = 0; } + default: { + iRet = 0; + break; + } } + CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); return iRet; } diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index b093b6c171..d7fe209e16 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -141,23 +141,24 @@ 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(); + FX_BOOL backDefault = TRUE; - switch (dwMsgCode) { - case FWL_MSGHASH_SetFocus: - case FWL_MSGHASH_KillFocus: { - if (dwMsgCode == FWL_MSGHASH_SetFocus) { - m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; - } else { - m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; - } + switch (pMessage->GetClassID()) { + case CFWL_MessageType::SetFocus: { + m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; + backDefault = FALSE; + break; + } + case CFWL_MessageType::KillFocus: { + 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 +167,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 +283,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 +328,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) { @@ -1356,26 +1361,30 @@ 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(); + FX_BOOL iRet = 1; - switch (dwMsgCode) { - case FWL_MSGHASH_SetFocus: - case FWL_MSGHASH_KillFocus: { - OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); + switch (pMessage->GetClassID()) { + case CFWL_MessageType::SetFocus: { + OnFocusChanged(pMessage, TRUE); + break; + } + case CFWL_MessageType::KillFocus: { + OnFocusChanged(pMessage, FALSE); 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) { + switch (pMsg->m_dwCmd) { case FWL_MSGMOUSECMD_LButtonDown: { OnLButtonDown(pMsg); break; @@ -1392,22 +1401,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; @@ -1416,14 +1431,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; @@ -1435,6 +1450,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); @@ -1586,20 +1602,23 @@ int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( CFWL_Message* pMessage) { if (!pMessage) return 0; - uint32_t dwMsgCode = pMessage->GetClassID(); + FX_BOOL backDefault = TRUE; - switch (dwMsgCode) { - case FWL_MSGHASH_SetFocus: - case FWL_MSGHASH_KillFocus: { + switch (pMessage->GetClassID()) { + case CFWL_MessageType::SetFocus: { backDefault = FALSE; - DisForm_OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); + DisForm_OnFocusChanged(pMessage, TRUE); break; } - case FWL_MSGHASH_Mouse: { + case CFWL_MessageType::KillFocus: { + backDefault = FALSE; + DisForm_OnFocusChanged(pMessage, FALSE); + break; + } + case CFWL_MessageType::Mouse: { backDefault = FALSE; CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - uint32_t dwCmd = pMsg->m_dwCmd; - switch (dwCmd) { + switch (pMsg->m_dwCmd) { case FWL_MSGMOUSECMD_LButtonDown: { DisForm_OnLButtonDown(pMsg); break; @@ -1608,22 +1627,22 @@ 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; - FX_BOOL bListKey = - dwKeyCode == FWL_VKEY_Up || dwKeyCode == FWL_VKEY_Down || - dwKeyCode == FWL_VKEY_Return || dwKeyCode == FWL_VKEY_Escape; + FX_BOOL bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || + pKey->m_dwKeyCode == FWL_VKEY_Down || + pKey->m_dwKeyCode == FWL_VKEY_Return || + pKey->m_dwKeyCode == FWL_VKEY_Escape; if (bListKey) { IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pListBox->SetDelegate(NULL); @@ -1634,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; @@ -1724,6 +1744,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) { pDelegate->OnProcessMessage(pMsg); } } + CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate( IFWL_Form* pForm, CFWL_ComboBoxImp* pComboBox) @@ -1732,38 +1753,50 @@ 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_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - uint32_t dwCmd = pMsg->m_dwCmd; - switch (dwCmd) { - case FWL_MSGMOUSECMD_LButtonDown: { - OnLButtonDown(pMsg); - break; - } - case FWL_MSGMOUSECMD_LButtonUp: { - OnLButtonUp(pMsg); - break; - } - case FWL_MSGMOUSECMD_MouseMove: { - OnMouseMove(pMsg); - break; + + switch (pMessage->GetClassID()) { + case CFWL_MessageType::Mouse: { + CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); + switch (pMsg->m_dwCmd) { + case FWL_MSGMOUSECMD_LButtonDown: { + OnLButtonDown(pMsg); + break; + } + case FWL_MSGMOUSECMD_LButtonUp: { + OnLButtonUp(pMsg); + break; + } + case FWL_MSGMOUSECMD_MouseMove: { + OnMouseMove(pMsg); + break; + } + default: + break; } - default: {} + break; } - } - if (dwMsgCode == FWL_MSGHASH_Deactivate) { - OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage)); - } - if (dwMsgCode == FWL_MSGHASH_KillFocus || dwMsgCode == FWL_MSGHASH_SetFocus) { - OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), - dwMsgCode == FWL_MSGHASH_SetFocus); + case CFWL_MessageType::Deactivate: { + OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage)); + break; + } + case CFWL_MessageType::KillFocus: { + OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), FALSE); + break; + } + case CFWL_MessageType::SetFocus: { + OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), TRUE); + break; + } + default: + break; } return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); } + FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp index 21616992b1..c70ad691a4 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp @@ -165,27 +165,30 @@ FWL_ERR CFWL_DateTimeEdit::Finalize() { m_pDelegate = nullptr; return CFWL_EditImp::Finalize(); } + CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( CFWL_DateTimeEdit* pOwner) : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} + int32_t CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { - if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { + if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) return DisForm_OnProcessMessage(pMessage); - } - uint32_t dwHashCode = pMessage->GetClassID(); - if (dwHashCode == FWL_MSGHASH_SetFocus || - dwHashCode == FWL_MSGHASH_KillFocus) { + + CFWL_MessageType dwHashCode = pMessage->GetClassID(); + if (dwHashCode == CFWL_MessageType::SetFocus || + dwHashCode == CFWL_MessageType::KillFocus) { IFWL_Widget* pOuter = m_pOwner->GetOuter(); IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); pDelegate->OnProcessMessage(pMessage); } return 1; } + int32_t CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( CFWL_Message* pMessage) { - uint32_t dwHashCode = pMessage->GetClassID(); + CFWL_MessageType dwHashCode = pMessage->GetClassID(); if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { - if (dwHashCode == FWL_MSGHASH_Mouse) { + if (dwHashCode == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); if (pMouse->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown || pMouse->m_dwCmd == FWL_MSGMOUSECMD_RButtonDown) { @@ -202,12 +205,13 @@ int32_t CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( pDateTime->Repaint(&rtInvalidate); } } - } else if (dwHashCode == FWL_MSGHASH_Key) { + } else if (dwHashCode == CFWL_MessageType::Key) { return CFWL_EditImpDelegate::OnProcessMessage(pMessage); } } return CFWL_EditImpDelegate::OnProcessMessage(pMessage); } + CFWL_DateTimeCalendar::CFWL_DateTimeCalendar( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) @@ -224,19 +228,22 @@ FWL_ERR CFWL_DateTimeCalendar::Finalize() { m_pDelegate = nullptr; return CFWL_MonthCalendarImp::Finalize(); } + CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate( CFWL_DateTimeCalendar* pOwner) : CFWL_MonthCalendarImpDelegate(pOwner), m_pOwner(pOwner) { m_bFlag = FALSE; } + int32_t CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( CFWL_Message* pMessage) { - uint32_t dwCode = pMessage->GetClassID(); - if (dwCode == FWL_MSGHASH_SetFocus || dwCode == FWL_MSGHASH_KillFocus) { + CFWL_MessageType dwCode = pMessage->GetClassID(); + if (dwCode == CFWL_MessageType::SetFocus || + dwCode == CFWL_MessageType::KillFocus) { IFWL_Widget* pOuter = m_pOwner->GetOuter(); IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); return pDelegate->OnProcessMessage(pMessage); - } else if (dwCode == FWL_MSGHASH_Mouse) { + } else if (dwCode == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); if (pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) { OnLButtonDownEx(pMsg); @@ -248,6 +255,7 @@ int32_t CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( } return CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage); } + void CFWL_DateTimeCalendarImpDelegate::OnLButtonDownEx(CFWL_MsgMouse* pMsg) { if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { m_pOwner->m_iLBtnPartStates = CFWL_PartState_Pressed; @@ -364,9 +372,10 @@ void CFWL_DateTimeCalendarImpDelegate::OnMouseMoveEx(CFWL_MsgMouse* pMsg) { m_pOwner->Repaint(&rtInvalidate); } } + int32_t CFWL_DateTimeCalendarImpDelegate::DisForm_OnProcessMessage( CFWL_Message* pMessage) { - if (pMessage->GetClassID() == FWL_MSGHASH_Mouse) { + if (pMessage->GetClassID() == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); if (pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonUp) { DisForm_OnLButtonUpEx(pMsg); @@ -375,6 +384,7 @@ int32_t CFWL_DateTimeCalendarImpDelegate::DisForm_OnProcessMessage( } return CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage); } + void CFWL_DateTimeCalendarImpDelegate::DisForm_OnLButtonUpEx( CFWL_MsgMouse* pMsg) { if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { @@ -1010,24 +1020,28 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, } return FWL_ERR_Succeeded; } + CFWL_DateTimePickerImpDelegate::CFWL_DateTimePickerImpDelegate( CFWL_DateTimePickerImp* pOwner) : m_pOwner(pOwner) {} + int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( CFWL_Message* pMessage) { if (!pMessage) return 0; - uint32_t dwMsgCode = pMessage->GetClassID(); - switch (dwMsgCode) { - case FWL_MSGHASH_SetFocus: - case FWL_MSGHASH_KillFocus: { - OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); + + switch (pMessage->GetClassID()) { + case CFWL_MessageType::SetFocus: { + OnFocusChanged(pMessage, TRUE); + break; + } + case CFWL_MessageType::KillFocus: { + OnFocusChanged(pMessage, FALSE); break; } - case FWL_MSGHASH_Mouse: { + case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); - uint32_t dwCmd = pMouse->m_dwCmd; - switch (dwCmd) { + switch (pMouse->m_dwCmd) { case FWL_MSGMOUSECMD_LButtonDown: { OnLButtonDown(pMouse); break; @@ -1044,20 +1058,25 @@ int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( OnMouseLeave(pMouse); break; } - default: {} + default: + break; + } + break; + } + case CFWL_MessageType::Key: { + if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { + IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); + return pDelegate->OnProcessMessage(pMessage); } break; } default: break; } - if (dwMsgCode == FWL_MSGHASH_Key && - m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { - IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); - return pDelegate->OnProcessMessage(pMessage); - } + return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); } + FWL_ERR CFWL_DateTimePickerImpDelegate::OnDrawWidget( CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index 54e8abcb8b..74db0c96af 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -1729,28 +1729,31 @@ void CFWL_EditImp::ProcessInsertError(int32_t iError) { default: {} } } + CFWL_EditImpDelegate::CFWL_EditImpDelegate(CFWL_EditImp* pOwner) : m_pOwner(pOwner) {} + int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return 0; - uint32_t dwMsgCode = pMessage->GetClassID(); + + CFWL_MessageType dwMsgCode = pMessage->GetClassID(); int32_t iRet = 1; switch (dwMsgCode) { - case FWL_MSGHASH_Activate: { + case CFWL_MessageType::Activate: { DoActivate(static_cast<CFWL_MsgActivate*>(pMessage)); break; } - case FWL_MSGHASH_Deactivate: { + case CFWL_MessageType::Deactivate: { DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage)); break; } - 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); 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) { @@ -1774,32 +1777,35 @@ int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { DoButtonDown(pMsg); break; } - default: {} + default: + break; } break; } - case FWL_MSGHASH_Key: { + case CFWL_MessageType::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); uint32_t dwCmd = pKey->m_dwCmd; - if (dwCmd == FWL_MSGKEYCMD_KeyDown) { + if (dwCmd == FWL_MSGKEYCMD_KeyDown) OnKeyDown(pKey); - } else if (dwCmd == FWL_MSGKEYCMD_Char) { + else if (dwCmd == FWL_MSGKEYCMD_Char) OnChar(pKey); - } break; } - default: { iRet = 0; } + default: { + iRet = 0; + break; + } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); return iRet; } + FWL_ERR CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { if (!pEvent) return FWL_ERR_Indefinite; - uint32_t dwHashCode = pEvent->GetClassID(); - if (dwHashCode != FWL_EVTHASH_Scroll) { + if (pEvent->GetClassID() != CFWL_EventType::Scroll) return FWL_ERR_Succeeded; - } + IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; if ((pSrcTarget == m_pOwner->m_pVertScrollBar.get() && m_pOwner->m_pVertScrollBar) || @@ -1811,6 +1817,7 @@ FWL_ERR CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { } return FWL_ERR_Succeeded; } + FWL_ERR CFWL_EditImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { return m_pOwner->DrawWidget(pGraphics, pMatrix); diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index 2adeb97496..49d5d41d87 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -982,26 +982,30 @@ void CFWL_ListBoxImp::ProcessSelChanged() { } DispatchEvent(&selEvent); } + CFWL_ListBoxImpDelegate::CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner) : m_pOwner(pOwner) {} + int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return 0; - if (!m_pOwner->IsEnabled()) { + if (!m_pOwner->IsEnabled()) return 1; - } - uint32_t dwMsgCode = pMessage->GetClassID(); + + CFWL_MessageType dwMsgCode = pMessage->GetClassID(); int32_t iRet = 1; switch (dwMsgCode) { - case FWL_MSGHASH_SetFocus: - case FWL_MSGHASH_KillFocus: { - OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); + case CFWL_MessageType::SetFocus: { + OnFocusChanged(pMessage, TRUE); break; } - case FWL_MSGHASH_Mouse: { + case CFWL_MessageType::KillFocus: { + OnFocusChanged(pMessage, FALSE); + break; + } + case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - uint32_t dwCmd = pMsg->m_dwCmd; - switch (dwCmd) { + switch (pMsg->m_dwCmd) { case FWL_MSGMOUSECMD_LButtonDown: { OnLButtonDown(pMsg); break; @@ -1010,31 +1014,36 @@ int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { OnLButtonUp(pMsg); break; } - default: {} + default: + break; } break; } - case FWL_MSGHASH_MouseWheel: { + case CFWL_MessageType::MouseWheel: { OnMouseWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage)); break; } - case FWL_MSGHASH_Key: { + case CFWL_MessageType::Key: { CFWL_MsgKey* pMsg = static_cast<CFWL_MsgKey*>(pMessage); if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown) OnKeyDown(pMsg); break; } - default: { iRet = 0; } + default: { + iRet = 0; + break; + } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); return iRet; } + FWL_ERR CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { if (!pEvent) return FWL_ERR_Indefinite; - if (pEvent->GetClassID() != FWL_EVTHASH_Scroll) { + if (pEvent->GetClassID() != CFWL_EventType::Scroll) return FWL_ERR_Succeeded; - } + IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; if ((pSrcTarget == m_pOwner->m_pVertScrollBar.get() && m_pOwner->m_pVertScrollBar) || @@ -1046,6 +1055,7 @@ FWL_ERR CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { } return FWL_ERR_Succeeded; } + FWL_ERR CFWL_ListBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { return m_pOwner->DrawWidget(pGraphics, pMatrix); diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp index 1965e400b7..0c6539b51d 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp @@ -1013,28 +1013,33 @@ FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { rtDay = pDateInfo->rect; return TRUE; } + CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate( CFWL_MonthCalendarImp* pOwner) : m_pOwner(pOwner) {} + int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( CFWL_Message* pMessage) { if (!pMessage) return 0; - uint32_t dwMsgCode = pMessage->GetClassID(); + + CFWL_MessageType dwMsgCode = pMessage->GetClassID(); int32_t iRet = 1; switch (dwMsgCode) { - case FWL_MSGHASH_SetFocus: - case FWL_MSGHASH_KillFocus: { - OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); + case CFWL_MessageType::SetFocus: { + OnFocusChanged(pMessage, TRUE); break; } - case FWL_MSGHASH_Key: { + case CFWL_MessageType::KillFocus: { + OnFocusChanged(pMessage, FALSE); break; } - case FWL_MSGHASH_Mouse: { + case CFWL_MessageType::Key: { + break; + } + case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); - uint32_t dwCmd = pMouse->m_dwCmd; - switch (dwCmd) { + switch (pMouse->m_dwCmd) { case FWL_MSGMOUSECMD_LButtonDown: { OnLButtonDown(pMouse); break; @@ -1051,7 +1056,8 @@ int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( OnMouseLeave(pMouse); break; } - default: { break; } + default: + break; } break; } @@ -1063,6 +1069,7 @@ int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); return iRet; } + FWL_ERR CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { return m_pOwner->DrawWidget(pGraphics, pMatrix); diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp index 92f0ca11d2..167d8f3c1f 100644 --- a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp @@ -398,27 +398,31 @@ void CFWL_PushButtonImp::UpdateTextOutStyles() { m_dwTTOStyles |= FDE_TTOSTYLE_RTL; } } + CFWL_PushButtonImpDelegate::CFWL_PushButtonImpDelegate( CFWL_PushButtonImp* pOwner) : m_pOwner(pOwner) {} + int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return 0; - if (!m_pOwner->IsEnabled()) { + if (!m_pOwner->IsEnabled()) return 1; - } + int32_t iRet = 1; - uint32_t dwMsgCode = pMessage->GetClassID(); + CFWL_MessageType dwMsgCode = pMessage->GetClassID(); switch (dwMsgCode) { - case FWL_MSGHASH_SetFocus: - case FWL_MSGHASH_KillFocus: { - OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); + case CFWL_MessageType::SetFocus: { + OnFocusChanged(pMessage, TRUE); break; } - case FWL_MSGHASH_Mouse: { + case CFWL_MessageType::KillFocus: { + OnFocusChanged(pMessage, FALSE); + break; + } + case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - uint32_t dwCmd = pMsg->m_dwCmd; - switch (dwCmd) { + switch (pMsg->m_dwCmd) { case FWL_MSGMOUSECMD_LButtonDown: { OnLButtonDown(pMsg); break; @@ -435,15 +439,15 @@ int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { OnMouseLeave(pMsg); break; } - default: {} + default: + break; } break; } - case FWL_MSGHASH_Key: { + case CFWL_MessageType::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); - if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { + if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) OnKeyDown(pKey); - } break; } default: { @@ -454,6 +458,7 @@ int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); return iRet; } + FWL_ERR CFWL_PushButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { return FWL_ERR_Succeeded; } diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp index 8812076f6b..fed93fbc07 100644 --- a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp +++ b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp @@ -625,14 +625,17 @@ FX_BOOL CFWL_ScrollBarImp::OnScroll(uint32_t dwCode, FX_FLOAT fPos) { DispatchEvent(&ev); return bRet; } + CFWL_ScrollBarImpDelegate::CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner) : m_pOwner(pOwner) {} + int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return 0; + int32_t iRet = 1; - 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) { @@ -652,9 +655,12 @@ int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { OnMouseLeave(); break; } - default: { iRet = 0; } + default: { + iRet = 0; + break; + } } - } else if (dwMsgCode == FWL_MSGHASH_MouseWheel) { + } else if (dwMsgCode == CFWL_MessageType::MouseWheel) { CFWL_MsgMouseWheel* pMsg = static_cast<CFWL_MsgMouseWheel*>(pMessage); OnMouseWheel(pMsg->m_fx, pMsg->m_fy, pMsg->m_dwFlags, pMsg->m_fDeltaX, pMsg->m_fDeltaY); @@ -663,6 +669,7 @@ int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } return iRet; } + FWL_ERR CFWL_ScrollBarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { return m_pOwner->DrawWidget(pGraphics, pMatrix); diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp index e52529d3c6..6d60d81e81 100644 --- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp @@ -201,24 +201,29 @@ void CFWL_SpinButtonImp::DrawDownButton(CFX_Graphics* pGraphics, params.m_rtPart = m_rtDnButton; pTheme->DrawBackground(¶ms); } + CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate( CFWL_SpinButtonImp* pOwner) : m_pOwner(pOwner) {} + int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return 0; + int32_t iRet = 1; - uint32_t dwMsgCode = pMessage->GetClassID(); + CFWL_MessageType dwMsgCode = pMessage->GetClassID(); switch (dwMsgCode) { - case FWL_MSGHASH_SetFocus: - case FWL_MSGHASH_KillFocus: { - OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); + case CFWL_MessageType::SetFocus: { + OnFocusChanged(pMessage, TRUE); + break; + } + case CFWL_MessageType::KillFocus: { + OnFocusChanged(pMessage, FALSE); 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) { + switch (pMsg->m_dwCmd) { case FWL_MSGMOUSECMD_LButtonDown: { OnLButtonDown(pMsg); break; @@ -235,15 +240,15 @@ int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { OnMouseLeave(pMsg); break; } - default: {} + default: + break; } break; } - case FWL_MSGHASH_Key: { + case CFWL_MessageType::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); - if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { + if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) OnKeyDown(pKey); - } break; } default: { @@ -254,6 +259,7 @@ int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); return iRet; } + FWL_ERR CFWL_SpinButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { return FWL_ERR_Succeeded; } diff --git a/xfa/fwl/basewidget/ifwl_checkbox.h b/xfa/fwl/basewidget/ifwl_checkbox.h index f4cfe5f956..0f4b42c2c8 100644 --- a/xfa/fwl/basewidget/ifwl_checkbox.h +++ b/xfa/fwl/basewidget/ifwl_checkbox.h @@ -45,11 +45,8 @@ #define FWL_STATE_CKB_Neutral (2 << (FWL_WGTSTATE_MAX + 2)) #define FWL_STATE_CKB_CheckMask (3L << (FWL_WGTSTATE_MAX + 2)) -// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 -#define FWL_EVTHASH_CKB_CheckStateChanged 2503252963 - BEGIN_FWL_EVENT_DEF(CFWL_EvtCkbCheckStateChanged, - FWL_EVTHASH_CKB_CheckStateChanged) + CFWL_EventType::CheckStateChanged) END_FWL_EVENT_DEF class IFWL_CheckBoxDP : public IFWL_DataProvider { diff --git a/xfa/fwl/basewidget/ifwl_combobox.h b/xfa/fwl/basewidget/ifwl_combobox.h index 826404f9aa..b76724811b 100644 --- a/xfa/fwl/basewidget/ifwl_combobox.h +++ b/xfa/fwl/basewidget/ifwl_combobox.h @@ -38,40 +38,32 @@ class IFWL_ComboBox; #define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12) #define FWL_STYLEEXT_CMB_ListItemAlignMask (3L << 12) #define FWL_STYLEEXT_CMB_ReadOnly (1L << 13) -// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 -#define FWL_EVTHASH_CMB_PreDropDown 1357646798 -#define FWL_EVTHASH_CMB_PostDropDown 3677010285 -#define FWL_EVTHASH_CMB_CloseUp 2871271190 -#define FWL_EVTHASH_CMB_EditChanged 1527034762 -#define FWL_EVTHASH_CMB_SelChanged 2923227784 -#define FWL_EVTHASH_CMB_HoverChanged 944325448 -#define FWL_EVTHASH_CMB_DrawItem 917354551 - -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, FWL_EVTHASH_CMB_PreDropDown) + +BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, CFWL_EventType::PreDropDown) END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, FWL_EVTHASH_CMB_PostDropDown) +BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, CFWL_EventType::PostDropDown) END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbCloseUp, FWL_EVTHASH_CMB_CloseUp) +BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbCloseUp, CFWL_EventType::CloseUp) END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbEditChanged, FWL_EVTHASH_CMB_EditChanged) +BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbEditChanged, CFWL_EventType::EditChanged) int32_t nChangeType; CFX_WideString wsInsert; CFX_WideString wsDelete; END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbSelChanged, FWL_EVTHASH_CMB_SelChanged) +BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbSelChanged, CFWL_EventType::SelectChanged) CFX_Int32Array iArraySels; FX_BOOL bLButtonUp; END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged, FWL_EVTHASH_CMB_HoverChanged) +BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged, CFWL_EventType::HoverChanged) int32_t m_iCurHover; END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbDrawItem, FWL_EVTHASH_CMB_DrawItem) +BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbDrawItem, CFWL_EventType::DrawItem) CFX_Graphics* m_pGraphics; CFX_Matrix m_matrix; int32_t m_index; diff --git a/xfa/fwl/basewidget/ifwl_datetimepicker.h b/xfa/fwl/basewidget/ifwl_datetimepicker.h index 07bc8715c3..3d1188eead 100644 --- a/xfa/fwl/basewidget/ifwl_datetimepicker.h +++ b/xfa/fwl/basewidget/ifwl_datetimepicker.h @@ -30,28 +30,22 @@ #define FWL_STYLEEXT_DTP_EditHAlignMask (3L << 4) #define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6) #define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8) -// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 -#define FWL_EVTHASH_DTP_DropDown 264728733 -#define FWL_EVTHASH_DTP_CloseUp 4280973803 -#define FWL_EVTHASH_DTP_EditChanged 4009610944 -#define FWL_EVTHASH_DTP_HoverChanged 686674750 -#define FWL_EVTHASH_DTP_SelectChanged 1589616858 -BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpDropDown, FWL_EVTHASH_DTP_DropDown) +BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpDropDown, CFWL_EventType::DropDown) END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpCloseUp, FWL_EVTHASH_DTP_CloseUp) +BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpCloseUp, CFWL_EventType::CloseUp) END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpEditChanged, FWL_EVTHASH_DTP_EditChanged) +BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpEditChanged, CFWL_EventType::EditChanged) CFX_WideString m_wsText; END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpHoverChanged, FWL_EVTHASH_DTP_HoverChanged) +BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpHoverChanged, CFWL_EventType::HoverChanged) int32_t hoverday; END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged, FWL_EVTHASH_DTP_SelectChanged) +BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged, CFWL_EventType::SelectChanged) int32_t iYear; int32_t iMonth; int32_t iDay; diff --git a/xfa/fwl/basewidget/ifwl_edit.h b/xfa/fwl/basewidget/ifwl_edit.h index caa2b530b8..eb8c77b8a6 100644 --- a/xfa/fwl/basewidget/ifwl_edit.h +++ b/xfa/fwl/basewidget/ifwl_edit.h @@ -9,6 +9,7 @@ #include <vector> +#include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/lightwidget/cfwl_widget.h" @@ -49,13 +50,6 @@ #define FWL_STYLEEXT_EDT_LastLineHeight (1L << 27) #define FWL_PARTDATA_EDT_Background 0 #define FWL_PARTDATA_EDT_StaticBackground 1 -// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 -#define FWL_EVTHASH_EDT_TextChanged 1064022132 -#define FWL_EVTHASH_EDT_PreSelfAdaption 1001979178 -#define FWL_EVTHASH_EDT_Validate 3373308608 -#define FWL_EVTHASH_EDT_CheckWord 2897181520 -#define FWL_EVTHASH_EDT_GetSuggestWords 315782791 -#define FWL_EVTHASH_EDT_TextFull 2158580174 typedef struct FWL_HEDTFIND_ { void* pData; } * FWL_HEDTFIND; @@ -65,34 +59,35 @@ enum FWL_EDT_TEXTCHANGED { FWL_EDT_TEXTCHANGED_Replace, }; -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtTextChanged, FWL_EVTHASH_EDT_TextChanged) +BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtTextChanged, CFWL_EventType::TextChanged) int32_t nChangeType; CFX_WideString wsInsert; CFX_WideString wsDelete; CFX_WideString wsPrevText; END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtTextFull, FWL_EVTHASH_EDT_TextFull) +BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtTextFull, CFWL_EventType::TextFull) END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtPreSelfAdaption, FWL_EVTHASH_EDT_PreSelfAdaption) +BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtPreSelfAdaption, CFWL_EventType::PreSelfAdaption) FX_BOOL bHSelfAdaption; FX_BOOL bVSelfAdaption; CFX_RectF rtAfterChange; END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtValidate, FWL_EVTHASH_EDT_Validate) +BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtValidate, CFWL_EventType::Validate) IFWL_Widget* pDstWidget; CFX_WideString wsInsert; FX_BOOL bValidate; END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtCheckWord, FWL_EVTHASH_EDT_CheckWord) +BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtCheckWord, CFWL_EventType::CheckWord) CFX_ByteString bsWord; FX_BOOL bCheckWord; END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtGetSuggestWords, FWL_EVTHASH_EDT_GetSuggestWords) +BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtGetSuggestWords, + CFWL_EventType::GetSuggestedWords) FX_BOOL bSuggestWords; CFX_ByteString bsWord; std::vector<CFX_ByteString> bsArraySuggestWords; diff --git a/xfa/fwl/basewidget/ifwl_listbox.h b/xfa/fwl/basewidget/ifwl_listbox.h index af4335aa03..87d11a3c56 100644 --- a/xfa/fwl/basewidget/ifwl_listbox.h +++ b/xfa/fwl/basewidget/ifwl_listbox.h @@ -30,9 +30,6 @@ #define FWL_ITEMSTATE_LTB_Selected (1L << 0) #define FWL_ITEMSTATE_LTB_Focused (1L << 1) #define FWL_ITEMSTATE_LTB_Checked (1L << 2) -// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 -#define FWL_EVTHASH_LTB_SelChanged 1701781688 -#define FWL_EVTHASH_LTB_DrawItem 1050853991 typedef struct FWL_HLISTITEM_ { void* pData; } * FWL_HLISTITEM; @@ -44,11 +41,11 @@ struct FWL_ListBoxItemData { int32_t iIndex; }; -BEGIN_FWL_EVENT_DEF(CFWL_EvtLtbSelChanged, FWL_EVTHASH_LTB_SelChanged) +BEGIN_FWL_EVENT_DEF(CFWL_EvtLtbSelChanged, CFWL_EventType::SelectChanged) CFX_Int32Array iarraySels; END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EvtLtbDrawItem, FWL_EVTHASH_LTB_DrawItem) +BEGIN_FWL_EVENT_DEF(CFWL_EvtLtbDrawItem, CFWL_EventType::DrawItem) CFX_Graphics* m_pGraphics; CFX_Matrix m_matrix; int32_t m_index; diff --git a/xfa/fwl/basewidget/ifwl_monthcalendar.h b/xfa/fwl/basewidget/ifwl_monthcalendar.h index ad3ce1d62e..38e06f265b 100644 --- a/xfa/fwl/basewidget/ifwl_monthcalendar.h +++ b/xfa/fwl/basewidget/ifwl_monthcalendar.h @@ -22,16 +22,13 @@ #define FWL_ITEMSTATE_MCD_Flag (1L << 0) #define FWL_ITEMSTATE_MCD_Selected (1L << 1) #define FWL_ITEMSTATE_MCD_Focused (1L << 2) -#define FWL_NOTEHASH_MCD_DATASELECTED 1085596932 -// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 -#define FWL_EVTHASH_MCD_DateChanged 54212227 -BEGIN_FWL_EVENT_DEF(CFWL_Event_McdDateSelected, FWL_NOTEHASH_MCD_DATASELECTED) +BEGIN_FWL_EVENT_DEF(CFWL_Event_McdDateSelected, CFWL_EventType::DataSelected) int32_t m_iStartDay; int32_t m_iEndDay; END_FWL_EVENT_DEF -BEGIN_FWL_EVENT_DEF(CFWL_EventMcdDateChanged, FWL_EVTHASH_MCD_DateChanged) +BEGIN_FWL_EVENT_DEF(CFWL_EventMcdDateChanged, CFWL_EventType::DateChanged) int32_t m_iOldYear; int32_t m_iOldMonth; int32_t m_iStartDay; diff --git a/xfa/fwl/basewidget/ifwl_spinbutton.h b/xfa/fwl/basewidget/ifwl_spinbutton.h index 9a8ff59520..b98e2255ff 100644 --- a/xfa/fwl/basewidget/ifwl_spinbutton.h +++ b/xfa/fwl/basewidget/ifwl_spinbutton.h @@ -14,10 +14,8 @@ #define FWL_STYLEEXE_SPB_Vert (1L << 0) #define FWL_WGTHITTEST_SPB_UpButton (FWL_WGTHITTEST_MAX + 1) #define FWL_WGTHITTEST_SPB_DownButton (FWL_WGTHITTEST_MAX + 2) -// TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 -#define FWL_EVTHASH_SPB_Click 2927651187 -BEGIN_FWL_EVENT_DEF(CFWL_EvtSpbClick, FWL_EVTHASH_SPB_Click) +BEGIN_FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click) FX_BOOL m_bUp; END_FWL_EVENT_DEF |