| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 params.m_pWidget = m_pInterface; | 194 params.m_pWidget = m_pInterface; |
| 195 params.m_iPart = CFWL_Part::DownButton; | 195 params.m_iPart = CFWL_Part::DownButton; |
| 196 params.m_pGraphics = pGraphics; | 196 params.m_pGraphics = pGraphics; |
| 197 params.m_dwStates = m_dwDnState + 1; | 197 params.m_dwStates = m_dwDnState + 1; |
| 198 if (pMatrix) { | 198 if (pMatrix) { |
| 199 params.m_matrix.Concat(*pMatrix); | 199 params.m_matrix.Concat(*pMatrix); |
| 200 } | 200 } |
| 201 params.m_rtPart = m_rtDnButton; | 201 params.m_rtPart = m_rtDnButton; |
| 202 pTheme->DrawBackground(¶ms); | 202 pTheme->DrawBackground(¶ms); |
| 203 } | 203 } |
| 204 |
| 204 CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate( | 205 CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate( |
| 205 CFWL_SpinButtonImp* pOwner) | 206 CFWL_SpinButtonImp* pOwner) |
| 206 : m_pOwner(pOwner) {} | 207 : m_pOwner(pOwner) {} |
| 208 |
| 207 int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 209 int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 208 if (!pMessage) | 210 if (!pMessage) |
| 209 return 0; | 211 return 0; |
| 212 |
| 210 int32_t iRet = 1; | 213 int32_t iRet = 1; |
| 211 uint32_t dwMsgCode = pMessage->GetClassID(); | 214 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
| 212 switch (dwMsgCode) { | 215 switch (dwMsgCode) { |
| 213 case FWL_MSGHASH_SetFocus: | 216 case CFWL_MessageType::SetFocus: { |
| 214 case FWL_MSGHASH_KillFocus: { | 217 OnFocusChanged(pMessage, TRUE); |
| 215 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | |
| 216 break; | 218 break; |
| 217 } | 219 } |
| 218 case FWL_MSGHASH_Mouse: { | 220 case CFWL_MessageType::KillFocus: { |
| 221 OnFocusChanged(pMessage, FALSE); |
| 222 break; |
| 223 } |
| 224 case CFWL_MessageType::Mouse: { |
| 219 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 225 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 220 uint32_t dwCmd = pMsg->m_dwCmd; | 226 switch (pMsg->m_dwCmd) { |
| 221 switch (dwCmd) { | |
| 222 case FWL_MSGMOUSECMD_LButtonDown: { | 227 case FWL_MSGMOUSECMD_LButtonDown: { |
| 223 OnLButtonDown(pMsg); | 228 OnLButtonDown(pMsg); |
| 224 break; | 229 break; |
| 225 } | 230 } |
| 226 case FWL_MSGMOUSECMD_LButtonUp: { | 231 case FWL_MSGMOUSECMD_LButtonUp: { |
| 227 OnLButtonUp(pMsg); | 232 OnLButtonUp(pMsg); |
| 228 break; | 233 break; |
| 229 } | 234 } |
| 230 case FWL_MSGMOUSECMD_MouseMove: { | 235 case FWL_MSGMOUSECMD_MouseMove: { |
| 231 OnMouseMove(pMsg); | 236 OnMouseMove(pMsg); |
| 232 break; | 237 break; |
| 233 } | 238 } |
| 234 case FWL_MSGMOUSECMD_MouseLeave: { | 239 case FWL_MSGMOUSECMD_MouseLeave: { |
| 235 OnMouseLeave(pMsg); | 240 OnMouseLeave(pMsg); |
| 236 break; | 241 break; |
| 237 } | 242 } |
| 238 default: {} | 243 default: |
| 244 break; |
| 239 } | 245 } |
| 240 break; | 246 break; |
| 241 } | 247 } |
| 242 case FWL_MSGHASH_Key: { | 248 case CFWL_MessageType::Key: { |
| 243 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 249 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
| 244 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { | 250 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) |
| 245 OnKeyDown(pKey); | 251 OnKeyDown(pKey); |
| 246 } | |
| 247 break; | 252 break; |
| 248 } | 253 } |
| 249 default: { | 254 default: { |
| 250 iRet = 0; | 255 iRet = 0; |
| 251 break; | 256 break; |
| 252 } | 257 } |
| 253 } | 258 } |
| 254 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 259 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| 255 return iRet; | 260 return iRet; |
| 256 } | 261 } |
| 262 |
| 257 FWL_ERR CFWL_SpinButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 263 FWL_ERR CFWL_SpinButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
| 258 return FWL_ERR_Succeeded; | 264 return FWL_ERR_Succeeded; |
| 259 } | 265 } |
| 260 FWL_ERR CFWL_SpinButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 266 FWL_ERR CFWL_SpinButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 261 const CFX_Matrix* pMatrix) { | 267 const CFX_Matrix* pMatrix) { |
| 262 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 268 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
| 263 } | 269 } |
| 264 void CFWL_SpinButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, | 270 void CFWL_SpinButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, |
| 265 FX_BOOL bSet) { | 271 FX_BOOL bSet) { |
| 266 if (bSet) { | 272 if (bSet) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 if (!bUpEnable && !bDownEnable) { | 430 if (!bUpEnable && !bDownEnable) { |
| 425 return; | 431 return; |
| 426 } | 432 } |
| 427 CFWL_EvtSpbClick wmPosChanged; | 433 CFWL_EvtSpbClick wmPosChanged; |
| 428 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; | 434 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; |
| 429 wmPosChanged.m_bUp = bUpEnable; | 435 wmPosChanged.m_bUp = bUpEnable; |
| 430 m_pOwner->DispatchEvent(&wmPosChanged); | 436 m_pOwner->DispatchEvent(&wmPosChanged); |
| 431 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton | 437 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton |
| 432 : &m_pOwner->m_rtDnButton); | 438 : &m_pOwner->m_rtDnButton); |
| 433 } | 439 } |
| OLD | NEW |