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

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

Issue 2029923002: Replace FWL_HLISTITEM with class IFWL_ListItem {} (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 months 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
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/lightwidget/cfwl_listbox.h" 7 #include "xfa/fwl/lightwidget/cfwl_listbox.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 13 matching lines...) Expand all
24 m_pProperties->MakeWidgetImpProperties(&m_ListBoxDP), nullptr)); 24 m_pProperties->MakeWidgetImpProperties(&m_ListBoxDP), nullptr));
25 FWL_Error ret = pListBox->Initialize(); 25 FWL_Error ret = pListBox->Initialize();
26 if (ret != FWL_Error::Succeeded) { 26 if (ret != FWL_Error::Succeeded) {
27 return ret; 27 return ret;
28 } 28 }
29 m_pIface = pListBox.release(); 29 m_pIface = pListBox.release();
30 CFWL_Widget::Initialize(); 30 CFWL_Widget::Initialize();
31 return FWL_Error::Succeeded; 31 return FWL_Error::Succeeded;
32 } 32 }
33 33
34 FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, FWL_HLISTITEM hItem) { 34 FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* hItem) {
35 reinterpret_cast<CFWL_ListItem*>(hItem)->m_pDIB = pDIB; 35 static_cast<CFWL_ListItem*>(hItem)->m_pDIB = pDIB;
36 return FWL_Error::Succeeded; 36 return FWL_Error::Succeeded;
37 } 37 }
38 38
39 FWL_HLISTITEM CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd, 39 IFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd,
40 FX_BOOL bSelect) { 40 FX_BOOL bSelect) {
41 std::unique_ptr<CFWL_ListItem> pItem(new CFWL_ListItem); 41 std::unique_ptr<CFWL_ListItem> pItem(new CFWL_ListItem);
42 pItem->m_dwStates = 0; 42 pItem->m_dwStates = 0;
43 pItem->m_wsText = wsAdd; 43 pItem->m_wsText = wsAdd;
44 pItem->m_dwStates = bSelect ? FWL_ITEMSTATE_LTB_Selected : 0; 44 pItem->m_dwStates = bSelect ? FWL_ITEMSTATE_LTB_Selected : 0;
45 m_ListBoxDP.m_ItemArray.push_back(std::move(pItem)); 45 m_ListBoxDP.m_ItemArray.push_back(std::move(pItem));
46 return (FWL_HLISTITEM)m_ListBoxDP.m_ItemArray.back().get(); 46 return (IFWL_ListItem*)m_ListBoxDP.m_ItemArray.back().get();
Lei Zhang 2016/06/02 01:14:16 Still need the cast?
Tom Sepez 2016/06/02 21:02:59 Done.
47 } 47 }
48 48
49 FX_BOOL CFWL_ListBox::DeleteString(FWL_HLISTITEM hItem) { 49 FX_BOOL CFWL_ListBox::DeleteString(IFWL_ListItem* hItem) {
50 int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), hItem); 50 int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), hItem);
51 if (nIndex < 0 || 51 if (nIndex < 0 ||
52 static_cast<size_t>(nIndex) >= m_ListBoxDP.m_ItemArray.size()) { 52 static_cast<size_t>(nIndex) >= m_ListBoxDP.m_ItemArray.size()) {
53 return FALSE; 53 return FALSE;
54 } 54 }
55 int32_t iCount = m_ListBoxDP.CountItems(m_pIface); 55 int32_t iCount = m_ListBoxDP.CountItems(m_pIface);
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;
61 } 61 }
62 } 62 }
63 if (iSel >= 0) { 63 if (iSel >= 0) {
64 CFWL_ListItem* pSel = 64 CFWL_ListItem* pSel =
65 reinterpret_cast<CFWL_ListItem*>(m_ListBoxDP.GetItem(m_pIface, iSel)); 65 static_cast<CFWL_ListItem*>(m_ListBoxDP.GetItem(m_pIface, iSel));
66 pSel->m_dwStates |= FWL_ITEMSTATE_LTB_Selected; 66 pSel->m_dwStates |= FWL_ITEMSTATE_LTB_Selected;
67 } 67 }
68 m_ListBoxDP.m_ItemArray.erase(m_ListBoxDP.m_ItemArray.begin() + nIndex); 68 m_ListBoxDP.m_ItemArray.erase(m_ListBoxDP.m_ItemArray.begin() + nIndex);
69 return TRUE; 69 return TRUE;
70 } 70 }
71 71
72 void CFWL_ListBox::DeleteAll() { 72 void CFWL_ListBox::DeleteAll() {
73 m_ListBoxDP.m_ItemArray.clear(); 73 m_ListBoxDP.m_ItemArray.clear();
74 } 74 }
75 75
76 int32_t CFWL_ListBox::CountSelItems() { 76 int32_t CFWL_ListBox::CountSelItems() {
77 if (!m_pIface) 77 if (!m_pIface)
78 return 0; 78 return 0;
79 return static_cast<IFWL_ListBox*>(m_pIface)->CountSelItems(); 79 return static_cast<IFWL_ListBox*>(m_pIface)->CountSelItems();
80 } 80 }
81 81
82 FWL_HLISTITEM CFWL_ListBox::GetSelItem(int32_t nIndexSel) { 82 IFWL_ListItem* CFWL_ListBox::GetSelItem(int32_t nIndexSel) {
83 if (!m_pIface) 83 if (!m_pIface)
84 return NULL; 84 return NULL;
85 return static_cast<IFWL_ListBox*>(m_pIface)->GetSelItem(nIndexSel); 85 return static_cast<IFWL_ListBox*>(m_pIface)->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 (!m_pIface) 89 if (!m_pIface)
90 return 0; 90 return 0;
91 return static_cast<IFWL_ListBox*>(m_pIface)->GetSelIndex(nIndex); 91 return static_cast<IFWL_ListBox*>(m_pIface)->GetSelIndex(nIndex);
92 } 92 }
93 93
94 FWL_Error CFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { 94 FWL_Error CFWL_ListBox::SetSelItem(IFWL_ListItem* hItem, FX_BOOL bSelect) {
95 if (!m_pIface) 95 if (!m_pIface)
96 return FWL_Error::Indefinite; 96 return FWL_Error::Indefinite;
97 return static_cast<IFWL_ListBox*>(m_pIface)->SetSelItem(hItem, bSelect); 97 return static_cast<IFWL_ListBox*>(m_pIface)->SetSelItem(hItem, bSelect);
98 } 98 }
99 99
100 FWL_Error CFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, 100 FWL_Error CFWL_ListBox::GetItemText(IFWL_ListItem* hItem,
101 CFX_WideString& wsText) { 101 CFX_WideString& wsText) {
102 if (!m_pIface) 102 if (!m_pIface)
103 return FWL_Error::Indefinite; 103 return FWL_Error::Indefinite;
104 return static_cast<IFWL_ListBox*>(m_pIface)->GetItemText(hItem, wsText); 104 return static_cast<IFWL_ListBox*>(m_pIface)->GetItemText(hItem, wsText);
105 } 105 }
106 106
107 FWL_Error CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { 107 FWL_Error CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) {
108 if (!m_pIface) 108 if (!m_pIface)
109 return FWL_Error::Indefinite; 109 return FWL_Error::Indefinite;
110 return static_cast<IFWL_ListBox*>(m_pIface)->GetScrollPos(fPos, bVert); 110 return static_cast<IFWL_ListBox*>(m_pIface)->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_ListBoxDP.m_fItemHeight = fItemHeight; 114 m_ListBoxDP.m_fItemHeight = fItemHeight;
115 return FWL_Error::Succeeded; 115 return FWL_Error::Succeeded;
116 } 116 }
117 117
118 FWL_HLISTITEM CFWL_ListBox::GetFocusItem() { 118 IFWL_ListItem* CFWL_ListBox::GetFocusItem() {
119 for (const auto& hItem : m_ListBoxDP.m_ItemArray) { 119 for (const auto& hItem : m_ListBoxDP.m_ItemArray) {
120 if (hItem->m_dwStates & FWL_ITEMSTATE_LTB_Focused) 120 if (hItem->m_dwStates & FWL_ITEMSTATE_LTB_Focused)
121 return (FWL_HLISTITEM)hItem.get(); 121 return (IFWL_ListItem*)hItem.get();
Lei Zhang 2016/06/02 01:14:16 Ditto
Tom Sepez 2016/06/02 21:03:00 Done.
122 } 122 }
123 return nullptr; 123 return nullptr;
124 } 124 }
125 125
126 FWL_Error CFWL_ListBox::SetFocusItem(FWL_HLISTITEM hItem) { 126 FWL_Error CFWL_ListBox::SetFocusItem(IFWL_ListItem* hItem) {
127 int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), hItem); 127 int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), hItem);
128 m_ListBoxDP.m_ItemArray[nIndex]->m_dwStates |= FWL_ITEMSTATE_LTB_Focused; 128 m_ListBoxDP.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_ListBoxDP.m_ItemArray); 133 return pdfium::CollectionSize<int32_t>(m_ListBoxDP.m_ItemArray);
134 } 134 }
135 135
136 FWL_HLISTITEM CFWL_ListBox::GetItem(int32_t nIndex) { 136 IFWL_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 (FWL_HLISTITEM)m_ListBoxDP.m_ItemArray[nIndex].get(); 140 return (IFWL_ListItem*)m_ListBoxDP.m_ItemArray[nIndex].get();
Lei Zhang 2016/06/02 01:14:16 Ditto
Tom Sepez 2016/06/02 21:03:00 Done.
141 } 141 }
142 142
143 FWL_Error CFWL_ListBox::SetItemString(FWL_HLISTITEM hItem, 143 FWL_Error CFWL_ListBox::SetItemString(IFWL_ListItem* hItem,
144 const CFX_WideStringC& wsText) { 144 const CFX_WideStringC& wsText) {
145 if (!hItem) 145 if (!hItem)
146 return FWL_Error::Indefinite; 146 return FWL_Error::Indefinite;
147 reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText = wsText; 147 static_cast<CFWL_ListItem*>(hItem)->m_wsText = wsText;
148 return FWL_Error::Succeeded; 148 return FWL_Error::Succeeded;
149 } 149 }
150 150
151 FWL_Error CFWL_ListBox::GetItemString(FWL_HLISTITEM hItem, 151 FWL_Error CFWL_ListBox::GetItemString(IFWL_ListItem* hItem,
152 CFX_WideString& wsText) { 152 CFX_WideString& wsText) {
153 if (!hItem) 153 if (!hItem)
154 return FWL_Error::Indefinite; 154 return FWL_Error::Indefinite;
155 wsText = reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText; 155 wsText = static_cast<CFWL_ListItem*>(hItem)->m_wsText;
156 return FWL_Error::Succeeded; 156 return FWL_Error::Succeeded;
157 } 157 }
158 158
159 FWL_Error CFWL_ListBox::SetItemData(FWL_HLISTITEM hItem, void* pData) { 159 FWL_Error CFWL_ListBox::SetItemData(IFWL_ListItem* hItem, void* pData) {
160 if (!hItem) 160 if (!hItem)
161 return FWL_Error::Indefinite; 161 return FWL_Error::Indefinite;
162 reinterpret_cast<CFWL_ListItem*>(hItem)->m_pData = pData; 162 static_cast<CFWL_ListItem*>(hItem)->m_pData = pData;
163 return FWL_Error::Succeeded; 163 return FWL_Error::Succeeded;
164 } 164 }
165 165
166 void* CFWL_ListBox::GetItemData(FWL_HLISTITEM hItem) { 166 void* CFWL_ListBox::GetItemData(IFWL_ListItem* hItem) {
167 if (!hItem) 167 if (!hItem)
168 return NULL; 168 return NULL;
169 return reinterpret_cast<CFWL_ListItem*>(hItem)->m_pData; 169 return static_cast<CFWL_ListItem*>(hItem)->m_pData;
170 } 170 }
171 171
172 FWL_HLISTITEM CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { 172 IFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
173 CFX_RectF rtClient; 173 CFX_RectF rtClient;
174 m_pIface->GetClientRect(rtClient); 174 m_pIface->GetClientRect(rtClient);
175 fx -= rtClient.left; 175 fx -= rtClient.left;
176 fy -= rtClient.top; 176 fy -= rtClient.top;
177 FX_FLOAT fPosX = 0; 177 FX_FLOAT fPosX = 0;
178 FX_FLOAT fPosY = 0; 178 FX_FLOAT fPosY = 0;
179 static_cast<IFWL_ListBox*>(m_pIface)->GetScrollPos(fx); 179 static_cast<IFWL_ListBox*>(m_pIface)->GetScrollPos(fx);
180 static_cast<IFWL_ListBox*>(m_pIface)->GetScrollPos(fy, FALSE); 180 static_cast<IFWL_ListBox*>(m_pIface)->GetScrollPos(fy, FALSE);
181 int32_t nCount = m_ListBoxDP.CountItems(NULL); 181 int32_t nCount = m_ListBoxDP.CountItems(NULL);
182 for (int32_t i = 0; i < nCount; i++) { 182 for (int32_t i = 0; i < nCount; i++) {
183 FWL_HLISTITEM hItem = m_ListBoxDP.GetItem(NULL, i); 183 IFWL_ListItem* hItem = m_ListBoxDP.GetItem(NULL, i);
184 if (!hItem) { 184 if (!hItem) {
185 continue; 185 continue;
186 } 186 }
187 CFX_RectF rtItem; 187 CFX_RectF rtItem;
188 m_ListBoxDP.GetItemRect(NULL, hItem, rtItem); 188 m_ListBoxDP.GetItemRect(NULL, hItem, rtItem);
189 rtItem.Offset(-fPosX, -fPosY); 189 rtItem.Offset(-fPosX, -fPosY);
190 if (rtItem.Contains(fx, fy)) { 190 if (rtItem.Contains(fx, fy)) {
191 return hItem; 191 return hItem;
192 } 192 }
193 } 193 }
194 return NULL; 194 return NULL;
195 } 195 }
196 196
197 uint32_t CFWL_ListBox::GetItemStates(FWL_HLISTITEM hItem) { 197 uint32_t CFWL_ListBox::GetItemStates(IFWL_ListItem* hItem) {
198 if (!hItem) 198 if (!hItem)
199 return 0; 199 return 0;
200 CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem); 200 CFWL_ListItem* pItem = static_cast<CFWL_ListItem*>(hItem);
201 return pItem->m_dwStates | pItem->m_dwCheckState; 201 return pItem->m_dwStates | pItem->m_dwCheckState;
202 } 202 }
203 203
204 CFWL_ListBox::CFWL_ListBox() {} 204 CFWL_ListBox::CFWL_ListBox() {}
205 205
206 CFWL_ListBox::~CFWL_ListBox() {} 206 CFWL_ListBox::~CFWL_ListBox() {}
207 207
208 CFWL_ListBox::CFWL_ListBoxDP::CFWL_ListBoxDP() {} 208 CFWL_ListBox::CFWL_ListBoxDP::CFWL_ListBoxDP() {}
209 209
210 CFWL_ListBox::CFWL_ListBoxDP::~CFWL_ListBoxDP() {} 210 CFWL_ListBox::CFWL_ListBoxDP::~CFWL_ListBoxDP() {}
211 211
212 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetCaption(IFWL_Widget* pWidget, 212 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetCaption(IFWL_Widget* pWidget,
213 CFX_WideString& wsCaption) { 213 CFX_WideString& wsCaption) {
214 wsCaption = m_wsData; 214 wsCaption = m_wsData;
215 return FWL_Error::Succeeded; 215 return FWL_Error::Succeeded;
216 } 216 }
217 217
218 int32_t CFWL_ListBox::CFWL_ListBoxDP::CountItems(IFWL_Widget* pWidget) { 218 int32_t CFWL_ListBox::CFWL_ListBoxDP::CountItems(IFWL_Widget* pWidget) {
219 return pdfium::CollectionSize<int32_t>(m_ItemArray); 219 return pdfium::CollectionSize<int32_t>(m_ItemArray);
220 } 220 }
221 221
222 FWL_HLISTITEM CFWL_ListBox::CFWL_ListBoxDP::GetItem(IFWL_Widget* pWidget, 222 IFWL_ListItem* CFWL_ListBox::CFWL_ListBoxDP::GetItem(IFWL_Widget* pWidget,
223 int32_t nIndex) { 223 int32_t nIndex) {
224 if (nIndex < 0 || nIndex >= CountItems(pWidget)) 224 if (nIndex < 0 || nIndex >= CountItems(pWidget))
225 return nullptr; 225 return nullptr;
226 226
227 return (FWL_HLISTITEM)m_ItemArray[nIndex].get(); 227 return (IFWL_ListItem*)m_ItemArray[nIndex].get();
Lei Zhang 2016/06/02 01:14:16 Ditto
228 } 228 }
229 229
230 int32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemIndex(IFWL_Widget* pWidget, 230 int32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemIndex(IFWL_Widget* pWidget,
231 FWL_HLISTITEM hItem) { 231 IFWL_ListItem* hItem) {
232 auto it = std::find_if( 232 auto it = std::find_if(
233 m_ItemArray.begin(), m_ItemArray.end(), 233 m_ItemArray.begin(), m_ItemArray.end(),
234 [hItem](const std::unique_ptr<CFWL_ListItem>& candidate) { 234 [hItem](const std::unique_ptr<CFWL_ListItem>& candidate) {
235 return candidate.get() == reinterpret_cast<CFWL_ListItem*>(hItem); 235 return candidate.get() == static_cast<CFWL_ListItem*>(hItem);
236 }); 236 });
237 return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; 237 return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1;
238 } 238 }
239 239
240 FX_BOOL CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget, 240 FX_BOOL CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget,
241 FWL_HLISTITEM hItem, 241 IFWL_ListItem* hItem,
242 int32_t nIndex) { 242 int32_t nIndex) {
243 if (nIndex < 0 || nIndex >= CountItems(pWidget)) 243 if (nIndex < 0 || nIndex >= CountItems(pWidget))
244 return FALSE; 244 return FALSE;
245 m_ItemArray[nIndex].reset(reinterpret_cast<CFWL_ListItem*>(hItem)); 245 m_ItemArray[nIndex].reset(static_cast<CFWL_ListItem*>(hItem));
246 return TRUE; 246 return TRUE;
247 } 247 }
248 248
249 uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemStyles(IFWL_Widget* pWidget, 249 uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemStyles(IFWL_Widget* pWidget,
250 FWL_HLISTITEM hItem) { 250 IFWL_ListItem* hItem) {
251 if (!hItem) 251 if (!hItem)
252 return 0; 252 return 0;
253 return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates; 253 return static_cast<CFWL_ListItem*>(hItem)->m_dwStates;
254 } 254 }
255 255
256 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget, 256 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget,
257 FWL_HLISTITEM hItem, 257 IFWL_ListItem* hItem,
258 CFX_WideString& wsText) { 258 CFX_WideString& wsText) {
259 if (!hItem) 259 if (!hItem)
260 return FWL_Error::Indefinite; 260 return FWL_Error::Indefinite;
261 wsText = reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText; 261 wsText = static_cast<CFWL_ListItem*>(hItem)->m_wsText;
262 return FWL_Error::Succeeded; 262 return FWL_Error::Succeeded;
263 } 263 }
264 264
265 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget, 265 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget,
266 FWL_HLISTITEM hItem, 266 IFWL_ListItem* hItem,
267 CFX_RectF& rtItem) { 267 CFX_RectF& rtItem) {
268 if (!hItem) 268 if (!hItem)
269 return FWL_Error::Indefinite; 269 return FWL_Error::Indefinite;
270 CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem); 270 CFWL_ListItem* pItem = static_cast<CFWL_ListItem*>(hItem);
271 rtItem = pItem->m_rtItem; 271 rtItem = pItem->m_rtItem;
272 return FWL_Error::Succeeded; 272 return FWL_Error::Succeeded;
273 } 273 }
274 274
275 void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget, 275 void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget,
276 FWL_HLISTITEM hItem) { 276 IFWL_ListItem* hItem) {
277 if (!hItem) 277 if (!hItem)
278 return NULL; 278 return NULL;
279 CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem); 279 CFWL_ListItem* pItem = static_cast<CFWL_ListItem*>(hItem);
280 return pItem->m_pData; 280 return pItem->m_pData;
281 } 281 }
282 282
283 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget, 283 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget,
284 FWL_HLISTITEM hItem, 284 IFWL_ListItem* hItem,
285 uint32_t dwStyle) { 285 uint32_t dwStyle) {
286 if (!hItem) 286 if (!hItem)
287 return FWL_Error::Indefinite; 287 return FWL_Error::Indefinite;
288 reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates = dwStyle; 288 static_cast<CFWL_ListItem*>(hItem)->m_dwStates = dwStyle;
289 return FWL_Error::Succeeded; 289 return FWL_Error::Succeeded;
290 } 290 }
291 291
292 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget, 292 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget,
293 FWL_HLISTITEM hItem, 293 IFWL_ListItem* hItem,
294 const FX_WCHAR* pszText) { 294 const FX_WCHAR* pszText) {
295 if (!hItem) 295 if (!hItem)
296 return FWL_Error::Indefinite; 296 return FWL_Error::Indefinite;
297 reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText = pszText; 297 static_cast<CFWL_ListItem*>(hItem)->m_wsText = pszText;
298 return FWL_Error::Succeeded; 298 return FWL_Error::Succeeded;
299 } 299 }
300 300
301 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget, 301 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget,
302 FWL_HLISTITEM hItem, 302 IFWL_ListItem* hItem,
303 const CFX_RectF& rtItem) { 303 const CFX_RectF& rtItem) {
304 if (!hItem) 304 if (!hItem)
305 return FWL_Error::Indefinite; 305 return FWL_Error::Indefinite;
306 reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtItem = rtItem; 306 static_cast<CFWL_ListItem*>(hItem)->m_rtItem = rtItem;
307 return FWL_Error::Succeeded; 307 return FWL_Error::Succeeded;
308 } 308 }
309 309
310 FX_FLOAT CFWL_ListBox::CFWL_ListBoxDP::GetItemHeight(IFWL_Widget* pWidget) { 310 FX_FLOAT CFWL_ListBox::CFWL_ListBoxDP::GetItemHeight(IFWL_Widget* pWidget) {
311 return m_fItemHeight; 311 return m_fItemHeight;
312 } 312 }
313 313
314 CFX_DIBitmap* CFWL_ListBox::CFWL_ListBoxDP::GetItemIcon(IFWL_Widget* pWidget, 314 CFX_DIBitmap* CFWL_ListBox::CFWL_ListBoxDP::GetItemIcon(IFWL_Widget* pWidget,
315 FWL_HLISTITEM hItem) { 315 IFWL_ListItem* hItem) {
316 return reinterpret_cast<CFWL_ListItem*>(hItem)->m_pDIB; 316 return static_cast<CFWL_ListItem*>(hItem)->m_pDIB;
317 } 317 }
318 318
319 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, 319 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckRect(IFWL_Widget* pWidget,
320 FWL_HLISTITEM hItem, 320 IFWL_ListItem* hItem,
321 CFX_RectF& rtCheck) { 321 CFX_RectF& rtCheck) {
322 rtCheck = reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox; 322 rtCheck = static_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox;
323 return FWL_Error::Succeeded; 323 return FWL_Error::Succeeded;
324 } 324 }
325 325
326 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect( 326 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect(
327 IFWL_Widget* pWidget, 327 IFWL_Widget* pWidget,
328 FWL_HLISTITEM hItem, 328 IFWL_ListItem* hItem,
329 const CFX_RectF& rtCheck) { 329 const CFX_RectF& rtCheck) {
330 reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox = rtCheck; 330 static_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox = rtCheck;
331 return FWL_Error::Succeeded; 331 return FWL_Error::Succeeded;
332 } 332 }
333 333
334 uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckState(IFWL_Widget* pWidget, 334 uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckState(IFWL_Widget* pWidget,
335 FWL_HLISTITEM hItem) { 335 IFWL_ListItem* hItem) {
336 return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState; 336 return static_cast<CFWL_ListItem*>(hItem)->m_dwCheckState;
337 } 337 }
338 338
339 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckState( 339 FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckState(
340 IFWL_Widget* pWidget, 340 IFWL_Widget* pWidget,
341 FWL_HLISTITEM hItem, 341 IFWL_ListItem* hItem,
342 uint32_t dwCheckState) { 342 uint32_t dwCheckState) {
343 reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState = dwCheckState; 343 static_cast<CFWL_ListItem*>(hItem)->m_dwCheckState = dwCheckState;
344 return FWL_Error::Succeeded; 344 return FWL_Error::Succeeded;
345 } 345 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698