| 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_widget.h" | 7 #include "xfa/fwl/core/ifwl_widget.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "xfa/fxfa/xfa_ffapp.h" | 23 #include "xfa/fxfa/xfa_ffapp.h" |
| 24 | 24 |
| 25 #define FWL_STYLEEXT_MNU_Vert (1L << 0) | 25 #define FWL_STYLEEXT_MNU_Vert (1L << 0) |
| 26 | 26 |
| 27 IFWL_Widget::IFWL_Widget(const IFWL_App* app, | 27 IFWL_Widget::IFWL_Widget(const IFWL_App* app, |
| 28 const CFWL_WidgetImpProperties& properties, | 28 const CFWL_WidgetImpProperties& properties, |
| 29 IFWL_Widget* pOuter) | 29 IFWL_Widget* pOuter) |
| 30 : m_pOwnerApp(app), | 30 : m_pOwnerApp(app), |
| 31 m_pWidgetMgr(app->GetWidgetMgr()), | 31 m_pWidgetMgr(app->GetWidgetMgr()), |
| 32 m_pProperties(new CFWL_WidgetImpProperties(properties)), | 32 m_pProperties(new CFWL_WidgetImpProperties(properties)), |
| 33 m_pDelegate(nullptr), | |
| 34 m_pCurDelegate(nullptr), | 33 m_pCurDelegate(nullptr), |
| 35 m_pOuter(pOuter), | 34 m_pOuter(pOuter), |
| 36 m_pLayoutItem(nullptr), | 35 m_pLayoutItem(nullptr), |
| 37 m_pAssociate(nullptr), | 36 m_pAssociate(nullptr), |
| 38 m_iLock(0), | 37 m_iLock(0), |
| 39 m_nEventKey(0) { | 38 m_nEventKey(0) { |
| 40 ASSERT(m_pWidgetMgr); | 39 ASSERT(m_pWidgetMgr); |
| 40 |
| 41 IFWL_Widget* pParent = m_pProperties->m_pParent; |
| 42 m_pWidgetMgr->InsertWidget(pParent, this); |
| 43 if (IsChild()) |
| 44 return; |
| 45 |
| 46 IFWL_Widget* pOwner = m_pProperties->m_pOwner; |
| 47 if (pOwner) |
| 48 m_pWidgetMgr->SetOwner(pOwner, this); |
| 41 } | 49 } |
| 42 | 50 |
| 43 IFWL_Widget::~IFWL_Widget() {} | 51 IFWL_Widget::~IFWL_Widget() { |
| 44 | |
| 45 void IFWL_Widget::Initialize() { | |
| 46 IFWL_Widget* pParent = m_pProperties->m_pParent; | |
| 47 m_pWidgetMgr->InsertWidget(pParent, this); | |
| 48 if (!IsChild()) { | |
| 49 IFWL_Widget* pOwner = m_pProperties->m_pOwner; | |
| 50 if (pOwner) | |
| 51 m_pWidgetMgr->SetOwner(pOwner, this); | |
| 52 } | |
| 53 } | |
| 54 | |
| 55 void IFWL_Widget::Finalize() { | |
| 56 NotifyDriver(); | 52 NotifyDriver(); |
| 57 m_pWidgetMgr->RemoveWidget(this); | 53 m_pWidgetMgr->RemoveWidget(this); |
| 58 } | 54 } |
| 59 | 55 |
| 60 FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { | 56 FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { |
| 61 return FALSE; | 57 return FALSE; |
| 62 } | 58 } |
| 63 | 59 |
| 64 FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 60 FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
| 65 if (bAutoSize) { | 61 if (bAutoSize) { |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() { | 343 IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() { |
| 348 return m_pProperties->m_pThemeProvider; | 344 return m_pProperties->m_pThemeProvider; |
| 349 } | 345 } |
| 350 FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { | 346 FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { |
| 351 m_pProperties->m_pThemeProvider = pThemeProvider; | 347 m_pProperties->m_pThemeProvider = pThemeProvider; |
| 352 return FWL_Error::Succeeded; | 348 return FWL_Error::Succeeded; |
| 353 } | 349 } |
| 354 | 350 |
| 355 IFWL_WidgetDelegate* IFWL_Widget::GetCurrentDelegate() { | 351 IFWL_WidgetDelegate* IFWL_Widget::GetCurrentDelegate() { |
| 356 if (!m_pCurDelegate) | 352 if (!m_pCurDelegate) |
| 357 m_pCurDelegate = m_pDelegate; | 353 m_pCurDelegate = m_pDelegate.get(); |
| 358 return m_pCurDelegate; | 354 return m_pCurDelegate; |
| 359 } | 355 } |
| 360 | 356 |
| 361 void IFWL_Widget::SetCurrentDelegate(IFWL_WidgetDelegate* pDelegate) { | 357 void IFWL_Widget::SetCurrentDelegate(IFWL_WidgetDelegate* pDelegate) { |
| 362 m_pCurDelegate = pDelegate; | 358 m_pCurDelegate = pDelegate; |
| 363 } | 359 } |
| 364 | 360 |
| 365 const IFWL_App* IFWL_Widget::GetOwnerApp() const { | 361 const IFWL_App* IFWL_Widget::GetOwnerApp() const { |
| 366 return m_pOwnerApp; | 362 return m_pOwnerApp; |
| 367 } | 363 } |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 } | 908 } |
| 913 } | 909 } |
| 914 | 910 |
| 915 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} | 911 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} |
| 916 | 912 |
| 917 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 913 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 918 const CFX_Matrix* pMatrix) { | 914 const CFX_Matrix* pMatrix) { |
| 919 CFWL_EvtDraw evt; | 915 CFWL_EvtDraw evt; |
| 920 evt.m_pGraphics = pGraphics; | 916 evt.m_pGraphics = pGraphics; |
| 921 } | 917 } |
| OLD | NEW |