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/cfwl_widget.h" | 7 #include "xfa/fwl/cfwl_widget.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 void CFWL_Widget::InflateWidgetRect(CFX_RectF& rect) { | 76 void CFWL_Widget::InflateWidgetRect(CFX_RectF& rect) { |
77 if (HasBorder()) { | 77 if (HasBorder()) { |
78 FX_FLOAT fBorder = GetBorderSize(true); | 78 FX_FLOAT fBorder = GetBorderSize(true); |
79 rect.Inflate(fBorder, fBorder); | 79 rect.Inflate(fBorder, fBorder); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { | 83 void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { |
84 m_pProperties->m_rtWidget = rect; | 84 m_pProperties->m_rtWidget = rect; |
85 if (IsChild()) | |
86 return; | |
87 | |
88 m_pWidgetMgr->SetWidgetRect_Native(this, rect); | |
89 } | 85 } |
90 | 86 |
91 CFX_RectF CFWL_Widget::GetClientRect() { | 87 CFX_RectF CFWL_Widget::GetClientRect() { |
92 return GetEdgeRect(); | 88 return GetEdgeRect(); |
93 } | 89 } |
94 | 90 |
95 void CFWL_Widget::SetParent(CFWL_Widget* pParent) { | 91 void CFWL_Widget::SetParent(CFWL_Widget* pParent) { |
96 m_pProperties->m_pParent = pParent; | 92 m_pProperties->m_pParent = pParent; |
97 m_pWidgetMgr->SetParent(pParent, this); | 93 m_pWidgetMgr->SetParent(pParent, this); |
98 } | 94 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 273 } |
278 | 274 |
279 bool CFWL_Widget::IsPopup() const { | 275 bool CFWL_Widget::IsPopup() const { |
280 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Popup); | 276 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Popup); |
281 } | 277 } |
282 | 278 |
283 bool CFWL_Widget::IsChild() const { | 279 bool CFWL_Widget::IsChild() const { |
284 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child); | 280 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child); |
285 } | 281 } |
286 | 282 |
287 bool CFWL_Widget::IsOffscreen() const { | |
288 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen); | |
289 } | |
290 | |
291 CFX_RectF CFWL_Widget::GetEdgeRect() { | 283 CFX_RectF CFWL_Widget::GetEdgeRect() { |
292 CFX_RectF rtEdge = m_pProperties->m_rtWidget; | 284 CFX_RectF rtEdge = m_pProperties->m_rtWidget; |
293 rtEdge.left = rtEdge.top = 0; | 285 rtEdge.left = rtEdge.top = 0; |
294 if (HasBorder()) { | 286 if (HasBorder()) { |
295 FX_FLOAT fCX = GetBorderSize(true); | 287 FX_FLOAT fCX = GetBorderSize(true); |
296 FX_FLOAT fCY = GetBorderSize(false); | 288 FX_FLOAT fCY = GetBorderSize(false); |
297 rtEdge.Deflate(fCX, fCY); | 289 rtEdge.Deflate(fCX, fCY); |
298 } | 290 } |
299 return rtEdge; | 291 return rtEdge; |
300 } | 292 } |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 } | 644 } |
653 default: | 645 default: |
654 break; | 646 break; |
655 } | 647 } |
656 } | 648 } |
657 | 649 |
658 void CFWL_Widget::OnProcessEvent(CFWL_Event* pEvent) {} | 650 void CFWL_Widget::OnProcessEvent(CFWL_Event* pEvent) {} |
659 | 651 |
660 void CFWL_Widget::OnDrawWidget(CFX_Graphics* pGraphics, | 652 void CFWL_Widget::OnDrawWidget(CFX_Graphics* pGraphics, |
661 const CFX_Matrix* pMatrix) {} | 653 const CFX_Matrix* pMatrix) {} |
OLD | NEW |