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

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

Issue 2556873004: Convert GetWidgetRect to return rect. (Closed)
Patch Set: Review feedback 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
« no previous file with comments | « xfa/fxfa/app/xfa_ffbarcode.cpp ('k') | xfa/fxfa/app/xfa_ffimageedit.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_fffield.h" 7 #include "xfa/fxfa/app/xfa_fffield.h"
8 8
9 #include "xfa/fwl/core/cfwl_edit.h" 9 #include "xfa/fwl/core/cfwl_edit.h"
10 #include "xfa/fwl/core/cfwl_evtmouse.h" 10 #include "xfa/fwl/core/cfwl_evtmouse.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 CFX_Matrix mtRotate; 62 CFX_Matrix mtRotate;
63 GetRotateMatrix(mtRotate); 63 GetRotateMatrix(mtRotate);
64 if (pMatrix) { 64 if (pMatrix) {
65 mtRotate.Concat(*pMatrix); 65 mtRotate.Concat(*pMatrix);
66 } 66 }
67 CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus); 67 CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
68 CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); 68 CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
69 DrawBorder(pGS, borderUI, m_rtUI, &mtRotate); 69 DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
70 RenderCaption(pGS, &mtRotate); 70 RenderCaption(pGS, &mtRotate);
71 DrawHighlight(pGS, &mtRotate, dwStatus, false); 71 DrawHighlight(pGS, &mtRotate, dwStatus, false);
72 CFX_RectF rtWidget; 72
73 m_pNormalWidget->GetWidgetRect(rtWidget, false); 73 CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect();
74 CFX_Matrix mt; 74 CFX_Matrix mt;
75 mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); 75 mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top);
76 mt.Concat(mtRotate); 76 mt.Concat(mtRotate);
77 GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt); 77 GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt);
78 } 78 }
79 void CXFA_FFField::DrawHighlight(CFX_Graphics* pGS, 79 void CXFA_FFField::DrawHighlight(CFX_Graphics* pGS,
80 CFX_Matrix* pMatrix, 80 CFX_Matrix* pMatrix,
81 uint32_t dwStatus, 81 uint32_t dwStatus,
82 bool bEllipse) { 82 bool bEllipse) {
83 if (m_rtUI.IsEmpty() || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { 83 if (m_rtUI.IsEmpty() || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 356 }
357 bool CXFA_FFField::OnMouseExit() { 357 bool CXFA_FFField::OnMouseExit() {
358 if (!m_pNormalWidget) { 358 if (!m_pNormalWidget) {
359 return false; 359 return false;
360 } 360 }
361 CFWL_MsgMouse ms(nullptr, m_pNormalWidget); 361 CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
362 ms.m_dwCmd = FWL_MouseCommand::Leave; 362 ms.m_dwCmd = FWL_MouseCommand::Leave;
363 TranslateFWLMessage(&ms); 363 TranslateFWLMessage(&ms);
364 return true; 364 return true;
365 } 365 }
366
366 void CXFA_FFField::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) { 367 void CXFA_FFField::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) {
367 if (!m_pNormalWidget) { 368 if (!m_pNormalWidget)
368 return; 369 return;
369 } 370
370 CFX_RectF rtWidget; 371 CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect();
371 m_pNormalWidget->GetWidgetRect(rtWidget, false);
372 fx -= rtWidget.left; 372 fx -= rtWidget.left;
373 fy -= rtWidget.top; 373 fy -= rtWidget.top;
374 } 374 }
375
375 bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { 376 bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
376 if (!m_pNormalWidget) { 377 if (!m_pNormalWidget) {
377 return false; 378 return false;
378 } 379 }
379 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || 380 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
380 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { 381 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
381 return false; 382 return false;
382 } 383 }
383 if (!PtInActiveRect(fx, fy)) { 384 if (!PtInActiveRect(fx, fy)) {
384 return false; 385 return false;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 return FWL_WidgetHit::Client; 579 return FWL_WidgetHit::Client;
579 } 580 }
580 CFX_RectF rtBox; 581 CFX_RectF rtBox;
581 GetRectWithoutRotate(rtBox); 582 GetRectWithoutRotate(rtBox);
582 if (!rtBox.Contains(fx, fy)) 583 if (!rtBox.Contains(fx, fy))
583 return FWL_WidgetHit::Unknown; 584 return FWL_WidgetHit::Unknown;
584 if (m_rtCaption.Contains(fx, fy)) 585 if (m_rtCaption.Contains(fx, fy))
585 return FWL_WidgetHit::Titlebar; 586 return FWL_WidgetHit::Titlebar;
586 return FWL_WidgetHit::Border; 587 return FWL_WidgetHit::Border;
587 } 588 }
589
588 bool CXFA_FFField::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { 590 bool CXFA_FFField::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) {
589 return true; 591 return true;
590 } 592 }
593
591 bool CXFA_FFField::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { 594 bool CXFA_FFField::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
592 if (!m_pNormalWidget) { 595 return m_pNormalWidget && m_pNormalWidget->GetWidgetRect().Contains(fx, fy);
593 return false;
594 }
595 CFX_RectF rtWidget;
596 m_pNormalWidget->GetWidgetRect(rtWidget, false);
597 if (rtWidget.Contains(fx, fy)) {
598 return true;
599 }
600 return false;
601 } 596 }
597
602 void CXFA_FFField::LayoutCaption() { 598 void CXFA_FFField::LayoutCaption() {
603 CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); 599 CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
604 if (!pCapTextLayout) 600 if (!pCapTextLayout)
605 return; 601 return;
606 602
607 FX_FLOAT fHeight = 0; 603 FX_FLOAT fHeight = 0;
608 pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height), 604 pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height),
609 &fHeight); 605 &fHeight);
610 if (m_rtCaption.height < fHeight) 606 if (m_rtCaption.height < fHeight)
611 m_rtCaption.height = fHeight; 607 m_rtCaption.height = fHeight;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam); 788 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam);
793 break; 789 break;
794 } 790 }
795 default: 791 default:
796 break; 792 break;
797 } 793 }
798 } 794 }
799 795
800 void CXFA_FFField::OnDrawWidget(CFX_Graphics* pGraphics, 796 void CXFA_FFField::OnDrawWidget(CFX_Graphics* pGraphics,
801 const CFX_Matrix* pMatrix) {} 797 const CFX_Matrix* pMatrix) {}
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffbarcode.cpp ('k') | xfa/fxfa/app/xfa_ffimageedit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698