Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: xfa/fwl/core/cfwl_listbox.cpp

Issue 2487943003: Rename IFWL_ListItem to CFWL_ListItem (Closed)
Patch Set: cleanup Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/cfwl_listbox.h ('k') | xfa/fwl/core/cfwl_listitem.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 9 #include <memory>
10 10
(...skipping 14 matching lines...) Expand all
25 25
26 void CFWL_ListBox::Initialize() { 26 void CFWL_ListBox::Initialize() {
27 ASSERT(!m_pIface); 27 ASSERT(!m_pIface);
28 28
29 m_pIface = pdfium::MakeUnique<IFWL_ListBox>( 29 m_pIface = pdfium::MakeUnique<IFWL_ListBox>(
30 m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this), nullptr); 30 m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this), nullptr);
31 31
32 CFWL_Widget::Initialize(); 32 CFWL_Widget::Initialize();
33 } 33 }
34 34
35 FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem) { 35 FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, CFWL_ListItem* pItem) {
36 static_cast<CFWL_ListItem*>(pItem)->m_pDIB = pDIB; 36 static_cast<CFWL_ListItem*>(pItem)->m_pDIB = pDIB;
37 return FWL_Error::Succeeded; 37 return FWL_Error::Succeeded;
38 } 38 }
39 39
40 IFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd, 40 CFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd,
41 bool bSelect) { 41 bool bSelect) {
42 std::unique_ptr<CFWL_ListItem> pItem(new CFWL_ListItem); 42 std::unique_ptr<CFWL_ListItem> pItem(new CFWL_ListItem);
43 pItem->m_dwStates = 0; 43 pItem->m_dwStates = 0;
44 pItem->m_wsText = wsAdd; 44 pItem->m_wsText = wsAdd;
45 pItem->m_dwStates = bSelect ? FWL_ITEMSTATE_LTB_Selected : 0; 45 pItem->m_dwStates = bSelect ? FWL_ITEMSTATE_LTB_Selected : 0;
46 m_ItemArray.push_back(std::move(pItem)); 46 m_ItemArray.push_back(std::move(pItem));
47 return m_ItemArray.back().get(); 47 return m_ItemArray.back().get();
48 } 48 }
49 49
50 bool CFWL_ListBox::DeleteString(IFWL_ListItem* pItem) { 50 bool CFWL_ListBox::DeleteString(CFWL_ListItem* pItem) {
51 int32_t nIndex = GetItemIndex(GetWidget(), pItem); 51 int32_t nIndex = GetItemIndex(GetWidget(), pItem);
52 if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size()) { 52 if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size()) {
53 return false; 53 return false;
54 } 54 }
55 int32_t iCount = CountItems(m_pIface.get()); 55 int32_t iCount = CountItems(m_pIface.get());
56 int32_t iSel = nIndex + 1; 56 int32_t iSel = nIndex + 1;
57 if (iSel >= iCount) { 57 if (iSel >= iCount) {
58 iSel = nIndex - 1; 58 iSel = nIndex - 1;
59 if (iSel < 0) { 59 if (iSel < 0) {
60 iSel = -1; 60 iSel = -1;
(...skipping 11 matching lines...) Expand all
72 void CFWL_ListBox::DeleteAll() { 72 void CFWL_ListBox::DeleteAll() {
73 m_ItemArray.clear(); 73 m_ItemArray.clear();
74 } 74 }
75 75
76 int32_t CFWL_ListBox::CountSelItems() { 76 int32_t CFWL_ListBox::CountSelItems() {
77 if (!GetWidget()) 77 if (!GetWidget())
78 return 0; 78 return 0;
79 return ToListBox(GetWidget())->CountSelItems(); 79 return ToListBox(GetWidget())->CountSelItems();
80 } 80 }
81 81
82 IFWL_ListItem* CFWL_ListBox::GetSelItem(int32_t nIndexSel) { 82 CFWL_ListItem* CFWL_ListBox::GetSelItem(int32_t nIndexSel) {
83 if (!GetWidget()) 83 if (!GetWidget())
84 return nullptr; 84 return nullptr;
85 return ToListBox(GetWidget())->GetSelItem(nIndexSel); 85 return ToListBox(GetWidget())->GetSelItem(nIndexSel);
86 } 86 }
87 87
88 int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) { 88 int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) {
89 if (!GetWidget()) 89 if (!GetWidget())
90 return 0; 90 return 0;
91 return ToListBox(GetWidget())->GetSelIndex(nIndex); 91 return ToListBox(GetWidget())->GetSelIndex(nIndex);
92 } 92 }
93 93
94 FWL_Error CFWL_ListBox::SetSelItem(IFWL_ListItem* pItem, bool bSelect) { 94 FWL_Error CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) {
95 if (!GetWidget()) 95 if (!GetWidget())
96 return FWL_Error::Indefinite; 96 return FWL_Error::Indefinite;
97 return ToListBox(GetWidget())->SetSelItem(pItem, bSelect); 97 return ToListBox(GetWidget())->SetSelItem(pItem, bSelect);
98 } 98 }
99 99
100 FWL_Error CFWL_ListBox::GetItemText(IFWL_ListItem* pItem, 100 FWL_Error CFWL_ListBox::GetItemText(CFWL_ListItem* pItem,
101 CFX_WideString& wsText) { 101 CFX_WideString& wsText) {
102 if (!GetWidget()) 102 if (!GetWidget())
103 return FWL_Error::Indefinite; 103 return FWL_Error::Indefinite;
104 return ToListBox(GetWidget())->GetItemText(pItem, wsText); 104 return ToListBox(GetWidget())->GetItemText(pItem, wsText);
105 } 105 }
106 106
107 FWL_Error CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) { 107 FWL_Error CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) {
108 if (!GetWidget()) 108 if (!GetWidget())
109 return FWL_Error::Indefinite; 109 return FWL_Error::Indefinite;
110 return ToListBox(GetWidget())->GetScrollPos(fPos, bVert); 110 return ToListBox(GetWidget())->GetScrollPos(fPos, bVert);
111 } 111 }
112 112
113 FWL_Error CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) { 113 FWL_Error CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) {
114 m_fItemHeight = fItemHeight; 114 m_fItemHeight = fItemHeight;
115 return FWL_Error::Succeeded; 115 return FWL_Error::Succeeded;
116 } 116 }
117 117
118 IFWL_ListItem* CFWL_ListBox::GetFocusItem() { 118 CFWL_ListItem* CFWL_ListBox::GetFocusItem() {
119 for (const auto& pItem : m_ItemArray) { 119 for (const auto& pItem : m_ItemArray) {
120 if (pItem->m_dwStates & FWL_ITEMSTATE_LTB_Focused) 120 if (pItem->m_dwStates & FWL_ITEMSTATE_LTB_Focused)
121 return pItem.get(); 121 return pItem.get();
122 } 122 }
123 return nullptr; 123 return nullptr;
124 } 124 }
125 125
126 FWL_Error CFWL_ListBox::SetFocusItem(IFWL_ListItem* pItem) { 126 FWL_Error CFWL_ListBox::SetFocusItem(CFWL_ListItem* pItem) {
127 int32_t nIndex = GetItemIndex(GetWidget(), pItem); 127 int32_t nIndex = GetItemIndex(GetWidget(), pItem);
128 m_ItemArray[nIndex]->m_dwStates |= FWL_ITEMSTATE_LTB_Focused; 128 m_ItemArray[nIndex]->m_dwStates |= FWL_ITEMSTATE_LTB_Focused;
129 return FWL_Error::Succeeded; 129 return FWL_Error::Succeeded;
130 } 130 }
131 131
132 int32_t CFWL_ListBox::CountItems() { 132 int32_t CFWL_ListBox::CountItems() {
133 return pdfium::CollectionSize<int32_t>(m_ItemArray); 133 return pdfium::CollectionSize<int32_t>(m_ItemArray);
134 } 134 }
135 135
136 IFWL_ListItem* CFWL_ListBox::GetItem(int32_t nIndex) { 136 CFWL_ListItem* CFWL_ListBox::GetItem(int32_t nIndex) {
137 if (nIndex < 0 || nIndex >= CountItems()) 137 if (nIndex < 0 || nIndex >= CountItems())
138 return nullptr; 138 return nullptr;
139 139
140 return m_ItemArray[nIndex].get(); 140 return m_ItemArray[nIndex].get();
141 } 141 }
142 142
143 FWL_Error CFWL_ListBox::SetItemString(IFWL_ListItem* pItem, 143 FWL_Error CFWL_ListBox::SetItemString(CFWL_ListItem* pItem,
144 const CFX_WideStringC& wsText) { 144 const CFX_WideStringC& wsText) {
145 if (!pItem) 145 if (!pItem)
146 return FWL_Error::Indefinite; 146 return FWL_Error::Indefinite;
147 static_cast<CFWL_ListItem*>(pItem)->m_wsText = wsText; 147 static_cast<CFWL_ListItem*>(pItem)->m_wsText = wsText;
148 return FWL_Error::Succeeded; 148 return FWL_Error::Succeeded;
149 } 149 }
150 150
151 FWL_Error CFWL_ListBox::GetItemString(IFWL_ListItem* pItem, 151 FWL_Error CFWL_ListBox::GetItemString(CFWL_ListItem* pItem,
152 CFX_WideString& wsText) { 152 CFX_WideString& wsText) {
153 if (!pItem) 153 if (!pItem)
154 return FWL_Error::Indefinite; 154 return FWL_Error::Indefinite;
155 wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText; 155 wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText;
156 return FWL_Error::Succeeded; 156 return FWL_Error::Succeeded;
157 } 157 }
158 158
159 FWL_Error CFWL_ListBox::SetItemData(IFWL_ListItem* pItem, void* pData) { 159 FWL_Error CFWL_ListBox::SetItemData(CFWL_ListItem* pItem, void* pData) {
160 if (!pItem) 160 if (!pItem)
161 return FWL_Error::Indefinite; 161 return FWL_Error::Indefinite;
162 static_cast<CFWL_ListItem*>(pItem)->m_pData = pData; 162 static_cast<CFWL_ListItem*>(pItem)->m_pData = pData;
163 return FWL_Error::Succeeded; 163 return FWL_Error::Succeeded;
164 } 164 }
165 165
166 void* CFWL_ListBox::GetItemData(IFWL_ListItem* pItem) { 166 void* CFWL_ListBox::GetItemData(CFWL_ListItem* pItem) {
167 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr; 167 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr;
168 } 168 }
169 169
170 IFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { 170 CFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
171 CFX_RectF rtClient; 171 CFX_RectF rtClient;
172 GetWidget()->GetClientRect(rtClient); 172 GetWidget()->GetClientRect(rtClient);
173 fx -= rtClient.left; 173 fx -= rtClient.left;
174 fy -= rtClient.top; 174 fy -= rtClient.top;
175 FX_FLOAT fPosX = 0; 175 FX_FLOAT fPosX = 0;
176 FX_FLOAT fPosY = 0; 176 FX_FLOAT fPosY = 0;
177 ToListBox(GetWidget())->GetScrollPos(fx); 177 ToListBox(GetWidget())->GetScrollPos(fx);
178 ToListBox(GetWidget())->GetScrollPos(fy, false); 178 ToListBox(GetWidget())->GetScrollPos(fy, false);
179 int32_t nCount = CountItems(nullptr); 179 int32_t nCount = CountItems(nullptr);
180 for (int32_t i = 0; i < nCount; i++) { 180 for (int32_t i = 0; i < nCount; i++) {
181 IFWL_ListItem* pItem = GetItem(nullptr, i); 181 CFWL_ListItem* pItem = GetItem(nullptr, i);
182 if (!pItem) { 182 if (!pItem) {
183 continue; 183 continue;
184 } 184 }
185 CFX_RectF rtItem; 185 CFX_RectF rtItem;
186 GetItemRect(nullptr, pItem, rtItem); 186 GetItemRect(nullptr, pItem, rtItem);
187 rtItem.Offset(-fPosX, -fPosY); 187 rtItem.Offset(-fPosX, -fPosY);
188 if (rtItem.Contains(fx, fy)) { 188 if (rtItem.Contains(fx, fy)) {
189 return pItem; 189 return pItem;
190 } 190 }
191 } 191 }
192 return nullptr; 192 return nullptr;
193 } 193 }
194 194
195 uint32_t CFWL_ListBox::GetItemStates(IFWL_ListItem* pItem) { 195 uint32_t CFWL_ListBox::GetItemStates(CFWL_ListItem* pItem) {
196 if (!pItem) 196 if (!pItem)
197 return 0; 197 return 0;
198 CFWL_ListItem* pListItem = static_cast<CFWL_ListItem*>(pItem); 198 CFWL_ListItem* pListItem = static_cast<CFWL_ListItem*>(pItem);
199 return pListItem->m_dwStates | pListItem->m_dwCheckState; 199 return pListItem->m_dwStates | pListItem->m_dwCheckState;
200 } 200 }
201 201
202 FWL_Error CFWL_ListBox::GetCaption(IFWL_Widget* pWidget, 202 FWL_Error CFWL_ListBox::GetCaption(IFWL_Widget* pWidget,
203 CFX_WideString& wsCaption) { 203 CFX_WideString& wsCaption) {
204 wsCaption = m_wsData; 204 wsCaption = m_wsData;
205 return FWL_Error::Succeeded; 205 return FWL_Error::Succeeded;
206 } 206 }
207 207
208 int32_t CFWL_ListBox::CountItems(const IFWL_Widget* pWidget) { 208 int32_t CFWL_ListBox::CountItems(const IFWL_Widget* pWidget) {
209 return pdfium::CollectionSize<int32_t>(m_ItemArray); 209 return pdfium::CollectionSize<int32_t>(m_ItemArray);
210 } 210 }
211 211
212 IFWL_ListItem* CFWL_ListBox::GetItem(const IFWL_Widget* pWidget, 212 CFWL_ListItem* CFWL_ListBox::GetItem(const IFWL_Widget* pWidget,
213 int32_t nIndex) { 213 int32_t nIndex) {
214 if (nIndex < 0 || nIndex >= CountItems(pWidget)) 214 if (nIndex < 0 || nIndex >= CountItems(pWidget))
215 return nullptr; 215 return nullptr;
216 216
217 return m_ItemArray[nIndex].get(); 217 return m_ItemArray[nIndex].get();
218 } 218 }
219 219
220 int32_t CFWL_ListBox::GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) { 220 int32_t CFWL_ListBox::GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) {
221 auto it = std::find_if( 221 auto it = std::find_if(
222 m_ItemArray.begin(), m_ItemArray.end(), 222 m_ItemArray.begin(), m_ItemArray.end(),
223 [pItem](const std::unique_ptr<CFWL_ListItem>& candidate) { 223 [pItem](const std::unique_ptr<CFWL_ListItem>& candidate) {
224 return candidate.get() == static_cast<CFWL_ListItem*>(pItem); 224 return candidate.get() == static_cast<CFWL_ListItem*>(pItem);
225 }); 225 });
226 return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; 226 return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1;
227 } 227 }
228 228
229 bool CFWL_ListBox::SetItemIndex(IFWL_Widget* pWidget, 229 bool CFWL_ListBox::SetItemIndex(IFWL_Widget* pWidget,
230 IFWL_ListItem* pItem, 230 CFWL_ListItem* pItem,
231 int32_t nIndex) { 231 int32_t nIndex) {
232 if (nIndex < 0 || nIndex >= CountItems(pWidget)) 232 if (nIndex < 0 || nIndex >= CountItems(pWidget))
233 return false; 233 return false;
234 m_ItemArray[nIndex].reset(static_cast<CFWL_ListItem*>(pItem)); 234 m_ItemArray[nIndex].reset(static_cast<CFWL_ListItem*>(pItem));
235 return true; 235 return true;
236 } 236 }
237 237
238 uint32_t CFWL_ListBox::GetItemStyles(IFWL_Widget* pWidget, 238 uint32_t CFWL_ListBox::GetItemStyles(IFWL_Widget* pWidget,
239 IFWL_ListItem* pItem) { 239 CFWL_ListItem* pItem) {
240 if (!pItem) 240 if (!pItem)
241 return 0; 241 return 0;
242 return static_cast<CFWL_ListItem*>(pItem)->m_dwStates; 242 return static_cast<CFWL_ListItem*>(pItem)->m_dwStates;
243 } 243 }
244 244
245 FWL_Error CFWL_ListBox::GetItemText(IFWL_Widget* pWidget, 245 FWL_Error CFWL_ListBox::GetItemText(IFWL_Widget* pWidget,
246 IFWL_ListItem* pItem, 246 CFWL_ListItem* pItem,
247 CFX_WideString& wsText) { 247 CFX_WideString& wsText) {
248 if (!pItem) 248 if (!pItem)
249 return FWL_Error::Indefinite; 249 return FWL_Error::Indefinite;
250 wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText; 250 wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText;
251 return FWL_Error::Succeeded; 251 return FWL_Error::Succeeded;
252 } 252 }
253 253
254 FWL_Error CFWL_ListBox::GetItemRect(IFWL_Widget* pWidget, 254 FWL_Error CFWL_ListBox::GetItemRect(IFWL_Widget* pWidget,
255 IFWL_ListItem* pItem, 255 CFWL_ListItem* pItem,
256 CFX_RectF& rtItem) { 256 CFX_RectF& rtItem) {
257 if (!pItem) 257 if (!pItem)
258 return FWL_Error::Indefinite; 258 return FWL_Error::Indefinite;
259 rtItem = static_cast<CFWL_ListItem*>(pItem)->m_rtItem; 259 rtItem = static_cast<CFWL_ListItem*>(pItem)->m_rtItem;
260 return FWL_Error::Succeeded; 260 return FWL_Error::Succeeded;
261 } 261 }
262 262
263 void* CFWL_ListBox::GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) { 263 void* CFWL_ListBox::GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) {
264 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr; 264 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr;
265 } 265 }
266 266
267 FWL_Error CFWL_ListBox::SetItemStyles(IFWL_Widget* pWidget, 267 FWL_Error CFWL_ListBox::SetItemStyles(IFWL_Widget* pWidget,
268 IFWL_ListItem* pItem, 268 CFWL_ListItem* pItem,
269 uint32_t dwStyle) { 269 uint32_t dwStyle) {
270 if (!pItem) 270 if (!pItem)
271 return FWL_Error::Indefinite; 271 return FWL_Error::Indefinite;
272 static_cast<CFWL_ListItem*>(pItem)->m_dwStates = dwStyle; 272 static_cast<CFWL_ListItem*>(pItem)->m_dwStates = dwStyle;
273 return FWL_Error::Succeeded; 273 return FWL_Error::Succeeded;
274 } 274 }
275 275
276 FWL_Error CFWL_ListBox::SetItemText(IFWL_Widget* pWidget, 276 FWL_Error CFWL_ListBox::SetItemText(IFWL_Widget* pWidget,
277 IFWL_ListItem* pItem, 277 CFWL_ListItem* pItem,
278 const FX_WCHAR* pszText) { 278 const FX_WCHAR* pszText) {
279 if (!pItem) 279 if (!pItem)
280 return FWL_Error::Indefinite; 280 return FWL_Error::Indefinite;
281 static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText; 281 static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText;
282 return FWL_Error::Succeeded; 282 return FWL_Error::Succeeded;
283 } 283 }
284 284
285 FWL_Error CFWL_ListBox::SetItemRect(IFWL_Widget* pWidget, 285 FWL_Error CFWL_ListBox::SetItemRect(IFWL_Widget* pWidget,
286 IFWL_ListItem* pItem, 286 CFWL_ListItem* pItem,
287 const CFX_RectF& rtItem) { 287 const CFX_RectF& rtItem) {
288 if (!pItem) 288 if (!pItem)
289 return FWL_Error::Indefinite; 289 return FWL_Error::Indefinite;
290 static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem; 290 static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem;
291 return FWL_Error::Succeeded; 291 return FWL_Error::Succeeded;
292 } 292 }
293 293
294 FX_FLOAT CFWL_ListBox::GetItemHeight(IFWL_Widget* pWidget) { 294 FX_FLOAT CFWL_ListBox::GetItemHeight(IFWL_Widget* pWidget) {
295 return m_fItemHeight; 295 return m_fItemHeight;
296 } 296 }
297 297
298 CFX_DIBitmap* CFWL_ListBox::GetItemIcon(IFWL_Widget* pWidget, 298 CFX_DIBitmap* CFWL_ListBox::GetItemIcon(IFWL_Widget* pWidget,
299 IFWL_ListItem* pItem) { 299 CFWL_ListItem* pItem) {
300 return static_cast<CFWL_ListItem*>(pItem)->m_pDIB; 300 return static_cast<CFWL_ListItem*>(pItem)->m_pDIB;
301 } 301 }
302 302
303 FWL_Error CFWL_ListBox::GetItemCheckRect(IFWL_Widget* pWidget, 303 FWL_Error CFWL_ListBox::GetItemCheckRect(IFWL_Widget* pWidget,
304 IFWL_ListItem* pItem, 304 CFWL_ListItem* pItem,
305 CFX_RectF& rtCheck) { 305 CFX_RectF& rtCheck) {
306 rtCheck = static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox; 306 rtCheck = static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox;
307 return FWL_Error::Succeeded; 307 return FWL_Error::Succeeded;
308 } 308 }
309 309
310 FWL_Error CFWL_ListBox::SetItemCheckRect(IFWL_Widget* pWidget, 310 FWL_Error CFWL_ListBox::SetItemCheckRect(IFWL_Widget* pWidget,
311 IFWL_ListItem* pItem, 311 CFWL_ListItem* pItem,
312 const CFX_RectF& rtCheck) { 312 const CFX_RectF& rtCheck) {
313 static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox = rtCheck; 313 static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox = rtCheck;
314 return FWL_Error::Succeeded; 314 return FWL_Error::Succeeded;
315 } 315 }
316 316
317 uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget, 317 uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget,
318 IFWL_ListItem* pItem) { 318 CFWL_ListItem* pItem) {
319 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState; 319 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState;
320 } 320 }
321 321
322 FWL_Error CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget, 322 FWL_Error CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget,
323 IFWL_ListItem* pItem, 323 CFWL_ListItem* pItem,
324 uint32_t dwCheckState) { 324 uint32_t dwCheckState) {
325 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState; 325 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState;
326 return FWL_Error::Succeeded; 326 return FWL_Error::Succeeded;
327 } 327 }
328
329 CFWL_ListItem::CFWL_ListItem() {
330 m_rtItem.Reset();
331 m_dwStates = 0;
332 m_wsText = L"";
333 m_pDIB = nullptr;
334 m_pData = nullptr;
335 m_dwCheckState = 0;
336 m_rtCheckBox.Reset();
337 }
338
339 CFWL_ListItem::~CFWL_ListItem() {}
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_listbox.h ('k') | xfa/fwl/core/cfwl_listitem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698