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/cfwl_checkbox.h" | 7 #include "xfa/fwl/cfwl_checkbox.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton) { | 185 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton) { |
186 if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) == | 186 if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) == |
187 FWL_STATE_CKB_Unchecked) { | 187 FWL_STATE_CKB_Unchecked) { |
188 CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr(); | 188 CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr(); |
189 if (!pWidgetMgr->IsFormDisabled()) { | 189 if (!pWidgetMgr->IsFormDisabled()) { |
190 CFX_ArrayTemplate<CFWL_Widget*> radioarr; | 190 CFX_ArrayTemplate<CFWL_Widget*> radioarr; |
191 pWidgetMgr->GetSameGroupRadioButton(this, radioarr); | 191 pWidgetMgr->GetSameGroupRadioButton(this, radioarr); |
192 CFWL_CheckBox* pCheckBox = nullptr; | 192 CFWL_CheckBox* pCheckBox = nullptr; |
193 int32_t iCount = radioarr.GetSize(); | 193 int32_t iCount = radioarr.GetSize(); |
194 for (int32_t i = 0; i < iCount; i++) { | 194 for (int32_t i = 0; i < iCount; i++) { |
| 195 // TODO(dsinclair): This is a bug as radioarr will only ever have |
| 196 // a nullptr set into it.... |
195 pCheckBox = static_cast<CFWL_CheckBox*>(radioarr[i]); | 197 pCheckBox = static_cast<CFWL_CheckBox*>(radioarr[i]); |
196 if (pCheckBox != this && | 198 if (pCheckBox != this && |
197 pCheckBox->GetStates() & FWL_STATE_CKB_Checked) { | 199 pCheckBox->GetStates() & FWL_STATE_CKB_Checked) { |
198 pCheckBox->SetCheckState(0); | 200 pCheckBox->SetCheckState(0); |
199 CFX_RectF rt = pCheckBox->GetWidgetRect(); | 201 CFX_RectF rt = pCheckBox->GetWidgetRect(); |
200 rt.left = rt.top = 0; | 202 rt.left = rt.top = 0; |
201 m_pWidgetMgr->RepaintWidget(pCheckBox, rt); | 203 m_pWidgetMgr->RepaintWidget(pCheckBox, rt); |
202 break; | 204 break; |
203 } | 205 } |
204 } | 206 } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 362 } |
361 | 363 |
362 void CFWL_CheckBox::OnKeyDown(CFWL_MessageKey* pMsg) { | 364 void CFWL_CheckBox::OnKeyDown(CFWL_MessageKey* pMsg) { |
363 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) | 365 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) |
364 return; | 366 return; |
365 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || | 367 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || |
366 pMsg->m_dwKeyCode == FWL_VKEY_Space) { | 368 pMsg->m_dwKeyCode == FWL_VKEY_Space) { |
367 NextStates(); | 369 NextStates(); |
368 } | 370 } |
369 } | 371 } |
OLD | NEW |