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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 m_rtClient.Reset(); | 53 m_rtClient.Reset(); |
54 m_rtUpButton.Reset(); | 54 m_rtUpButton.Reset(); |
55 m_rtDnButton.Reset(); | 55 m_rtDnButton.Reset(); |
56 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; | 56 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; |
57 } | 57 } |
58 CFWL_SpinButtonImp::~CFWL_SpinButtonImp() {} | 58 CFWL_SpinButtonImp::~CFWL_SpinButtonImp() {} |
59 FWL_ERR CFWL_SpinButtonImp::GetClassName(CFX_WideString& wsClass) const { | 59 FWL_ERR CFWL_SpinButtonImp::GetClassName(CFX_WideString& wsClass) const { |
60 wsClass = FWL_CLASS_SpinButton; | 60 wsClass = FWL_CLASS_SpinButton; |
61 return FWL_ERR_Succeeded; | 61 return FWL_ERR_Succeeded; |
62 } | 62 } |
63 FX_DWORD CFWL_SpinButtonImp::GetClassID() const { | 63 uint32_t CFWL_SpinButtonImp::GetClassID() const { |
64 return FWL_CLASSHASH_SpinButton; | 64 return FWL_CLASSHASH_SpinButton; |
65 } | 65 } |
66 FWL_ERR CFWL_SpinButtonImp::Initialize() { | 66 FWL_ERR CFWL_SpinButtonImp::Initialize() { |
67 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) | 67 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) |
68 return FWL_ERR_Indefinite; | 68 return FWL_ERR_Indefinite; |
69 m_pDelegate = new CFWL_SpinButtonImpDelegate(this); | 69 m_pDelegate = new CFWL_SpinButtonImpDelegate(this); |
70 return FWL_ERR_Succeeded; | 70 return FWL_ERR_Succeeded; |
71 } | 71 } |
72 FWL_ERR CFWL_SpinButtonImp::Finalize() { | 72 FWL_ERR CFWL_SpinButtonImp::Finalize() { |
73 delete m_pDelegate; | 73 delete m_pDelegate; |
(...skipping 20 matching lines...) Expand all Loading... |
94 m_rtDnButton.Set(m_rtClient.left, m_rtClient.top + m_rtClient.height / 2, | 94 m_rtDnButton.Set(m_rtClient.left, m_rtClient.top + m_rtClient.height / 2, |
95 m_rtClient.width, m_rtClient.height / 2); | 95 m_rtClient.width, m_rtClient.height / 2); |
96 } else { | 96 } else { |
97 m_rtUpButton.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width / 2, | 97 m_rtUpButton.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width / 2, |
98 m_rtClient.height); | 98 m_rtClient.height); |
99 m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, | 99 m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, |
100 m_rtClient.width / 2, m_rtClient.height); | 100 m_rtClient.width / 2, m_rtClient.height); |
101 } | 101 } |
102 return FWL_ERR_Succeeded; | 102 return FWL_ERR_Succeeded; |
103 } | 103 } |
104 FX_DWORD CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 104 uint32_t CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
105 if (m_rtClient.Contains(fx, fy)) { | 105 if (m_rtClient.Contains(fx, fy)) { |
106 return FWL_WGTHITTEST_Client; | 106 return FWL_WGTHITTEST_Client; |
107 } | 107 } |
108 if (HasBorder() && (m_rtClient.Contains(fx, fy))) { | 108 if (HasBorder() && (m_rtClient.Contains(fx, fy))) { |
109 return FWL_WGTHITTEST_Border; | 109 return FWL_WGTHITTEST_Border; |
110 } | 110 } |
111 if (HasEdge()) { | 111 if (HasEdge()) { |
112 CFX_RectF rtEdge; | 112 CFX_RectF rtEdge; |
113 GetEdgeRect(rtEdge); | 113 GetEdgeRect(rtEdge); |
114 if (rtEdge.Contains(fx, fy)) { | 114 if (rtEdge.Contains(fx, fy)) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 params.m_rtPart = m_rtDnButton; | 201 params.m_rtPart = m_rtDnButton; |
202 pTheme->DrawBackground(¶ms); | 202 pTheme->DrawBackground(¶ms); |
203 } | 203 } |
204 CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate( | 204 CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate( |
205 CFWL_SpinButtonImp* pOwner) | 205 CFWL_SpinButtonImp* pOwner) |
206 : m_pOwner(pOwner) {} | 206 : m_pOwner(pOwner) {} |
207 int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 207 int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
208 if (!pMessage) | 208 if (!pMessage) |
209 return 0; | 209 return 0; |
210 int32_t iRet = 1; | 210 int32_t iRet = 1; |
211 FX_DWORD dwMsgCode = pMessage->GetClassID(); | 211 uint32_t dwMsgCode = pMessage->GetClassID(); |
212 switch (dwMsgCode) { | 212 switch (dwMsgCode) { |
213 case FWL_MSGHASH_SetFocus: | 213 case FWL_MSGHASH_SetFocus: |
214 case FWL_MSGHASH_KillFocus: { | 214 case FWL_MSGHASH_KillFocus: { |
215 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 215 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); |
216 break; | 216 break; |
217 } | 217 } |
218 case FWL_MSGHASH_Mouse: { | 218 case FWL_MSGHASH_Mouse: { |
219 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 219 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
220 FX_DWORD dwCmd = pMsg->m_dwCmd; | 220 uint32_t dwCmd = pMsg->m_dwCmd; |
221 switch (dwCmd) { | 221 switch (dwCmd) { |
222 case FWL_MSGMOUSECMD_LButtonDown: { | 222 case FWL_MSGMOUSECMD_LButtonDown: { |
223 OnLButtonDown(pMsg); | 223 OnLButtonDown(pMsg); |
224 break; | 224 break; |
225 } | 225 } |
226 case FWL_MSGMOUSECMD_LButtonUp: { | 226 case FWL_MSGMOUSECMD_LButtonUp: { |
227 OnLButtonUp(pMsg); | 227 OnLButtonUp(pMsg); |
228 break; | 228 break; |
229 } | 229 } |
230 case FWL_MSGMOUSECMD_MouseMove: { | 230 case FWL_MSGMOUSECMD_MouseMove: { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 if (!bUpEnable && !bDownEnable) { | 424 if (!bUpEnable && !bDownEnable) { |
425 return; | 425 return; |
426 } | 426 } |
427 CFWL_EvtSpbClick wmPosChanged; | 427 CFWL_EvtSpbClick wmPosChanged; |
428 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; | 428 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; |
429 wmPosChanged.m_bUp = bUpEnable; | 429 wmPosChanged.m_bUp = bUpEnable; |
430 m_pOwner->DispatchEvent(&wmPosChanged); | 430 m_pOwner->DispatchEvent(&wmPosChanged); |
431 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton | 431 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton |
432 : &m_pOwner->m_rtDnButton); | 432 : &m_pOwner->m_rtDnButton); |
433 } | 433 } |
OLD | NEW |