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/basewidget/fwl_spinbuttonimp.h" | 7 #include "xfa/fwl/basewidget/fwl_spinbuttonimp.h" |
8 | 8 |
9 #include "xfa/fwl/basewidget/ifwl_spinbutton.h" | 9 #include "xfa/fwl/basewidget/ifwl_spinbutton.h" |
10 #include "xfa/fwl/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 m_rtDnButton.Set(m_rtClient.left, m_rtClient.top + m_rtClient.height / 2, | 93 m_rtDnButton.Set(m_rtClient.left, m_rtClient.top + m_rtClient.height / 2, |
94 m_rtClient.width, m_rtClient.height / 2); | 94 m_rtClient.width, m_rtClient.height / 2); |
95 } else { | 95 } else { |
96 m_rtUpButton.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width / 2, | 96 m_rtUpButton.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width / 2, |
97 m_rtClient.height); | 97 m_rtClient.height); |
98 m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, | 98 m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, |
99 m_rtClient.width / 2, m_rtClient.height); | 99 m_rtClient.width / 2, m_rtClient.height); |
100 } | 100 } |
101 return FWL_ERR_Succeeded; | 101 return FWL_ERR_Succeeded; |
102 } | 102 } |
103 uint32_t CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 103 FWL_WidgetHit CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
104 if (m_rtClient.Contains(fx, fy)) { | 104 if (m_rtClient.Contains(fx, fy)) |
105 return FWL_WGTHITTEST_Client; | 105 return FWL_WidgetHit::Client; |
106 } | 106 if (HasBorder() && (m_rtClient.Contains(fx, fy))) |
107 if (HasBorder() && (m_rtClient.Contains(fx, fy))) { | 107 return FWL_WidgetHit::Border; |
108 return FWL_WGTHITTEST_Border; | |
109 } | |
110 if (HasEdge()) { | 108 if (HasEdge()) { |
111 CFX_RectF rtEdge; | 109 CFX_RectF rtEdge; |
112 GetEdgeRect(rtEdge); | 110 GetEdgeRect(rtEdge); |
113 if (rtEdge.Contains(fx, fy)) { | 111 if (rtEdge.Contains(fx, fy)) |
114 return FWL_WGTHITTEST_Left; | 112 return FWL_WidgetHit::Left; |
115 } | |
116 } | 113 } |
117 if (m_rtUpButton.Contains(fx, fy)) { | 114 if (m_rtUpButton.Contains(fx, fy)) |
118 return FWL_WGTHITTEST_SPB_UpButton; | 115 return FWL_WidgetHit::UpButton; |
119 } | 116 if (m_rtDnButton.Contains(fx, fy)) |
120 if (m_rtDnButton.Contains(fx, fy)) { | 117 return FWL_WidgetHit::DownButton; |
121 return FWL_WGTHITTEST_SPB_DownButton; | 118 return FWL_WidgetHit::Unknown; |
122 } | |
123 return FWL_WGTHITTEST_Unknown; | |
124 } | 119 } |
125 FWL_ERR CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics, | 120 FWL_ERR CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics, |
126 const CFX_Matrix* pMatrix) { | 121 const CFX_Matrix* pMatrix) { |
127 if (!pGraphics) | 122 if (!pGraphics) |
128 return FWL_ERR_Indefinite; | 123 return FWL_ERR_Indefinite; |
129 CFX_RectF rtClip(m_rtClient); | 124 CFX_RectF rtClip(m_rtClient); |
130 if (pMatrix != NULL) { | 125 if (pMatrix != NULL) { |
131 pMatrix->TransformRect(rtClip); | 126 pMatrix->TransformRect(rtClip); |
132 } | 127 } |
133 IFWL_ThemeProvider* pTheme = GetAvailableTheme(); | 128 IFWL_ThemeProvider* pTheme = GetAvailableTheme(); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 if (!bUpEnable && !bDownEnable) { | 424 if (!bUpEnable && !bDownEnable) { |
430 return; | 425 return; |
431 } | 426 } |
432 CFWL_EvtSpbClick wmPosChanged; | 427 CFWL_EvtSpbClick wmPosChanged; |
433 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; | 428 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; |
434 wmPosChanged.m_bUp = bUpEnable; | 429 wmPosChanged.m_bUp = bUpEnable; |
435 m_pOwner->DispatchEvent(&wmPosChanged); | 430 m_pOwner->DispatchEvent(&wmPosChanged); |
436 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton | 431 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton |
437 : &m_pOwner->m_rtDnButton); | 432 : &m_pOwner->m_rtDnButton); |
438 } | 433 } |
OLD | NEW |