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_checkbox.h" | 7 #include "xfa/fwl/core/ifwl_checkbox.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "third_party/base/ptr_util.h" | 11 #include "third_party/base/ptr_util.h" |
12 #include "xfa/fde/tto/fde_textout.h" | 12 #include "xfa/fde/tto/fde_textout.h" |
| 13 #include "xfa/fwl/core/cfwl_evtcheckstatechanged.h" |
13 #include "xfa/fwl/core/cfwl_msgkey.h" | 14 #include "xfa/fwl/core/cfwl_msgkey.h" |
14 #include "xfa/fwl/core/cfwl_msgmouse.h" | 15 #include "xfa/fwl/core/cfwl_msgmouse.h" |
15 #include "xfa/fwl/core/cfwl_themebackground.h" | 16 #include "xfa/fwl/core/cfwl_themebackground.h" |
16 #include "xfa/fwl/core/cfwl_themetext.h" | 17 #include "xfa/fwl/core/cfwl_themetext.h" |
17 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 18 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
18 #include "xfa/fwl/core/fwl_noteimp.h" | 19 #include "xfa/fwl/core/fwl_noteimp.h" |
19 #include "xfa/fwl/core/ifwl_app.h" | 20 #include "xfa/fwl/core/ifwl_app.h" |
20 #include "xfa/fwl/core/ifwl_checkbox.h" | 21 #include "xfa/fwl/core/ifwl_checkbox.h" |
21 #include "xfa/fwl/core/ifwl_themeprovider.h" | 22 #include "xfa/fwl/core/ifwl_themeprovider.h" |
22 | 23 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask; | 354 m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask; |
354 } else { | 355 } else { |
355 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) | 356 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) |
356 m_pProperties->m_dwStates |= FWL_STATE_CKB_Neutral; | 357 m_pProperties->m_dwStates |= FWL_STATE_CKB_Neutral; |
357 else | 358 else |
358 m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked; | 359 m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked; |
359 } | 360 } |
360 } | 361 } |
361 | 362 |
362 Repaint(&m_rtClient); | 363 Repaint(&m_rtClient); |
363 if (dwFirststate != m_pProperties->m_dwStates) { | 364 if (dwFirststate == m_pProperties->m_dwStates) |
364 CFWL_EvtCkbCheckStateChanged wmCheckBoxState; | 365 return; |
365 wmCheckBoxState.m_pSrcTarget = this; | 366 |
366 DispatchEvent(&wmCheckBoxState); | 367 CFWL_EvtCheckStateChanged wmCheckBoxState; |
367 } | 368 wmCheckBoxState.m_pSrcTarget = this; |
| 369 DispatchEvent(&wmCheckBoxState); |
368 } | 370 } |
369 | 371 |
370 void IFWL_CheckBox::OnProcessMessage(CFWL_Message* pMessage) { | 372 void IFWL_CheckBox::OnProcessMessage(CFWL_Message* pMessage) { |
371 if (!pMessage) | 373 if (!pMessage) |
372 return; | 374 return; |
373 | 375 |
374 switch (pMessage->GetClassID()) { | 376 switch (pMessage->GetClassID()) { |
375 case CFWL_MessageType::SetFocus: | 377 case CFWL_MessageType::SetFocus: |
376 OnFocusChanged(true); | 378 OnFocusChanged(true); |
377 break; | 379 break; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 void IFWL_CheckBox::OnKeyDown(CFWL_MsgKey* pMsg) { | 501 void IFWL_CheckBox::OnKeyDown(CFWL_MsgKey* pMsg) { |
500 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 502 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { |
501 DispatchKeyEvent(pMsg); | 503 DispatchKeyEvent(pMsg); |
502 return; | 504 return; |
503 } | 505 } |
504 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || | 506 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || |
505 pMsg->m_dwKeyCode == FWL_VKEY_Space) { | 507 pMsg->m_dwKeyCode == FWL_VKEY_Space) { |
506 NextStates(); | 508 NextStates(); |
507 } | 509 } |
508 } | 510 } |
OLD | NEW |