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/cfwl_listbox.h" | 7 #include "xfa/fwl/core/cfwl_listbox.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 m_rtConent.Reset(); | 42 m_rtConent.Reset(); |
43 m_rtStatic.Reset(); | 43 m_rtStatic.Reset(); |
44 } | 44 } |
45 | 45 |
46 CFWL_ListBox::~CFWL_ListBox() {} | 46 CFWL_ListBox::~CFWL_ListBox() {} |
47 | 47 |
48 FWL_Type CFWL_ListBox::GetClassID() const { | 48 FWL_Type CFWL_ListBox::GetClassID() const { |
49 return FWL_Type::ListBox; | 49 return FWL_Type::ListBox; |
50 } | 50 } |
51 | 51 |
52 void CFWL_ListBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { | |
53 if (!bAutoSize) { | |
54 rect = m_pProperties->m_rtWidget; | |
55 return; | |
56 } | |
57 | |
58 rect.Set(0, 0, 0, 0); | |
59 if (!m_pProperties->m_pThemeProvider) | |
60 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | |
61 | |
62 CFX_SizeF fs = CalcSize(true); | |
63 rect.Set(0, 0, fs.x, fs.y); | |
64 InflateWidgetRect(rect); | |
65 } | |
66 | |
67 void CFWL_ListBox::Update() { | 52 void CFWL_ListBox::Update() { |
68 if (IsLocked()) | 53 if (IsLocked()) |
69 return; | 54 return; |
70 if (!m_pProperties->m_pThemeProvider) | 55 if (!m_pProperties->m_pThemeProvider) |
71 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 56 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
72 | 57 |
73 switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_AlignMask) { | 58 switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_AlignMask) { |
74 case FWL_STYLEEXT_LTB_LeftAlign: { | 59 case FWL_STYLEEXT_LTB_LeftAlign: { |
75 m_iTTOAligns = FDE_TTOALIGNMENT_CenterLeft; | 60 m_iTTOAligns = FDE_TTOALIGNMENT_CenterLeft; |
76 break; | 61 break; |
(...skipping 11 matching lines...) Expand all Loading... |
88 if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) | 73 if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) |
89 m_dwTTOStyles |= FDE_TTOSTYLE_RTL; | 74 m_dwTTOStyles |= FDE_TTOSTYLE_RTL; |
90 | 75 |
91 m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine; | 76 m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine; |
92 m_fScorllBarWidth = GetScrollWidth(); | 77 m_fScorllBarWidth = GetScrollWidth(); |
93 CalcSize(false); | 78 CalcSize(false); |
94 } | 79 } |
95 | 80 |
96 FWL_WidgetHit CFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 81 FWL_WidgetHit CFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
97 if (IsShowScrollBar(false)) { | 82 if (IsShowScrollBar(false)) { |
98 CFX_RectF rect; | 83 CFX_RectF rect = m_pHorzScrollBar->GetWidgetRect(); |
99 m_pHorzScrollBar->GetWidgetRect(rect, false); | |
100 if (rect.Contains(fx, fy)) | 84 if (rect.Contains(fx, fy)) |
101 return FWL_WidgetHit::HScrollBar; | 85 return FWL_WidgetHit::HScrollBar; |
102 } | 86 } |
103 if (IsShowScrollBar(true)) { | 87 if (IsShowScrollBar(true)) { |
104 CFX_RectF rect; | 88 CFX_RectF rect = m_pVertScrollBar->GetWidgetRect(); |
105 m_pVertScrollBar->GetWidgetRect(rect, false); | |
106 if (rect.Contains(fx, fy)) | 89 if (rect.Contains(fx, fy)) |
107 return FWL_WidgetHit::VScrollBar; | 90 return FWL_WidgetHit::VScrollBar; |
108 } | 91 } |
109 if (m_rtClient.Contains(fx, fy)) | 92 if (m_rtClient.Contains(fx, fy)) |
110 return FWL_WidgetHit::Client; | 93 return FWL_WidgetHit::Client; |
111 return FWL_WidgetHit::Unknown; | 94 return FWL_WidgetHit::Unknown; |
112 } | 95 } |
113 | 96 |
114 void CFWL_ListBox::DrawWidget(CFX_Graphics* pGraphics, | 97 void CFWL_ListBox::DrawWidget(CFX_Graphics* pGraphics, |
115 const CFX_Matrix* pMatrix) { | 98 const CFX_Matrix* pMatrix) { |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 void CFWL_ListBox::DeleteAll() { | 1122 void CFWL_ListBox::DeleteAll() { |
1140 m_ItemArray.clear(); | 1123 m_ItemArray.clear(); |
1141 } | 1124 } |
1142 | 1125 |
1143 uint32_t CFWL_ListBox::GetItemStates(CFWL_ListItem* pItem) { | 1126 uint32_t CFWL_ListBox::GetItemStates(CFWL_ListItem* pItem) { |
1144 if (!pItem) | 1127 if (!pItem) |
1145 return 0; | 1128 return 0; |
1146 return pItem->m_dwStates | pItem->m_dwCheckState; | 1129 return pItem->m_dwStates | pItem->m_dwCheckState; |
1147 } | 1130 } |
1148 | 1131 |
OLD | NEW |