| 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 "../../../foxitlib.h" | 7 #include "../../../foxitlib.h" |
| 8 #include "../core/include/fwl_targetimp.h" | 8 #include "../core/include/fwl_targetimp.h" |
| 9 #include "../core/include/fwl_noteimp.h" | 9 #include "../core/include/fwl_noteimp.h" |
| 10 #include "../core/include/fwl_widgetimp.h" | 10 #include "../core/include/fwl_widgetimp.h" |
| 11 #include "../core/include/fwl_widgetmgrimp.h" | 11 #include "../core/include/fwl_widgetmgrimp.h" |
| 12 #include "include/fwl_checkboximp.h" | 12 #include "include/fwl_checkboximp.h" |
| 13 #define FWL_CKB_CaptionMargin 5 | 13 #define FWL_CKB_CaptionMargin 5 |
| 14 IFWL_CheckBox::IFWL_CheckBox() { | 14 |
| 15 // static |
| 16 IFWL_CheckBox* IFWL_CheckBox::Create(const CFWL_WidgetImpProperties& properties, |
| 17 IFWL_Widget* pOuter) { |
| 18 IFWL_CheckBox* pCheckBox = new IFWL_CheckBox; |
| 19 CFWL_CheckBoxImp* pCheckBoxImpl = new CFWL_CheckBoxImp(properties, pOuter); |
| 20 pCheckBox->SetImpl(pCheckBoxImpl); |
| 21 pCheckBoxImpl->SetInterface(pCheckBox); |
| 22 return pCheckBox; |
| 15 } | 23 } |
| 16 FWL_ERR IFWL_CheckBox::Initialize(const CFWL_WidgetImpProperties& properties, | 24 IFWL_CheckBox::IFWL_CheckBox() {} |
| 17 IFWL_Widget* pOuter) { | |
| 18 CFWL_CheckBoxImp* pCheckBoxImpl = new CFWL_CheckBoxImp(properties, pOuter); | |
| 19 SetImpl(pCheckBoxImpl); | |
| 20 pCheckBoxImpl->SetInterface(this); | |
| 21 return pCheckBoxImpl->Initialize(); | |
| 22 } | |
| 23 int32_t IFWL_CheckBox::GetCheckState() { | 25 int32_t IFWL_CheckBox::GetCheckState() { |
| 24 return static_cast<CFWL_CheckBoxImp*>(GetImpl())->GetCheckState(); | 26 return static_cast<CFWL_CheckBoxImp*>(GetImpl())->GetCheckState(); |
| 25 } | 27 } |
| 26 FWL_ERR IFWL_CheckBox::SetCheckState(int32_t iCheck) { | 28 FWL_ERR IFWL_CheckBox::SetCheckState(int32_t iCheck) { |
| 27 return static_cast<CFWL_CheckBoxImp*>(GetImpl())->SetCheckState(iCheck); | 29 return static_cast<CFWL_CheckBoxImp*>(GetImpl())->SetCheckState(iCheck); |
| 28 } | 30 } |
| 29 IFWL_RadioButton::IFWL_RadioButton() { | 31 |
| 30 } | |
| 31 FWL_ERR IFWL_RadioButton::Initialize(const CFWL_WidgetImpProperties& properties, | |
| 32 IFWL_Widget* pOuter) { | |
| 33 CFWL_CheckBoxImp* pCheckBoxImpl = new CFWL_CheckBoxImp(properties, pOuter); | |
| 34 SetImpl(pCheckBoxImpl); | |
| 35 pCheckBoxImpl->SetInterface(this); | |
| 36 return pCheckBoxImpl->Initialize(); | |
| 37 } | |
| 38 CFWL_CheckBoxImp::CFWL_CheckBoxImp(IFWL_Widget* pOuter) | |
| 39 : CFWL_WidgetImp(pOuter), | |
| 40 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), | |
| 41 m_iTTOAlign(FDE_TTOALIGNMENT_Center), | |
| 42 m_bBtnDown(FALSE) { | |
| 43 m_rtClient.Reset(); | |
| 44 m_rtBox.Reset(); | |
| 45 m_rtCaption.Reset(); | |
| 46 m_rtFocus.Reset(); | |
| 47 } | |
| 48 CFWL_CheckBoxImp::CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties, | 32 CFWL_CheckBoxImp::CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties, |
| 49 IFWL_Widget* pOuter) | 33 IFWL_Widget* pOuter) |
| 50 : CFWL_WidgetImp(properties, pOuter), | 34 : CFWL_WidgetImp(properties, pOuter), |
| 51 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), | 35 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), |
| 52 m_iTTOAlign(FDE_TTOALIGNMENT_Center), | 36 m_iTTOAlign(FDE_TTOALIGNMENT_Center), |
| 53 m_bBtnDown(FALSE) { | 37 m_bBtnDown(FALSE) { |
| 54 m_rtClient.Reset(); | 38 m_rtClient.Reset(); |
| 55 m_rtBox.Reset(); | 39 m_rtBox.Reset(); |
| 56 m_rtCaption.Reset(); | 40 m_rtCaption.Reset(); |
| 57 m_rtFocus.Reset(); | 41 m_rtFocus.Reset(); |
| 58 } | 42 } |
| 59 CFWL_CheckBoxImp::~CFWL_CheckBoxImp() {} | 43 CFWL_CheckBoxImp::~CFWL_CheckBoxImp() {} |
| 60 FWL_ERR CFWL_CheckBoxImp::GetClassName(CFX_WideString& wsClass) const { | 44 FWL_ERR CFWL_CheckBoxImp::GetClassName(CFX_WideString& wsClass) const { |
| 61 wsClass = (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton) | 45 wsClass = FWL_CLASS_CheckBox; |
| 62 ? FWL_CLASS_RadioButton | |
| 63 : FWL_CLASS_CheckBox; | |
| 64 return FWL_ERR_Succeeded; | 46 return FWL_ERR_Succeeded; |
| 65 } | 47 } |
| 66 FX_DWORD CFWL_CheckBoxImp::GetClassID() const { | 48 FX_DWORD CFWL_CheckBoxImp::GetClassID() const { |
| 67 return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton | 49 return FWL_CLASSHASH_CheckBox; |
| 68 ? FWL_CLASSHASH_RadioButton | |
| 69 : FWL_CLASSHASH_CheckBox; | |
| 70 } | 50 } |
| 71 FWL_ERR CFWL_CheckBoxImp::Initialize() { | 51 FWL_ERR CFWL_CheckBoxImp::Initialize() { |
| 72 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) | 52 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) |
| 73 return FWL_ERR_Indefinite; | 53 return FWL_ERR_Indefinite; |
| 74 m_pDelegate = new CFWL_CheckBoxImpDelegate(this); | 54 m_pDelegate = new CFWL_CheckBoxImpDelegate(this); |
| 75 return FWL_ERR_Succeeded; | 55 return FWL_ERR_Succeeded; |
| 76 } | 56 } |
| 77 FWL_ERR CFWL_CheckBoxImp::Finalize() { | 57 FWL_ERR CFWL_CheckBoxImp::Finalize() { |
| 78 delete m_pDelegate; | 58 delete m_pDelegate; |
| 79 m_pDelegate = nullptr; | 59 m_pDelegate = nullptr; |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 void CFWL_CheckBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { | 540 void CFWL_CheckBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { |
| 561 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 541 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { |
| 562 m_pOwner->DispatchKeyEvent(pMsg); | 542 m_pOwner->DispatchKeyEvent(pMsg); |
| 563 return; | 543 return; |
| 564 } | 544 } |
| 565 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || | 545 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || |
| 566 pMsg->m_dwKeyCode == FWL_VKEY_Space) { | 546 pMsg->m_dwKeyCode == FWL_VKEY_Space) { |
| 567 m_pOwner->NextStates(); | 547 m_pOwner->NextStates(); |
| 568 } | 548 } |
| 569 } | 549 } |
| OLD | NEW |