| 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/basewidget/fwl_listboximp.h" | 7 #include "xfa/fwl/basewidget/fwl_listboximp.h" |
| 8 | 8 |
| 9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
| 10 #include "xfa/fwl/basewidget/fwl_comboboximp.h" | 10 #include "xfa/fwl/basewidget/fwl_comboboximp.h" |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 GetThemeCapacity(CFWL_WidgetCapacity::UIMargin)); | 721 GetThemeCapacity(CFWL_WidgetCapacity::UIMargin)); |
| 722 if (pUIMargin) { | 722 if (pUIMargin) { |
| 723 m_rtConent.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, | 723 m_rtConent.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, |
| 724 pUIMargin->height); | 724 pUIMargin->height); |
| 725 } | 725 } |
| 726 } | 726 } |
| 727 FX_FLOAT fWidth = 0; | 727 FX_FLOAT fWidth = 0; |
| 728 if (m_pProperties->m_pThemeProvider->IsCustomizedLayout(m_pInterface)) { | 728 if (m_pProperties->m_pThemeProvider->IsCustomizedLayout(m_pInterface)) { |
| 729 IFWL_ListBoxDP* pData = | 729 IFWL_ListBoxDP* pData = |
| 730 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); | 730 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); |
| 731 if (!bAutoSize) { | |
| 732 } | |
| 733 int32_t iCount = pData->CountItems(m_pInterface); | 731 int32_t iCount = pData->CountItems(m_pInterface); |
| 734 for (int32_t i = 0; i < iCount; i++) { | 732 for (int32_t i = 0; i < iCount; i++) { |
| 735 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i); | 733 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i); |
| 736 CFWL_ThemePart itemPart; | 734 CFWL_ThemePart itemPart; |
| 737 itemPart.m_pWidget = m_pInterface; | 735 itemPart.m_pWidget = m_pInterface; |
| 738 itemPart.m_iPart = CFWL_Part::ListItem; | 736 itemPart.m_iPart = CFWL_Part::ListItem; |
| 739 itemPart.m_pData = m_pProperties->m_pDataProvider; | 737 itemPart.m_pData = m_pProperties->m_pDataProvider; |
| 740 itemPart.m_bMaximize = i > 0; | 738 itemPart.m_bMaximize = i > 0; |
| 741 CFX_RectF r; | 739 CFX_RectF r; |
| 742 m_pProperties->m_pThemeProvider->GetPartRect(&itemPart, r); | 740 m_pProperties->m_pThemeProvider->GetPartRect(&itemPart, r); |
| 743 if (!bAutoSize) { | 741 if (!bAutoSize) { |
| 744 CFX_RectF rtItem; | 742 CFX_RectF rtItem; |
| 745 rtItem.Set(m_rtClient.left, m_rtClient.top + fs.y, r.width, r.height); | 743 rtItem.Set(m_rtClient.left, m_rtClient.top + fs.y, r.width, r.height); |
| 746 IFWL_ListBoxDP* pData = | 744 IFWL_ListBoxDP* pBox = |
| 747 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); | 745 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); |
| 748 pData->SetItemRect(m_pInterface, hItem, rtItem); | 746 pBox->SetItemRect(m_pInterface, hItem, rtItem); |
| 749 } | 747 } |
| 750 fs.y += r.height; | 748 fs.y += r.height; |
| 751 if (fs.x < r.width) { | 749 if (fs.x < r.width) { |
| 752 fs.x = r.width; | 750 fs.x = r.width; |
| 753 fWidth = r.width; | 751 fWidth = r.width; |
| 754 } | 752 } |
| 755 } | 753 } |
| 756 } else { | 754 } else { |
| 757 fWidth = GetMaxTextWidth(); | 755 fWidth = GetMaxTextWidth(); |
| 758 fWidth += 2 * kItemTextMargin; | 756 fWidth += 2 * kItemTextMargin; |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 pScrollBar->SetTrackPos(fPos); | 1224 pScrollBar->SetTrackPos(fPos); |
| 1227 m_pOwner->Repaint(&m_pOwner->m_rtClient); | 1225 m_pOwner->Repaint(&m_pOwner->m_rtClient); |
| 1228 } | 1226 } |
| 1229 return TRUE; | 1227 return TRUE; |
| 1230 } | 1228 } |
| 1231 void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() { | 1229 void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() { |
| 1232 CFWL_EvtLtbSelChanged ev; | 1230 CFWL_EvtLtbSelChanged ev; |
| 1233 ev.m_pSrcTarget = m_pOwner->m_pInterface; | 1231 ev.m_pSrcTarget = m_pOwner->m_pInterface; |
| 1234 m_pOwner->DispatchEvent(&ev); | 1232 m_pOwner->DispatchEvent(&ev); |
| 1235 } | 1233 } |
| OLD | NEW |