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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 m_iTTOAlign(FDE_TTOALIGNMENT_Center), | 29 m_iTTOAlign(FDE_TTOALIGNMENT_Center), |
30 m_bBtnDown(FALSE) { | 30 m_bBtnDown(FALSE) { |
31 m_rtClient.Reset(); | 31 m_rtClient.Reset(); |
32 m_rtBox.Reset(); | 32 m_rtBox.Reset(); |
33 m_rtCaption.Reset(); | 33 m_rtCaption.Reset(); |
34 m_rtFocus.Reset(); | 34 m_rtFocus.Reset(); |
35 } | 35 } |
36 | 36 |
37 IFWL_CheckBox::~IFWL_CheckBox() {} | 37 IFWL_CheckBox::~IFWL_CheckBox() {} |
38 | 38 |
39 FWL_Error IFWL_CheckBox::GetClassName(CFX_WideString& wsClass) const { | |
40 wsClass = FWL_CLASS_CheckBox; | |
41 return FWL_Error::Succeeded; | |
42 } | |
43 | |
44 FWL_Type IFWL_CheckBox::GetClassID() const { | 39 FWL_Type IFWL_CheckBox::GetClassID() const { |
45 return FWL_Type::CheckBox; | 40 return FWL_Type::CheckBox; |
46 } | 41 } |
47 | 42 |
48 FWL_Error IFWL_CheckBox::Initialize() { | 43 FWL_Error IFWL_CheckBox::Initialize() { |
49 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) | 44 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) |
50 return FWL_Error::Indefinite; | 45 return FWL_Error::Indefinite; |
51 | 46 |
52 m_pDelegate = new CFWL_CheckBoxImpDelegate(this); | 47 m_pDelegate = new CFWL_CheckBoxImpDelegate(this); |
53 return FWL_Error::Succeeded; | 48 return FWL_Error::Succeeded; |
54 } | 49 } |
55 | 50 |
56 FWL_Error IFWL_CheckBox::Finalize() { | 51 void IFWL_CheckBox::Finalize() { |
57 delete m_pDelegate; | 52 delete m_pDelegate; |
58 m_pDelegate = nullptr; | 53 m_pDelegate = nullptr; |
59 return IFWL_Widget::Finalize(); | 54 IFWL_Widget::Finalize(); |
60 } | 55 } |
61 | 56 |
62 FWL_Error IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 57 FWL_Error IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
63 if (bAutoSize) { | 58 if (bAutoSize) { |
64 rect.Set(0, 0, 0, 0); | 59 rect.Set(0, 0, 0, 0); |
65 if (!m_pProperties->m_pThemeProvider) | 60 if (!m_pProperties->m_pThemeProvider) |
66 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 61 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
67 if (!m_pProperties->m_pThemeProvider) | 62 if (!m_pProperties->m_pThemeProvider) |
68 return FWL_Error::Indefinite; | 63 return FWL_Error::Indefinite; |
69 if (!m_pProperties->m_pDataProvider) | 64 if (!m_pProperties->m_pDataProvider) |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 void CFWL_CheckBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { | 553 void CFWL_CheckBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { |
559 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 554 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { |
560 m_pOwner->DispatchKeyEvent(pMsg); | 555 m_pOwner->DispatchKeyEvent(pMsg); |
561 return; | 556 return; |
562 } | 557 } |
563 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || | 558 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || |
564 pMsg->m_dwKeyCode == FWL_VKEY_Space) { | 559 pMsg->m_dwKeyCode == FWL_VKEY_Space) { |
565 m_pOwner->NextStates(); | 560 m_pOwner->NextStates(); |
566 } | 561 } |
567 } | 562 } |
OLD | NEW |