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/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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 FX_FLOAT fStep) { | 44 FX_FLOAT fStep) { |
45 pPathData->MoveTo(fStartX, fY); | 45 pPathData->MoveTo(fStartX, fY); |
46 int i = 1; | 46 int i = 1; |
47 for (FX_FLOAT fx = fStartX + fStep; fx < fEndX; fx += fStep, ++i) { | 47 for (FX_FLOAT fx = fStartX + fStep; fx < fEndX; fx += fStep, ++i) { |
48 pPathData->LineTo(fx, fY + (i & 1) * fStep); | 48 pPathData->LineTo(fx, fY + (i & 1) * fStep); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 } // namespace | 52 } // namespace |
53 | 53 |
54 // static | |
55 IFWL_Edit* IFWL_Edit::Create(const CFWL_WidgetImpProperties& properties, | |
56 IFWL_Widget* pOuter) { | |
57 return new IFWL_Edit(properties, pOuter); | |
58 } | |
59 | |
60 IFWL_Edit::IFWL_Edit(const CFWL_WidgetImpProperties& properties, | 54 IFWL_Edit::IFWL_Edit(const CFWL_WidgetImpProperties& properties, |
61 IFWL_Widget* pOuter) | 55 IFWL_Widget* pOuter) |
62 : IFWL_Widget(properties, pOuter), | 56 : IFWL_Widget(properties, pOuter), |
63 m_fVAlignOffset(0.0f), | 57 m_fVAlignOffset(0.0f), |
64 m_fScrollOffsetX(0.0f), | 58 m_fScrollOffsetX(0.0f), |
65 m_fScrollOffsetY(0.0f), | 59 m_fScrollOffsetY(0.0f), |
66 m_bLButtonDown(FALSE), | 60 m_bLButtonDown(FALSE), |
67 m_nSelStart(0), | 61 m_nSelStart(0), |
68 m_nLimit(-1), | 62 m_nLimit(-1), |
69 m_fSpaceAbove(0), | 63 m_fSpaceAbove(0), |
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 | 1469 |
1476 void IFWL_Edit::InitScrollBar(FX_BOOL bVert) { | 1470 void IFWL_Edit::InitScrollBar(FX_BOOL bVert) { |
1477 if ((bVert && m_pVertScrollBar) || (!bVert && m_pHorzScrollBar)) { | 1471 if ((bVert && m_pVertScrollBar) || (!bVert && m_pHorzScrollBar)) { |
1478 return; | 1472 return; |
1479 } | 1473 } |
1480 CFWL_WidgetImpProperties prop; | 1474 CFWL_WidgetImpProperties prop; |
1481 prop.m_dwStyleExes = bVert ? FWL_STYLEEXT_SCB_Vert : FWL_STYLEEXT_SCB_Horz; | 1475 prop.m_dwStyleExes = bVert ? FWL_STYLEEXT_SCB_Vert : FWL_STYLEEXT_SCB_Horz; |
1482 prop.m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible; | 1476 prop.m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible; |
1483 prop.m_pParent = this; | 1477 prop.m_pParent = this; |
1484 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; | 1478 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; |
1485 IFWL_ScrollBar* pScrollBar = IFWL_ScrollBar::Create(prop, this); | 1479 IFWL_ScrollBar* pScrollBar = new IFWL_ScrollBar(prop, this); |
1486 pScrollBar->Initialize(); | 1480 pScrollBar->Initialize(); |
1487 (bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar); | 1481 (bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar); |
1488 } | 1482 } |
1489 | 1483 |
1490 void IFWL_Edit::InitEngine() { | 1484 void IFWL_Edit::InitEngine() { |
1491 if (!m_pEdtEngine) | 1485 if (!m_pEdtEngine) |
1492 m_pEdtEngine.reset(new CFDE_TxtEdtEngine); | 1486 m_pEdtEngine.reset(new CFDE_TxtEdtEngine); |
1493 } | 1487 } |
1494 | 1488 |
1495 FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, | 1489 FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 if (wsText.GetInteger() <= m_iMax) { | 1567 if (wsText.GetInteger() <= m_iMax) { |
1574 return TRUE; | 1568 return TRUE; |
1575 } | 1569 } |
1576 } | 1570 } |
1577 return FALSE; | 1571 return FALSE; |
1578 } | 1572 } |
1579 void IFWL_Edit::InitCaret() { | 1573 void IFWL_Edit::InitCaret() { |
1580 if (!m_pCaret) { | 1574 if (!m_pCaret) { |
1581 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret)) { | 1575 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret)) { |
1582 CFWL_WidgetImpProperties prop; | 1576 CFWL_WidgetImpProperties prop; |
1583 m_pCaret.reset(IFWL_Caret::Create(prop, this)); | 1577 m_pCaret.reset(new IFWL_Caret(prop, this)); |
1584 m_pCaret->Initialize(); | 1578 m_pCaret->Initialize(); |
1585 m_pCaret->SetParent(this); | 1579 m_pCaret->SetParent(this); |
1586 m_pCaret->SetStates(m_pProperties->m_dwStates); | 1580 m_pCaret->SetStates(m_pProperties->m_dwStates); |
1587 } | 1581 } |
1588 } else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret) == | 1582 } else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret) == |
1589 0) { | 1583 0) { |
1590 m_pCaret.reset(); | 1584 m_pCaret.reset(); |
1591 } | 1585 } |
1592 } | 1586 } |
1593 | 1587 |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2044 } | 2038 } |
2045 CFX_RectF rect; | 2039 CFX_RectF rect; |
2046 m_pOwner->GetWidgetRect(rect); | 2040 m_pOwner->GetWidgetRect(rect); |
2047 CFX_RectF rtInvalidate; | 2041 CFX_RectF rtInvalidate; |
2048 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 2042 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
2049 m_pOwner->Repaint(&rtInvalidate); | 2043 m_pOwner->Repaint(&rtInvalidate); |
2050 } | 2044 } |
2051 return TRUE; | 2045 return TRUE; |
2052 } | 2046 } |
2053 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} | 2047 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} |
OLD | NEW |