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/lightwidget/cfwl_widget.h" | 7 #include "xfa/fwl/lightwidget/cfwl_widget.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fwl/core/cfwl_themetext.h" | 10 #include "xfa/fwl/core/cfwl_themetext.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return 0; | 117 return 0; |
118 return m_pIface->GetStylesEx(); | 118 return m_pIface->GetStylesEx(); |
119 } | 119 } |
120 | 120 |
121 FWL_Error CFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, | 121 FWL_Error CFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, |
122 uint32_t dwStylesExRemoved) { | 122 uint32_t dwStylesExRemoved) { |
123 return m_pIface->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 123 return m_pIface->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
124 } | 124 } |
125 | 125 |
126 uint32_t CFWL_Widget::GetStates() { | 126 uint32_t CFWL_Widget::GetStates() { |
127 if (!m_pIface) | 127 return m_pIface ? m_pIface->GetStates() : 0; |
128 return 0; | |
129 return m_pIface->GetStates(); | |
130 } | 128 } |
131 | 129 |
132 void CFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) { | 130 void CFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) { |
133 if (m_pIface) | 131 if (m_pIface) |
134 m_pIface->SetStates(dwStates, bSet); | 132 m_pIface->SetStates(dwStates, bSet); |
135 } | 133 } |
136 | 134 |
| 135 void* CFWL_Widget::GetLayoutItem() const { |
| 136 return m_pIface ? m_pIface->GetLayoutItem() : nullptr; |
| 137 } |
| 138 |
| 139 void CFWL_Widget::SetLayoutItem(void* pItem) { |
| 140 if (m_pIface) |
| 141 m_pIface->SetLayoutItem(pItem); |
| 142 } |
| 143 |
137 FWL_Error CFWL_Widget::SetPrivateData(void* module_id, | 144 FWL_Error CFWL_Widget::SetPrivateData(void* module_id, |
138 void* pData, | 145 void* pData, |
139 PD_CALLBACK_FREEDATA callback) { | 146 PD_CALLBACK_FREEDATA callback) { |
140 if (!m_pIface) | 147 if (!m_pIface) |
141 return FWL_Error::Indefinite; | 148 return FWL_Error::Indefinite; |
142 return m_pIface->SetPrivateData(module_id, pData, callback); | 149 return m_pIface->SetPrivateData(module_id, pData, callback); |
143 } | 150 } |
144 | 151 |
145 void* CFWL_Widget::GetPrivateData(void* module_id) { | 152 void* CFWL_Widget::GetPrivateData(void* module_id) { |
146 if (!m_pIface) | 153 if (!m_pIface) |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 calPart.m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft; | 341 calPart.m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft; |
335 CFX_RectF rect; | 342 CFX_RectF rect; |
336 FX_FLOAT fWidth = bMultiLine | 343 FX_FLOAT fWidth = bMultiLine |
337 ? (iLineWidth > 0 ? (FX_FLOAT)iLineWidth | 344 ? (iLineWidth > 0 ? (FX_FLOAT)iLineWidth |
338 : FWL_WGT_CalcMultiLineDefWidth) | 345 : FWL_WGT_CalcMultiLineDefWidth) |
339 : FWL_WGT_CalcWidth; | 346 : FWL_WGT_CalcWidth; |
340 rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight); | 347 rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight); |
341 pTheme->CalcTextRect(&calPart, rect); | 348 pTheme->CalcTextRect(&calPart, rect); |
342 return CFX_SizeF(rect.width, rect.height); | 349 return CFX_SizeF(rect.width, rect.height); |
343 } | 350 } |
OLD | NEW |