| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxfa/app/xfa_ffcheckbutton.h" | 7 #include "xfa/fxfa/app/xfa_ffcheckbutton.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/core/cfwl_checkbox.h" | 9 #include "xfa/fwl/core/cfwl_checkbox.h" |
| 10 #include "xfa/fwl/core/cfwl_msgmouse.h" | 10 #include "xfa/fwl/core/cfwl_msgmouse.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 mt.Concat(mtRotate); | 239 mt.Concat(mtRotate); |
| 240 GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt); | 240 GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt); |
| 241 } | 241 } |
| 242 bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags, | 242 bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags, |
| 243 FX_FLOAT fx, | 243 FX_FLOAT fx, |
| 244 FX_FLOAT fy) { | 244 FX_FLOAT fy) { |
| 245 if (!m_pNormalWidget || !IsButtonDown()) | 245 if (!m_pNormalWidget || !IsButtonDown()) |
| 246 return false; | 246 return false; |
| 247 | 247 |
| 248 SetButtonDown(false); | 248 SetButtonDown(false); |
| 249 CFWL_MsgMouse ms; | 249 CFWL_MsgMouse ms(nullptr, m_pNormalWidget); |
| 250 ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp; | 250 ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp; |
| 251 ms.m_dwFlags = dwFlags; | 251 ms.m_dwFlags = dwFlags; |
| 252 ms.m_fx = fx; | 252 ms.m_fx = fx; |
| 253 ms.m_fy = fy; | 253 ms.m_fy = fy; |
| 254 FWLToClient(ms.m_fx, ms.m_fy); | 254 FWLToClient(ms.m_fx, ms.m_fy); |
| 255 ms.m_pDstTarget = m_pNormalWidget; | |
| 256 TranslateFWLMessage(&ms); | 255 TranslateFWLMessage(&ms); |
| 257 return true; | 256 return true; |
| 258 } | 257 } |
| 259 | 258 |
| 260 XFA_CHECKSTATE CXFA_FFCheckButton::FWLState2XFAState() { | 259 XFA_CHECKSTATE CXFA_FFCheckButton::FWLState2XFAState() { |
| 261 uint32_t dwState = m_pNormalWidget->GetStates(); | 260 uint32_t dwState = m_pNormalWidget->GetStates(); |
| 262 if (dwState & FWL_STATE_CKB_Checked) | 261 if (dwState & FWL_STATE_CKB_Checked) |
| 263 return XFA_CHECKSTATE_On; | 262 return XFA_CHECKSTATE_On; |
| 264 if (dwState & FWL_STATE_CKB_Neutral) | 263 if (dwState & FWL_STATE_CKB_Neutral) |
| 265 return XFA_CHECKSTATE_Neutral; | 264 return XFA_CHECKSTATE_Neutral; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 293 m_pNormalWidget->Update(); | 292 m_pNormalWidget->Update(); |
| 294 return true; | 293 return true; |
| 295 } | 294 } |
| 296 | 295 |
| 297 void CXFA_FFCheckButton::OnProcessMessage(CFWL_Message* pMessage) { | 296 void CXFA_FFCheckButton::OnProcessMessage(CFWL_Message* pMessage) { |
| 298 m_pOldDelegate->OnProcessMessage(pMessage); | 297 m_pOldDelegate->OnProcessMessage(pMessage); |
| 299 } | 298 } |
| 300 | 299 |
| 301 void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { | 300 void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { |
| 302 CXFA_FFField::OnProcessEvent(pEvent); | 301 CXFA_FFField::OnProcessEvent(pEvent); |
| 303 switch (pEvent->GetClassID()) { | 302 switch (pEvent->GetType()) { |
| 304 case CFWL_EventType::CheckStateChanged: { | 303 case CFWL_Event::Type::CheckStateChanged: { |
| 305 CXFA_EventParam eParam; | 304 CXFA_EventParam eParam; |
| 306 eParam.m_eType = XFA_EVENT_Change; | 305 eParam.m_eType = XFA_EVENT_Change; |
| 307 m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw); | 306 m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw); |
| 308 CXFA_WidgetAcc* pFFExclGroup = m_pDataAcc->GetExclGroup(); | 307 CXFA_WidgetAcc* pFFExclGroup = m_pDataAcc->GetExclGroup(); |
| 309 if (ProcessCommittedData()) { | 308 if (ProcessCommittedData()) { |
| 310 eParam.m_pTarget = pFFExclGroup; | 309 eParam.m_pTarget = pFFExclGroup; |
| 311 if (pFFExclGroup) { | 310 if (pFFExclGroup) { |
| 312 m_pDocView->AddValidateWidget(pFFExclGroup); | 311 m_pDocView->AddValidateWidget(pFFExclGroup); |
| 313 m_pDocView->AddCalculateWidgetAcc(pFFExclGroup); | 312 m_pDocView->AddCalculateWidgetAcc(pFFExclGroup); |
| 314 pFFExclGroup->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); | 313 pFFExclGroup->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 329 default: | 328 default: |
| 330 break; | 329 break; |
| 331 } | 330 } |
| 332 m_pOldDelegate->OnProcessEvent(pEvent); | 331 m_pOldDelegate->OnProcessEvent(pEvent); |
| 333 } | 332 } |
| 334 | 333 |
| 335 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, | 334 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, |
| 336 const CFX_Matrix* pMatrix) { | 335 const CFX_Matrix* pMatrix) { |
| 337 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 336 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
| 338 } | 337 } |
| OLD | NEW |