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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 m_iMin(-1), | 215 m_iMin(-1), |
216 m_iMax(0xFFFFFFF), | 216 m_iMax(0xFFFFFFF), |
217 m_backColor(0), | 217 m_backColor(0), |
218 m_updateBackColor(FALSE), | 218 m_updateBackColor(FALSE), |
219 m_iCurRecord(-1), | 219 m_iCurRecord(-1), |
220 m_iMaxRecord(128) { | 220 m_iMaxRecord(128) { |
221 m_rtClient.Reset(); | 221 m_rtClient.Reset(); |
222 m_rtEngine.Reset(); | 222 m_rtEngine.Reset(); |
223 m_rtStatic.Reset(); | 223 m_rtStatic.Reset(); |
224 } | 224 } |
| 225 |
225 CFWL_EditImp::~CFWL_EditImp() { | 226 CFWL_EditImp::~CFWL_EditImp() { |
226 if (m_pEdtEngine) { | 227 if (m_pEdtEngine) { |
227 m_pEdtEngine->Release(); | 228 m_pEdtEngine->Release(); |
228 m_pEdtEngine = NULL; | 229 m_pEdtEngine = NULL; |
229 } | 230 } |
230 ClearRecord(); | 231 ClearRecord(); |
231 } | 232 } |
| 233 |
232 FWL_Error CFWL_EditImp::GetClassName(CFX_WideString& wsClass) const { | 234 FWL_Error CFWL_EditImp::GetClassName(CFX_WideString& wsClass) const { |
233 wsClass = FWL_CLASS_Edit; | 235 wsClass = FWL_CLASS_Edit; |
234 return FWL_Error::Succeeded; | 236 return FWL_Error::Succeeded; |
235 } | 237 } |
236 uint32_t CFWL_EditImp::GetClassID() const { | 238 |
237 return FWL_CLASSHASH_Edit; | 239 FWL_Type CFWL_EditImp::GetClassID() const { |
| 240 return FWL_Type::Edit; |
238 } | 241 } |
| 242 |
239 FWL_Error CFWL_EditImp::Initialize() { | 243 FWL_Error CFWL_EditImp::Initialize() { |
240 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) | 244 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) |
241 return FWL_Error::Indefinite; | 245 return FWL_Error::Indefinite; |
242 if (!m_pDelegate) { | 246 if (!m_pDelegate) |
243 m_pDelegate = new CFWL_EditImpDelegate(this); | 247 m_pDelegate = new CFWL_EditImpDelegate(this); |
244 } | 248 |
245 InitCaret(); | 249 InitCaret(); |
246 if (!m_pEdtEngine) { | 250 if (!m_pEdtEngine) |
247 InitEngine(); | 251 InitEngine(); |
248 } | 252 |
249 return FWL_Error::Succeeded; | 253 return FWL_Error::Succeeded; |
250 } | 254 } |
| 255 |
251 FWL_Error CFWL_EditImp::Finalize() { | 256 FWL_Error CFWL_EditImp::Finalize() { |
252 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { | 257 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { |
253 ShowCaret(FALSE); | 258 ShowCaret(FALSE); |
254 } | 259 } |
255 if (m_pHorzScrollBar) { | 260 if (m_pHorzScrollBar) { |
256 m_pHorzScrollBar->Finalize(); | 261 m_pHorzScrollBar->Finalize(); |
257 } | 262 } |
258 if (m_pVertScrollBar) { | 263 if (m_pVertScrollBar) { |
259 m_pVertScrollBar->Finalize(); | 264 m_pVertScrollBar->Finalize(); |
260 } | 265 } |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 if (!pfWidth) | 1505 if (!pfWidth) |
1501 return; | 1506 return; |
1502 FX_FLOAT fWidth = *pfWidth; | 1507 FX_FLOAT fWidth = *pfWidth; |
1503 if (!m_pOuter) { | 1508 if (!m_pOuter) { |
1504 CFX_RectF* pUIMargin = static_cast<CFX_RectF*>( | 1509 CFX_RectF* pUIMargin = static_cast<CFX_RectF*>( |
1505 GetThemeCapacity(CFWL_WidgetCapacity::UIMargin)); | 1510 GetThemeCapacity(CFWL_WidgetCapacity::UIMargin)); |
1506 if (pUIMargin) { | 1511 if (pUIMargin) { |
1507 m_rtEngine.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, | 1512 m_rtEngine.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, |
1508 pUIMargin->height); | 1513 pUIMargin->height); |
1509 } | 1514 } |
1510 } else if (m_pOuter->GetClassID() == FWL_CLASSHASH_DateTimePicker) { | 1515 } else if (m_pOuter->GetClassID() == FWL_Type::DateTimePicker) { |
1511 CFWL_ThemePart part; | 1516 CFWL_ThemePart part; |
1512 part.m_pWidget = m_pOuter; | 1517 part.m_pWidget = m_pOuter; |
1513 CFX_RectF* pUIMargin = | 1518 CFX_RectF* pUIMargin = |
1514 static_cast<CFX_RectF*>(m_pOuter->GetThemeProvider()->GetCapacity( | 1519 static_cast<CFX_RectF*>(m_pOuter->GetThemeProvider()->GetCapacity( |
1515 &part, CFWL_WidgetCapacity::UIMargin)); | 1520 &part, CFWL_WidgetCapacity::UIMargin)); |
1516 if (pUIMargin) { | 1521 if (pUIMargin) { |
1517 m_rtEngine.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, | 1522 m_rtEngine.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, |
1518 pUIMargin->height); | 1523 pUIMargin->height); |
1519 } | 1524 } |
1520 } | 1525 } |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2199 } | 2204 } |
2200 CFX_RectF rect; | 2205 CFX_RectF rect; |
2201 m_pOwner->GetWidgetRect(rect); | 2206 m_pOwner->GetWidgetRect(rect); |
2202 CFX_RectF rtInvalidate; | 2207 CFX_RectF rtInvalidate; |
2203 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 2208 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
2204 m_pOwner->Repaint(&rtInvalidate); | 2209 m_pOwner->Repaint(&rtInvalidate); |
2205 } | 2210 } |
2206 return TRUE; | 2211 return TRUE; |
2207 } | 2212 } |
2208 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} | 2213 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} |
OLD | NEW |