Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: xfa/fxfa/app/xfa_ffcheckbutton.cpp

Issue 2524173002: Merge IFWL and CFWL classes. (Closed)
Patch Set: make chrome build happy Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_FFPageView* pPageView, 21 CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_FFPageView* pPageView,
22 CXFA_WidgetAcc* pDataAcc) 22 CXFA_WidgetAcc* pDataAcc)
23 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) { 23 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {
24 m_rtCheckBox.Set(0, 0, 0, 0); 24 m_rtCheckBox.Set(0, 0, 0, 0);
25 } 25 }
26 26
27 CXFA_FFCheckButton::~CXFA_FFCheckButton() {} 27 CXFA_FFCheckButton::~CXFA_FFCheckButton() {}
28 28
29 bool CXFA_FFCheckButton::LoadWidget() { 29 bool CXFA_FFCheckButton::LoadWidget() {
30 CFWL_CheckBox* pCheckBox = new CFWL_CheckBox(GetFWLApp()); 30 CFWL_CheckBox* pCheckBox = new CFWL_CheckBox(GetFWLApp());
31 pCheckBox->Initialize();
32 m_pNormalWidget = pCheckBox; 31 m_pNormalWidget = pCheckBox;
33 m_pNormalWidget->SetLayoutItem(this); 32 m_pNormalWidget->SetLayoutItem(this);
34 33
35 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); 34 CFWL_NoteDriver* pNoteDriver =
36 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); 35 m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
37 pNoteDriver->RegisterEventTarget(pWidget, pWidget); 36 pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget);
38 37
39 m_pOldDelegate = m_pNormalWidget->GetDelegate(); 38 m_pOldDelegate = m_pNormalWidget->GetDelegate();
40 m_pNormalWidget->SetDelegate(this); 39 m_pNormalWidget->SetDelegate(this);
41 40
42 if (m_pDataAcc->IsRadioButton()) 41 if (m_pDataAcc->IsRadioButton())
43 pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF); 42 pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF);
44 43
45 m_pNormalWidget->LockUpdate(); 44 m_pNormalWidget->LockUpdate();
46 UpdateWidgetProperty(); 45 UpdateWidgetProperty();
47 SetFWLCheckState(m_pDataAcc->GetCheckState()); 46 SetFWLCheckState(m_pDataAcc->GetCheckState());
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 DrawBorder(pGS, borderUI, m_rtUI, &mtRotate, 230 DrawBorder(pGS, borderUI, m_rtUI, &mtRotate,
232 m_pDataAcc->GetCheckButtonShape() == XFA_ATTRIBUTEENUM_Round 231 m_pDataAcc->GetCheckButtonShape() == XFA_ATTRIBUTEENUM_Round
233 ? XFA_DRAWBOX_ForceRound 232 ? XFA_DRAWBOX_ForceRound
234 : 0); 233 : 0);
235 RenderCaption(pGS, &mtRotate); 234 RenderCaption(pGS, &mtRotate);
236 DrawHighlight(pGS, &mtRotate, dwStatus, 235 DrawHighlight(pGS, &mtRotate, dwStatus,
237 m_pDataAcc->GetCheckButtonShape() == XFA_ATTRIBUTEENUM_Round); 236 m_pDataAcc->GetCheckButtonShape() == XFA_ATTRIBUTEENUM_Round);
238 CFX_Matrix mt; 237 CFX_Matrix mt;
239 mt.Set(1, 0, 0, 1, m_rtCheckBox.left, m_rtCheckBox.top); 238 mt.Set(1, 0, 0, 1, m_rtCheckBox.left, m_rtCheckBox.top);
240 mt.Concat(mtRotate); 239 mt.Concat(mtRotate);
241 GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget->GetWidget(), 240 GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt);
242 pGS, &mt);
243 } 241 }
244 bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags, 242 bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags,
245 FX_FLOAT fx, 243 FX_FLOAT fx,
246 FX_FLOAT fy) { 244 FX_FLOAT fy) {
247 if (!m_pNormalWidget || !IsButtonDown()) 245 if (!m_pNormalWidget || !IsButtonDown())
248 return false; 246 return false;
249 247
250 SetButtonDown(false); 248 SetButtonDown(false);
251 CFWL_MsgMouse ms; 249 CFWL_MsgMouse ms;
252 ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp; 250 ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp;
253 ms.m_dwFlags = dwFlags; 251 ms.m_dwFlags = dwFlags;
254 ms.m_fx = fx; 252 ms.m_fx = fx;
255 ms.m_fy = fy; 253 ms.m_fy = fy;
256 FWLToClient(ms.m_fx, ms.m_fy); 254 FWLToClient(ms.m_fx, ms.m_fy);
257 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); 255 ms.m_pDstTarget = m_pNormalWidget;
258 TranslateFWLMessage(&ms); 256 TranslateFWLMessage(&ms);
259 return true; 257 return true;
260 } 258 }
261 259
262 XFA_CHECKSTATE CXFA_FFCheckButton::FWLState2XFAState() { 260 XFA_CHECKSTATE CXFA_FFCheckButton::FWLState2XFAState() {
263 uint32_t dwState = m_pNormalWidget->GetStates(); 261 uint32_t dwState = m_pNormalWidget->GetStates();
264 if (dwState & FWL_STATE_CKB_Checked) 262 if (dwState & FWL_STATE_CKB_Checked)
265 return XFA_CHECKSTATE_On; 263 return XFA_CHECKSTATE_On;
266 if (dwState & FWL_STATE_CKB_Neutral) 264 if (dwState & FWL_STATE_CKB_Neutral)
267 return XFA_CHECKSTATE_Neutral; 265 return XFA_CHECKSTATE_Neutral;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 default: 329 default:
332 break; 330 break;
333 } 331 }
334 m_pOldDelegate->OnProcessEvent(pEvent); 332 m_pOldDelegate->OnProcessEvent(pEvent);
335 } 333 }
336 334
337 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, 335 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics,
338 const CFX_Matrix* pMatrix) { 336 const CFX_Matrix* pMatrix) {
339 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); 337 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
340 } 338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698