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

Side by Side Diff: xfa/fwl/core/ifwl_edit.cpp

Issue 2469893004: Unify CFWL_WidgetProperties and CFWL_WidgetImpProperties. (Closed)
Patch Set: review cleanup Created 4 years, 1 month 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/fwl/core/ifwl_edit.h ('k') | xfa/fwl/core/ifwl_form.h » ('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/fwl/core/ifwl_edit.h" 7 #include "xfa/fwl/core/ifwl_edit.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 pPathData->MoveTo(fStartX, fY); 46 pPathData->MoveTo(fStartX, fY);
47 int i = 1; 47 int i = 1;
48 for (FX_FLOAT fx = fStartX + fStep; fx < fEndX; fx += fStep, ++i) { 48 for (FX_FLOAT fx = fStartX + fStep; fx < fEndX; fx += fStep, ++i) {
49 pPathData->LineTo(fx, fY + (i & 1) * fStep); 49 pPathData->LineTo(fx, fY + (i & 1) * fStep);
50 } 50 }
51 } 51 }
52 52
53 } // namespace 53 } // namespace
54 54
55 IFWL_Edit::IFWL_Edit(const IFWL_App* app, 55 IFWL_Edit::IFWL_Edit(const IFWL_App* app,
56 const CFWL_WidgetImpProperties& properties, 56 std::unique_ptr<CFWL_WidgetProperties> properties,
57 IFWL_Widget* pOuter) 57 IFWL_Widget* pOuter)
58 : IFWL_Widget(app, properties, pOuter), 58 : IFWL_Widget(app, std::move(properties), pOuter),
59 m_fVAlignOffset(0.0f), 59 m_fVAlignOffset(0.0f),
60 m_fScrollOffsetX(0.0f), 60 m_fScrollOffsetX(0.0f),
61 m_fScrollOffsetY(0.0f), 61 m_fScrollOffsetY(0.0f),
62 m_bLButtonDown(false), 62 m_bLButtonDown(false),
63 m_nSelStart(0), 63 m_nSelStart(0),
64 m_nLimit(-1), 64 m_nLimit(-1),
65 m_fSpaceAbove(0), 65 m_fSpaceAbove(0),
66 m_fSpaceBelow(0), 66 m_fSpaceBelow(0),
67 m_fFontSize(0), 67 m_fFontSize(0),
68 m_bSetRange(false), 68 m_bSetRange(false),
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 1442
1443 void IFWL_Edit::DeviceToEngine(CFX_PointF& pt) { 1443 void IFWL_Edit::DeviceToEngine(CFX_PointF& pt) {
1444 pt.x += m_fScrollOffsetX - m_rtEngine.left; 1444 pt.x += m_fScrollOffsetX - m_rtEngine.left;
1445 pt.y += m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset; 1445 pt.y += m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset;
1446 } 1446 }
1447 1447
1448 void IFWL_Edit::InitScrollBar(bool bVert) { 1448 void IFWL_Edit::InitScrollBar(bool bVert) {
1449 if ((bVert && m_pVertScrollBar) || (!bVert && m_pHorzScrollBar)) { 1449 if ((bVert && m_pVertScrollBar) || (!bVert && m_pHorzScrollBar)) {
1450 return; 1450 return;
1451 } 1451 }
1452 CFWL_WidgetImpProperties prop;
1453 prop.m_dwStyleExes = bVert ? FWL_STYLEEXT_SCB_Vert : FWL_STYLEEXT_SCB_Horz;
1454 prop.m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible;
1455 prop.m_pParent = this;
1456 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
1457 1452
1458 IFWL_ScrollBar* sb = new IFWL_ScrollBar(m_pOwnerApp, prop, this); 1453 auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>();
1454 prop->m_dwStyleExes = bVert ? FWL_STYLEEXT_SCB_Vert : FWL_STYLEEXT_SCB_Horz;
1455 prop->m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible;
1456 prop->m_pParent = this;
1457 prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
1458
1459 IFWL_ScrollBar* sb = new IFWL_ScrollBar(m_pOwnerApp, std::move(prop), this);
1459 if (bVert) 1460 if (bVert)
1460 m_pVertScrollBar.reset(sb); 1461 m_pVertScrollBar.reset(sb);
1461 else 1462 else
1462 m_pHorzScrollBar.reset(sb); 1463 m_pHorzScrollBar.reset(sb);
1463 } 1464 }
1464 1465
1465 void IFWL_Edit::InitEngine() { 1466 void IFWL_Edit::InitEngine() {
1466 if (!m_pEdtEngine) 1467 if (!m_pEdtEngine)
1467 m_pEdtEngine.reset(new CFDE_TxtEdtEngine); 1468 m_pEdtEngine.reset(new CFDE_TxtEdtEngine);
1468 } 1469 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 } else { 1548 } else {
1548 if (wsText.GetInteger() <= m_iMax) { 1549 if (wsText.GetInteger() <= m_iMax) {
1549 return true; 1550 return true;
1550 } 1551 }
1551 } 1552 }
1552 return false; 1553 return false;
1553 } 1554 }
1554 void IFWL_Edit::InitCaret() { 1555 void IFWL_Edit::InitCaret() {
1555 if (!m_pCaret) { 1556 if (!m_pCaret) {
1556 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret)) { 1557 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret)) {
1557 CFWL_WidgetImpProperties prop; 1558 m_pCaret.reset(new IFWL_Caret(
1558 m_pCaret.reset(new IFWL_Caret(m_pOwnerApp, prop, this)); 1559 m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), this));
1559 m_pCaret->SetParent(this); 1560 m_pCaret->SetParent(this);
1560 m_pCaret->SetStates(m_pProperties->m_dwStates); 1561 m_pCaret->SetStates(m_pProperties->m_dwStates);
1561 } 1562 }
1562 } else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret) == 1563 } else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret) ==
1563 0) { 1564 0) {
1564 m_pCaret.reset(); 1565 m_pCaret.reset();
1565 } 1566 }
1566 } 1567 }
1567 1568
1568 void IFWL_Edit::ClearRecord() { 1569 void IFWL_Edit::ClearRecord() {
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 UpdateCaret(); 1995 UpdateCaret();
1995 } 1996 }
1996 CFX_RectF rect; 1997 CFX_RectF rect;
1997 GetWidgetRect(rect); 1998 GetWidgetRect(rect);
1998 CFX_RectF rtInvalidate; 1999 CFX_RectF rtInvalidate;
1999 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); 2000 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2);
2000 Repaint(&rtInvalidate); 2001 Repaint(&rtInvalidate);
2001 } 2002 }
2002 return true; 2003 return true;
2003 } 2004 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_edit.h ('k') | xfa/fwl/core/ifwl_form.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698