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 case CFWL_MessageType::KillFocus: { |
215 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 218 OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); |
Tom Sepez
2016/04/21 19:22:33
missed fourth
dsinclair
2016/04/21 19:35:49
Done.
| |
216 break; | 219 break; |
217 } | 220 } |
218 case FWL_MSGHASH_Mouse: { | 221 case CFWL_MessageType::Mouse: { |
219 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 222 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
220 uint32_t dwCmd = pMsg->m_dwCmd; | 223 uint32_t dwCmd = pMsg->m_dwCmd; |
221 switch (dwCmd) { | 224 switch (dwCmd) { |
222 case FWL_MSGMOUSECMD_LButtonDown: { | 225 case FWL_MSGMOUSECMD_LButtonDown: { |
223 OnLButtonDown(pMsg); | 226 OnLButtonDown(pMsg); |
224 break; | 227 break; |
225 } | 228 } |
226 case FWL_MSGMOUSECMD_LButtonUp: { | 229 case FWL_MSGMOUSECMD_LButtonUp: { |
227 OnLButtonUp(pMsg); | 230 OnLButtonUp(pMsg); |
228 break; | 231 break; |
229 } | 232 } |
230 case FWL_MSGMOUSECMD_MouseMove: { | 233 case FWL_MSGMOUSECMD_MouseMove: { |
231 OnMouseMove(pMsg); | 234 OnMouseMove(pMsg); |
232 break; | 235 break; |
233 } | 236 } |
234 case FWL_MSGMOUSECMD_MouseLeave: { | 237 case FWL_MSGMOUSECMD_MouseLeave: { |
235 OnMouseLeave(pMsg); | 238 OnMouseLeave(pMsg); |
236 break; | 239 break; |
237 } | 240 } |
238 default: {} | 241 default: |
242 break; | |
239 } | 243 } |
240 break; | 244 break; |
241 } | 245 } |
242 case FWL_MSGHASH_Key: { | 246 case CFWL_MessageType::Key: { |
243 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 247 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
244 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { | 248 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) |
245 OnKeyDown(pKey); | 249 OnKeyDown(pKey); |
246 } | |
247 break; | 250 break; |
248 } | 251 } |
249 default: { | 252 default: { |
250 iRet = 0; | 253 iRet = 0; |
251 break; | 254 break; |
252 } | 255 } |
253 } | 256 } |
254 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 257 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
255 return iRet; | 258 return iRet; |
256 } | 259 } |
260 | |
257 FWL_ERR CFWL_SpinButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 261 FWL_ERR CFWL_SpinButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
258 return FWL_ERR_Succeeded; | 262 return FWL_ERR_Succeeded; |
259 } | 263 } |
260 FWL_ERR CFWL_SpinButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 264 FWL_ERR CFWL_SpinButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
261 const CFX_Matrix* pMatrix) { | 265 const CFX_Matrix* pMatrix) { |
262 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 266 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
263 } | 267 } |
264 void CFWL_SpinButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, | 268 void CFWL_SpinButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, |
265 FX_BOOL bSet) { | 269 FX_BOOL bSet) { |
266 if (bSet) { | 270 if (bSet) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 if (!bUpEnable && !bDownEnable) { | 428 if (!bUpEnable && !bDownEnable) { |
425 return; | 429 return; |
426 } | 430 } |
427 CFWL_EvtSpbClick wmPosChanged; | 431 CFWL_EvtSpbClick wmPosChanged; |
428 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; | 432 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; |
429 wmPosChanged.m_bUp = bUpEnable; | 433 wmPosChanged.m_bUp = bUpEnable; |
430 m_pOwner->DispatchEvent(&wmPosChanged); | 434 m_pOwner->DispatchEvent(&wmPosChanged); |
431 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton | 435 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton |
432 : &m_pOwner->m_rtDnButton); | 436 : &m_pOwner->m_rtDnButton); |
433 } | 437 } |
OLD | NEW |