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_checkboximp.h" | 7 #include "xfa/fwl/basewidget/fwl_checkboximp.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 IFWL_Widget* pOuter) | 45 IFWL_Widget* pOuter) |
46 : CFWL_WidgetImp(properties, pOuter), | 46 : CFWL_WidgetImp(properties, pOuter), |
47 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), | 47 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), |
48 m_iTTOAlign(FDE_TTOALIGNMENT_Center), | 48 m_iTTOAlign(FDE_TTOALIGNMENT_Center), |
49 m_bBtnDown(FALSE) { | 49 m_bBtnDown(FALSE) { |
50 m_rtClient.Reset(); | 50 m_rtClient.Reset(); |
51 m_rtBox.Reset(); | 51 m_rtBox.Reset(); |
52 m_rtCaption.Reset(); | 52 m_rtCaption.Reset(); |
53 m_rtFocus.Reset(); | 53 m_rtFocus.Reset(); |
54 } | 54 } |
| 55 |
55 CFWL_CheckBoxImp::~CFWL_CheckBoxImp() {} | 56 CFWL_CheckBoxImp::~CFWL_CheckBoxImp() {} |
| 57 |
56 FWL_Error CFWL_CheckBoxImp::GetClassName(CFX_WideString& wsClass) const { | 58 FWL_Error CFWL_CheckBoxImp::GetClassName(CFX_WideString& wsClass) const { |
57 wsClass = FWL_CLASS_CheckBox; | 59 wsClass = FWL_CLASS_CheckBox; |
58 return FWL_Error::Succeeded; | 60 return FWL_Error::Succeeded; |
59 } | 61 } |
60 uint32_t CFWL_CheckBoxImp::GetClassID() const { | 62 |
61 return FWL_CLASSHASH_CheckBox; | 63 FWL_Type CFWL_CheckBoxImp::GetClassID() const { |
| 64 return FWL_Type::CheckBox; |
62 } | 65 } |
| 66 |
63 FWL_Error CFWL_CheckBoxImp::Initialize() { | 67 FWL_Error CFWL_CheckBoxImp::Initialize() { |
64 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) | 68 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) |
65 return FWL_Error::Indefinite; | 69 return FWL_Error::Indefinite; |
| 70 |
66 m_pDelegate = new CFWL_CheckBoxImpDelegate(this); | 71 m_pDelegate = new CFWL_CheckBoxImpDelegate(this); |
67 return FWL_Error::Succeeded; | 72 return FWL_Error::Succeeded; |
68 } | 73 } |
| 74 |
69 FWL_Error CFWL_CheckBoxImp::Finalize() { | 75 FWL_Error CFWL_CheckBoxImp::Finalize() { |
70 delete m_pDelegate; | 76 delete m_pDelegate; |
71 m_pDelegate = nullptr; | 77 m_pDelegate = nullptr; |
72 return CFWL_WidgetImp::Finalize(); | 78 return CFWL_WidgetImp::Finalize(); |
73 } | 79 } |
74 FWL_Error CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 80 FWL_Error CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
75 if (bAutoSize) { | 81 if (bAutoSize) { |
76 rect.Set(0, 0, 0, 0); | 82 rect.Set(0, 0, 0, 0); |
77 if (!m_pProperties->m_pThemeProvider) | 83 if (!m_pProperties->m_pThemeProvider) |
78 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 84 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 void CFWL_CheckBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { | 564 void CFWL_CheckBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { |
559 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 565 if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) { |
560 m_pOwner->DispatchKeyEvent(pMsg); | 566 m_pOwner->DispatchKeyEvent(pMsg); |
561 return; | 567 return; |
562 } | 568 } |
563 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || | 569 if (pMsg->m_dwKeyCode == FWL_VKEY_Return || |
564 pMsg->m_dwKeyCode == FWL_VKEY_Space) { | 570 pMsg->m_dwKeyCode == FWL_VKEY_Space) { |
565 m_pOwner->NextStates(); | 571 m_pOwner->NextStates(); |
566 } | 572 } |
567 } | 573 } |
OLD | NEW |