| 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/core/ifwl_listbox.h" | 7 #include "xfa/fwl/core/ifwl_listbox.h" |
| 8 | 8 |
| 9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
| 10 #include "xfa/fwl/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
| 11 #include "xfa/fwl/core/cfwl_themebackground.h" | 11 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 12 #include "xfa/fwl/core/cfwl_themepart.h" | 12 #include "xfa/fwl/core/cfwl_themepart.h" |
| 13 #include "xfa/fwl/core/cfwl_themetext.h" | 13 #include "xfa/fwl/core/cfwl_themetext.h" |
| 14 #include "xfa/fwl/core/ifwl_app.h" | 14 #include "xfa/fwl/core/ifwl_app.h" |
| 15 #include "xfa/fwl/core/ifwl_themeprovider.h" | 15 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 const int kItemTextMargin = 2; | 19 const int kItemTextMargin = 2; |
| 20 | 20 |
| 21 } // namespace | 21 } // namespace |
| 22 | 22 |
| 23 // static | |
| 24 IFWL_ListBox* IFWL_ListBox::Create(const CFWL_WidgetImpProperties& properties, | |
| 25 IFWL_Widget* pOuter) { | |
| 26 return new IFWL_ListBox(properties, pOuter); | |
| 27 } | |
| 28 | |
| 29 IFWL_ListBox::IFWL_ListBox(const CFWL_WidgetImpProperties& properties, | 23 IFWL_ListBox::IFWL_ListBox(const CFWL_WidgetImpProperties& properties, |
| 30 IFWL_Widget* pOuter) | 24 IFWL_Widget* pOuter) |
| 31 : IFWL_Widget(properties, pOuter), | 25 : IFWL_Widget(properties, pOuter), |
| 32 m_dwTTOStyles(0), | 26 m_dwTTOStyles(0), |
| 33 m_iTTOAligns(0), | 27 m_iTTOAligns(0), |
| 34 m_hAnchor(nullptr), | 28 m_hAnchor(nullptr), |
| 35 m_fScorllBarWidth(0), | 29 m_fScorllBarWidth(0), |
| 36 m_bLButtonDown(FALSE), | 30 m_bLButtonDown(FALSE), |
| 37 m_pScrollBarTP(nullptr) { | 31 m_pScrollBarTP(nullptr) { |
| 38 m_rtClient.Reset(); | 32 m_rtClient.Reset(); |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 | 899 |
| 906 void IFWL_ListBox::InitScrollBar(FX_BOOL bVert) { | 900 void IFWL_ListBox::InitScrollBar(FX_BOOL bVert) { |
| 907 if ((bVert && m_pVertScrollBar) || (!bVert && m_pHorzScrollBar)) { | 901 if ((bVert && m_pVertScrollBar) || (!bVert && m_pHorzScrollBar)) { |
| 908 return; | 902 return; |
| 909 } | 903 } |
| 910 CFWL_WidgetImpProperties prop; | 904 CFWL_WidgetImpProperties prop; |
| 911 prop.m_dwStyleExes = bVert ? FWL_STYLEEXT_SCB_Vert : FWL_STYLEEXT_SCB_Horz; | 905 prop.m_dwStyleExes = bVert ? FWL_STYLEEXT_SCB_Vert : FWL_STYLEEXT_SCB_Horz; |
| 912 prop.m_dwStates = FWL_WGTSTATE_Invisible; | 906 prop.m_dwStates = FWL_WGTSTATE_Invisible; |
| 913 prop.m_pParent = this; | 907 prop.m_pParent = this; |
| 914 prop.m_pThemeProvider = m_pScrollBarTP; | 908 prop.m_pThemeProvider = m_pScrollBarTP; |
| 915 IFWL_ScrollBar* pScrollBar = IFWL_ScrollBar::Create(prop, this); | 909 IFWL_ScrollBar* pScrollBar = new IFWL_ScrollBar(prop, this); |
| 916 pScrollBar->Initialize(); | 910 pScrollBar->Initialize(); |
| 917 (bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar); | 911 (bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar); |
| 918 } | 912 } |
| 919 | 913 |
| 920 FX_BOOL IFWL_ListBox::IsShowScrollBar(FX_BOOL bVert) { | 914 FX_BOOL IFWL_ListBox::IsShowScrollBar(FX_BOOL bVert) { |
| 921 IFWL_ScrollBar* pScrollbar = | 915 IFWL_ScrollBar* pScrollbar = |
| 922 bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get(); | 916 bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get(); |
| 923 if (!pScrollbar || (pScrollbar->GetStates() & FWL_WGTSTATE_Invisible)) { | 917 if (!pScrollbar || (pScrollbar->GetStates() & FWL_WGTSTATE_Invisible)) { |
| 924 return FALSE; | 918 return FALSE; |
| 925 } | 919 } |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 m_pOwner->Repaint(&m_pOwner->m_rtClient); | 1203 m_pOwner->Repaint(&m_pOwner->m_rtClient); |
| 1210 } | 1204 } |
| 1211 return TRUE; | 1205 return TRUE; |
| 1212 } | 1206 } |
| 1213 | 1207 |
| 1214 void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() { | 1208 void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() { |
| 1215 CFWL_EvtLtbSelChanged ev; | 1209 CFWL_EvtLtbSelChanged ev; |
| 1216 ev.m_pSrcTarget = m_pOwner; | 1210 ev.m_pSrcTarget = m_pOwner; |
| 1217 m_pOwner->DispatchEvent(&ev); | 1211 m_pOwner->DispatchEvent(&ev); |
| 1218 } | 1212 } |
| OLD | NEW |