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/lightwidget/cfwl_combobox.h" | 7 #include "xfa/fwl/lightwidget/cfwl_combobox.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "xfa/fwl/core/fwl_error.h" | 11 #include "xfa/fwl/core/fwl_error.h" |
12 #include "xfa/fwl/core/ifwl_widget.h" | 12 #include "xfa/fwl/core/ifwl_widget.h" |
13 | 13 |
14 CFWL_ComboBox* CFWL_ComboBox::Create() { | 14 CFWL_ComboBox* CFWL_ComboBox::Create() { |
15 return new CFWL_ComboBox; | 15 return new CFWL_ComboBox; |
16 } | 16 } |
17 | 17 |
18 FWL_ERR CFWL_ComboBox::Initialize(const CFWL_WidgetProperties* pProperties) { | 18 FWL_Error CFWL_ComboBox::Initialize(const CFWL_WidgetProperties* pProperties) { |
19 if (m_pIface) | 19 if (m_pIface) |
20 return FWL_ERR_Indefinite; | 20 return FWL_Error::Indefinite; |
21 if (pProperties) { | 21 if (pProperties) { |
22 *m_pProperties = *pProperties; | 22 *m_pProperties = *pProperties; |
23 } | 23 } |
24 std::unique_ptr<IFWL_ComboBox> pComboBox(IFWL_ComboBox::Create( | 24 std::unique_ptr<IFWL_ComboBox> pComboBox(IFWL_ComboBox::Create( |
25 m_pProperties->MakeWidgetImpProperties(&m_comboBoxData))); | 25 m_pProperties->MakeWidgetImpProperties(&m_comboBoxData))); |
26 FWL_ERR ret = pComboBox->Initialize(); | 26 FWL_Error ret = pComboBox->Initialize(); |
27 if (ret != FWL_ERR_Succeeded) { | 27 if (ret != FWL_Error::Succeeded) { |
28 return ret; | 28 return ret; |
29 } | 29 } |
30 m_pIface = pComboBox.release(); | 30 m_pIface = pComboBox.release(); |
31 CFWL_Widget::Initialize(); | 31 CFWL_Widget::Initialize(); |
32 return FWL_ERR_Succeeded; | 32 return FWL_Error::Succeeded; |
33 } | 33 } |
34 | 34 |
35 int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) { | 35 int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) { |
36 std::unique_ptr<CFWL_ComboBoxItem> pItem(new CFWL_ComboBoxItem); | 36 std::unique_ptr<CFWL_ComboBoxItem> pItem(new CFWL_ComboBoxItem); |
37 pItem->m_wsText = wsText; | 37 pItem->m_wsText = wsText; |
38 pItem->m_dwStyles = 0; | 38 pItem->m_dwStyles = 0; |
39 m_comboBoxData.m_ItemArray.push_back(std::move(pItem)); | 39 m_comboBoxData.m_ItemArray.push_back(std::move(pItem)); |
40 return m_comboBoxData.m_ItemArray.size() - 1; | 40 return m_comboBoxData.m_ItemArray.size() - 1; |
41 } | 41 } |
42 | 42 |
(...skipping 17 matching lines...) Expand all Loading... |
60 } | 60 } |
61 | 61 |
62 void CFWL_ComboBox::RemoveAll() { | 62 void CFWL_ComboBox::RemoveAll() { |
63 m_comboBoxData.m_ItemArray.clear(); | 63 m_comboBoxData.m_ItemArray.clear(); |
64 } | 64 } |
65 | 65 |
66 int32_t CFWL_ComboBox::CountItems() { | 66 int32_t CFWL_ComboBox::CountItems() { |
67 return m_comboBoxData.CountItems(GetWidget()); | 67 return m_comboBoxData.CountItems(GetWidget()); |
68 } | 68 } |
69 | 69 |
70 FWL_ERR CFWL_ComboBox::GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) { | 70 FWL_Error CFWL_ComboBox::GetTextByIndex(int32_t iIndex, |
| 71 CFX_WideString& wsText) { |
71 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>( | 72 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>( |
72 m_comboBoxData.GetItem(m_pIface, iIndex)); | 73 m_comboBoxData.GetItem(m_pIface, iIndex)); |
73 if (!pItem) | 74 if (!pItem) |
74 return FWL_ERR_Indefinite; | 75 return FWL_Error::Indefinite; |
75 wsText = pItem->m_wsText; | 76 wsText = pItem->m_wsText; |
76 return FWL_ERR_Succeeded; | 77 return FWL_Error::Succeeded; |
77 } | 78 } |
78 | 79 |
79 int32_t CFWL_ComboBox::GetCurSel() { | 80 int32_t CFWL_ComboBox::GetCurSel() { |
80 if (!m_pIface) | 81 if (!m_pIface) |
81 return -1; | 82 return -1; |
82 return static_cast<IFWL_ComboBox*>(m_pIface)->GetCurSel(); | 83 return static_cast<IFWL_ComboBox*>(m_pIface)->GetCurSel(); |
83 } | 84 } |
84 | 85 |
85 FWL_ERR CFWL_ComboBox::SetCurSel(int32_t iSel) { | 86 FWL_Error CFWL_ComboBox::SetCurSel(int32_t iSel) { |
86 if (!m_pIface) | 87 if (!m_pIface) |
87 return FWL_ERR_Indefinite; | 88 return FWL_Error::Indefinite; |
88 return static_cast<IFWL_ComboBox*>(m_pIface)->SetCurSel(iSel); | 89 return static_cast<IFWL_ComboBox*>(m_pIface)->SetCurSel(iSel); |
89 } | 90 } |
90 | 91 |
91 FWL_ERR CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { | 92 FWL_Error CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { |
92 if (!m_pIface) | 93 if (!m_pIface) |
93 return FWL_ERR_Indefinite; | 94 return FWL_Error::Indefinite; |
94 return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditText(wsText); | 95 return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditText(wsText); |
95 } | 96 } |
96 | 97 |
97 int32_t CFWL_ComboBox::GetEditTextLength() const { | 98 int32_t CFWL_ComboBox::GetEditTextLength() const { |
98 if (!m_pIface) | 99 if (!m_pIface) |
99 return 0; | 100 return 0; |
100 return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditTextLength(); | 101 return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditTextLength(); |
101 } | 102 } |
102 | 103 |
103 FWL_ERR CFWL_ComboBox::GetEditText(CFX_WideString& wsText, | 104 FWL_Error CFWL_ComboBox::GetEditText(CFX_WideString& wsText, |
104 int32_t nStart, | 105 int32_t nStart, |
105 int32_t nCount) const { | 106 int32_t nCount) const { |
106 if (!m_pIface) | 107 if (!m_pIface) |
107 return FWL_ERR_Indefinite; | 108 return FWL_Error::Indefinite; |
108 return static_cast<IFWL_ComboBox*>(m_pIface) | 109 return static_cast<IFWL_ComboBox*>(m_pIface) |
109 ->GetEditText(wsText, nStart, nCount); | 110 ->GetEditText(wsText, nStart, nCount); |
110 } | 111 } |
111 | 112 |
112 FWL_ERR CFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { | 113 FWL_Error CFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { |
113 if (!m_pIface) | 114 if (!m_pIface) |
114 return FWL_ERR_Indefinite; | 115 return FWL_Error::Indefinite; |
115 return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditSelRange(nStart, nCount); | 116 return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditSelRange(nStart, nCount); |
116 } | 117 } |
117 | 118 |
118 int32_t CFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) { | 119 int32_t CFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) { |
119 if (!m_pIface) | 120 if (!m_pIface) |
120 return 0; | 121 return 0; |
121 return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditSelRange(nIndex, nStart); | 122 return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditSelRange(nIndex, nStart); |
122 } | 123 } |
123 | 124 |
124 int32_t CFWL_ComboBox::GetEditLimit() { | 125 int32_t CFWL_ComboBox::GetEditLimit() { |
125 if (!m_pIface) | 126 if (!m_pIface) |
126 return 0; | 127 return 0; |
127 return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditLimit(); | 128 return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditLimit(); |
128 } | 129 } |
129 | 130 |
130 FWL_ERR CFWL_ComboBox::SetEditLimit(int32_t nLimit) { | 131 FWL_Error CFWL_ComboBox::SetEditLimit(int32_t nLimit) { |
131 if (!m_pIface) | 132 if (!m_pIface) |
132 return FWL_ERR_Indefinite; | 133 return FWL_Error::Indefinite; |
133 return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditLimit(nLimit); | 134 return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditLimit(nLimit); |
134 } | 135 } |
135 | 136 |
136 FWL_ERR CFWL_ComboBox::EditDoClipboard(int32_t iCmd) { | 137 FWL_Error CFWL_ComboBox::EditDoClipboard(int32_t iCmd) { |
137 if (!m_pIface) | 138 if (!m_pIface) |
138 return FWL_ERR_Indefinite; | 139 return FWL_Error::Indefinite; |
139 return static_cast<IFWL_ComboBox*>(m_pIface)->EditDoClipboard(iCmd); | 140 return static_cast<IFWL_ComboBox*>(m_pIface)->EditDoClipboard(iCmd); |
140 } | 141 } |
141 | 142 |
142 FX_BOOL CFWL_ComboBox::EditRedo(const CFX_ByteStringC& bsRecord) { | 143 FX_BOOL CFWL_ComboBox::EditRedo(const CFX_ByteStringC& bsRecord) { |
143 if (!m_pIface) | 144 if (!m_pIface) |
144 return FALSE; | 145 return FALSE; |
145 return static_cast<IFWL_ComboBox*>(m_pIface)->EditRedo(bsRecord); | 146 return static_cast<IFWL_ComboBox*>(m_pIface)->EditRedo(bsRecord); |
146 } | 147 } |
147 | 148 |
148 FX_BOOL CFWL_ComboBox::EditUndo(const CFX_ByteStringC& bsRecord) { | 149 FX_BOOL CFWL_ComboBox::EditUndo(const CFX_ByteStringC& bsRecord) { |
149 if (!m_pIface) | 150 if (!m_pIface) |
150 return FALSE; | 151 return FALSE; |
151 return static_cast<IFWL_ComboBox*>(m_pIface)->EditUndo(bsRecord); | 152 return static_cast<IFWL_ComboBox*>(m_pIface)->EditUndo(bsRecord); |
152 } | 153 } |
153 | 154 |
154 FWL_ERR CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) { | 155 FWL_Error CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) { |
155 m_comboBoxData.m_fMaxListHeight = fMaxHeight; | 156 m_comboBoxData.m_fMaxListHeight = fMaxHeight; |
156 return FWL_ERR_Succeeded; | 157 return FWL_Error::Succeeded; |
157 } | 158 } |
158 | 159 |
159 FWL_ERR CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) { | 160 FWL_Error CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) { |
160 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>( | 161 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>( |
161 m_comboBoxData.GetItem(m_pIface, iIndex)); | 162 m_comboBoxData.GetItem(m_pIface, iIndex)); |
162 if (!pItem) | 163 if (!pItem) |
163 return FWL_ERR_Indefinite; | 164 return FWL_Error::Indefinite; |
164 pItem->m_pData = pData; | 165 pItem->m_pData = pData; |
165 return FWL_ERR_Succeeded; | 166 return FWL_Error::Succeeded; |
166 } | 167 } |
167 | 168 |
168 void* CFWL_ComboBox::GetItemData(int32_t iIndex) { | 169 void* CFWL_ComboBox::GetItemData(int32_t iIndex) { |
169 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>( | 170 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>( |
170 m_comboBoxData.GetItem(m_pIface, iIndex)); | 171 m_comboBoxData.GetItem(m_pIface, iIndex)); |
171 if (!pItem) | 172 if (!pItem) |
172 return NULL; | 173 return NULL; |
173 return pItem->m_pData; | 174 return pItem->m_pData; |
174 } | 175 } |
175 | 176 |
176 FWL_ERR CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { | 177 FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { |
177 return static_cast<IFWL_ComboBox*>(m_pIface)->GetListBoxt()->SetThemeProvider( | 178 return static_cast<IFWL_ComboBox*>(m_pIface)->GetListBoxt()->SetThemeProvider( |
178 pTheme); | 179 pTheme); |
179 } | 180 } |
180 | 181 |
181 FX_BOOL CFWL_ComboBox::AfterFocusShowDropList() { | 182 FX_BOOL CFWL_ComboBox::AfterFocusShowDropList() { |
182 return static_cast<IFWL_ComboBox*>(m_pIface)->AfterFocusShowDropList(); | 183 return static_cast<IFWL_ComboBox*>(m_pIface)->AfterFocusShowDropList(); |
183 } | 184 } |
184 | 185 |
185 FWL_ERR CFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { | 186 FWL_Error CFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { |
186 return static_cast<IFWL_ComboBox*>(m_pIface)->OpenDropDownList(bActivate); | 187 return static_cast<IFWL_ComboBox*>(m_pIface)->OpenDropDownList(bActivate); |
187 } | 188 } |
188 | 189 |
189 FX_BOOL CFWL_ComboBox::EditCanUndo() { | 190 FX_BOOL CFWL_ComboBox::EditCanUndo() { |
190 if (!m_pIface) | 191 if (!m_pIface) |
191 return FALSE; | 192 return FALSE; |
192 return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanUndo(); | 193 return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanUndo(); |
193 } | 194 } |
194 | 195 |
195 FX_BOOL CFWL_ComboBox::EditCanRedo() { | 196 FX_BOOL CFWL_ComboBox::EditCanRedo() { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 return FALSE; | 258 return FALSE; |
258 return static_cast<IFWL_ComboBox*>(m_pIface)->EditDelete(); | 259 return static_cast<IFWL_ComboBox*>(m_pIface)->EditDelete(); |
259 } | 260 } |
260 | 261 |
261 FX_BOOL CFWL_ComboBox::EditDeSelect() { | 262 FX_BOOL CFWL_ComboBox::EditDeSelect() { |
262 if (!m_pIface) | 263 if (!m_pIface) |
263 return FALSE; | 264 return FALSE; |
264 return static_cast<IFWL_ComboBox*>(m_pIface)->EditDeSelect(); | 265 return static_cast<IFWL_ComboBox*>(m_pIface)->EditDeSelect(); |
265 } | 266 } |
266 | 267 |
267 FWL_ERR CFWL_ComboBox::GetBBox(CFX_RectF& rect) { | 268 FWL_Error CFWL_ComboBox::GetBBox(CFX_RectF& rect) { |
268 if (!m_pIface) | 269 if (!m_pIface) |
269 return FALSE; | 270 return FWL_Error::Indefinite; |
270 return static_cast<IFWL_ComboBox*>(m_pIface)->GetBBox(rect); | 271 return static_cast<IFWL_ComboBox*>(m_pIface)->GetBBox(rect); |
271 } | 272 } |
272 | 273 |
273 FWL_ERR CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, | 274 FWL_Error CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, |
274 uint32_t dwStylesExRemoved) { | 275 uint32_t dwStylesExRemoved) { |
275 if (!m_pIface) | 276 if (!m_pIface) |
276 return FALSE; | 277 return FWL_Error::Indefinite; |
277 return static_cast<IFWL_ComboBox*>(m_pIface) | 278 return static_cast<IFWL_ComboBox*>(m_pIface) |
278 ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 279 ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
279 } | 280 } |
280 | 281 |
281 CFWL_ComboBox::CFWL_ComboBox() {} | 282 CFWL_ComboBox::CFWL_ComboBox() {} |
282 | 283 |
283 CFWL_ComboBox::~CFWL_ComboBox() {} | 284 CFWL_ComboBox::~CFWL_ComboBox() {} |
284 | 285 |
285 CFWL_ComboBox::CFWL_ComboBoxDP::CFWL_ComboBoxDP() { | 286 CFWL_ComboBox::CFWL_ComboBoxDP::CFWL_ComboBoxDP() { |
286 m_fItemHeight = 0; | 287 m_fItemHeight = 0; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 return TRUE; | 322 return TRUE; |
322 } | 323 } |
323 | 324 |
324 uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemStyles(IFWL_Widget* pWidget, | 325 uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemStyles(IFWL_Widget* pWidget, |
325 FWL_HLISTITEM hItem) { | 326 FWL_HLISTITEM hItem) { |
326 if (!hItem) | 327 if (!hItem) |
327 return 0; | 328 return 0; |
328 return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles; | 329 return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles; |
329 } | 330 } |
330 | 331 |
331 FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemText(IFWL_Widget* pWidget, | 332 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemText(IFWL_Widget* pWidget, |
332 FWL_HLISTITEM hItem, | 333 FWL_HLISTITEM hItem, |
333 CFX_WideString& wsText) { | 334 CFX_WideString& wsText) { |
334 if (!hItem) | 335 if (!hItem) |
335 return FWL_ERR_Indefinite; | 336 return FWL_Error::Indefinite; |
336 wsText = reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_wsText; | 337 wsText = reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_wsText; |
337 return FWL_ERR_Succeeded; | 338 return FWL_Error::Succeeded; |
338 } | 339 } |
339 | 340 |
340 FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget, | 341 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget, |
341 FWL_HLISTITEM hItem, | 342 FWL_HLISTITEM hItem, |
342 CFX_RectF& rtItem) { | 343 CFX_RectF& rtItem) { |
343 if (!hItem) | 344 if (!hItem) |
344 return FWL_ERR_Indefinite; | 345 return FWL_Error::Indefinite; |
345 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); | 346 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); |
346 rtItem.Set(pItem->m_rtItem.left, pItem->m_rtItem.top, pItem->m_rtItem.width, | 347 rtItem.Set(pItem->m_rtItem.left, pItem->m_rtItem.top, pItem->m_rtItem.width, |
347 pItem->m_rtItem.height); | 348 pItem->m_rtItem.height); |
348 return FWL_ERR_Succeeded; | 349 return FWL_Error::Succeeded; |
349 } | 350 } |
350 | 351 |
351 void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget, | 352 void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget, |
352 FWL_HLISTITEM hItem) { | 353 FWL_HLISTITEM hItem) { |
353 if (!hItem) | 354 if (!hItem) |
354 return NULL; | 355 return NULL; |
355 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); | 356 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); |
356 return pItem->m_pData; | 357 return pItem->m_pData; |
357 } | 358 } |
358 | 359 |
359 FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget, | 360 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget, |
360 FWL_HLISTITEM hItem, | 361 FWL_HLISTITEM hItem, |
361 uint32_t dwStyle) { | 362 uint32_t dwStyle) { |
362 if (!hItem) | 363 if (!hItem) |
363 return FWL_ERR_Indefinite; | 364 return FWL_Error::Indefinite; |
364 reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles = dwStyle; | 365 reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles = dwStyle; |
365 return FWL_ERR_Succeeded; | 366 return FWL_Error::Succeeded; |
366 } | 367 } |
367 | 368 |
368 FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemText(IFWL_Widget* pWidget, | 369 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemText(IFWL_Widget* pWidget, |
369 FWL_HLISTITEM hItem, | 370 FWL_HLISTITEM hItem, |
370 const FX_WCHAR* pszText) { | 371 const FX_WCHAR* pszText) { |
371 if (!hItem) | 372 if (!hItem) |
372 return FWL_ERR_Indefinite; | 373 return FWL_Error::Indefinite; |
373 reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_wsText = pszText; | 374 reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_wsText = pszText; |
374 return FWL_ERR_Succeeded; | 375 return FWL_Error::Succeeded; |
375 } | 376 } |
376 | 377 |
377 FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemRect(IFWL_Widget* pWidget, | 378 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemRect(IFWL_Widget* pWidget, |
378 FWL_HLISTITEM hItem, | 379 FWL_HLISTITEM hItem, |
379 const CFX_RectF& rtItem) { | 380 const CFX_RectF& rtItem) { |
380 if (!hItem) | 381 if (!hItem) |
381 return FWL_ERR_Indefinite; | 382 return FWL_Error::Indefinite; |
382 reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_rtItem = rtItem; | 383 reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_rtItem = rtItem; |
383 return FWL_ERR_Succeeded; | 384 return FWL_Error::Succeeded; |
384 } | 385 } |
385 | 386 |
386 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) { | 387 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) { |
387 return m_fItemHeight; | 388 return m_fItemHeight; |
388 } | 389 } |
389 | 390 |
390 CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon(IFWL_Widget* pWidget, | 391 CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon(IFWL_Widget* pWidget, |
391 FWL_HLISTITEM hItem) { | 392 FWL_HLISTITEM hItem) { |
392 if (!hItem) | 393 if (!hItem) |
393 return NULL; | 394 return NULL; |
394 return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_pDIB; | 395 return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_pDIB; |
395 } | 396 } |
396 | 397 |
397 FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, | 398 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, |
398 FWL_HLISTITEM hItem, | 399 FWL_HLISTITEM hItem, |
399 CFX_RectF& rtCheck) { | 400 CFX_RectF& rtCheck) { |
400 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); | 401 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); |
401 rtCheck = pItem->m_rtCheckBox; | 402 rtCheck = pItem->m_rtCheckBox; |
402 return FWL_ERR_Succeeded; | 403 return FWL_Error::Succeeded; |
403 } | 404 } |
404 | 405 |
405 FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect( | 406 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect( |
406 IFWL_Widget* pWidget, | 407 IFWL_Widget* pWidget, |
407 FWL_HLISTITEM hItem, | 408 FWL_HLISTITEM hItem, |
408 const CFX_RectF& rtCheck) { | 409 const CFX_RectF& rtCheck) { |
409 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); | 410 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); |
410 pItem->m_rtCheckBox = rtCheck; | 411 pItem->m_rtCheckBox = rtCheck; |
411 return FWL_ERR_Succeeded; | 412 return FWL_Error::Succeeded; |
412 } | 413 } |
413 | 414 |
414 uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckState( | 415 uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckState( |
415 IFWL_Widget* pWidget, | 416 IFWL_Widget* pWidget, |
416 FWL_HLISTITEM hItem) { | 417 FWL_HLISTITEM hItem) { |
417 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); | 418 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); |
418 return pItem->m_dwCheckState; | 419 return pItem->m_dwCheckState; |
419 } | 420 } |
420 | 421 |
421 FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckState( | 422 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckState( |
422 IFWL_Widget* pWidget, | 423 IFWL_Widget* pWidget, |
423 FWL_HLISTITEM hItem, | 424 FWL_HLISTITEM hItem, |
424 uint32_t dwCheckState) { | 425 uint32_t dwCheckState) { |
425 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); | 426 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); |
426 pItem->m_dwCheckState = dwCheckState; | 427 pItem->m_dwCheckState = dwCheckState; |
427 return FWL_ERR_Succeeded; | 428 return FWL_Error::Succeeded; |
428 } | 429 } |
429 | 430 |
430 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) { | 431 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) { |
431 return m_fMaxListHeight; | 432 return m_fMaxListHeight; |
432 } | 433 } |
OLD | NEW |