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_combobox.h" | 7 #include "xfa/fwl/core/ifwl_combobox.h" |
8 | 8 |
9 #include "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
10 #include "xfa/fde/cfde_txtedtengine.h" | 10 #include "xfa/fde/cfde_txtedtengine.h" |
11 #include "xfa/fde/tto/fde_textout.h" | 11 #include "xfa/fde/tto/fde_textout.h" |
| 12 #include "xfa/fwl/core/cfwl_evtpostdropdown.h" |
| 13 #include "xfa/fwl/core/cfwl_evtpredropdown.h" |
12 #include "xfa/fwl/core/cfwl_evttextchanged.h" | 14 #include "xfa/fwl/core/cfwl_evttextchanged.h" |
13 #include "xfa/fwl/core/cfwl_msgkey.h" | 15 #include "xfa/fwl/core/cfwl_msgkey.h" |
14 #include "xfa/fwl/core/cfwl_msgkillfocus.h" | 16 #include "xfa/fwl/core/cfwl_msgkillfocus.h" |
15 #include "xfa/fwl/core/cfwl_msgmouse.h" | 17 #include "xfa/fwl/core/cfwl_msgmouse.h" |
16 #include "xfa/fwl/core/cfwl_msgsetfocus.h" | 18 #include "xfa/fwl/core/cfwl_msgsetfocus.h" |
17 #include "xfa/fwl/core/cfwl_themebackground.h" | 19 #include "xfa/fwl/core/cfwl_themebackground.h" |
18 #include "xfa/fwl/core/cfwl_themepart.h" | 20 #include "xfa/fwl/core/cfwl_themepart.h" |
19 #include "xfa/fwl/core/cfwl_themetext.h" | 21 #include "xfa/fwl/core/cfwl_themetext.h" |
20 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 22 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
21 #include "xfa/fwl/core/fwl_noteimp.h" | 23 #include "xfa/fwl/core/fwl_noteimp.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 m_rtList.top = m_fComboFormHandler; | 388 m_rtList.top = m_fComboFormHandler; |
387 } else { | 389 } else { |
388 m_rtHandler.Set(0, m_rtList.height, m_rtList.width, m_fComboFormHandler); | 390 m_rtHandler.Set(0, m_rtList.height, m_rtList.width, m_fComboFormHandler); |
389 } | 391 } |
390 } | 392 } |
391 m_pComboBoxProxy->SetWidgetRect(m_rtProxy); | 393 m_pComboBoxProxy->SetWidgetRect(m_rtProxy); |
392 m_pComboBoxProxy->Update(); | 394 m_pComboBoxProxy->Update(); |
393 m_pListBox->SetWidgetRect(m_rtList); | 395 m_pListBox->SetWidgetRect(m_rtList); |
394 m_pListBox->Update(); | 396 m_pListBox->Update(); |
395 | 397 |
396 CFWL_EvtCmbPreDropDown ev; | 398 CFWL_EvtPreDropDown ev; |
397 ev.m_pSrcTarget = this; | 399 ev.m_pSrcTarget = this; |
398 DispatchEvent(&ev); | 400 DispatchEvent(&ev); |
399 | 401 |
400 m_fItemHeight = m_pListBox->GetItemHeight(); | 402 m_fItemHeight = m_pListBox->GetItemHeight(); |
401 m_pListBox->SetFocus(true); | 403 m_pListBox->SetFocus(true); |
402 m_pComboBoxProxy->DoModal(); | 404 m_pComboBoxProxy->DoModal(); |
403 m_pListBox->SetFocus(false); | 405 m_pListBox->SetFocus(false); |
404 } | 406 } |
405 | 407 |
406 void IFWL_ComboBox::MatchEditText() { | 408 void IFWL_ComboBox::MatchEditText() { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 m_pEdit = | 612 m_pEdit = |
611 pdfium::MakeUnique<IFWL_ComboEdit>(m_pOwnerApp, std::move(prop), this); | 613 pdfium::MakeUnique<IFWL_ComboEdit>(m_pOwnerApp, std::move(prop), this); |
612 m_pEdit->SetOuter(this); | 614 m_pEdit->SetOuter(this); |
613 } | 615 } |
614 | 616 |
615 void IFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { | 617 void IFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { |
616 if (DisForm_IsDropListVisible() == bActivate) | 618 if (DisForm_IsDropListVisible() == bActivate) |
617 return; | 619 return; |
618 | 620 |
619 if (bActivate) { | 621 if (bActivate) { |
620 CFWL_EvtCmbPreDropDown preEvent; | 622 CFWL_EvtPreDropDown preEvent; |
621 preEvent.m_pSrcTarget = this; | 623 preEvent.m_pSrcTarget = this; |
622 DispatchEvent(&preEvent); | 624 DispatchEvent(&preEvent); |
623 | 625 |
624 IFWL_ComboList* pComboList = m_pListBox.get(); | 626 IFWL_ComboList* pComboList = m_pListBox.get(); |
625 int32_t iItems = pComboList->CountItems(); | 627 int32_t iItems = pComboList->CountItems(); |
626 if (iItems < 1) | 628 if (iItems < 1) |
627 return; | 629 return; |
628 | 630 |
629 ResetListItemAlignment(); | 631 ResetListItemAlignment(); |
630 pComboList->ChangeSelected(m_iCurSel); | 632 pComboList->ChangeSelected(m_iCurSel); |
(...skipping 13 matching lines...) Expand all Loading... |
644 GetPopupPos(fPopupMin, fPopupMax, m_pProperties->m_rtWidget, rtList); | 646 GetPopupPos(fPopupMin, fPopupMax, m_pProperties->m_rtWidget, rtList); |
645 | 647 |
646 m_pListBox->SetWidgetRect(rtList); | 648 m_pListBox->SetWidgetRect(rtList); |
647 m_pListBox->Update(); | 649 m_pListBox->Update(); |
648 } else { | 650 } else { |
649 SetFocus(true); | 651 SetFocus(true); |
650 } | 652 } |
651 | 653 |
652 m_pListBox->SetStates(FWL_WGTSTATE_Invisible, !bActivate); | 654 m_pListBox->SetStates(FWL_WGTSTATE_Invisible, !bActivate); |
653 if (bActivate) { | 655 if (bActivate) { |
654 CFWL_EvtCmbPostDropDown postEvent; | 656 CFWL_EvtPostDropDown postEvent; |
655 postEvent.m_pSrcTarget = this; | 657 postEvent.m_pSrcTarget = this; |
656 DispatchEvent(&postEvent); | 658 DispatchEvent(&postEvent); |
657 } | 659 } |
658 | 660 |
659 CFX_RectF rect; | 661 CFX_RectF rect; |
660 m_pListBox->GetWidgetRect(rect); | 662 m_pListBox->GetWidgetRect(rect); |
661 rect.Inflate(2, 2); | 663 rect.Inflate(2, 2); |
662 Repaint(&rect); | 664 Repaint(&rect); |
663 } | 665 } |
664 | 666 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 else | 1141 else |
1140 iCurSel++; | 1142 iCurSel++; |
1141 } | 1143 } |
1142 m_iCurSel = iCurSel; | 1144 m_iCurSel = iCurSel; |
1143 SyncEditText(m_iCurSel); | 1145 SyncEditText(m_iCurSel); |
1144 return; | 1146 return; |
1145 } | 1147 } |
1146 if (m_pEdit) | 1148 if (m_pEdit) |
1147 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); | 1149 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); |
1148 } | 1150 } |
OLD | NEW |