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/basewidget/fwl_editimp.h" | 7 #include "xfa/fwl/basewidget/fwl_editimp.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 m_pOwner->DeviceToEngine(pt); | 1824 m_pOwner->DeviceToEngine(pt); |
1825 FX_BOOL bBefore = TRUE; | 1825 FX_BOOL bBefore = TRUE; |
1826 int32_t nIndex = pPage->GetCharIndex(pt, bBefore); | 1826 int32_t nIndex = pPage->GetCharIndex(pt, bBefore); |
1827 if (nIndex < 0) { | 1827 if (nIndex < 0) { |
1828 nIndex = 0; | 1828 nIndex = 0; |
1829 } | 1829 } |
1830 m_pOwner->m_pEdtEngine->SetCaretPos(nIndex, bBefore); | 1830 m_pOwner->m_pEdtEngine->SetCaretPos(nIndex, bBefore); |
1831 } | 1831 } |
1832 void CFWL_EditImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { | 1832 void CFWL_EditImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { |
1833 uint32_t dwStyleEx = m_pOwner->GetStylesEx(); | 1833 uint32_t dwStyleEx = m_pOwner->GetStylesEx(); |
1834 FX_BOOL bRepaint = dwStyleEx & FWL_STYLEEXT_EDT_InnerCaret; | 1834 bool bRepaint = !!(dwStyleEx & FWL_STYLEEXT_EDT_InnerCaret); |
1835 if (bSet) { | 1835 if (bSet) { |
1836 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; | 1836 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; |
1837 if (!m_pOwner->m_pEdtEngine) { | 1837 if (!m_pOwner->m_pEdtEngine) { |
1838 m_pOwner->UpdateEditEngine(); | 1838 m_pOwner->UpdateEditEngine(); |
1839 } | 1839 } |
1840 m_pOwner->UpdateVAlignment(); | 1840 m_pOwner->UpdateVAlignment(); |
1841 m_pOwner->UpdateOffset(); | 1841 m_pOwner->UpdateOffset(); |
1842 m_pOwner->UpdateCaret(); | 1842 m_pOwner->UpdateCaret(); |
1843 } else if (m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { | 1843 } else if (m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { |
1844 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; | 1844 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2153 } | 2153 } |
2154 CFX_RectF rect; | 2154 CFX_RectF rect; |
2155 m_pOwner->GetWidgetRect(rect); | 2155 m_pOwner->GetWidgetRect(rect); |
2156 CFX_RectF rtInvalidate; | 2156 CFX_RectF rtInvalidate; |
2157 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 2157 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
2158 m_pOwner->Repaint(&rtInvalidate); | 2158 m_pOwner->Repaint(&rtInvalidate); |
2159 } | 2159 } |
2160 return TRUE; | 2160 return TRUE; |
2161 } | 2161 } |
2162 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} | 2162 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} |
OLD | NEW |