OLD | NEW |
---|---|
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_combolist.h" | 7 #include "xfa/fwl/core/ifwl_combolist.h" |
8 | 8 |
9 #include "xfa/fwl/core/ifwl_combobox.h" | 9 #include "xfa/fwl/core/ifwl_combobox.h" |
10 #include "xfa/fwl/core/ifwl_comboedit.h" | 10 #include "xfa/fwl/core/ifwl_comboedit.h" |
11 | 11 |
12 IFWL_ComboList::IFWL_ComboList(const CFWL_WidgetImpProperties& properties, | 12 IFWL_ComboList::IFWL_ComboList(const IFWL_App* app, |
13 const CFWL_WidgetImpProperties& properties, | |
13 IFWL_Widget* pOuter) | 14 IFWL_Widget* pOuter) |
14 : IFWL_ListBox(properties, pOuter), m_bNotifyOwner(TRUE) { | 15 : IFWL_ListBox(app, properties, pOuter), m_bNotifyOwner(TRUE) { |
15 ASSERT(pOuter); | 16 ASSERT(pOuter); |
16 } | 17 } |
17 | 18 |
18 FWL_Error IFWL_ComboList::Initialize() { | 19 void IFWL_ComboList::Initialize() { |
19 if (IFWL_ListBox::Initialize() != FWL_Error::Succeeded) | 20 IFWL_ListBox::Initialize(); |
20 return FWL_Error::Indefinite; | 21 |
22 // Delete the delegate that was created by IFWL_ListBox::Initialize ... | |
21 delete m_pDelegate; | 23 delete m_pDelegate; |
22 m_pDelegate = new CFWL_ComboListImpDelegate(this); | 24 m_pDelegate = new CFWL_ComboListImpDelegate(this); |
Tom Sepez
2016/10/28 23:11:47
nit: maybe m_pDelegate should be unique_ptr. Also
dsinclair
2016/10/31 14:13:18
Ack. I'm working on that, will be in a follow up C
| |
23 return FWL_Error::Succeeded; | |
24 } | 25 } |
25 | 26 |
26 void IFWL_ComboList::Finalize() { | 27 void IFWL_ComboList::Finalize() { |
27 delete m_pDelegate; | 28 delete m_pDelegate; |
28 m_pDelegate = nullptr; | 29 m_pDelegate = nullptr; |
Tom Sepez
2016/10/28 23:11:47
nit. e.g. SetDelegate(nullptr);
dsinclair
2016/10/31 14:13:18
Acknowledged.
| |
29 IFWL_ListBox::Finalize(); | 30 IFWL_ListBox::Finalize(); |
30 } | 31 } |
31 | 32 |
32 int32_t IFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) { | 33 int32_t IFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) { |
33 if (wsMatch.IsEmpty()) { | 34 if (wsMatch.IsEmpty()) { |
34 return -1; | 35 return -1; |
35 } | 36 } |
36 if (!m_pProperties->m_pDataProvider) | 37 if (!m_pProperties->m_pDataProvider) |
37 return -1; | 38 return -1; |
38 IFWL_ListBoxDP* pData = | 39 IFWL_ListBoxDP* pData = |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 CFX_RectF rtInvalidate; | 283 CFX_RectF rtInvalidate; |
283 rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width, | 284 rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width, |
284 m_pOwner->m_pProperties->m_rtWidget.height); | 285 m_pOwner->m_pProperties->m_rtWidget.height); |
285 m_pOwner->Repaint(&rtInvalidate); | 286 m_pOwner->Repaint(&rtInvalidate); |
286 break; | 287 break; |
287 } | 288 } |
288 default: | 289 default: |
289 break; | 290 break; |
290 } | 291 } |
291 } | 292 } |
OLD | NEW |