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/fwl_panelimp.h" | 7 #include "xfa/fwl/core/fwl_panelimp.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" | 9 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" |
10 #include "xfa/fwl/core/fwl_noteimp.h" | 10 #include "xfa/fwl/core/fwl_noteimp.h" |
11 #include "xfa/fwl/core/fwl_targetimp.h" | 11 #include "xfa/fwl/core/fwl_targetimp.h" |
12 #include "xfa/fwl/core/fwl_widgetimp.h" | 12 #include "xfa/fwl/core/fwl_widgetimp.h" |
13 #include "xfa/fwl/core/fwl_widgetmgrimp.h" | 13 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
14 #include "xfa/fwl/core/ifwl_content.h" | 14 #include "xfa/fwl/core/ifwl_content.h" |
15 #include "xfa/fwl/core/ifwl_custompanel.h" | 15 #include "xfa/fwl/core/ifwl_custompanel.h" |
16 #include "xfa/fwl/core/ifwl_grid.h" | |
17 #include "xfa/fwl/core/ifwl_panel.h" | 16 #include "xfa/fwl/core/ifwl_panel.h" |
18 #include "xfa/fwl/core/ifwl_proxy.h" | 17 #include "xfa/fwl/core/ifwl_proxy.h" |
19 | 18 |
20 // static | 19 // static |
21 IFWL_Panel* IFWL_Panel::Create(CFWL_WidgetImpProperties& properties, | 20 IFWL_Panel* IFWL_Panel::Create(CFWL_WidgetImpProperties& properties, |
22 IFWL_Widget* pOuter) { | 21 IFWL_Widget* pOuter) { |
23 IFWL_Panel* pPanel = new IFWL_Panel; | 22 IFWL_Panel* pPanel = new IFWL_Panel; |
24 CFWL_PanelImp* pPanelImpl = new CFWL_PanelImp(properties, pOuter); | 23 CFWL_PanelImp* pPanelImpl = new CFWL_PanelImp(properties, pOuter); |
25 pPanel->SetImpl(pPanelImpl); | 24 pPanel->SetImpl(pPanelImpl); |
26 pPanelImpl->SetInterface(pPanel); | 25 pPanelImpl->SetInterface(pPanel); |
(...skipping 25 matching lines...) Expand all Loading... |
52 } | 51 } |
53 } else { | 52 } else { |
54 rect = m_pProperties->m_rtWidget; | 53 rect = m_pProperties->m_rtWidget; |
55 } | 54 } |
56 return FWL_ERR_Succeeded; | 55 return FWL_ERR_Succeeded; |
57 } | 56 } |
58 FWL_ERR CFWL_PanelImp::Update() { | 57 FWL_ERR CFWL_PanelImp::Update() { |
59 if (m_pContent) { | 58 if (m_pContent) { |
60 CFX_RectF rtClient; | 59 CFX_RectF rtClient; |
61 GetClientRect(rtClient); | 60 GetClientRect(rtClient); |
62 FWL_GRIDUNIT eWidth = FWL_GRIDUNIT_Fixed, eHeight = FWL_GRIDUNIT_Fixed; | |
63 IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr(); | 61 IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr(); |
64 if (!pWidgetMgr) | 62 if (!pWidgetMgr) |
65 return FWL_ERR_Indefinite; | 63 return FWL_ERR_Indefinite; |
66 IFWL_Widget* pParent = | 64 |
67 pWidgetMgr->GetWidget(GetInterface(), FWL_WGTRELATION_Parent); | |
68 if (pParent && pParent->GetClassID() == FWL_CLASSHASH_Grid) { | |
69 IFWL_Grid* pGrid = static_cast<IFWL_Grid*>(pParent); | |
70 pGrid->GetWidgetSize(GetInterface(), FWL_GRIDSIZE_Width, eWidth); | |
71 pGrid->GetWidgetSize(GetInterface(), FWL_GRIDSIZE_Height, eHeight); | |
72 } | |
73 m_pContent->SetWidgetRect(rtClient); | 65 m_pContent->SetWidgetRect(rtClient); |
74 m_pContent->Update(); | 66 m_pContent->Update(); |
75 } | 67 } |
76 return FWL_ERR_Succeeded; | 68 return FWL_ERR_Succeeded; |
77 } | 69 } |
78 IFWL_Content* CFWL_PanelImp::GetContent() { | 70 IFWL_Content* CFWL_PanelImp::GetContent() { |
79 return m_pContent; | 71 return m_pContent; |
80 } | 72 } |
81 FWL_ERR CFWL_PanelImp::SetContent(IFWL_Content* pContent) { | 73 FWL_ERR CFWL_PanelImp::SetContent(IFWL_Content* pContent) { |
82 if (!pContent) | 74 if (!pContent) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 IFWL_CustomPanel::IFWL_CustomPanel() {} | 138 IFWL_CustomPanel::IFWL_CustomPanel() {} |
147 IFWL_Content* IFWL_CustomPanel::GetContent() { | 139 IFWL_Content* IFWL_CustomPanel::GetContent() { |
148 return static_cast<CFWL_CustomPanelImp*>(GetImpl())->GetContent(); | 140 return static_cast<CFWL_CustomPanelImp*>(GetImpl())->GetContent(); |
149 } | 141 } |
150 FWL_ERR IFWL_CustomPanel::SetContent(IFWL_Content* pContent) { | 142 FWL_ERR IFWL_CustomPanel::SetContent(IFWL_Content* pContent) { |
151 return static_cast<CFWL_CustomPanelImp*>(GetImpl())->SetContent(pContent); | 143 return static_cast<CFWL_CustomPanelImp*>(GetImpl())->SetContent(pContent); |
152 } | 144 } |
153 FWL_ERR IFWL_CustomPanel::SetProxy(IFWL_Proxy* pProxy) { | 145 FWL_ERR IFWL_CustomPanel::SetProxy(IFWL_Proxy* pProxy) { |
154 return static_cast<CFWL_CustomPanelImp*>(GetImpl())->SetProxy(pProxy); | 146 return static_cast<CFWL_CustomPanelImp*>(GetImpl())->SetProxy(pProxy); |
155 } | 147 } |
OLD | NEW |