OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #include "xfa/src/fwl/core/fwl_contentimp.h" | |
8 | |
9 #include "xfa/include/fwl/core/fwl_content.h" | |
10 #include "xfa/src/fwl/core/fwl_noteimp.h" | |
11 #include "xfa/src/fwl/core/fwl_targetimp.h" | |
12 #include "xfa/src/fwl/core/fwl_threadimp.h" | |
13 #include "xfa/src/fwl/core/fwl_widgetimp.h" | |
14 #include "xfa/src/fwl/core/fwl_widgetmgrimp.h" | |
15 | |
16 FWL_ERR IFWL_Content::InsertWidget(IFWL_Widget* pChild, int32_t nIndex) { | |
17 return static_cast<CFWL_ContentImp*>(GetImpl())->InsertWidget(pChild, nIndex); | |
18 } | |
19 FWL_ERR IFWL_Content::RemoveWidget(IFWL_Widget* pWidget) { | |
20 return static_cast<CFWL_ContentImp*>(GetImpl())->RemoveWidget(pWidget); | |
21 } | |
22 FWL_ERR IFWL_Content::RemoveAllWidgets() { | |
23 return static_cast<CFWL_ContentImp*>(GetImpl())->RemoveAllWidgets(); | |
24 } | |
25 FWL_ERR IFWL_Content::GetMinSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) { | |
26 return static_cast<CFWL_ContentImp*>(GetImpl())->GetMinSize(fWidth, fHeight); | |
27 } | |
28 FWL_ERR IFWL_Content::SetMinSize(FX_FLOAT fWidth, FX_FLOAT fHeight) { | |
29 return static_cast<CFWL_ContentImp*>(GetImpl())->SetMinSize(fWidth, fHeight); | |
30 } | |
31 FWL_ERR IFWL_Content::GetMaxSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) { | |
32 return static_cast<CFWL_ContentImp*>(GetImpl())->GetMaxSize(fWidth, fHeight); | |
33 } | |
34 FWL_ERR IFWL_Content::SetMaxSize(FX_FLOAT fWidth, FX_FLOAT fHeight) { | |
35 return static_cast<CFWL_ContentImp*>(GetImpl())->SetMaxSize(fWidth, fHeight); | |
36 } | |
37 IFWL_Content::IFWL_Content() {} | |
38 CFWL_ContentImp::CFWL_ContentImp(const CFWL_WidgetImpProperties& properties, | |
39 IFWL_Widget* pOuter) | |
40 : CFWL_WidgetImp(properties, pOuter), | |
41 m_fWidthMin(0), | |
42 m_fWidthMax(10000), | |
43 m_fHeightMin(0), | |
44 m_fHeightMax(10000) {} | |
45 CFWL_ContentImp::~CFWL_ContentImp() {} | |
46 FWL_ERR CFWL_ContentImp::InsertWidget(IFWL_Widget* pChild, int32_t nIndex) { | |
47 if (!pChild) | |
48 return FWL_ERR_Indefinite; | |
49 pChild->SetParent(m_pInterface); | |
50 if (nIndex == -1) { | |
51 return FWL_ERR_Succeeded; | |
52 } | |
53 CFWL_WidgetMgr* pMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | |
54 if (!pMgr) | |
55 return FWL_ERR_Indefinite; | |
56 pMgr->SetWidgetIndex(pChild, nIndex); | |
57 return FWL_ERR_Succeeded; | |
58 } | |
59 FWL_ERR CFWL_ContentImp::RemoveWidget(IFWL_Widget* pWidget) { | |
60 if (!pWidget) | |
61 return FWL_ERR_Indefinite; | |
62 pWidget->SetParent(NULL); | |
63 return FWL_ERR_Succeeded; | |
64 } | |
65 FWL_ERR CFWL_ContentImp::RemoveAllWidgets() { | |
66 CFWL_WidgetMgr* pMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | |
67 if (!pMgr) | |
68 return FWL_ERR_Indefinite; | |
69 while (IFWL_Widget* widget = | |
70 pMgr->GetWidget(m_pInterface, FWL_WGTRELATION_FirstChild)) { | |
71 pMgr->SetParent(NULL, widget); | |
72 } | |
73 return FWL_ERR_Succeeded; | |
74 } | |
75 FWL_ERR CFWL_ContentImp::GetMinSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) { | |
76 fWidth = m_fWidthMin; | |
77 fHeight = m_fHeightMin; | |
78 return FWL_ERR_Succeeded; | |
79 } | |
80 FWL_ERR CFWL_ContentImp::SetMinSize(FX_FLOAT fWidth, FX_FLOAT fHeight) { | |
81 m_fWidthMin = fWidth; | |
82 m_fHeightMin = fHeight; | |
83 return FWL_ERR_Succeeded; | |
84 } | |
85 FWL_ERR CFWL_ContentImp::GetMaxSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) { | |
86 fWidth = m_fWidthMax; | |
87 fHeight = m_fHeightMax; | |
88 return FWL_ERR_Succeeded; | |
89 } | |
90 FWL_ERR CFWL_ContentImp::SetMaxSize(FX_FLOAT fWidth, FX_FLOAT fHeight) { | |
91 m_fWidthMax = fWidth; | |
92 m_fHeightMax = fHeight; | |
93 return FWL_ERR_Succeeded; | |
94 } | |
OLD | NEW |