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 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 static_cast<CFWL_ComboBoxItem*>(m_comboBoxData.GetItem(m_pIface, iIndex)); | 162 static_cast<CFWL_ComboBoxItem*>(m_comboBoxData.GetItem(m_pIface, iIndex)); |
163 if (!pItem) | 163 if (!pItem) |
164 return FWL_Error::Indefinite; | 164 return FWL_Error::Indefinite; |
165 pItem->m_pData = pData; | 165 pItem->m_pData = pData; |
166 return FWL_Error::Succeeded; | 166 return FWL_Error::Succeeded; |
167 } | 167 } |
168 | 168 |
169 void* CFWL_ComboBox::GetItemData(int32_t iIndex) { | 169 void* CFWL_ComboBox::GetItemData(int32_t iIndex) { |
170 CFWL_ComboBoxItem* pItem = | 170 CFWL_ComboBoxItem* pItem = |
171 static_cast<CFWL_ComboBoxItem*>(m_comboBoxData.GetItem(m_pIface, iIndex)); | 171 static_cast<CFWL_ComboBoxItem*>(m_comboBoxData.GetItem(m_pIface, iIndex)); |
172 if (!pItem) | 172 return pItem ? pItem->m_pData : nullptr; |
173 return NULL; | |
174 return pItem->m_pData; | |
175 } | 173 } |
176 | 174 |
177 FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { | 175 FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { |
178 return static_cast<IFWL_ComboBox*>(m_pIface)->GetListBoxt()->SetThemeProvider( | 176 return static_cast<IFWL_ComboBox*>(m_pIface)->GetListBoxt()->SetThemeProvider( |
179 pTheme); | 177 pTheme); |
180 } | 178 } |
181 | 179 |
182 FX_BOOL CFWL_ComboBox::AfterFocusShowDropList() { | 180 FX_BOOL CFWL_ComboBox::AfterFocusShowDropList() { |
183 return static_cast<IFWL_ComboBox*>(m_pIface)->AfterFocusShowDropList(); | 181 return static_cast<IFWL_ComboBox*>(m_pIface)->AfterFocusShowDropList(); |
184 } | 182 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 if (!pItem) | 348 if (!pItem) |
351 return FWL_Error::Indefinite; | 349 return FWL_Error::Indefinite; |
352 CFWL_ComboBoxItem* pComboItem = static_cast<CFWL_ComboBoxItem*>(pItem); | 350 CFWL_ComboBoxItem* pComboItem = static_cast<CFWL_ComboBoxItem*>(pItem); |
353 rtItem.Set(pComboItem->m_rtItem.left, pComboItem->m_rtItem.top, | 351 rtItem.Set(pComboItem->m_rtItem.left, pComboItem->m_rtItem.top, |
354 pComboItem->m_rtItem.width, pComboItem->m_rtItem.height); | 352 pComboItem->m_rtItem.width, pComboItem->m_rtItem.height); |
355 return FWL_Error::Succeeded; | 353 return FWL_Error::Succeeded; |
356 } | 354 } |
357 | 355 |
358 void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget, | 356 void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget, |
359 IFWL_ListItem* pItem) { | 357 IFWL_ListItem* pItem) { |
360 if (!pItem) | 358 return pItem ? static_cast<CFWL_ComboBoxItem*>(pItem)->m_pData : nullptr; |
361 return NULL; | |
362 return static_cast<CFWL_ComboBoxItem*>(pItem)->m_pData; | |
363 } | 359 } |
364 | 360 |
365 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget, | 361 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget, |
366 IFWL_ListItem* pItem, | 362 IFWL_ListItem* pItem, |
367 uint32_t dwStyle) { | 363 uint32_t dwStyle) { |
368 if (!pItem) | 364 if (!pItem) |
369 return FWL_Error::Indefinite; | 365 return FWL_Error::Indefinite; |
370 static_cast<CFWL_ComboBoxItem*>(pItem)->m_dwStyles = dwStyle; | 366 static_cast<CFWL_ComboBoxItem*>(pItem)->m_dwStyles = dwStyle; |
371 return FWL_Error::Succeeded; | 367 return FWL_Error::Succeeded; |
372 } | 368 } |
(...skipping 16 matching lines...) Expand all Loading... |
389 return FWL_Error::Succeeded; | 385 return FWL_Error::Succeeded; |
390 } | 386 } |
391 | 387 |
392 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) { | 388 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) { |
393 return m_fItemHeight; | 389 return m_fItemHeight; |
394 } | 390 } |
395 | 391 |
396 CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon( | 392 CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon( |
397 IFWL_Widget* pWidget, | 393 IFWL_Widget* pWidget, |
398 IFWL_ListItem* pItem) { | 394 IFWL_ListItem* pItem) { |
399 if (!pItem) | 395 return pItem ? static_cast<CFWL_ComboBoxItem*>(pItem)->m_pDIB : nullptr; |
400 return NULL; | |
401 return static_cast<CFWL_ComboBoxItem*>(pItem)->m_pDIB; | |
402 } | 396 } |
403 | 397 |
404 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, | 398 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, |
405 IFWL_ListItem* pItem, | 399 IFWL_ListItem* pItem, |
406 CFX_RectF& rtCheck) { | 400 CFX_RectF& rtCheck) { |
407 rtCheck = static_cast<CFWL_ComboBoxItem*>(pItem)->m_rtCheckBox; | 401 rtCheck = static_cast<CFWL_ComboBoxItem*>(pItem)->m_rtCheckBox; |
408 return FWL_Error::Succeeded; | 402 return FWL_Error::Succeeded; |
409 } | 403 } |
410 | 404 |
411 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect( | 405 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect( |
(...skipping 18 matching lines...) Expand all Loading... |
430 return FWL_Error::Succeeded; | 424 return FWL_Error::Succeeded; |
431 } | 425 } |
432 | 426 |
433 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) { | 427 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) { |
434 return m_fMaxListHeight; | 428 return m_fMaxListHeight; |
435 } | 429 } |
436 | 430 |
437 CFWL_ComboBoxItem::CFWL_ComboBoxItem() : m_pDIB(nullptr), m_pData(nullptr) {} | 431 CFWL_ComboBoxItem::CFWL_ComboBoxItem() : m_pDIB(nullptr), m_pData(nullptr) {} |
438 | 432 |
439 CFWL_ComboBoxItem::~CFWL_ComboBoxItem() {} | 433 CFWL_ComboBoxItem::~CFWL_ComboBoxItem() {} |
OLD | NEW |