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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 FX_FLOAT fEdge = GetEdgeWidth(); | 111 FX_FLOAT fEdge = GetEdgeWidth(); |
112 rect.Deflate(fEdge, fEdge); | 112 rect.Deflate(fEdge, fEdge); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 void IFWL_Widget::SetParent(IFWL_Widget* pParent) { | 116 void IFWL_Widget::SetParent(IFWL_Widget* pParent) { |
117 m_pProperties->m_pParent = pParent; | 117 m_pProperties->m_pParent = pParent; |
118 m_pWidgetMgr->SetParent(pParent, this); | 118 m_pWidgetMgr->SetParent(pParent, this); |
119 } | 119 } |
120 | 120 |
| 121 uint32_t IFWL_Widget::GetStyles() const { |
| 122 return m_pProperties->m_dwStyles; |
| 123 } |
| 124 |
121 void IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, | 125 void IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, |
122 uint32_t dwStylesRemoved) { | 126 uint32_t dwStylesRemoved) { |
123 m_pProperties->m_dwStyles = | 127 m_pProperties->m_dwStyles = |
124 (m_pProperties->m_dwStyles & ~dwStylesRemoved) | dwStylesAdded; | 128 (m_pProperties->m_dwStyles & ~dwStylesRemoved) | dwStylesAdded; |
125 } | 129 } |
126 | 130 |
| 131 uint32_t IFWL_Widget::GetStylesEx() const { |
| 132 return m_pProperties->m_dwStyleExes; |
| 133 } |
| 134 uint32_t IFWL_Widget::GetStates() const { |
| 135 return m_pProperties->m_dwStates; |
| 136 } |
| 137 |
127 void IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, | 138 void IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, |
128 uint32_t dwStylesExRemoved) { | 139 uint32_t dwStylesExRemoved) { |
129 m_pProperties->m_dwStyleExes = | 140 m_pProperties->m_dwStyleExes = |
130 (m_pProperties->m_dwStyleExes & ~dwStylesExRemoved) | dwStylesExAdded; | 141 (m_pProperties->m_dwStyleExes & ~dwStylesExRemoved) | dwStylesExAdded; |
131 } | 142 } |
132 | 143 |
133 static void NotifyHideChildWidget(CFWL_WidgetMgr* widgetMgr, | 144 static void NotifyHideChildWidget(CFWL_WidgetMgr* widgetMgr, |
134 IFWL_Widget* widget, | 145 IFWL_Widget* widget, |
135 CFWL_NoteDriver* noteDriver) { | 146 CFWL_NoteDriver* noteDriver) { |
136 IFWL_Widget* child = widgetMgr->GetFirstChildWidget(widget); | 147 IFWL_Widget* child = widgetMgr->GetFirstChildWidget(widget); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 parent->GetWidgetRect(rect); | 276 parent->GetWidgetRect(rect); |
266 matrix.Concat(ctmOnParent, true); | 277 matrix.Concat(ctmOnParent, true); |
267 matrix.Translate(rect.left, rect.top, true); | 278 matrix.Translate(rect.left, rect.top, true); |
268 } | 279 } |
269 CFX_Matrix m; | 280 CFX_Matrix m; |
270 m.SetIdentity(); | 281 m.SetIdentity(); |
271 matrix.Concat(m, true); | 282 matrix.Concat(m, true); |
272 parents.RemoveAll(); | 283 parents.RemoveAll(); |
273 } | 284 } |
274 | 285 |
| 286 IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() const { |
| 287 return m_pProperties->m_pThemeProvider; |
| 288 } |
| 289 |
| 290 IFWL_Widget::DataProvider* IFWL_Widget::GetDataProvider() const { |
| 291 return m_pProperties->m_pDataProvider; |
| 292 } |
| 293 |
275 void IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, | 294 void IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, |
276 const CFX_Matrix* pMatrix) {} | 295 const CFX_Matrix* pMatrix) {} |
277 | 296 |
278 void IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { | 297 void IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { |
279 m_pProperties->m_pThemeProvider = pThemeProvider; | 298 m_pProperties->m_pThemeProvider = pThemeProvider; |
280 } | 299 } |
281 | 300 |
| 301 bool IFWL_Widget::IsEnabled() const { |
| 302 return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; |
| 303 } |
| 304 |
| 305 bool IFWL_Widget::IsActive() const { |
| 306 return (m_pProperties->m_dwStates & FWL_WGTSTATE_Deactivated) == 0; |
| 307 } |
| 308 |
| 309 bool IFWL_Widget::HasBorder() const { |
| 310 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border); |
| 311 } |
| 312 |
| 313 bool IFWL_Widget::HasEdge() const { |
| 314 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_EdgeMask); |
| 315 } |
| 316 |
| 317 bool IFWL_Widget::IsVisible() const { |
| 318 return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0; |
| 319 } |
| 320 |
| 321 bool IFWL_Widget::IsOverLapper() const { |
| 322 return (m_pProperties->m_dwStyles & FWL_WGTSTYLE_WindowTypeMask) == |
| 323 FWL_WGTSTYLE_OverLapper; |
| 324 } |
| 325 |
| 326 bool IFWL_Widget::IsPopup() const { |
| 327 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Popup); |
| 328 } |
| 329 |
| 330 bool IFWL_Widget::IsChild() const { |
| 331 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child); |
| 332 } |
| 333 |
| 334 bool IFWL_Widget::IsOffscreen() const { |
| 335 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen); |
| 336 } |
| 337 |
282 void IFWL_Widget::GetEdgeRect(CFX_RectF& rtEdge) { | 338 void IFWL_Widget::GetEdgeRect(CFX_RectF& rtEdge) { |
283 rtEdge = m_pProperties->m_rtWidget; | 339 rtEdge = m_pProperties->m_rtWidget; |
284 rtEdge.left = rtEdge.top = 0; | 340 rtEdge.left = rtEdge.top = 0; |
285 if (HasBorder()) { | 341 if (HasBorder()) { |
286 FX_FLOAT fCX = GetBorderSize(); | 342 FX_FLOAT fCX = GetBorderSize(); |
287 FX_FLOAT fCY = GetBorderSize(false); | 343 FX_FLOAT fCY = GetBorderSize(false); |
288 rtEdge.Deflate(fCX, fCY); | 344 rtEdge.Deflate(fCX, fCY); |
289 } | 345 } |
290 } | 346 } |
291 | 347 |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 } | 804 } |
749 default: | 805 default: |
750 break; | 806 break; |
751 } | 807 } |
752 } | 808 } |
753 | 809 |
754 void IFWL_Widget::OnProcessEvent(CFWL_Event* pEvent) {} | 810 void IFWL_Widget::OnProcessEvent(CFWL_Event* pEvent) {} |
755 | 811 |
756 void IFWL_Widget::OnDrawWidget(CFX_Graphics* pGraphics, | 812 void IFWL_Widget::OnDrawWidget(CFX_Graphics* pGraphics, |
757 const CFX_Matrix* pMatrix) {} | 813 const CFX_Matrix* pMatrix) {} |
OLD | NEW |