diff options
Diffstat (limited to 'xfa')
77 files changed, 332 insertions, 964 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.cpp b/xfa/fwl/core/cfwl_barcode.cpp index 6ddcdf3920..8f5b08113c 100644 --- a/xfa/fwl/core/cfwl_barcode.cpp +++ b/xfa/fwl/core/cfwl_barcode.cpp @@ -88,7 +88,7 @@ bool CFWL_Barcode::IsProtectedType() const { } void CFWL_Barcode::OnProcessEvent(CFWL_Event* pEvent) { - if (pEvent->GetClassID() == CFWL_EventType::TextChanged) { + if (pEvent->GetType() == CFWL_Event::Type::TextChanged) { m_pBarcodeEngine.reset(); m_dwStatus = XFA_BCS_NeedUpdate; } diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp index cdd8211b60..dc042d5c39 100644 --- a/xfa/fwl/core/cfwl_checkbox.cpp +++ b/xfa/fwl/core/cfwl_checkbox.cpp @@ -13,7 +13,7 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" #include "xfa/fwl/core/cfwl_app.h" -#include "xfa/fwl/core/cfwl_evtcheckstatechanged.h" +#include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_msgkey.h" #include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_notedriver.h" @@ -339,8 +339,7 @@ void CFWL_CheckBox::NextStates() { if (dwFirststate == m_pProperties->m_dwStates) return; - CFWL_EvtCheckStateChanged wmCheckBoxState; - wmCheckBoxState.m_pSrcTarget = this; + CFWL_Event wmCheckBoxState(CFWL_Event::Type::CheckStateChanged, this); DispatchEvent(&wmCheckBoxState); } @@ -348,14 +347,14 @@ void CFWL_CheckBox::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - switch (pMessage->GetClassID()) { - case CFWL_MessageType::SetFocus: + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: OnFocusChanged(true); break; - case CFWL_MessageType::KillFocus: + case CFWL_Message::Type::KillFocus: OnFocusChanged(false); break; - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -375,7 +374,7 @@ void CFWL_CheckBox::OnProcessMessage(CFWL_Message* pMessage) { } break; } - case CFWL_MessageType::Key: { + case CFWL_Message::Type::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pKey); @@ -474,10 +473,8 @@ void CFWL_CheckBox::OnMouseLeave() { } void CFWL_CheckBox::OnKeyDown(CFWL_MsgKey* pMsg) { - if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { - DispatchKeyEvent(pMsg); + if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) return; - } if (pMsg->m_dwKeyCode == FWL_VKEY_Return || pMsg->m_dwKeyCode == FWL_VKEY_Space) { NextStates(); diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index 5996af9c41..c8486c39c4 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -14,9 +14,7 @@ #include "xfa/fde/cfde_txtedtengine.h" #include "xfa/fde/tto/fde_textout.h" #include "xfa/fwl/core/cfwl_app.h" -#include "xfa/fwl/core/cfwl_evteditchanged.h" -#include "xfa/fwl/core/cfwl_evtpostdropdown.h" -#include "xfa/fwl/core/cfwl_evtpredropdown.h" +#include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_evtselectchanged.h" #include "xfa/fwl/core/cfwl_evttextchanged.h" #include "xfa/fwl/core/cfwl_formproxy.h" @@ -399,8 +397,7 @@ void CFWL_ComboBox::ShowDropList(bool bActivate) { m_pListBox->SetWidgetRect(m_rtList); m_pListBox->Update(); - CFWL_EvtPreDropDown ev; - ev.m_pSrcTarget = this; + CFWL_Event ev(CFWL_Event::Type::PreDropDown, this); DispatchEvent(&ev); m_fItemHeight = m_pListBox->GetItemHeight(); @@ -553,9 +550,8 @@ void CFWL_ComboBox::ProcessSelChanged(bool bLButtonUp) { m_pEdit->SetSelected(); } - CFWL_EvtSelectChanged ev; + CFWL_EvtSelectChanged ev(this); ev.bLButtonUp = bLButtonUp; - ev.m_pSrcTarget = this; DispatchEvent(&ev); } @@ -608,8 +604,7 @@ void CFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { return; if (bActivate) { - CFWL_EvtPreDropDown preEvent; - preEvent.m_pSrcTarget = this; + CFWL_Event preEvent(CFWL_Event::Type::PreDropDown, this); DispatchEvent(&preEvent); CFWL_ComboList* pComboList = m_pListBox.get(); @@ -642,8 +637,7 @@ void CFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { m_pListBox->SetStates(FWL_WGTSTATE_Invisible, !bActivate); if (bActivate) { - CFWL_EvtPostDropDown postEvent; - postEvent.m_pSrcTarget = this; + CFWL_Event postEvent(CFWL_Event::Type::PostDropDown, this); DispatchEvent(&postEvent); } @@ -794,14 +788,14 @@ void CFWL_ComboBox::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - switch (pMessage->GetClassID()) { - case CFWL_MessageType::SetFocus: + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: OnFocusChanged(pMessage, true); break; - case CFWL_MessageType::KillFocus: + case CFWL_Message::Type::KillFocus: OnFocusChanged(pMessage, false); break; - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -821,7 +815,7 @@ void CFWL_ComboBox::OnProcessMessage(CFWL_Message* pMessage) { } break; } - case CFWL_MessageType::Key: + case CFWL_Message::Type::Key: OnKey(static_cast<CFWL_MsgKey*>(pMessage)); break; default: @@ -832,17 +826,15 @@ void CFWL_ComboBox::OnProcessMessage(CFWL_Message* pMessage) { } void CFWL_ComboBox::OnProcessEvent(CFWL_Event* pEvent) { - CFWL_EventType dwFlag = pEvent->GetClassID(); - if (dwFlag == CFWL_EventType::Scroll) { + CFWL_Event::Type type = pEvent->GetType(); + if (type == CFWL_Event::Type::Scroll) { CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); - CFWL_EvtScroll pScrollEv; - pScrollEv.m_pSrcTarget = this; + CFWL_EvtScroll pScrollEv(this); pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode; pScrollEv.m_fPos = pScrollEvent->m_fPos; DispatchEvent(&pScrollEv); - } else if (dwFlag == CFWL_EventType::TextChanged) { - CFWL_EvtEditChanged pTemp; - pTemp.m_pSrcTarget = this; + } else if (type == CFWL_Event::Type::TextChanged) { + CFWL_Event pTemp(CFWL_Event::Type::EditChanged, this); DispatchEvent(&pTemp); } } @@ -934,10 +926,8 @@ void CFWL_ComboBox::OnMouseLeave(CFWL_MsgMouse* pMsg) { void CFWL_ComboBox::OnKey(CFWL_MsgKey* pMsg) { uint32_t dwKeyCode = pMsg->m_dwKeyCode; - if (dwKeyCode == FWL_VKEY_Tab) { - DispatchKeyEvent(pMsg); + if (dwKeyCode == FWL_VKEY_Tab) return; - } if (pMsg->m_pDstTarget == this) DoSubCtrlKey(pMsg); } @@ -990,18 +980,18 @@ void CFWL_ComboBox::DisForm_OnProcessMessage(CFWL_Message* pMessage) { return; bool backDefault = true; - switch (pMessage->GetClassID()) { - case CFWL_MessageType::SetFocus: { + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: { backDefault = false; DisForm_OnFocusChanged(pMessage, true); break; } - case CFWL_MessageType::KillFocus: { + case CFWL_Message::Type::KillFocus: { backDefault = false; DisForm_OnFocusChanged(pMessage, false); break; } - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::Mouse: { backDefault = false; CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { @@ -1016,7 +1006,7 @@ void CFWL_ComboBox::DisForm_OnProcessMessage(CFWL_Message* pMessage) { } break; } - case CFWL_MessageType::Key: { + case CFWL_Message::Type::Key: { backDefault = false; CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); if (pKey->m_dwCmd == FWL_KeyCommand::KeyUp) @@ -1061,17 +1051,13 @@ void CFWL_ComboBox::DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet) { if (bSet) { m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; if ((m_pEdit->GetStates() & FWL_WGTSTATE_Focused) == 0) { - CFWL_MsgSetFocus msg; - msg.m_pDstTarget = m_pEdit.get(); - msg.m_pSrcTarget = nullptr; + CFWL_MsgSetFocus msg(nullptr, m_pEdit.get()); m_pEdit->GetDelegate()->OnProcessMessage(&msg); } } else { m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; DisForm_ShowDropList(false); - CFWL_MsgKillFocus msg; - msg.m_pDstTarget = nullptr; - msg.m_pSrcTarget = m_pEdit.get(); + CFWL_MsgKillFocus msg(m_pEdit.get()); m_pEdit->GetDelegate()->OnProcessMessage(&msg); } } diff --git a/xfa/fwl/core/cfwl_comboboxproxy.cpp b/xfa/fwl/core/cfwl_comboboxproxy.cpp index 4ad358d723..4fb6bbb3ac 100644 --- a/xfa/fwl/core/cfwl_comboboxproxy.cpp +++ b/xfa/fwl/core/cfwl_comboboxproxy.cpp @@ -31,8 +31,8 @@ void CFWL_ComboBoxProxy::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - switch (pMessage->GetClassID()) { - case CFWL_MessageType::Mouse: { + switch (pMessage->GetType()) { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -46,10 +46,10 @@ void CFWL_ComboBoxProxy::OnProcessMessage(CFWL_Message* pMessage) { } break; } - case CFWL_MessageType::KillFocus: + case CFWL_Message::Type::KillFocus: OnFocusChanged(pMessage, false); break; - case CFWL_MessageType::SetFocus: + case CFWL_Message::Type::SetFocus: OnFocusChanged(pMessage, true); break; default: diff --git a/xfa/fwl/core/cfwl_comboedit.cpp b/xfa/fwl/core/cfwl_comboedit.cpp index af5c2a74b6..32e4cbb2dc 100644 --- a/xfa/fwl/core/cfwl_comboedit.cpp +++ b/xfa/fwl/core/cfwl_comboedit.cpp @@ -47,18 +47,18 @@ void CFWL_ComboEdit::OnProcessMessage(CFWL_Message* pMessage) { return; bool backDefault = true; - switch (pMessage->GetClassID()) { - case CFWL_MessageType::SetFocus: { + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: { m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; backDefault = false; break; } - case CFWL_MessageType::KillFocus: { + case CFWL_Message::Type::KillFocus: { m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; backDefault = false; break; } - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) && ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) { diff --git a/xfa/fwl/core/cfwl_combolist.cpp b/xfa/fwl/core/cfwl_combolist.cpp index e333cda18a..ad80ac0475 100644 --- a/xfa/fwl/core/cfwl_combolist.cpp +++ b/xfa/fwl/core/cfwl_combolist.cpp @@ -77,12 +77,12 @@ void CFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - CFWL_MessageType dwHashCode = pMessage->GetClassID(); + CFWL_Message::Type type = pMessage->GetType(); bool backDefault = true; - if (dwHashCode == CFWL_MessageType::SetFocus || - dwHashCode == CFWL_MessageType::KillFocus) { - OnDropListFocusChanged(pMessage, dwHashCode == CFWL_MessageType::SetFocus); - } else if (dwHashCode == CFWL_MessageType::Mouse) { + if (type == CFWL_Message::Type::SetFocus || + type == CFWL_Message::Type::KillFocus) { + OnDropListFocusChanged(pMessage, type == CFWL_Message::Type::SetFocus); + } else if (type == CFWL_Message::Type::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); CFWL_ScrollBar* vertSB = GetVertScrollBar(); if (IsShowScrollBar(true) && vertSB) { @@ -114,7 +114,7 @@ void CFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) { default: break; } - } else if (dwHashCode == CFWL_MessageType::Key) { + } else if (type == CFWL_Message::Type::Key) { backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage)); } if (backDefault) diff --git a/xfa/fwl/core/cfwl_datetimeedit.cpp b/xfa/fwl/core/cfwl_datetimeedit.cpp index b74efb1284..dc7aa1faef 100644 --- a/xfa/fwl/core/cfwl_datetimeedit.cpp +++ b/xfa/fwl/core/cfwl_datetimeedit.cpp @@ -26,18 +26,17 @@ void CFWL_DateTimeEdit::OnProcessMessage(CFWL_Message* pMessage) { return; } - CFWL_MessageType dwHashCode = pMessage->GetClassID(); - if (dwHashCode == CFWL_MessageType::SetFocus || - dwHashCode == CFWL_MessageType::KillFocus) { + CFWL_Message::Type type = pMessage->GetType(); + if (type == CFWL_Message::Type::SetFocus || + type == CFWL_Message::Type::KillFocus) { CFWL_Widget* pOuter = GetOuter(); pOuter->GetDelegate()->OnProcessMessage(pMessage); } } void CFWL_DateTimeEdit::DisForm_OnProcessMessage(CFWL_Message* pMessage) { - CFWL_MessageType dwHashCode = pMessage->GetClassID(); if (!m_pWidgetMgr->IsFormDisabled() || - dwHashCode != CFWL_MessageType::Mouse) { + pMessage->GetType() != CFWL_Message::Type::Mouse) { CFWL_Edit::OnProcessMessage(pMessage); return; } diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp index 35b038d6ce..28f174c374 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.cpp +++ b/xfa/fwl/core/cfwl_datetimepicker.cpp @@ -10,7 +10,7 @@ #include <utility> #include "third_party/base/ptr_util.h" -#include "xfa/fwl/core/cfwl_evteditchanged.h" +#include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_evtselectchanged.h" #include "xfa/fwl/core/cfwl_formproxy.h" #include "xfa/fwl/core/cfwl_msgmouse.h" @@ -192,7 +192,7 @@ void CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { m_pEdit->SetText(wsText); Repaint(&m_rtClient); - CFWL_EvtEditChanged ev; + CFWL_Event ev(CFWL_Event::Type::EditChanged); DispatchEvent(&ev); } @@ -347,8 +347,7 @@ void CFWL_DateTimePicker::ProcessSelChanged(int32_t iYear, m_pEdit->Update(); Repaint(&m_rtClient); - CFWL_EvtSelectChanged ev; - ev.m_pSrcTarget = this; + CFWL_EvtSelectChanged ev(this); ev.iYear = m_iYear; ev.iMonth = m_iMonth; ev.iDay = m_iDay; @@ -399,9 +398,7 @@ void CFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) { m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible, !bActivate); if (bActivate) { - CFWL_MsgSetFocus msg; - msg.m_pDstTarget = m_pMonthCal.get(); - msg.m_pSrcTarget = m_pEdit.get(); + CFWL_MsgSetFocus msg(m_pEdit.get(), m_pMonthCal.get()); m_pEdit->GetDelegate()->OnProcessMessage(&msg); } @@ -520,14 +517,14 @@ void CFWL_DateTimePicker::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - switch (pMessage->GetClassID()) { - case CFWL_MessageType::SetFocus: + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: OnFocusChanged(pMessage, true); break; - case CFWL_MessageType::KillFocus: + case CFWL_Message::Type::KillFocus: OnFocusChanged(pMessage, false); break; - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMouse->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -547,7 +544,7 @@ void CFWL_DateTimePicker::OnProcessMessage(CFWL_Message* pMessage) { } break; } - case CFWL_MessageType::Key: { + case CFWL_Message::Type::Key: { if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { m_pEdit->GetDelegate()->OnProcessMessage(pMessage); return; diff --git a/xfa/fwl/core/cfwl_edit.cpp b/xfa/fwl/core/cfwl_edit.cpp index 4544ebcb82..751bf4336a 100644 --- a/xfa/fwl/core/cfwl_edit.cpp +++ b/xfa/fwl/core/cfwl_edit.cpp @@ -20,9 +20,9 @@ #include "xfa/fgas/font/cfgas_gefont.h" #include "xfa/fwl/core/cfwl_app.h" #include "xfa/fwl/core/cfwl_caret.h" +#include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_evtcheckword.h" #include "xfa/fwl/core/cfwl_evttextchanged.h" -#include "xfa/fwl/core/cfwl_evttextfull.h" #include "xfa/fwl/core/cfwl_evtvalidate.h" #include "xfa/fwl/core/cfwl_msgkey.h" #include "xfa/fwl/core/cfwl_msgmouse.h" @@ -200,8 +200,7 @@ void CFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics, pGraphics->ConcatMatrix(const_cast<CFX_Matrix*>(pMatrix)); CFX_Color crLine(0xFFFF0000); - CFWL_EvtCheckWord checkWordEvent; - checkWordEvent.m_pSrcTarget = this; + CFWL_EvtCheckWord checkWordEvent(this); CFX_ByteString sLatinWord; CFX_Path pathSpell; @@ -452,11 +451,7 @@ void CFWL_Edit::On_TextChanged(CFDE_TxtEdtEngine* pEdit, CFX_RectF rtTemp; GetClientRect(rtTemp); - CFWL_EvtTextChanged event; - event.m_pSrcTarget = this; - event.nChangeType = ChangeInfo.nChangeType; - event.wsInsert = ChangeInfo.wsInsert; - event.wsDelete = ChangeInfo.wsDelete; + CFWL_EvtTextChanged event(this); event.wsPrevText = ChangeInfo.wsPrevText; DispatchEvent(&event); @@ -502,9 +497,7 @@ bool CFWL_Edit::On_Validate(CFDE_TxtEdtEngine* pEdit, CFX_WideString& wsText) { if (!pDst) pDst = this; - CFWL_EvtValidate event; - event.pDstWidget = pDst; - event.m_pSrcTarget = this; + CFWL_EvtValidate event(this); event.wsInsert = wsText; event.bValidate = true; DispatchEvent(&event); @@ -1277,8 +1270,7 @@ void CFWL_Edit::ProcessInsertError(int32_t iError) { if (iError != -2) return; - CFWL_EvtTextFull textFullEvent; - textFullEvent.m_pSrcTarget = this; + CFWL_Event textFullEvent(CFWL_Event::Type::TextFull, this); DispatchEvent(&textFullEvent); } @@ -1286,13 +1278,14 @@ void CFWL_Edit::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - switch (dwMsgCode) { - case CFWL_MessageType::SetFocus: - case CFWL_MessageType::KillFocus: - OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: + OnFocusChanged(pMessage, true); break; - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::KillFocus: + OnFocusChanged(pMessage, false); + break; + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -1315,7 +1308,7 @@ void CFWL_Edit::OnProcessMessage(CFWL_Message* pMessage) { } break; } - case CFWL_MessageType::Key: { + case CFWL_Message::Type::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pKey); @@ -1332,7 +1325,7 @@ void CFWL_Edit::OnProcessMessage(CFWL_Message* pMessage) { void CFWL_Edit::OnProcessEvent(CFWL_Event* pEvent) { if (!pEvent) return; - if (pEvent->GetClassID() != CFWL_EventType::Scroll) + if (pEvent->GetType() != CFWL_Event::Type::Scroll) return; CFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; @@ -1522,11 +1515,7 @@ void CFWL_Edit::OnKeyDown(CFWL_MsgKey* pMsg) { break; } case FWL_VKEY_F2: - break; - case FWL_VKEY_Tab: { - DispatchKeyEvent(pMsg); - break; - } + case FWL_VKEY_Tab: default: break; } @@ -1589,54 +1578,54 @@ void CFWL_Edit::OnChar(CFWL_MsgKey* pMsg) { } bool CFWL_Edit::OnScroll(CFWL_ScrollBar* pScrollBar, - FWL_SCBCODE dwCode, + CFWL_EvtScroll::Code dwCode, FX_FLOAT fPos) { CFX_SizeF fs; pScrollBar->GetRange(&fs.x, &fs.y); FX_FLOAT iCurPos = pScrollBar->GetPos(); FX_FLOAT fStep = pScrollBar->GetStepSize(); switch (dwCode) { - case FWL_SCBCODE::Min: { + case CFWL_EvtScroll::Code::Min: { fPos = fs.x; break; } - case FWL_SCBCODE::Max: { + case CFWL_EvtScroll::Code::Max: { fPos = fs.y; break; } - case FWL_SCBCODE::StepBackward: { + case CFWL_EvtScroll::Code::StepBackward: { fPos -= fStep; if (fPos < fs.x + fStep / 2) { fPos = fs.x; } break; } - case FWL_SCBCODE::StepForward: { + case CFWL_EvtScroll::Code::StepForward: { fPos += fStep; if (fPos > fs.y - fStep / 2) { fPos = fs.y; } break; } - case FWL_SCBCODE::PageBackward: { + case CFWL_EvtScroll::Code::PageBackward: { fPos -= pScrollBar->GetPageSize(); if (fPos < fs.x) { fPos = fs.x; } break; } - case FWL_SCBCODE::PageForward: { + case CFWL_EvtScroll::Code::PageForward: { fPos += pScrollBar->GetPageSize(); if (fPos > fs.y) { fPos = fs.y; } break; } - case FWL_SCBCODE::Pos: - case FWL_SCBCODE::TrackPos: - case FWL_SCBCODE::None: + case CFWL_EvtScroll::Code::Pos: + case CFWL_EvtScroll::Code::TrackPos: + case CFWL_EvtScroll::Code::None: break; - case FWL_SCBCODE::EndScroll: + case CFWL_EvtScroll::Code::EndScroll: return false; } if (iCurPos == fPos) diff --git a/xfa/fwl/core/cfwl_edit.h b/xfa/fwl/core/cfwl_edit.h index 342c6dd4d2..d560bc5d8d 100644 --- a/xfa/fwl/core/cfwl_edit.h +++ b/xfa/fwl/core/cfwl_edit.h @@ -166,7 +166,9 @@ class CFWL_Edit : public CFWL_Widget { void OnMouseMove(CFWL_MsgMouse* pMsg); void OnKeyDown(CFWL_MsgKey* pMsg); void OnChar(CFWL_MsgKey* pMsg); - bool OnScroll(CFWL_ScrollBar* pScrollBar, FWL_SCBCODE dwCode, FX_FLOAT fPos); + bool OnScroll(CFWL_ScrollBar* pScrollBar, + CFWL_EvtScroll::Code dwCode, + FX_FLOAT fPos); CFX_RectF m_rtClient; CFX_RectF m_rtEngine; diff --git a/xfa/fwl/core/cfwl_event.cpp b/xfa/fwl/core/cfwl_event.cpp index 06b734531f..d598f6974a 100644 --- a/xfa/fwl/core/cfwl_event.cpp +++ b/xfa/fwl/core/cfwl_event.cpp @@ -6,10 +6,15 @@ #include "xfa/fwl/core/cfwl_event.h" -CFWL_Event::CFWL_Event() : m_pSrcTarget(nullptr), m_pDstTarget(nullptr) {} +CFWL_Event::CFWL_Event(CFWL_Event::Type type) + : CFWL_Event(type, nullptr, nullptr) {} -CFWL_Event::~CFWL_Event() {} +CFWL_Event::CFWL_Event(Type type, CFWL_Widget* pSrcTarget) + : CFWL_Event(type, pSrcTarget, nullptr) {} + +CFWL_Event::CFWL_Event(Type type, + CFWL_Widget* pSrcTarget, + CFWL_Widget* pDstTarget) + : m_pSrcTarget(pSrcTarget), m_pDstTarget(pDstTarget), m_type(type) {} -CFWL_EventType CFWL_Event::GetClassID() const { - return CFWL_EventType::None; -} +CFWL_Event::~CFWL_Event() {} diff --git a/xfa/fwl/core/cfwl_event.h b/xfa/fwl/core/cfwl_event.h index fe8e1b37f0..aa435e54b2 100644 --- a/xfa/fwl/core/cfwl_event.h +++ b/xfa/fwl/core/cfwl_event.h @@ -14,41 +14,39 @@ #include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/fwl_error.h" -enum class CFWL_EventType { - None = 0, - - CheckStateChanged, - CheckWord, - Click, - Close, - EditChanged, - Key, - KillFocus, - Mouse, - MouseWheel, - PostDropDown, - PreDropDown, - Scroll, - SelectChanged, - SetFocus, - SizeChanged, - TextChanged, - TextFull, - Validate -}; - class CFX_Graphics; class CFWL_Widget; class CFWL_Event { public: - CFWL_Event(); + enum class Type { + CheckStateChanged, + CheckWord, + Click, + Close, + EditChanged, + Mouse, + PostDropDown, + PreDropDown, + Scroll, + SelectChanged, + TextChanged, + TextFull, + Validate + }; + + explicit CFWL_Event(Type type); + CFWL_Event(Type type, CFWL_Widget* pSrcTarget); + CFWL_Event(Type type, CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget); virtual ~CFWL_Event(); - virtual CFWL_EventType GetClassID() const; + Type GetType() const { return m_type; } CFWL_Widget* m_pSrcTarget; CFWL_Widget* m_pDstTarget; + + private: + Type m_type; }; #endif // XFA_FWL_CORE_CFWL_EVENT_H_ diff --git a/xfa/fwl/core/cfwl_evtcheckstatechanged.cpp b/xfa/fwl/core/cfwl_evtcheckstatechanged.cpp deleted file mode 100644 index 53f7848fae..0000000000 --- a/xfa/fwl/core/cfwl_evtcheckstatechanged.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evtcheckstatechanged.h" - -CFWL_EvtCheckStateChanged::CFWL_EvtCheckStateChanged() {} - -CFWL_EvtCheckStateChanged::~CFWL_EvtCheckStateChanged() {} - -CFWL_EventType CFWL_EvtCheckStateChanged::GetClassID() const { - return CFWL_EventType::CheckStateChanged; -} diff --git a/xfa/fwl/core/cfwl_evtcheckstatechanged.h b/xfa/fwl/core/cfwl_evtcheckstatechanged.h deleted file mode 100644 index 544fbad896..0000000000 --- a/xfa/fwl/core/cfwl_evtcheckstatechanged.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTCHECKSTATECHANGED_H_ -#define XFA_FWL_CORE_CFWL_EVTCHECKSTATECHANGED_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtCheckStateChanged : public CFWL_Event { - public: - CFWL_EvtCheckStateChanged(); - ~CFWL_EvtCheckStateChanged() override; - - CFWL_EventType GetClassID() const override; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTCHECKSTATECHANGED_H_ diff --git a/xfa/fwl/core/cfwl_evtcheckword.cpp b/xfa/fwl/core/cfwl_evtcheckword.cpp index 99ecee96e0..88bdcf6760 100644 --- a/xfa/fwl/core/cfwl_evtcheckword.cpp +++ b/xfa/fwl/core/cfwl_evtcheckword.cpp @@ -6,10 +6,8 @@ #include "xfa/fwl/core/cfwl_evtcheckword.h" -CFWL_EvtCheckWord::CFWL_EvtCheckWord() {} +CFWL_EvtCheckWord::CFWL_EvtCheckWord(CFWL_Widget* pSrcTarget) + : CFWL_Event(CFWL_Event::Type::CheckWord, pSrcTarget) {} CFWL_EvtCheckWord::~CFWL_EvtCheckWord() {} -CFWL_EventType CFWL_EvtCheckWord::GetClassID() const { - return CFWL_EventType::CheckWord; -} diff --git a/xfa/fwl/core/cfwl_evtcheckword.h b/xfa/fwl/core/cfwl_evtcheckword.h index aceb865cf5..aa853c6a8f 100644 --- a/xfa/fwl/core/cfwl_evtcheckword.h +++ b/xfa/fwl/core/cfwl_evtcheckword.h @@ -11,11 +11,9 @@ class CFWL_EvtCheckWord : public CFWL_Event { public: - CFWL_EvtCheckWord(); + explicit CFWL_EvtCheckWord(CFWL_Widget* pSrcTarget); ~CFWL_EvtCheckWord() override; - CFWL_EventType GetClassID() const override; - CFX_ByteString bsWord; bool bCheckWord; }; diff --git a/xfa/fwl/core/cfwl_evtclick.cpp b/xfa/fwl/core/cfwl_evtclick.cpp deleted file mode 100644 index 35ff6451f6..0000000000 --- a/xfa/fwl/core/cfwl_evtclick.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evtclick.h" - -CFWL_EvtClick::CFWL_EvtClick() {} - -CFWL_EvtClick::~CFWL_EvtClick() {} - -CFWL_EventType CFWL_EvtClick::GetClassID() const { - return CFWL_EventType::Click; -} diff --git a/xfa/fwl/core/cfwl_evtclick.h b/xfa/fwl/core/cfwl_evtclick.h deleted file mode 100644 index 280004a6e9..0000000000 --- a/xfa/fwl/core/cfwl_evtclick.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTCLICK_H_ -#define XFA_FWL_CORE_CFWL_EVTCLICK_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtClick : public CFWL_Event { - public: - CFWL_EvtClick(); - ~CFWL_EvtClick() override; - - CFWL_EventType GetClassID() const override; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTCLICK_H_ diff --git a/xfa/fwl/core/cfwl_evtclose.cpp b/xfa/fwl/core/cfwl_evtclose.cpp deleted file mode 100644 index 72713a17d1..0000000000 --- a/xfa/fwl/core/cfwl_evtclose.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evtclose.h" - -CFWL_EvtClose::CFWL_EvtClose() {} - -CFWL_EvtClose::~CFWL_EvtClose() {} - -CFWL_EventType CFWL_EvtClose::GetClassID() const { - return CFWL_EventType::Close; -} diff --git a/xfa/fwl/core/cfwl_evtclose.h b/xfa/fwl/core/cfwl_evtclose.h deleted file mode 100644 index 5847a39fdf..0000000000 --- a/xfa/fwl/core/cfwl_evtclose.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTCLOSE_H_ -#define XFA_FWL_CORE_CFWL_EVTCLOSE_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtClose : public CFWL_Event { - public: - CFWL_EvtClose(); - ~CFWL_EvtClose() override; - - CFWL_EventType GetClassID() const override; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTCLOSE_H_ diff --git a/xfa/fwl/core/cfwl_evteditchanged.cpp b/xfa/fwl/core/cfwl_evteditchanged.cpp deleted file mode 100644 index abffbe80e5..0000000000 --- a/xfa/fwl/core/cfwl_evteditchanged.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evteditchanged.h" - -CFWL_EvtEditChanged::CFWL_EvtEditChanged() {} - -CFWL_EvtEditChanged::~CFWL_EvtEditChanged() {} - -CFWL_EventType CFWL_EvtEditChanged::GetClassID() const { - return CFWL_EventType::EditChanged; -} diff --git a/xfa/fwl/core/cfwl_evteditchanged.h b/xfa/fwl/core/cfwl_evteditchanged.h deleted file mode 100644 index d910f7d6a6..0000000000 --- a/xfa/fwl/core/cfwl_evteditchanged.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTEDITCHANGED_H_ -#define XFA_FWL_CORE_CFWL_EVTEDITCHANGED_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtEditChanged : public CFWL_Event { - public: - CFWL_EvtEditChanged(); - ~CFWL_EvtEditChanged() override; - - CFWL_EventType GetClassID() const override; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTEDITCHANGED_H_ diff --git a/xfa/fwl/core/cfwl_evtkey.cpp b/xfa/fwl/core/cfwl_evtkey.cpp deleted file mode 100644 index 492c42fc98..0000000000 --- a/xfa/fwl/core/cfwl_evtkey.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evtkey.h" - -CFWL_EvtKey::CFWL_EvtKey() {} - -CFWL_EvtKey::~CFWL_EvtKey() {} - -CFWL_EventType CFWL_EvtKey::GetClassID() const { - return CFWL_EventType::Key; -} diff --git a/xfa/fwl/core/cfwl_evtkey.h b/xfa/fwl/core/cfwl_evtkey.h deleted file mode 100644 index 634456260a..0000000000 --- a/xfa/fwl/core/cfwl_evtkey.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTKEY_H_ -#define XFA_FWL_CORE_CFWL_EVTKEY_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtKey : public CFWL_Event { - public: - CFWL_EvtKey(); - ~CFWL_EvtKey() override; - - CFWL_EventType GetClassID() const override; - - uint32_t m_dwKeyCode; - uint32_t m_dwFlags; - FWL_KeyCommand m_dwCmd; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTKEY_H_ diff --git a/xfa/fwl/core/cfwl_evtkillfocus.cpp b/xfa/fwl/core/cfwl_evtkillfocus.cpp deleted file mode 100644 index ad6f40bcc3..0000000000 --- a/xfa/fwl/core/cfwl_evtkillfocus.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evtkillfocus.h" - -CFWL_EvtKillFocus::CFWL_EvtKillFocus() {} - -CFWL_EvtKillFocus::~CFWL_EvtKillFocus() {} - -CFWL_EventType CFWL_EvtKillFocus::GetClassID() const { - return CFWL_EventType::KillFocus; -} diff --git a/xfa/fwl/core/cfwl_evtkillfocus.h b/xfa/fwl/core/cfwl_evtkillfocus.h deleted file mode 100644 index 737053bc3d..0000000000 --- a/xfa/fwl/core/cfwl_evtkillfocus.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTKILLFOCUS_H_ -#define XFA_FWL_CORE_CFWL_EVTKILLFOCUS_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtKillFocus : public CFWL_Event { - public: - CFWL_EvtKillFocus(); - ~CFWL_EvtKillFocus() override; - - CFWL_EventType GetClassID() const override; - - CFWL_Widget* m_pKillFocus; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTKILLFOCUS_H_ diff --git a/xfa/fwl/core/cfwl_evtmouse.cpp b/xfa/fwl/core/cfwl_evtmouse.cpp index c85172b738..8bfce8a9c5 100644 --- a/xfa/fwl/core/cfwl_evtmouse.cpp +++ b/xfa/fwl/core/cfwl_evtmouse.cpp @@ -6,10 +6,10 @@ #include "xfa/fwl/core/cfwl_evtmouse.h" -CFWL_EvtMouse::CFWL_EvtMouse() {} +CFWL_EvtMouse::CFWL_EvtMouse(CFWL_Widget* pSrcTarget) + : CFWL_EvtMouse(pSrcTarget, nullptr) {} -CFWL_EvtMouse::~CFWL_EvtMouse() {} +CFWL_EvtMouse::CFWL_EvtMouse(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget) + : CFWL_Event(CFWL_Event::Type::Mouse, pSrcTarget, pDstTarget) {} -CFWL_EventType CFWL_EvtMouse::GetClassID() const { - return CFWL_EventType::Mouse; -} +CFWL_EvtMouse::~CFWL_EvtMouse() {} diff --git a/xfa/fwl/core/cfwl_evtmouse.h b/xfa/fwl/core/cfwl_evtmouse.h index 386301ea5e..e8b1fd541b 100644 --- a/xfa/fwl/core/cfwl_evtmouse.h +++ b/xfa/fwl/core/cfwl_evtmouse.h @@ -11,14 +11,10 @@ class CFWL_EvtMouse : public CFWL_Event { public: - CFWL_EvtMouse(); + explicit CFWL_EvtMouse(CFWL_Widget* pSrcTarget); + CFWL_EvtMouse(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget); ~CFWL_EvtMouse() override; - CFWL_EventType GetClassID() const override; - - FX_FLOAT m_fx; - FX_FLOAT m_fy; - uint32_t m_dwFlags; FWL_MouseCommand m_dwCmd; }; diff --git a/xfa/fwl/core/cfwl_evtmousewheel.cpp b/xfa/fwl/core/cfwl_evtmousewheel.cpp deleted file mode 100644 index 215947c0ea..0000000000 --- a/xfa/fwl/core/cfwl_evtmousewheel.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evtmousewheel.h" - -CFWL_EvtMouseWheel::CFWL_EvtMouseWheel() {} - -CFWL_EvtMouseWheel::~CFWL_EvtMouseWheel() {} - -CFWL_EventType CFWL_EvtMouseWheel::GetClassID() const { - return CFWL_EventType::MouseWheel; -} diff --git a/xfa/fwl/core/cfwl_evtmousewheel.h b/xfa/fwl/core/cfwl_evtmousewheel.h deleted file mode 100644 index 09e73ca42e..0000000000 --- a/xfa/fwl/core/cfwl_evtmousewheel.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTMOUSEWHEEL_H_ -#define XFA_FWL_CORE_CFWL_EVTMOUSEWHEEL_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtMouseWheel : public CFWL_Event { - public: - CFWL_EvtMouseWheel(); - ~CFWL_EvtMouseWheel() override; - - CFWL_EventType GetClassID() const override; - - FX_FLOAT m_fx; - FX_FLOAT m_fy; - FX_FLOAT m_fDeltaX; - FX_FLOAT m_fDeltaY; - uint32_t m_dwFlags; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTMOUSEWHEEL_H_ diff --git a/xfa/fwl/core/cfwl_evtpostdropdown.cpp b/xfa/fwl/core/cfwl_evtpostdropdown.cpp deleted file mode 100644 index 52ba803197..0000000000 --- a/xfa/fwl/core/cfwl_evtpostdropdown.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evtpostdropdown.h" - -CFWL_EvtPostDropDown::CFWL_EvtPostDropDown() {} - -CFWL_EvtPostDropDown::~CFWL_EvtPostDropDown() {} - -CFWL_EventType CFWL_EvtPostDropDown::GetClassID() const { - return CFWL_EventType::PostDropDown; -} diff --git a/xfa/fwl/core/cfwl_evtpostdropdown.h b/xfa/fwl/core/cfwl_evtpostdropdown.h deleted file mode 100644 index b4d8516593..0000000000 --- a/xfa/fwl/core/cfwl_evtpostdropdown.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTPOSTDROPDOWN_H_ -#define XFA_FWL_CORE_CFWL_EVTPOSTDROPDOWN_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtPostDropDown : public CFWL_Event { - public: - CFWL_EvtPostDropDown(); - ~CFWL_EvtPostDropDown() override; - - CFWL_EventType GetClassID() const override; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTPOSTDROPDOWN_H_ diff --git a/xfa/fwl/core/cfwl_evtpredropdown.cpp b/xfa/fwl/core/cfwl_evtpredropdown.cpp deleted file mode 100644 index 12fe9fc727..0000000000 --- a/xfa/fwl/core/cfwl_evtpredropdown.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evtpredropdown.h" - -CFWL_EvtPreDropDown::CFWL_EvtPreDropDown() {} - -CFWL_EvtPreDropDown::~CFWL_EvtPreDropDown() {} - -CFWL_EventType CFWL_EvtPreDropDown::GetClassID() const { - return CFWL_EventType::PreDropDown; -} diff --git a/xfa/fwl/core/cfwl_evtpredropdown.h b/xfa/fwl/core/cfwl_evtpredropdown.h deleted file mode 100644 index df4d29abe4..0000000000 --- a/xfa/fwl/core/cfwl_evtpredropdown.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTPREDROPDOWN_H_ -#define XFA_FWL_CORE_CFWL_EVTPREDROPDOWN_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtPreDropDown : public CFWL_Event { - public: - CFWL_EvtPreDropDown(); - ~CFWL_EvtPreDropDown() override; - - CFWL_EventType GetClassID() const override; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTPREDROPDOWN_H_ diff --git a/xfa/fwl/core/cfwl_evtscroll.cpp b/xfa/fwl/core/cfwl_evtscroll.cpp index 37e561017e..00ca57eb84 100644 --- a/xfa/fwl/core/cfwl_evtscroll.cpp +++ b/xfa/fwl/core/cfwl_evtscroll.cpp @@ -6,10 +6,7 @@ #include "xfa/fwl/core/cfwl_evtscroll.h" -CFWL_EvtScroll::CFWL_EvtScroll() {} +CFWL_EvtScroll::CFWL_EvtScroll(CFWL_Widget* pSrcTarget) + : CFWL_Event(CFWL_Event::Type::Scroll, pSrcTarget) {} CFWL_EvtScroll::~CFWL_EvtScroll() {} - -CFWL_EventType CFWL_EvtScroll::GetClassID() const { - return CFWL_EventType::Scroll; -} diff --git a/xfa/fwl/core/cfwl_evtscroll.h b/xfa/fwl/core/cfwl_evtscroll.h index d8da34e86d..64ee7815f6 100644 --- a/xfa/fwl/core/cfwl_evtscroll.h +++ b/xfa/fwl/core/cfwl_evtscroll.h @@ -9,29 +9,26 @@ #include "xfa/fwl/core/cfwl_event.h" -enum class FWL_SCBCODE { - None = 1, - Min, - Max, - PageBackward, - PageForward, - StepBackward, - StepForward, - Pos, - TrackPos, - EndScroll, -}; - class CFWL_EvtScroll : public CFWL_Event { public: - CFWL_EvtScroll(); + enum class Code { + None = 1, + Min, + Max, + PageBackward, + PageForward, + StepBackward, + StepForward, + Pos, + TrackPos, + EndScroll, + }; + + explicit CFWL_EvtScroll(CFWL_Widget* pSrcTarget); ~CFWL_EvtScroll() override; - CFWL_EventType GetClassID() const override; - - FWL_SCBCODE m_iScrollCode; + Code m_iScrollCode; FX_FLOAT m_fPos; - bool* m_pRet; }; #endif // XFA_FWL_CORE_CFWL_EVTSCROLL_H_ diff --git a/xfa/fwl/core/cfwl_evtselectchanged.cpp b/xfa/fwl/core/cfwl_evtselectchanged.cpp index 3eead94d6e..811fc9490f 100644 --- a/xfa/fwl/core/cfwl_evtselectchanged.cpp +++ b/xfa/fwl/core/cfwl_evtselectchanged.cpp @@ -6,10 +6,7 @@ #include "xfa/fwl/core/cfwl_evtselectchanged.h" -CFWL_EvtSelectChanged::CFWL_EvtSelectChanged() {} +CFWL_EvtSelectChanged::CFWL_EvtSelectChanged(CFWL_Widget* pSrcTarget) + : CFWL_Event(CFWL_Event::Type::SelectChanged, pSrcTarget) {} CFWL_EvtSelectChanged::~CFWL_EvtSelectChanged() {} - -CFWL_EventType CFWL_EvtSelectChanged::GetClassID() const { - return CFWL_EventType::SelectChanged; -} diff --git a/xfa/fwl/core/cfwl_evtselectchanged.h b/xfa/fwl/core/cfwl_evtselectchanged.h index f01b2aac6a..94381c7063 100644 --- a/xfa/fwl/core/cfwl_evtselectchanged.h +++ b/xfa/fwl/core/cfwl_evtselectchanged.h @@ -11,11 +11,9 @@ class CFWL_EvtSelectChanged : public CFWL_Event { public: - CFWL_EvtSelectChanged(); + explicit CFWL_EvtSelectChanged(CFWL_Widget* pSrcTarget); ~CFWL_EvtSelectChanged() override; - CFWL_EventType GetClassID() const override; - // Used by ComboBox. bool bLButtonUp; diff --git a/xfa/fwl/core/cfwl_evtsetfocus.cpp b/xfa/fwl/core/cfwl_evtsetfocus.cpp deleted file mode 100644 index def4c82726..0000000000 --- a/xfa/fwl/core/cfwl_evtsetfocus.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evtsetfocus.h" - -CFWL_EvtSetFocus::CFWL_EvtSetFocus() {} - -CFWL_EvtSetFocus::~CFWL_EvtSetFocus() {} - -CFWL_EventType CFWL_EvtSetFocus::GetClassID() const { - return CFWL_EventType::SetFocus; -} diff --git a/xfa/fwl/core/cfwl_evtsetfocus.h b/xfa/fwl/core/cfwl_evtsetfocus.h deleted file mode 100644 index 0232b59576..0000000000 --- a/xfa/fwl/core/cfwl_evtsetfocus.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTSETFOCUS_H_ -#define XFA_FWL_CORE_CFWL_EVTSETFOCUS_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtSetFocus : public CFWL_Event { - public: - CFWL_EvtSetFocus(); - ~CFWL_EvtSetFocus() override; - - CFWL_EventType GetClassID() const override; - - CFWL_Widget* m_pSetFocus; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTSETFOCUS_H_ diff --git a/xfa/fwl/core/cfwl_evtsizechanged.cpp b/xfa/fwl/core/cfwl_evtsizechanged.cpp deleted file mode 100644 index efccde3f48..0000000000 --- a/xfa/fwl/core/cfwl_evtsizechanged.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evtsizechanged.h" - -CFWL_EvtSizeChanged::CFWL_EvtSizeChanged() {} - -CFWL_EvtSizeChanged::~CFWL_EvtSizeChanged() {} - -CFWL_EventType CFWL_EvtSizeChanged::GetClassID() const { - return CFWL_EventType::SizeChanged; -} diff --git a/xfa/fwl/core/cfwl_evtsizechanged.h b/xfa/fwl/core/cfwl_evtsizechanged.h deleted file mode 100644 index 33d526751f..0000000000 --- a/xfa/fwl/core/cfwl_evtsizechanged.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTSIZECHANGED_H_ -#define XFA_FWL_CORE_CFWL_EVTSIZECHANGED_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtSizeChanged : public CFWL_Event { - public: - CFWL_EvtSizeChanged(); - ~CFWL_EvtSizeChanged() override; - - CFWL_EventType GetClassID() const override; - - CFWL_Widget* m_pWidget; - CFX_RectF m_rtOld; - CFX_RectF m_rtNew; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTSIZECHANGED_H_ diff --git a/xfa/fwl/core/cfwl_evttextchanged.cpp b/xfa/fwl/core/cfwl_evttextchanged.cpp index 76718be6a2..d21dd037c1 100644 --- a/xfa/fwl/core/cfwl_evttextchanged.cpp +++ b/xfa/fwl/core/cfwl_evttextchanged.cpp @@ -6,10 +6,7 @@ #include "xfa/fwl/core/cfwl_evttextchanged.h" -CFWL_EvtTextChanged::CFWL_EvtTextChanged() {} +CFWL_EvtTextChanged::CFWL_EvtTextChanged(CFWL_Widget* pSrcTarget) + : CFWL_Event(CFWL_Event::Type::TextChanged, pSrcTarget) {} CFWL_EvtTextChanged::~CFWL_EvtTextChanged() {} - -CFWL_EventType CFWL_EvtTextChanged::GetClassID() const { - return CFWL_EventType::TextChanged; -} diff --git a/xfa/fwl/core/cfwl_evttextchanged.h b/xfa/fwl/core/cfwl_evttextchanged.h index 69d28bb4a6..a2d0761f80 100644 --- a/xfa/fwl/core/cfwl_evttextchanged.h +++ b/xfa/fwl/core/cfwl_evttextchanged.h @@ -11,14 +11,9 @@ class CFWL_EvtTextChanged : public CFWL_Event { public: - CFWL_EvtTextChanged(); + explicit CFWL_EvtTextChanged(CFWL_Widget* pSrcTarget); ~CFWL_EvtTextChanged() override; - CFWL_EventType GetClassID() const override; - - int32_t nChangeType; - CFX_WideString wsInsert; - CFX_WideString wsDelete; CFX_WideString wsPrevText; }; diff --git a/xfa/fwl/core/cfwl_evttextfull.cpp b/xfa/fwl/core/cfwl_evttextfull.cpp deleted file mode 100644 index 4762f24755..0000000000 --- a/xfa/fwl/core/cfwl_evttextfull.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/core/cfwl_evttextfull.h" - -CFWL_EvtTextFull::CFWL_EvtTextFull() {} - -CFWL_EvtTextFull::~CFWL_EvtTextFull() {} - -CFWL_EventType CFWL_EvtTextFull::GetClassID() const { - return CFWL_EventType::TextFull; -} diff --git a/xfa/fwl/core/cfwl_evttextfull.h b/xfa/fwl/core/cfwl_evttextfull.h deleted file mode 100644 index 40fcd8a84e..0000000000 --- a/xfa/fwl/core/cfwl_evttextfull.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_CFWL_EVTTEXTFULL_H_ -#define XFA_FWL_CORE_CFWL_EVTTEXTFULL_H_ - -#include "xfa/fwl/core/cfwl_event.h" - -class CFWL_EvtTextFull : public CFWL_Event { - public: - CFWL_EvtTextFull(); - ~CFWL_EvtTextFull() override; - - CFWL_EventType GetClassID() const override; -}; - -#endif // XFA_FWL_CORE_CFWL_EVTTEXTFULL_H_ diff --git a/xfa/fwl/core/cfwl_evtvalidate.cpp b/xfa/fwl/core/cfwl_evtvalidate.cpp index 7b795f6ca6..1f2b6977fa 100644 --- a/xfa/fwl/core/cfwl_evtvalidate.cpp +++ b/xfa/fwl/core/cfwl_evtvalidate.cpp @@ -6,10 +6,7 @@ #include "xfa/fwl/core/cfwl_evtvalidate.h" -CFWL_EvtValidate::CFWL_EvtValidate() {} +CFWL_EvtValidate::CFWL_EvtValidate(CFWL_Widget* pSrcTarget) + : CFWL_Event(CFWL_Event::Type::Validate, pSrcTarget) {} CFWL_EvtValidate::~CFWL_EvtValidate() {} - -CFWL_EventType CFWL_EvtValidate::GetClassID() const { - return CFWL_EventType::Validate; -} diff --git a/xfa/fwl/core/cfwl_evtvalidate.h b/xfa/fwl/core/cfwl_evtvalidate.h index fae20b845b..dbd5413aa4 100644 --- a/xfa/fwl/core/cfwl_evtvalidate.h +++ b/xfa/fwl/core/cfwl_evtvalidate.h @@ -11,12 +11,9 @@ class CFWL_EvtValidate : public CFWL_Event { public: - CFWL_EvtValidate(); + explicit CFWL_EvtValidate(CFWL_Widget* pSrcTarget); ~CFWL_EvtValidate() override; - CFWL_EventType GetClassID() const override; - - CFWL_Widget* pDstWidget; CFX_WideString wsInsert; bool bValidate; }; diff --git a/xfa/fwl/core/cfwl_form.cpp b/xfa/fwl/core/cfwl_form.cpp index 4eec163900..00d47d4100 100644 --- a/xfa/fwl/core/cfwl_form.cpp +++ b/xfa/fwl/core/cfwl_form.cpp @@ -11,7 +11,7 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" #include "xfa/fwl/core/cfwl_app.h" -#include "xfa/fwl/core/cfwl_evtclose.h" +#include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_formproxy.h" #include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_notedriver.h" @@ -487,8 +487,8 @@ void CFWL_Form::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - switch (pMessage->GetClassID()) { - case CFWL_MessageType::Mouse: { + switch (pMessage->GetType()) { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -556,8 +556,7 @@ void CFWL_Form::OnLButtonUp(CFWL_MsgMouse* pMsg) { } m_bMaximized = !m_bMaximized; } else if (pPressedBtn != m_pMinBox) { - CFWL_EvtClose eClose; - eClose.m_pSrcTarget = this; + CFWL_Event eClose(CFWL_Event::Type::Close, this); DispatchEvent(&eClose); } } diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp index dff981f283..be9e8b9395 100644 --- a/xfa/fwl/core/cfwl_listbox.cpp +++ b/xfa/fwl/core/cfwl_listbox.cpp @@ -772,15 +772,14 @@ void CFWL_ListBox::OnProcessMessage(CFWL_Message* pMessage) { if (!IsEnabled()) return; - CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - switch (dwMsgCode) { - case CFWL_MessageType::SetFocus: + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: OnFocusChanged(pMessage, true); break; - case CFWL_MessageType::KillFocus: + case CFWL_Message::Type::KillFocus: OnFocusChanged(pMessage, false); break; - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -794,10 +793,10 @@ void CFWL_ListBox::OnProcessMessage(CFWL_Message* pMessage) { } break; } - case CFWL_MessageType::MouseWheel: + case CFWL_Message::Type::MouseWheel: OnMouseWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage)); break; - case CFWL_MessageType::Key: { + case CFWL_Message::Type::Key: { CFWL_MsgKey* pMsg = static_cast<CFWL_MsgKey*>(pMessage); if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pMsg); @@ -812,7 +811,7 @@ void CFWL_ListBox::OnProcessMessage(CFWL_Message* pMessage) { void CFWL_ListBox::OnProcessEvent(CFWL_Event* pEvent) { if (!pEvent) return; - if (pEvent->GetClassID() != CFWL_EventType::Scroll) + if (pEvent->GetType() != CFWL_Event::Type::Scroll) return; CFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; @@ -949,50 +948,50 @@ void CFWL_ListBox::OnVK(CFWL_ListItem* pItem, bool bShift, bool bCtrl) { } bool CFWL_ListBox::OnScroll(CFWL_ScrollBar* pScrollBar, - FWL_SCBCODE dwCode, + CFWL_EvtScroll::Code dwCode, FX_FLOAT fPos) { CFX_SizeF fs; pScrollBar->GetRange(&fs.x, &fs.y); FX_FLOAT iCurPos = pScrollBar->GetPos(); FX_FLOAT fStep = pScrollBar->GetStepSize(); switch (dwCode) { - case FWL_SCBCODE::Min: { + case CFWL_EvtScroll::Code::Min: { fPos = fs.x; break; } - case FWL_SCBCODE::Max: { + case CFWL_EvtScroll::Code::Max: { fPos = fs.y; break; } - case FWL_SCBCODE::StepBackward: { + case CFWL_EvtScroll::Code::StepBackward: { fPos -= fStep; if (fPos < fs.x + fStep / 2) fPos = fs.x; break; } - case FWL_SCBCODE::StepForward: { + case CFWL_EvtScroll::Code::StepForward: { fPos += fStep; if (fPos > fs.y - fStep / 2) fPos = fs.y; break; } - case FWL_SCBCODE::PageBackward: { + case CFWL_EvtScroll::Code::PageBackward: { fPos -= pScrollBar->GetPageSize(); if (fPos < fs.x) fPos = fs.x; break; } - case FWL_SCBCODE::PageForward: { + case CFWL_EvtScroll::Code::PageForward: { fPos += pScrollBar->GetPageSize(); if (fPos > fs.y) fPos = fs.y; break; } - case FWL_SCBCODE::Pos: - case FWL_SCBCODE::TrackPos: - case FWL_SCBCODE::None: + case CFWL_EvtScroll::Code::Pos: + case CFWL_EvtScroll::Code::TrackPos: + case CFWL_EvtScroll::Code::None: break; - case FWL_SCBCODE::EndScroll: + case CFWL_EvtScroll::Code::EndScroll: return false; } if (iCurPos != fPos) { diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h index e30068b0b4..d2f439e108 100644 --- a/xfa/fwl/core/cfwl_listbox.h +++ b/xfa/fwl/core/cfwl_listbox.h @@ -148,7 +148,9 @@ class CFWL_ListBox : public CFWL_Widget { void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); void OnKeyDown(CFWL_MsgKey* pMsg); void OnVK(CFWL_ListItem* hItem, bool bShift, bool bCtrl); - bool OnScroll(CFWL_ScrollBar* pScrollBar, FWL_SCBCODE dwCode, FX_FLOAT fPos); + bool OnScroll(CFWL_ScrollBar* pScrollBar, + CFWL_EvtScroll::Code dwCode, + FX_FLOAT fPos); CFX_RectF m_rtClient; CFX_RectF m_rtStatic; diff --git a/xfa/fwl/core/cfwl_message.cpp b/xfa/fwl/core/cfwl_message.cpp index e233900d6e..b20cf0e6a1 100644 --- a/xfa/fwl/core/cfwl_message.cpp +++ b/xfa/fwl/core/cfwl_message.cpp @@ -6,15 +6,22 @@ #include "xfa/fwl/core/cfwl_message.h" -CFWL_Message::CFWL_Message() - : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwExtend(0) {} +CFWL_Message::CFWL_Message(CFWL_Message::Type type) + : CFWL_Message(type, nullptr, nullptr) {} + +CFWL_Message::CFWL_Message(Type type, CFWL_Widget* pSrcTarget) + : CFWL_Message(type, pSrcTarget, nullptr) {} + +CFWL_Message::CFWL_Message(Type type, + CFWL_Widget* pSrcTarget, + CFWL_Widget* pDstTarget) + : m_pSrcTarget(pSrcTarget), + m_pDstTarget(pDstTarget), + m_dwExtend(0), + m_type(type) {} CFWL_Message::~CFWL_Message() {} std::unique_ptr<CFWL_Message> CFWL_Message::Clone() { return nullptr; } - -CFWL_MessageType CFWL_Message::GetClassID() const { - return CFWL_MessageType::None; -} diff --git a/xfa/fwl/core/cfwl_message.h b/xfa/fwl/core/cfwl_message.h index 827b4181e3..a1545b1013 100644 --- a/xfa/fwl/core/cfwl_message.h +++ b/xfa/fwl/core/cfwl_message.h @@ -14,28 +14,26 @@ #include "core/fxcrt/fx_system.h" #include "xfa/fwl/core/fwl_error.h" -enum class CFWL_MessageType { - None = 0, - Key, - KillFocus, - Mouse, - MouseWheel, - SetFocus -}; - class CFWL_Widget; class CFWL_Message { public: - CFWL_Message(); + enum class Type { Key, KillFocus, Mouse, MouseWheel, SetFocus }; + + explicit CFWL_Message(Type type); + CFWL_Message(Type type, CFWL_Widget* pSrcTarget); + CFWL_Message(Type type, CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget); virtual ~CFWL_Message(); virtual std::unique_ptr<CFWL_Message> Clone(); - virtual CFWL_MessageType GetClassID() const; + Type GetType() const { return m_type; } CFWL_Widget* m_pSrcTarget; CFWL_Widget* m_pDstTarget; uint32_t m_dwExtend; + + private: + Type m_type; }; diff --git a/xfa/fwl/core/cfwl_monthcalendar.cpp b/xfa/fwl/core/cfwl_monthcalendar.cpp index 9d22b13509..a550d310c4 100644 --- a/xfa/fwl/core/cfwl_monthcalendar.cpp +++ b/xfa/fwl/core/cfwl_monthcalendar.cpp @@ -912,15 +912,14 @@ void CFWL_MonthCalendar::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - switch (dwMsgCode) { - case CFWL_MessageType::SetFocus: - case CFWL_MessageType::KillFocus: + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: + case CFWL_Message::Type::KillFocus: GetOuter()->GetDelegate()->OnProcessMessage(pMessage); break; - case CFWL_MessageType::Key: + case CFWL_Message::Type::Key: break; - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMouse->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: diff --git a/xfa/fwl/core/cfwl_msgkey.cpp b/xfa/fwl/core/cfwl_msgkey.cpp index 7d839f7203..3eda29ab49 100644 --- a/xfa/fwl/core/cfwl_msgkey.cpp +++ b/xfa/fwl/core/cfwl_msgkey.cpp @@ -10,14 +10,11 @@ #include "third_party/base/ptr_util.h" -CFWL_MsgKey::CFWL_MsgKey() {} +CFWL_MsgKey::CFWL_MsgKey(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget) + : CFWL_Message(CFWL_Message::Type::Key, pSrcTarget, pDstTarget) {} CFWL_MsgKey::~CFWL_MsgKey() {} std::unique_ptr<CFWL_Message> CFWL_MsgKey::Clone() { return pdfium::MakeUnique<CFWL_MsgKey>(*this); } - -CFWL_MessageType CFWL_MsgKey::GetClassID() const { - return CFWL_MessageType::Key; -} diff --git a/xfa/fwl/core/cfwl_msgkey.h b/xfa/fwl/core/cfwl_msgkey.h index c7cd74315c..36089ea43e 100644 --- a/xfa/fwl/core/cfwl_msgkey.h +++ b/xfa/fwl/core/cfwl_msgkey.h @@ -15,12 +15,11 @@ enum class FWL_KeyCommand { KeyDown, KeyUp, Char }; class CFWL_MsgKey : public CFWL_Message { public: - CFWL_MsgKey(); + CFWL_MsgKey(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget); ~CFWL_MsgKey() override; // CFWL_Message std::unique_ptr<CFWL_Message> Clone() override; - CFWL_MessageType GetClassID() const override; uint32_t m_dwKeyCode; uint32_t m_dwFlags; diff --git a/xfa/fwl/core/cfwl_msgkillfocus.cpp b/xfa/fwl/core/cfwl_msgkillfocus.cpp index 0c8ac47029..c7164850d1 100644 --- a/xfa/fwl/core/cfwl_msgkillfocus.cpp +++ b/xfa/fwl/core/cfwl_msgkillfocus.cpp @@ -10,14 +10,15 @@ #include "third_party/base/ptr_util.h" -CFWL_MsgKillFocus::CFWL_MsgKillFocus() {} +CFWL_MsgKillFocus::CFWL_MsgKillFocus(CFWL_Widget* pSrcTarget) + : CFWL_MsgKillFocus(pSrcTarget, nullptr) {} + +CFWL_MsgKillFocus::CFWL_MsgKillFocus(CFWL_Widget* pSrcTarget, + CFWL_Widget* pDstTarget) + : CFWL_Message(CFWL_Message::Type::KillFocus, pSrcTarget, pDstTarget) {} CFWL_MsgKillFocus::~CFWL_MsgKillFocus() {} std::unique_ptr<CFWL_Message> CFWL_MsgKillFocus::Clone() { return pdfium::MakeUnique<CFWL_MsgKillFocus>(*this); } - -CFWL_MessageType CFWL_MsgKillFocus::GetClassID() const { - return CFWL_MessageType::KillFocus; -} diff --git a/xfa/fwl/core/cfwl_msgkillfocus.h b/xfa/fwl/core/cfwl_msgkillfocus.h index ef687524f9..1c176b122a 100644 --- a/xfa/fwl/core/cfwl_msgkillfocus.h +++ b/xfa/fwl/core/cfwl_msgkillfocus.h @@ -13,12 +13,12 @@ class CFWL_MsgKillFocus : public CFWL_Message { public: - CFWL_MsgKillFocus(); + explicit CFWL_MsgKillFocus(CFWL_Widget* pSrcTarget); + CFWL_MsgKillFocus(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget); ~CFWL_MsgKillFocus() override; // CFWL_Message std::unique_ptr<CFWL_Message> Clone() override; - CFWL_MessageType GetClassID() const override; CFWL_Widget* m_pSetFocus; }; diff --git a/xfa/fwl/core/cfwl_msgmouse.cpp b/xfa/fwl/core/cfwl_msgmouse.cpp index de2540d8fc..f8a4e64608 100644 --- a/xfa/fwl/core/cfwl_msgmouse.cpp +++ b/xfa/fwl/core/cfwl_msgmouse.cpp @@ -10,14 +10,11 @@ #include "third_party/base/ptr_util.h" -CFWL_MsgMouse::CFWL_MsgMouse() {} +CFWL_MsgMouse::CFWL_MsgMouse(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget) + : CFWL_Message(CFWL_Message::Type::Mouse, pSrcTarget, pDstTarget) {} CFWL_MsgMouse::~CFWL_MsgMouse() {} std::unique_ptr<CFWL_Message> CFWL_MsgMouse::Clone() { return pdfium::MakeUnique<CFWL_MsgMouse>(*this); } - -CFWL_MessageType CFWL_MsgMouse::GetClassID() const { - return CFWL_MessageType::Mouse; -} diff --git a/xfa/fwl/core/cfwl_msgmouse.h b/xfa/fwl/core/cfwl_msgmouse.h index 5a4054c024..0765cbc500 100644 --- a/xfa/fwl/core/cfwl_msgmouse.h +++ b/xfa/fwl/core/cfwl_msgmouse.h @@ -26,12 +26,11 @@ enum class FWL_MouseCommand { class CFWL_MsgMouse : public CFWL_Message { public: - CFWL_MsgMouse(); + CFWL_MsgMouse(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget); ~CFWL_MsgMouse() override; // CFWL_Message std::unique_ptr<CFWL_Message> Clone() override; - CFWL_MessageType GetClassID() const override; FX_FLOAT m_fx; FX_FLOAT m_fy; diff --git a/xfa/fwl/core/cfwl_msgmousewheel.cpp b/xfa/fwl/core/cfwl_msgmousewheel.cpp index 739c43174c..02629ec909 100644 --- a/xfa/fwl/core/cfwl_msgmousewheel.cpp +++ b/xfa/fwl/core/cfwl_msgmousewheel.cpp @@ -10,14 +10,12 @@ #include "third_party/base/ptr_util.h" -CFWL_MsgMouseWheel::CFWL_MsgMouseWheel() {} +CFWL_MsgMouseWheel::CFWL_MsgMouseWheel(CFWL_Widget* pSrcTarget, + CFWL_Widget* pDstTarget) + : CFWL_Message(CFWL_Message::Type::MouseWheel, pSrcTarget, pDstTarget) {} CFWL_MsgMouseWheel::~CFWL_MsgMouseWheel() {} std::unique_ptr<CFWL_Message> CFWL_MsgMouseWheel::Clone() { return pdfium::MakeUnique<CFWL_MsgMouseWheel>(*this); } - -CFWL_MessageType CFWL_MsgMouseWheel::GetClassID() const { - return CFWL_MessageType::MouseWheel; -} diff --git a/xfa/fwl/core/cfwl_msgmousewheel.h b/xfa/fwl/core/cfwl_msgmousewheel.h index 076870135b..503bcdebe8 100644 --- a/xfa/fwl/core/cfwl_msgmousewheel.h +++ b/xfa/fwl/core/cfwl_msgmousewheel.h @@ -13,12 +13,11 @@ class CFWL_MsgMouseWheel : public CFWL_Message { public: - CFWL_MsgMouseWheel(); + CFWL_MsgMouseWheel(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget); ~CFWL_MsgMouseWheel() override; // CFWL_Message std::unique_ptr<CFWL_Message> Clone() override; - CFWL_MessageType GetClassID() const override; FX_FLOAT m_fx; FX_FLOAT m_fy; diff --git a/xfa/fwl/core/cfwl_msgsetfocus.cpp b/xfa/fwl/core/cfwl_msgsetfocus.cpp index 0463da1c6c..82e9610b15 100644 --- a/xfa/fwl/core/cfwl_msgsetfocus.cpp +++ b/xfa/fwl/core/cfwl_msgsetfocus.cpp @@ -10,14 +10,12 @@ #include "third_party/base/ptr_util.h" -CFWL_MsgSetFocus::CFWL_MsgSetFocus() {} +CFWL_MsgSetFocus::CFWL_MsgSetFocus(CFWL_Widget* pSrcTarget, + CFWL_Widget* pDstTarget) + : CFWL_Message(CFWL_Message::Type::SetFocus, pSrcTarget, pDstTarget) {} CFWL_MsgSetFocus::~CFWL_MsgSetFocus() {} std::unique_ptr<CFWL_Message> CFWL_MsgSetFocus::Clone() { return pdfium::MakeUnique<CFWL_MsgSetFocus>(*this); } - -CFWL_MessageType CFWL_MsgSetFocus::GetClassID() const { - return CFWL_MessageType::SetFocus; -} diff --git a/xfa/fwl/core/cfwl_msgsetfocus.h b/xfa/fwl/core/cfwl_msgsetfocus.h index 42f14ede77..628f7a6d66 100644 --- a/xfa/fwl/core/cfwl_msgsetfocus.h +++ b/xfa/fwl/core/cfwl_msgsetfocus.h @@ -13,14 +13,11 @@ class CFWL_MsgSetFocus : public CFWL_Message { public: - CFWL_MsgSetFocus(); + CFWL_MsgSetFocus(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget); ~CFWL_MsgSetFocus() override; // CFWL_Message std::unique_ptr<CFWL_Message> Clone() override; - CFWL_MessageType GetClassID() const override; - - CFWL_Widget* m_pKillFocus; }; #endif // XFA_FWL_CORE_CFWL_MSGSETFOCUS_H_ diff --git a/xfa/fwl/core/cfwl_notedriver.cpp b/xfa/fwl/core/cfwl_notedriver.cpp index 06d8fd5df9..00a0b3e4b7 100644 --- a/xfa/fwl/core/cfwl_notedriver.cpp +++ b/xfa/fwl/core/cfwl_notedriver.cpp @@ -91,9 +91,7 @@ bool CFWL_NoteDriver::SetFocus(CFWL_Widget* pFocus, bool bNotify) { CFWL_Widget* pPrev = m_pFocus; m_pFocus = pFocus; if (pPrev) { - CFWL_MsgKillFocus ms; - ms.m_pDstTarget = pPrev; - ms.m_pSrcTarget = pPrev; + CFWL_MsgKillFocus ms(pPrev, pPrev); if (bNotify) ms.m_dwExtend = 1; @@ -107,8 +105,7 @@ bool CFWL_NoteDriver::SetFocus(CFWL_Widget* pFocus, bool bNotify) { if (pForm) pForm->SetSubFocus(pFocus); - CFWL_MsgSetFocus ms; - ms.m_pDstTarget = pFocus; + CFWL_MsgSetFocus ms(nullptr, pFocus); if (bNotify) ms.m_dwExtend = 1; if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate()) @@ -222,34 +219,34 @@ void CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { if (!DispatchMessage(pMessage, pMessageForm)) return; - if (pMessage->GetClassID() == CFWL_MessageType::Mouse) + if (pMessage->GetType() == CFWL_Message::Type::Mouse) MouseSecondary(pMessage); } bool CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, CFWL_Widget* pMessageForm) { - switch (pMessage->GetClassID()) { - case CFWL_MessageType::SetFocus: { + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: { if (!DoSetFocus(pMessage, pMessageForm)) return false; break; } - case CFWL_MessageType::KillFocus: { + case CFWL_Message::Type::KillFocus: { if (!DoKillFocus(pMessage, pMessageForm)) return false; break; } - case CFWL_MessageType::Key: { + case CFWL_Message::Type::Key: { if (!DoKey(pMessage, pMessageForm)) return false; break; } - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::Mouse: { if (!DoMouse(pMessage, pMessageForm)) return false; break; } - case CFWL_MessageType::MouseWheel: { + case CFWL_Message::Type::MouseWheel: { if (!DoWheel(pMessage, pMessageForm)) return false; break; @@ -416,8 +413,7 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_Message* pMessage) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); if (m_pHover) { - CFWL_MsgMouse msLeave; - msLeave.m_pDstTarget = m_pHover; + CFWL_MsgMouse msLeave(nullptr, m_pHover); msLeave.m_fx = pMsg->m_fx; msLeave.m_fy = pMsg->m_fy; pTarget->TransformTo(m_pHover, msLeave.m_fx, msLeave.m_fy); @@ -432,8 +428,7 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_Message* pMessage) { } m_pHover = pTarget; - CFWL_MsgMouse msHover; - msHover.m_pDstTarget = pTarget; + CFWL_MsgMouse msHover(nullptr, pTarget); msHover.m_fx = pMsg->m_fx; msHover.m_fy = pMsg->m_fy; msHover.m_dwFlags = 0; diff --git a/xfa/fwl/core/cfwl_pushbutton.cpp b/xfa/fwl/core/cfwl_pushbutton.cpp index 15e98fc4a5..295de1e07e 100644 --- a/xfa/fwl/core/cfwl_pushbutton.cpp +++ b/xfa/fwl/core/cfwl_pushbutton.cpp @@ -11,7 +11,7 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" -#include "xfa/fwl/core/cfwl_evtclick.h" +#include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_evtmouse.h" #include "xfa/fwl/core/cfwl_msgkey.h" #include "xfa/fwl/core/cfwl_msgmouse.h" @@ -174,15 +174,14 @@ void CFWL_PushButton::OnProcessMessage(CFWL_Message* pMessage) { if (!IsEnabled()) return; - CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - switch (dwMsgCode) { - case CFWL_MessageType::SetFocus: + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: OnFocusChanged(pMessage, true); break; - case CFWL_MessageType::KillFocus: + case CFWL_Message::Type::KillFocus: OnFocusChanged(pMessage, false); break; - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -202,7 +201,7 @@ void CFWL_PushButton::OnProcessMessage(CFWL_Message* pMessage) { } break; } - case CFWL_MessageType::Key: { + case CFWL_Message::Type::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pKey); @@ -248,8 +247,7 @@ void CFWL_PushButton::OnLButtonUp(CFWL_MsgMouse* pMsg) { m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Pressed; } if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) { - CFWL_EvtClick wmClick; - wmClick.m_pSrcTarget = this; + CFWL_Event wmClick(CFWL_Event::Type::Click, this); DispatchEvent(&wmClick); } Repaint(&m_rtClient); @@ -297,18 +295,13 @@ void CFWL_PushButton::OnMouseLeave(CFWL_MsgMouse* pMsg) { } void CFWL_PushButton::OnKeyDown(CFWL_MsgKey* pMsg) { - if (pMsg->m_dwKeyCode == FWL_VKEY_Return) { - CFWL_EvtMouse wmMouse; - wmMouse.m_pSrcTarget = this; - wmMouse.m_dwCmd = FWL_MouseCommand::LeftButtonUp; - DispatchEvent(&wmMouse); - CFWL_EvtClick wmClick; - wmClick.m_pSrcTarget = this; - DispatchEvent(&wmClick); - return; - } - if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) + if (pMsg->m_dwKeyCode != FWL_VKEY_Return) return; - DispatchKeyEvent(pMsg); + CFWL_EvtMouse wmMouse(this); + wmMouse.m_dwCmd = FWL_MouseCommand::LeftButtonUp; + DispatchEvent(&wmMouse); + + CFWL_Event wmClick(CFWL_Event::Type::Click, this); + DispatchEvent(&wmClick); } diff --git a/xfa/fwl/core/cfwl_scrollbar.cpp b/xfa/fwl/core/cfwl_scrollbar.cpp index 6647350ef2..490940491c 100644 --- a/xfa/fwl/core/cfwl_scrollbar.cpp +++ b/xfa/fwl/core/cfwl_scrollbar.cpp @@ -115,8 +115,8 @@ void CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { CalcMaxTrackRect(m_rtMaxTrack); } -bool CFWL_ScrollBar::DoScroll(FWL_SCBCODE dwCode, FX_FLOAT fPos) { - if (dwCode == FWL_SCBCODE::None) +bool CFWL_ScrollBar::DoScroll(CFWL_EvtScroll::Code dwCode, FX_FLOAT fPos) { + if (dwCode == CFWL_EvtScroll::Code::None) return false; return OnScroll(dwCode, fPos); } @@ -351,46 +351,44 @@ void CFWL_ScrollBar::GetTrackRect(CFX_RectF& rect, bool bLower) { bool CFWL_ScrollBar::SendEvent() { if (m_iMinButtonState == CFWL_PartState_Pressed) { - DoScroll(FWL_SCBCODE::StepBackward, m_fTrackPos); + DoScroll(CFWL_EvtScroll::Code::StepBackward, m_fTrackPos); return false; } if (m_iMaxButtonState == CFWL_PartState_Pressed) { - DoScroll(FWL_SCBCODE::StepForward, m_fTrackPos); + DoScroll(CFWL_EvtScroll::Code::StepForward, m_fTrackPos); return false; } if (m_iMinTrackState == CFWL_PartState_Pressed) { - DoScroll(FWL_SCBCODE::PageBackward, m_fTrackPos); + DoScroll(CFWL_EvtScroll::Code::PageBackward, m_fTrackPos); return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY); } if (m_iMaxTrackState == CFWL_PartState_Pressed) { - DoScroll(FWL_SCBCODE::PageForward, m_fTrackPos); + DoScroll(CFWL_EvtScroll::Code::PageForward, m_fTrackPos); return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY); } if (m_iMouseWheel) { - FWL_SCBCODE dwCode = m_iMouseWheel < 0 ? FWL_SCBCODE::StepForward - : FWL_SCBCODE::StepBackward; + CFWL_EvtScroll::Code dwCode = m_iMouseWheel < 0 + ? CFWL_EvtScroll::Code::StepForward + : CFWL_EvtScroll::Code::StepBackward; DoScroll(dwCode, m_fTrackPos); } return true; } -bool CFWL_ScrollBar::OnScroll(FWL_SCBCODE dwCode, FX_FLOAT fPos) { - bool bRet = true; - CFWL_EvtScroll ev; +bool CFWL_ScrollBar::OnScroll(CFWL_EvtScroll::Code dwCode, FX_FLOAT fPos) { + CFWL_EvtScroll ev(this); ev.m_iScrollCode = dwCode; - ev.m_pSrcTarget = this; ev.m_fPos = fPos; - ev.m_pRet = &bRet; DispatchEvent(&ev); - return bRet; + return true; } void CFWL_ScrollBar::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - if (dwMsgCode == CFWL_MessageType::Mouse) { + CFWL_Message::Type type = pMessage->GetType(); + if (type == CFWL_Message::Type::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -408,7 +406,7 @@ void CFWL_ScrollBar::OnProcessMessage(CFWL_Message* pMessage) { default: break; } - } else if (dwMsgCode == CFWL_MessageType::MouseWheel) { + } else if (type == CFWL_Message::Type::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); @@ -507,7 +505,7 @@ void CFWL_ScrollBar::DoMouseUp(int32_t iItem, iState = iNewState; Repaint(&rtItem); - OnScroll(FWL_SCBCODE::EndScroll, m_fTrackPos); + OnScroll(CFWL_EvtScroll::Code::EndScroll, m_fTrackPos); } void CFWL_ScrollBar::DoMouseMove(int32_t iItem, @@ -526,7 +524,7 @@ void CFWL_ScrollBar::DoMouseMove(int32_t iItem, } else if ((2 == iItem) && (m_iThumbButtonState == CFWL_PartState_Pressed)) { FX_FLOAT fPos = GetTrackPointPos(fx, fy); m_fTrackPos = fPos; - OnScroll(FWL_SCBCODE::TrackPos, fPos); + OnScroll(CFWL_EvtScroll::Code::TrackPos, fPos); } } diff --git a/xfa/fwl/core/cfwl_scrollbar.h b/xfa/fwl/core/cfwl_scrollbar.h index 800df51a41..98bcaf2178 100644 --- a/xfa/fwl/core/cfwl_scrollbar.h +++ b/xfa/fwl/core/cfwl_scrollbar.h @@ -89,7 +89,7 @@ class CFWL_ScrollBar : public CFWL_Widget { FX_FLOAT GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy); void GetTrackRect(CFX_RectF& rect, bool bLower = true); bool SendEvent(); - bool OnScroll(FWL_SCBCODE dwCode, FX_FLOAT fPos); + bool OnScroll(CFWL_EvtScroll::Code dwCode, FX_FLOAT fPos); void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); void OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); void OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); @@ -99,7 +99,7 @@ class CFWL_ScrollBar : public CFWL_Widget { uint32_t dwFlags, FX_FLOAT fDeltaX, FX_FLOAT fDeltaY); - bool DoScroll(FWL_SCBCODE dwCode, FX_FLOAT fPos = 0.0f); + bool DoScroll(CFWL_EvtScroll::Code dwCode, FX_FLOAT fPos = 0.0f); void DoMouseDown(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState, diff --git a/xfa/fwl/core/cfwl_spinbutton.cpp b/xfa/fwl/core/cfwl_spinbutton.cpp index 71ed3b05d2..e66b92e701 100644 --- a/xfa/fwl/core/cfwl_spinbutton.cpp +++ b/xfa/fwl/core/cfwl_spinbutton.cpp @@ -10,7 +10,7 @@ #include <utility> #include "third_party/base/ptr_util.h" -#include "xfa/fwl/core/cfwl_evtclick.h" +#include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_msgkey.h" #include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_notedriver.h" @@ -161,17 +161,16 @@ void CFWL_SpinButton::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - switch (dwMsgCode) { - case CFWL_MessageType::SetFocus: { + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: { OnFocusChanged(pMessage, true); break; } - case CFWL_MessageType::KillFocus: { + case CFWL_Message::Type::KillFocus: { OnFocusChanged(pMessage, false); break; } - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -191,7 +190,7 @@ void CFWL_SpinButton::OnProcessMessage(CFWL_Message* pMessage) { } break; } - case CFWL_MessageType::Key: { + case CFWL_Message::Type::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pKey); @@ -237,8 +236,7 @@ void CFWL_SpinButton::OnLButtonDown(CFWL_MsgMouse* pMsg) { m_dwDnState = CFWL_PartState_Pressed; } - CFWL_EvtClick wmPosChanged; - wmPosChanged.m_pSrcTarget = this; + CFWL_Event wmPosChanged(CFWL_Event::Type::Click, this); DispatchEvent(&wmPosChanged); Repaint(bUpPress ? &m_rtUpButton : &m_rtDnButton); @@ -359,8 +357,7 @@ void CFWL_SpinButton::OnKeyDown(CFWL_MsgKey* pMsg) { if (!bUpEnable && !bDownEnable) return; - CFWL_EvtClick wmPosChanged; - wmPosChanged.m_pSrcTarget = this; + CFWL_Event wmPosChanged(CFWL_Event::Type::Click, this); DispatchEvent(&wmPosChanged); Repaint(bUpEnable ? &m_rtUpButton : &m_rtDnButton); @@ -375,7 +372,6 @@ void CFWL_SpinButton::Timer::Run(CFWL_TimerInfo* pTimerInfo) { if (!pButton->m_pTimerInfo) return; - CFWL_EvtClick wmPosChanged; - wmPosChanged.m_pSrcTarget = pButton; + CFWL_Event wmPosChanged(CFWL_Event::Type::Click, pButton); pButton->DispatchEvent(&wmPosChanged); } diff --git a/xfa/fwl/core/cfwl_spinbutton.h b/xfa/fwl/core/cfwl_spinbutton.h index 6b53e68a90..391d55c3e8 100644 --- a/xfa/fwl/core/cfwl_spinbutton.h +++ b/xfa/fwl/core/cfwl_spinbutton.h @@ -9,7 +9,6 @@ #include <memory> -#include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_timer.h" #include "xfa/fwl/core/cfwl_widget.h" #include "xfa/fxfa/cxfa_eventparam.h" @@ -33,7 +32,6 @@ class CFWL_SpinButton : public CFWL_Widget { void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; void OnProcessMessage(CFWL_Message* pMessage) override; - void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp index e2de866817..d487aadb9d 100644 --- a/xfa/fwl/core/cfwl_widget.cpp +++ b/xfa/fwl/core/cfwl_widget.cpp @@ -12,12 +12,8 @@ #include "xfa/fde/tto/fde_textout.h" #include "xfa/fwl/core/cfwl_app.h" #include "xfa/fwl/core/cfwl_combobox.h" -#include "xfa/fwl/core/cfwl_evtkey.h" -#include "xfa/fwl/core/cfwl_evtkillfocus.h" +#include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_evtmouse.h" -#include "xfa/fwl/core/cfwl_evtmousewheel.h" -#include "xfa/fwl/core/cfwl_evtsetfocus.h" -#include "xfa/fwl/core/cfwl_evtsizechanged.h" #include "xfa/fwl/core/cfwl_form.h" #include "xfa/fwl/core/cfwl_msgkey.h" #include "xfa/fwl/core/cfwl_msgkillfocus.h" @@ -86,21 +82,10 @@ void CFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { - CFX_RectF rtOld = m_pProperties->m_rtWidget; m_pProperties->m_rtWidget = rect; - if (IsChild()) { - if (FXSYS_fabs(rtOld.width - rect.width) > 0.5f || - FXSYS_fabs(rtOld.height - rect.height) > 0.5f) { - CFWL_EvtSizeChanged ev; - ev.m_pSrcTarget = this; - ev.m_rtOld = rtOld; - ev.m_rtNew = rect; - - if (IFWL_WidgetDelegate* pDelegate = GetDelegate()) - pDelegate->OnProcessEvent(&ev); - } + if (IsChild()) return; - } + m_pWidgetMgr->SetWidgetRect_Native(this, rect); } @@ -598,18 +583,6 @@ void CFWL_Widget::UnregisterEventTarget() { pNoteDriver->UnregisterEventTarget(this); } -void CFWL_Widget::DispatchKeyEvent(CFWL_MsgKey* pNote) { - if (!pNote) - return; - - auto pEvent = pdfium::MakeUnique<CFWL_EvtKey>(); - pEvent->m_pSrcTarget = this; - pEvent->m_dwCmd = pNote->m_dwCmd; - pEvent->m_dwKeyCode = pNote->m_dwKeyCode; - pEvent->m_dwFlags = pNote->m_dwFlags; - DispatchEvent(pEvent.get()); -} - void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) { if (m_pOuter) { m_pOuter->GetDelegate()->OnProcessEvent(pEvent); @@ -733,61 +706,12 @@ void CFWL_Widget::OnProcessMessage(CFWL_Message* pMessage) { return; CFWL_Widget* pWidget = pMessage->m_pDstTarget; - CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - switch (dwMsgCode) { - case CFWL_MessageType::Mouse: { + switch (pMessage->GetType()) { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMsgMouse = static_cast<CFWL_MsgMouse*>(pMessage); - CFWL_EvtMouse evt; - evt.m_pSrcTarget = pWidget; - evt.m_pDstTarget = pWidget; + + CFWL_EvtMouse evt(pWidget, pWidget); evt.m_dwCmd = pMsgMouse->m_dwCmd; - evt.m_dwFlags = pMsgMouse->m_dwFlags; - evt.m_fx = pMsgMouse->m_fx; - evt.m_fy = pMsgMouse->m_fy; - pWidget->DispatchEvent(&evt); - break; - } - case CFWL_MessageType::MouseWheel: { - CFWL_MsgMouseWheel* pMsgMouseWheel = - static_cast<CFWL_MsgMouseWheel*>(pMessage); - CFWL_EvtMouseWheel evt; - evt.m_pSrcTarget = pWidget; - evt.m_pDstTarget = pWidget; - evt.m_dwFlags = pMsgMouseWheel->m_dwFlags; - evt.m_fDeltaX = pMsgMouseWheel->m_fDeltaX; - evt.m_fDeltaY = pMsgMouseWheel->m_fDeltaY; - evt.m_fx = pMsgMouseWheel->m_fx; - evt.m_fy = pMsgMouseWheel->m_fy; - pWidget->DispatchEvent(&evt); - break; - } - case CFWL_MessageType::Key: { - CFWL_MsgKey* pMsgKey = static_cast<CFWL_MsgKey*>(pMessage); - CFWL_EvtKey evt; - evt.m_pSrcTarget = pWidget; - evt.m_pDstTarget = pWidget; - evt.m_dwKeyCode = pMsgKey->m_dwKeyCode; - evt.m_dwFlags = pMsgKey->m_dwFlags; - evt.m_dwCmd = pMsgKey->m_dwCmd; - pWidget->DispatchEvent(&evt); - break; - } - case CFWL_MessageType::SetFocus: { - CFWL_MsgSetFocus* pMsgSetFocus = static_cast<CFWL_MsgSetFocus*>(pMessage); - CFWL_EvtSetFocus evt; - evt.m_pSrcTarget = pMsgSetFocus->m_pDstTarget; - evt.m_pDstTarget = pMsgSetFocus->m_pDstTarget; - evt.m_pSetFocus = pWidget; - pWidget->DispatchEvent(&evt); - break; - } - case CFWL_MessageType::KillFocus: { - CFWL_MsgKillFocus* pMsgKillFocus = - static_cast<CFWL_MsgKillFocus*>(pMessage); - CFWL_EvtKillFocus evt; - evt.m_pSrcTarget = pMsgKillFocus->m_pDstTarget; - evt.m_pDstTarget = pMsgKillFocus->m_pDstTarget; - evt.m_pKillFocus = pWidget; pWidget->DispatchEvent(&evt); break; } diff --git a/xfa/fwl/core/cfwl_widget.h b/xfa/fwl/core/cfwl_widget.h index 7a993e5e22..5e9660c6de 100644 --- a/xfa/fwl/core/cfwl_widget.h +++ b/xfa/fwl/core/cfwl_widget.h @@ -140,7 +140,6 @@ class CFWL_Widget : public IFWL_WidgetDelegate { CFX_RectF& rtPopup); void RegisterEventTarget(CFWL_Widget* pEventSource); void UnregisterEventTarget(); - void DispatchKeyEvent(CFWL_MsgKey* pNote); void DispatchEvent(CFWL_Event* pEvent); void DrawBorder(CFX_Graphics* pGraphics, CFWL_Part iPartBorder, diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index 06e3b2c8b8..dab6b2cde0 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -246,13 +246,12 @@ bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags, return false; SetButtonDown(false); - CFWL_MsgMouse ms; + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -300,8 +299,8 @@ void CXFA_FFCheckButton::OnProcessMessage(CFWL_Message* pMessage) { void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { CXFA_FFField::OnProcessEvent(pEvent); - switch (pEvent->GetClassID()) { - case CFWL_EventType::CheckStateChanged: { + switch (pEvent->GetType()) { + case CFWL_Event::Type::CheckStateChanged: { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw); diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index c9a513607e..d4cfe07202 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -196,8 +196,8 @@ void CXFA_FFListBox::OnProcessMessage(CFWL_Message* pMessage) { void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) { CXFA_FFField::OnProcessEvent(pEvent); - switch (pEvent->GetClassID()) { - case CFWL_EventType::SelectChanged: { + switch (pEvent->GetType()) { + case CFWL_Event::Type::SelectChanged: { CFX_Int32Array arrSels; OnSelectChanged(m_pNormalWidget, arrSels); break; @@ -510,23 +510,23 @@ void CXFA_FFComboBox::OnProcessMessage(CFWL_Message* pMessage) { void CXFA_FFComboBox::OnProcessEvent(CFWL_Event* pEvent) { CXFA_FFField::OnProcessEvent(pEvent); - switch (pEvent->GetClassID()) { - case CFWL_EventType::SelectChanged: { + switch (pEvent->GetType()) { + case CFWL_Event::Type::SelectChanged: { CFWL_EvtSelectChanged* postEvent = static_cast<CFWL_EvtSelectChanged*>(pEvent); OnSelectChanged(m_pNormalWidget, postEvent->bLButtonUp); break; } - case CFWL_EventType::EditChanged: { + case CFWL_Event::Type::EditChanged: { CFX_WideString wsChanged; OnTextChanged(m_pNormalWidget, wsChanged); break; } - case CFWL_EventType::PreDropDown: { + case CFWL_Event::Type::PreDropDown: { OnPreOpen(m_pNormalWidget); break; } - case CFWL_EventType::PostDropDown: { + case CFWL_Event::Type::PostDropDown: { OnPostOpen(m_pNormalWidget); break; } diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 43efb5ee90..689a0b5469 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -349,10 +349,8 @@ bool CXFA_FFField::OnMouseEnter() { if (!m_pNormalWidget) { return false; } - CFWL_MsgMouse ms; + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::Enter; - ms.m_pDstTarget = m_pNormalWidget; - ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return true; } @@ -360,9 +358,8 @@ bool CXFA_FFField::OnMouseExit() { if (!m_pNormalWidget) { return false; } - CFWL_MsgMouse ms; + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::Leave; - ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -387,13 +384,12 @@ bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { return false; } SetButtonDown(true); - CFWL_MsgMouse ms; + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -405,13 +401,12 @@ bool CXFA_FFField::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { return false; } SetButtonDown(false); - CFWL_MsgMouse ms; + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -419,13 +414,12 @@ bool CXFA_FFField::OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { if (!m_pNormalWidget) { return false; } - CFWL_MsgMouse ms; + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonDblClk; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -433,13 +427,12 @@ bool CXFA_FFField::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { if (!m_pNormalWidget) { return false; } - CFWL_MsgMouse ms; + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::Move; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -450,14 +443,13 @@ bool CXFA_FFField::OnMouseWheel(uint32_t dwFlags, if (!m_pNormalWidget) { return false; } - CFWL_MsgMouseWheel ms; + CFWL_MsgMouseWheel ms(nullptr, m_pNormalWidget); ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); ms.m_fDeltaX = zDelta; ms.m_fDeltaY = 0; - ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -473,13 +465,13 @@ bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { return false; } SetButtonDown(true); - CFWL_MsgMouse ms; + + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -491,13 +483,12 @@ bool CXFA_FFField::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { return false; } SetButtonDown(false); - CFWL_MsgMouse ms; + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::RightButtonUp; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -505,13 +496,12 @@ bool CXFA_FFField::OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { if (!m_pNormalWidget) { return false; } - CFWL_MsgMouse ms; + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::RightButtonDblClk; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -521,9 +511,7 @@ bool CXFA_FFField::OnSetFocus(CXFA_FFWidget* pOldWidget) { if (!m_pNormalWidget) { return false; } - CFWL_MsgSetFocus ms; - ms.m_pDstTarget = m_pNormalWidget; - ms.m_pSrcTarget = nullptr; + CFWL_MsgSetFocus ms(nullptr, m_pNormalWidget); TranslateFWLMessage(&ms); m_dwStatus |= XFA_WidgetStatus_Focused; AddInvalidateRect(); @@ -533,9 +521,7 @@ bool CXFA_FFField::OnKillFocus(CXFA_FFWidget* pNewWidget) { if (!m_pNormalWidget) { return CXFA_FFWidget::OnKillFocus(pNewWidget); } - CFWL_MsgKillFocus ms; - ms.m_pDstTarget = m_pNormalWidget; - ms.m_pSrcTarget = nullptr; + CFWL_MsgKillFocus ms(nullptr, m_pNormalWidget); TranslateFWLMessage(&ms); m_dwStatus &= ~XFA_WidgetStatus_Focused; AddInvalidateRect(); @@ -546,12 +532,10 @@ bool CXFA_FFField::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { if (!m_pNormalWidget || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { return false; } - CFWL_MsgKey ms; + CFWL_MsgKey ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_KeyCommand::KeyDown; ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwKeyCode; - ms.m_pDstTarget = m_pNormalWidget; - ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return true; } @@ -559,12 +543,10 @@ bool CXFA_FFField::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { if (!m_pNormalWidget || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { return false; } - CFWL_MsgKey ms; + CFWL_MsgKey ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_KeyCommand::KeyUp; ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwKeyCode; - ms.m_pDstTarget = m_pNormalWidget; - ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return true; } @@ -581,12 +563,10 @@ bool CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) { if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { return false; } - CFWL_MsgKey ms; + CFWL_MsgKey ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_KeyCommand::Char; ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwChar; - ms.m_pDstTarget = m_pNormalWidget; - ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return true; } @@ -779,8 +759,8 @@ void CXFA_FFField::TranslateFWLMessage(CFWL_Message* pMessage) { void CXFA_FFField::OnProcessMessage(CFWL_Message* pMessage) {} void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { - switch (pEvent->GetClassID()) { - case CFWL_EventType::Mouse: { + switch (pEvent->GetType()) { + case CFWL_Event::Type::Mouse: { CFWL_EvtMouse* event = (CFWL_EvtMouse*)pEvent; if (event->m_dwCmd == FWL_MouseCommand::Enter) { CXFA_EventParam eParam; @@ -805,7 +785,7 @@ void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { } break; } - case CFWL_EventType::Click: { + case CFWL_Event::Type::Click: { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Click; eParam.m_pTarget = m_pDataAcc; diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index 318a772855..3506cc9703 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -93,12 +93,12 @@ bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, return false; SetButtonDown(true); - CFWL_MsgMouse ms; + + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; - ms.m_pDstTarget = m_pNormalWidget; FWLToClient(ms.m_fx, ms.m_fy); TranslateFWLMessage(&ms); return true; diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index a070f90b99..89c323c23b 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -117,12 +117,11 @@ bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, AddInvalidateRect(); } SetButtonDown(true); - CFWL_MsgMouse ms; + CFWL_MsgMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; - ms.m_pDstTarget = m_pNormalWidget; FWLToClient(ms.m_fx, ms.m_fy); TranslateFWLMessage(&ms); return true; @@ -142,7 +141,7 @@ bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, AddInvalidateRect(); } SetButtonDown(true); - CFWL_MsgMouse ms; + CFWL_MsgMouse ms(nullptr, nullptr); ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; ms.m_dwFlags = dwFlags; ms.m_fx = fx; @@ -166,16 +165,12 @@ bool CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) { AddInvalidateRect(); } CXFA_FFWidget::OnSetFocus(pOldWidget); - CFWL_MsgSetFocus ms; - ms.m_pDstTarget = m_pNormalWidget; - ms.m_pSrcTarget = nullptr; + CFWL_MsgSetFocus ms(nullptr, m_pNormalWidget); TranslateFWLMessage(&ms); return true; } bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) { - CFWL_MsgKillFocus ms; - ms.m_pDstTarget = m_pNormalWidget; - ms.m_pSrcTarget = nullptr; + CFWL_MsgKillFocus ms(nullptr, m_pNormalWidget); TranslateFWLMessage(&ms); m_dwStatus &= ~XFA_WidgetStatus_Focused; SetEditScrollOffset(); @@ -338,18 +333,18 @@ void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { CXFA_FFField::OnProcessEvent(pEvent); - switch (pEvent->GetClassID()) { - case CFWL_EventType::TextChanged: { + switch (pEvent->GetType()) { + case CFWL_Event::Type::TextChanged: { CFWL_EvtTextChanged* event = static_cast<CFWL_EvtTextChanged*>(pEvent); CFX_WideString wsChange; OnTextChanged(m_pNormalWidget, wsChange, event->wsPrevText); break; } - case CFWL_EventType::TextFull: { + case CFWL_Event::Type::TextFull: { OnTextFull(m_pNormalWidget); break; } - case CFWL_EventType::CheckWord: { + case CFWL_Event::Type::CheckWord: { CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged"); CFWL_EvtCheckWord* event = static_cast<CFWL_EvtCheckWord*>(pEvent); event->bCheckWord = CheckWord(event->bsWord.AsStringC()); @@ -418,7 +413,7 @@ void CXFA_FFNumericEdit::UpdateWidgetProperty() { } void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { - if (pEvent->GetClassID() == CFWL_EventType::Validate) { + if (pEvent->GetType() == CFWL_Event::Type::Validate) { CFWL_EvtValidate* event = static_cast<CFWL_EvtValidate*>(pEvent); event->bValidate = OnValidate(m_pNormalWidget, event->wsInsert); return; @@ -683,7 +678,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget, } void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { - if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { + if (pEvent->GetType() == CFWL_Event::Type::SelectChanged) { CFWL_EvtSelectChanged* event = static_cast<CFWL_EvtSelectChanged*>(pEvent); OnSelectChanged(m_pNormalWidget, event->iYear, event->iMonth, event->iDay); return; |