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_listbox.h" | 7 #include "xfa/fwl/core/ifwl_listbox.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fwl/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 m_fScorllBarWidth(0), | 29 m_fScorllBarWidth(0), |
30 m_bLButtonDown(FALSE), | 30 m_bLButtonDown(FALSE), |
31 m_pScrollBarTP(nullptr) { | 31 m_pScrollBarTP(nullptr) { |
32 m_rtClient.Reset(); | 32 m_rtClient.Reset(); |
33 m_rtConent.Reset(); | 33 m_rtConent.Reset(); |
34 m_rtStatic.Reset(); | 34 m_rtStatic.Reset(); |
35 } | 35 } |
36 | 36 |
37 IFWL_ListBox::~IFWL_ListBox() {} | 37 IFWL_ListBox::~IFWL_ListBox() {} |
38 | 38 |
39 FWL_Error IFWL_ListBox::GetClassName(CFX_WideString& wsClass) const { | |
40 wsClass = FWL_CLASS_ListBox; | |
41 return FWL_Error::Succeeded; | |
42 } | |
43 | |
44 FWL_Type IFWL_ListBox::GetClassID() const { | 39 FWL_Type IFWL_ListBox::GetClassID() const { |
45 return FWL_Type::ListBox; | 40 return FWL_Type::ListBox; |
46 } | 41 } |
47 | 42 |
48 FWL_Error IFWL_ListBox::Initialize() { | 43 FWL_Error IFWL_ListBox::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_ListBoxImpDelegate(this); | 47 m_pDelegate = new CFWL_ListBoxImpDelegate(this); |
53 return FWL_Error::Succeeded; | 48 return FWL_Error::Succeeded; |
54 } | 49 } |
55 | 50 |
56 FWL_Error IFWL_ListBox::Finalize() { | 51 void IFWL_ListBox::Finalize() { |
57 if (m_pVertScrollBar) { | 52 if (m_pVertScrollBar) |
58 m_pVertScrollBar->Finalize(); | 53 m_pVertScrollBar->Finalize(); |
59 } | 54 if (m_pHorzScrollBar) |
60 if (m_pHorzScrollBar) { | |
61 m_pHorzScrollBar->Finalize(); | 55 m_pHorzScrollBar->Finalize(); |
62 } | 56 |
63 delete m_pDelegate; | 57 delete m_pDelegate; |
64 m_pDelegate = nullptr; | 58 m_pDelegate = nullptr; |
65 return IFWL_Widget::Finalize(); | 59 IFWL_Widget::Finalize(); |
66 } | 60 } |
67 | 61 |
68 FWL_Error IFWL_ListBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 62 FWL_Error IFWL_ListBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
69 if (bAutoSize) { | 63 if (bAutoSize) { |
70 rect.Set(0, 0, 0, 0); | 64 rect.Set(0, 0, 0, 0); |
71 if (!m_pProperties->m_pThemeProvider) { | 65 if (!m_pProperties->m_pThemeProvider) { |
72 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 66 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
73 } | 67 } |
74 CFX_SizeF fs = CalcSize(TRUE); | 68 CFX_SizeF fs = CalcSize(TRUE); |
75 rect.Set(0, 0, fs.x, fs.y); | 69 rect.Set(0, 0, fs.x, fs.y); |
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 m_pOwner->Repaint(&m_pOwner->m_rtClient); | 1197 m_pOwner->Repaint(&m_pOwner->m_rtClient); |
1204 } | 1198 } |
1205 return TRUE; | 1199 return TRUE; |
1206 } | 1200 } |
1207 | 1201 |
1208 void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() { | 1202 void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() { |
1209 CFWL_EvtLtbSelChanged ev; | 1203 CFWL_EvtLtbSelChanged ev; |
1210 ev.m_pSrcTarget = m_pOwner; | 1204 ev.m_pSrcTarget = m_pOwner; |
1211 m_pOwner->DispatchEvent(&ev); | 1205 m_pOwner->DispatchEvent(&ev); |
1212 } | 1206 } |
OLD | NEW |