| 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/cfwl_combobox.h" | 7 #include "xfa/fwl/core/cfwl_combobox.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "third_party/base/ptr_util.h" | 13 #include "third_party/base/ptr_util.h" |
| 14 #include "xfa/fde/cfde_txtedtengine.h" | 14 #include "xfa/fde/cfde_txtedtengine.h" |
| 15 #include "xfa/fde/tto/fde_textout.h" | 15 #include "xfa/fde/tto/fde_textout.h" |
| 16 #include "xfa/fwl/core/cfwl_app.h" | 16 #include "xfa/fwl/core/cfwl_app.h" |
| 17 #include "xfa/fwl/core/cfwl_evteditchanged.h" | 17 #include "xfa/fwl/core/cfwl_event.h" |
| 18 #include "xfa/fwl/core/cfwl_evtpostdropdown.h" | |
| 19 #include "xfa/fwl/core/cfwl_evtpredropdown.h" | |
| 20 #include "xfa/fwl/core/cfwl_evtselectchanged.h" | 18 #include "xfa/fwl/core/cfwl_evtselectchanged.h" |
| 21 #include "xfa/fwl/core/cfwl_evttextchanged.h" | 19 #include "xfa/fwl/core/cfwl_evttextchanged.h" |
| 22 #include "xfa/fwl/core/cfwl_formproxy.h" | 20 #include "xfa/fwl/core/cfwl_formproxy.h" |
| 23 #include "xfa/fwl/core/cfwl_listbox.h" | 21 #include "xfa/fwl/core/cfwl_listbox.h" |
| 24 #include "xfa/fwl/core/cfwl_msgkey.h" | 22 #include "xfa/fwl/core/cfwl_msgkey.h" |
| 25 #include "xfa/fwl/core/cfwl_msgkillfocus.h" | 23 #include "xfa/fwl/core/cfwl_msgkillfocus.h" |
| 26 #include "xfa/fwl/core/cfwl_msgmouse.h" | 24 #include "xfa/fwl/core/cfwl_msgmouse.h" |
| 27 #include "xfa/fwl/core/cfwl_msgsetfocus.h" | 25 #include "xfa/fwl/core/cfwl_msgsetfocus.h" |
| 28 #include "xfa/fwl/core/cfwl_notedriver.h" | 26 #include "xfa/fwl/core/cfwl_notedriver.h" |
| 29 #include "xfa/fwl/core/cfwl_themebackground.h" | 27 #include "xfa/fwl/core/cfwl_themebackground.h" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 m_rtList.top = m_fComboFormHandler; | 390 m_rtList.top = m_fComboFormHandler; |
| 393 } else { | 391 } else { |
| 394 m_rtHandler.Set(0, m_rtList.height, m_rtList.width, m_fComboFormHandler); | 392 m_rtHandler.Set(0, m_rtList.height, m_rtList.width, m_fComboFormHandler); |
| 395 } | 393 } |
| 396 } | 394 } |
| 397 m_pComboBoxProxy->SetWidgetRect(m_rtProxy); | 395 m_pComboBoxProxy->SetWidgetRect(m_rtProxy); |
| 398 m_pComboBoxProxy->Update(); | 396 m_pComboBoxProxy->Update(); |
| 399 m_pListBox->SetWidgetRect(m_rtList); | 397 m_pListBox->SetWidgetRect(m_rtList); |
| 400 m_pListBox->Update(); | 398 m_pListBox->Update(); |
| 401 | 399 |
| 402 CFWL_EvtPreDropDown ev; | 400 CFWL_Event ev(CFWL_Event::Type::PreDropDown, this); |
| 403 ev.m_pSrcTarget = this; | |
| 404 DispatchEvent(&ev); | 401 DispatchEvent(&ev); |
| 405 | 402 |
| 406 m_fItemHeight = m_pListBox->GetItemHeight(); | 403 m_fItemHeight = m_pListBox->GetItemHeight(); |
| 407 m_pListBox->SetFocus(true); | 404 m_pListBox->SetFocus(true); |
| 408 m_pComboBoxProxy->DoModal(); | 405 m_pComboBoxProxy->DoModal(); |
| 409 m_pListBox->SetFocus(false); | 406 m_pListBox->SetFocus(false); |
| 410 } | 407 } |
| 411 | 408 |
| 412 void CFWL_ComboBox::MatchEditText() { | 409 void CFWL_ComboBox::MatchEditText() { |
| 413 CFX_WideString wsText = m_pEdit->GetText(); | 410 CFX_WideString wsText = m_pEdit->GetText(); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 if (!hItem) | 543 if (!hItem) |
| 547 return; | 544 return; |
| 548 | 545 |
| 549 CFX_WideString wsText = m_pListBox->GetItemText(this, hItem); | 546 CFX_WideString wsText = m_pListBox->GetItemText(this, hItem); |
| 550 if (m_pEdit) { | 547 if (m_pEdit) { |
| 551 m_pEdit->SetText(wsText); | 548 m_pEdit->SetText(wsText); |
| 552 m_pEdit->Update(); | 549 m_pEdit->Update(); |
| 553 m_pEdit->SetSelected(); | 550 m_pEdit->SetSelected(); |
| 554 } | 551 } |
| 555 | 552 |
| 556 CFWL_EvtSelectChanged ev; | 553 CFWL_EvtSelectChanged ev(this); |
| 557 ev.bLButtonUp = bLButtonUp; | 554 ev.bLButtonUp = bLButtonUp; |
| 558 ev.m_pSrcTarget = this; | |
| 559 DispatchEvent(&ev); | 555 DispatchEvent(&ev); |
| 560 } | 556 } |
| 561 | 557 |
| 562 void CFWL_ComboBox::InitProxyForm() { | 558 void CFWL_ComboBox::InitProxyForm() { |
| 563 if (m_pComboBoxProxy) | 559 if (m_pComboBoxProxy) |
| 564 return; | 560 return; |
| 565 if (!m_pListBox) | 561 if (!m_pListBox) |
| 566 return; | 562 return; |
| 567 | 563 |
| 568 auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(); | 564 auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 m_pEdit = | 597 m_pEdit = |
| 602 pdfium::MakeUnique<CFWL_ComboEdit>(m_pOwnerApp, std::move(prop), this); | 598 pdfium::MakeUnique<CFWL_ComboEdit>(m_pOwnerApp, std::move(prop), this); |
| 603 m_pEdit->SetOuter(this); | 599 m_pEdit->SetOuter(this); |
| 604 } | 600 } |
| 605 | 601 |
| 606 void CFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { | 602 void CFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { |
| 607 if (DisForm_IsDropListVisible() == bActivate) | 603 if (DisForm_IsDropListVisible() == bActivate) |
| 608 return; | 604 return; |
| 609 | 605 |
| 610 if (bActivate) { | 606 if (bActivate) { |
| 611 CFWL_EvtPreDropDown preEvent; | 607 CFWL_Event preEvent(CFWL_Event::Type::PreDropDown, this); |
| 612 preEvent.m_pSrcTarget = this; | |
| 613 DispatchEvent(&preEvent); | 608 DispatchEvent(&preEvent); |
| 614 | 609 |
| 615 CFWL_ComboList* pComboList = m_pListBox.get(); | 610 CFWL_ComboList* pComboList = m_pListBox.get(); |
| 616 int32_t iItems = pComboList->CountItems(nullptr); | 611 int32_t iItems = pComboList->CountItems(nullptr); |
| 617 if (iItems < 1) | 612 if (iItems < 1) |
| 618 return; | 613 return; |
| 619 | 614 |
| 620 ResetListItemAlignment(); | 615 ResetListItemAlignment(); |
| 621 pComboList->ChangeSelected(m_iCurSel); | 616 pComboList->ChangeSelected(m_iCurSel); |
| 622 | 617 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 635 GetPopupPos(fPopupMin, fPopupMax, m_pProperties->m_rtWidget, rtList); | 630 GetPopupPos(fPopupMin, fPopupMax, m_pProperties->m_rtWidget, rtList); |
| 636 | 631 |
| 637 m_pListBox->SetWidgetRect(rtList); | 632 m_pListBox->SetWidgetRect(rtList); |
| 638 m_pListBox->Update(); | 633 m_pListBox->Update(); |
| 639 } else { | 634 } else { |
| 640 SetFocus(true); | 635 SetFocus(true); |
| 641 } | 636 } |
| 642 | 637 |
| 643 m_pListBox->SetStates(FWL_WGTSTATE_Invisible, !bActivate); | 638 m_pListBox->SetStates(FWL_WGTSTATE_Invisible, !bActivate); |
| 644 if (bActivate) { | 639 if (bActivate) { |
| 645 CFWL_EvtPostDropDown postEvent; | 640 CFWL_Event postEvent(CFWL_Event::Type::PostDropDown, this); |
| 646 postEvent.m_pSrcTarget = this; | |
| 647 DispatchEvent(&postEvent); | 641 DispatchEvent(&postEvent); |
| 648 } | 642 } |
| 649 | 643 |
| 650 CFX_RectF rect; | 644 CFX_RectF rect; |
| 651 m_pListBox->GetWidgetRect(rect); | 645 m_pListBox->GetWidgetRect(rect); |
| 652 rect.Inflate(2, 2); | 646 rect.Inflate(2, 2); |
| 653 Repaint(&rect); | 647 Repaint(&rect); |
| 654 } | 648 } |
| 655 | 649 |
| 656 void CFWL_ComboBox::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, | 650 void CFWL_ComboBox::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 } | 781 } |
| 788 | 782 |
| 789 void CFWL_ComboBox::OnProcessMessage(CFWL_Message* pMessage) { | 783 void CFWL_ComboBox::OnProcessMessage(CFWL_Message* pMessage) { |
| 790 if (m_pWidgetMgr->IsFormDisabled()) { | 784 if (m_pWidgetMgr->IsFormDisabled()) { |
| 791 DisForm_OnProcessMessage(pMessage); | 785 DisForm_OnProcessMessage(pMessage); |
| 792 return; | 786 return; |
| 793 } | 787 } |
| 794 if (!pMessage) | 788 if (!pMessage) |
| 795 return; | 789 return; |
| 796 | 790 |
| 797 switch (pMessage->GetClassID()) { | 791 switch (pMessage->GetType()) { |
| 798 case CFWL_MessageType::SetFocus: | 792 case CFWL_Message::Type::SetFocus: |
| 799 OnFocusChanged(pMessage, true); | 793 OnFocusChanged(pMessage, true); |
| 800 break; | 794 break; |
| 801 case CFWL_MessageType::KillFocus: | 795 case CFWL_Message::Type::KillFocus: |
| 802 OnFocusChanged(pMessage, false); | 796 OnFocusChanged(pMessage, false); |
| 803 break; | 797 break; |
| 804 case CFWL_MessageType::Mouse: { | 798 case CFWL_Message::Type::Mouse: { |
| 805 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 799 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 806 switch (pMsg->m_dwCmd) { | 800 switch (pMsg->m_dwCmd) { |
| 807 case FWL_MouseCommand::LeftButtonDown: | 801 case FWL_MouseCommand::LeftButtonDown: |
| 808 OnLButtonDown(pMsg); | 802 OnLButtonDown(pMsg); |
| 809 break; | 803 break; |
| 810 case FWL_MouseCommand::LeftButtonUp: | 804 case FWL_MouseCommand::LeftButtonUp: |
| 811 OnLButtonUp(pMsg); | 805 OnLButtonUp(pMsg); |
| 812 break; | 806 break; |
| 813 case FWL_MouseCommand::Move: | 807 case FWL_MouseCommand::Move: |
| 814 OnMouseMove(pMsg); | 808 OnMouseMove(pMsg); |
| 815 break; | 809 break; |
| 816 case FWL_MouseCommand::Leave: | 810 case FWL_MouseCommand::Leave: |
| 817 OnMouseLeave(pMsg); | 811 OnMouseLeave(pMsg); |
| 818 break; | 812 break; |
| 819 default: | 813 default: |
| 820 break; | 814 break; |
| 821 } | 815 } |
| 822 break; | 816 break; |
| 823 } | 817 } |
| 824 case CFWL_MessageType::Key: | 818 case CFWL_Message::Type::Key: |
| 825 OnKey(static_cast<CFWL_MsgKey*>(pMessage)); | 819 OnKey(static_cast<CFWL_MsgKey*>(pMessage)); |
| 826 break; | 820 break; |
| 827 default: | 821 default: |
| 828 break; | 822 break; |
| 829 } | 823 } |
| 830 | 824 |
| 831 CFWL_Widget::OnProcessMessage(pMessage); | 825 CFWL_Widget::OnProcessMessage(pMessage); |
| 832 } | 826 } |
| 833 | 827 |
| 834 void CFWL_ComboBox::OnProcessEvent(CFWL_Event* pEvent) { | 828 void CFWL_ComboBox::OnProcessEvent(CFWL_Event* pEvent) { |
| 835 CFWL_EventType dwFlag = pEvent->GetClassID(); | 829 CFWL_Event::Type type = pEvent->GetType(); |
| 836 if (dwFlag == CFWL_EventType::Scroll) { | 830 if (type == CFWL_Event::Type::Scroll) { |
| 837 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); | 831 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); |
| 838 CFWL_EvtScroll pScrollEv; | 832 CFWL_EvtScroll pScrollEv(this); |
| 839 pScrollEv.m_pSrcTarget = this; | |
| 840 pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode; | 833 pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode; |
| 841 pScrollEv.m_fPos = pScrollEvent->m_fPos; | 834 pScrollEv.m_fPos = pScrollEvent->m_fPos; |
| 842 DispatchEvent(&pScrollEv); | 835 DispatchEvent(&pScrollEv); |
| 843 } else if (dwFlag == CFWL_EventType::TextChanged) { | 836 } else if (type == CFWL_Event::Type::TextChanged) { |
| 844 CFWL_EvtEditChanged pTemp; | 837 CFWL_Event pTemp(CFWL_Event::Type::EditChanged, this); |
| 845 pTemp.m_pSrcTarget = this; | |
| 846 DispatchEvent(&pTemp); | 838 DispatchEvent(&pTemp); |
| 847 } | 839 } |
| 848 } | 840 } |
| 849 | 841 |
| 850 void CFWL_ComboBox::OnDrawWidget(CFX_Graphics* pGraphics, | 842 void CFWL_ComboBox::OnDrawWidget(CFX_Graphics* pGraphics, |
| 851 const CFX_Matrix* pMatrix) { | 843 const CFX_Matrix* pMatrix) { |
| 852 DrawWidget(pGraphics, pMatrix); | 844 DrawWidget(pGraphics, pMatrix); |
| 853 } | 845 } |
| 854 | 846 |
| 855 void CFWL_ComboBox::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { | 847 void CFWL_ComboBox::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 if (!IsDropListVisible() && | 919 if (!IsDropListVisible() && |
| 928 !((m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == | 920 !((m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == |
| 929 FWL_WGTSTATE_Disabled)) { | 921 FWL_WGTSTATE_Disabled)) { |
| 930 m_iBtnState = CFWL_PartState_Normal; | 922 m_iBtnState = CFWL_PartState_Normal; |
| 931 Repaint(&m_rtBtn); | 923 Repaint(&m_rtBtn); |
| 932 } | 924 } |
| 933 } | 925 } |
| 934 | 926 |
| 935 void CFWL_ComboBox::OnKey(CFWL_MsgKey* pMsg) { | 927 void CFWL_ComboBox::OnKey(CFWL_MsgKey* pMsg) { |
| 936 uint32_t dwKeyCode = pMsg->m_dwKeyCode; | 928 uint32_t dwKeyCode = pMsg->m_dwKeyCode; |
| 937 if (dwKeyCode == FWL_VKEY_Tab) { | 929 if (dwKeyCode == FWL_VKEY_Tab) |
| 938 DispatchKeyEvent(pMsg); | |
| 939 return; | 930 return; |
| 940 } | |
| 941 if (pMsg->m_pDstTarget == this) | 931 if (pMsg->m_pDstTarget == this) |
| 942 DoSubCtrlKey(pMsg); | 932 DoSubCtrlKey(pMsg); |
| 943 } | 933 } |
| 944 | 934 |
| 945 void CFWL_ComboBox::DoSubCtrlKey(CFWL_MsgKey* pMsg) { | 935 void CFWL_ComboBox::DoSubCtrlKey(CFWL_MsgKey* pMsg) { |
| 946 uint32_t dwKeyCode = pMsg->m_dwKeyCode; | 936 uint32_t dwKeyCode = pMsg->m_dwKeyCode; |
| 947 const bool bUp = dwKeyCode == FWL_VKEY_Up; | 937 const bool bUp = dwKeyCode == FWL_VKEY_Up; |
| 948 const bool bDown = dwKeyCode == FWL_VKEY_Down; | 938 const bool bDown = dwKeyCode == FWL_VKEY_Down; |
| 949 if (bUp || bDown) { | 939 if (bUp || bDown) { |
| 950 int32_t iCount = m_pListBox->CountItems(nullptr); | 940 int32_t iCount = m_pListBox->CountItems(nullptr); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 | 973 |
| 984 if (IsDropDownStyle()) | 974 if (IsDropDownStyle()) |
| 985 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); | 975 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); |
| 986 } | 976 } |
| 987 | 977 |
| 988 void CFWL_ComboBox::DisForm_OnProcessMessage(CFWL_Message* pMessage) { | 978 void CFWL_ComboBox::DisForm_OnProcessMessage(CFWL_Message* pMessage) { |
| 989 if (!pMessage) | 979 if (!pMessage) |
| 990 return; | 980 return; |
| 991 | 981 |
| 992 bool backDefault = true; | 982 bool backDefault = true; |
| 993 switch (pMessage->GetClassID()) { | 983 switch (pMessage->GetType()) { |
| 994 case CFWL_MessageType::SetFocus: { | 984 case CFWL_Message::Type::SetFocus: { |
| 995 backDefault = false; | 985 backDefault = false; |
| 996 DisForm_OnFocusChanged(pMessage, true); | 986 DisForm_OnFocusChanged(pMessage, true); |
| 997 break; | 987 break; |
| 998 } | 988 } |
| 999 case CFWL_MessageType::KillFocus: { | 989 case CFWL_Message::Type::KillFocus: { |
| 1000 backDefault = false; | 990 backDefault = false; |
| 1001 DisForm_OnFocusChanged(pMessage, false); | 991 DisForm_OnFocusChanged(pMessage, false); |
| 1002 break; | 992 break; |
| 1003 } | 993 } |
| 1004 case CFWL_MessageType::Mouse: { | 994 case CFWL_Message::Type::Mouse: { |
| 1005 backDefault = false; | 995 backDefault = false; |
| 1006 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 996 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 1007 switch (pMsg->m_dwCmd) { | 997 switch (pMsg->m_dwCmd) { |
| 1008 case FWL_MouseCommand::LeftButtonDown: | 998 case FWL_MouseCommand::LeftButtonDown: |
| 1009 DisForm_OnLButtonDown(pMsg); | 999 DisForm_OnLButtonDown(pMsg); |
| 1010 break; | 1000 break; |
| 1011 case FWL_MouseCommand::LeftButtonUp: | 1001 case FWL_MouseCommand::LeftButtonUp: |
| 1012 OnLButtonUp(pMsg); | 1002 OnLButtonUp(pMsg); |
| 1013 break; | 1003 break; |
| 1014 default: | 1004 default: |
| 1015 break; | 1005 break; |
| 1016 } | 1006 } |
| 1017 break; | 1007 break; |
| 1018 } | 1008 } |
| 1019 case CFWL_MessageType::Key: { | 1009 case CFWL_Message::Type::Key: { |
| 1020 backDefault = false; | 1010 backDefault = false; |
| 1021 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 1011 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
| 1022 if (pKey->m_dwCmd == FWL_KeyCommand::KeyUp) | 1012 if (pKey->m_dwCmd == FWL_KeyCommand::KeyUp) |
| 1023 break; | 1013 break; |
| 1024 if (DisForm_IsDropListVisible() && | 1014 if (DisForm_IsDropListVisible() && |
| 1025 pKey->m_dwCmd == FWL_KeyCommand::KeyDown) { | 1015 pKey->m_dwCmd == FWL_KeyCommand::KeyDown) { |
| 1026 bool bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || | 1016 bool bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || |
| 1027 pKey->m_dwKeyCode == FWL_VKEY_Down || | 1017 pKey->m_dwKeyCode == FWL_VKEY_Down || |
| 1028 pKey->m_dwKeyCode == FWL_VKEY_Return || | 1018 pKey->m_dwKeyCode == FWL_VKEY_Return || |
| 1029 pKey->m_dwKeyCode == FWL_VKEY_Escape; | 1019 pKey->m_dwKeyCode == FWL_VKEY_Escape; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1054 } | 1044 } |
| 1055 if (m_pEdit) | 1045 if (m_pEdit) |
| 1056 MatchEditText(); | 1046 MatchEditText(); |
| 1057 DisForm_ShowDropList(true); | 1047 DisForm_ShowDropList(true); |
| 1058 } | 1048 } |
| 1059 | 1049 |
| 1060 void CFWL_ComboBox::DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet) { | 1050 void CFWL_ComboBox::DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet) { |
| 1061 if (bSet) { | 1051 if (bSet) { |
| 1062 m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; | 1052 m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; |
| 1063 if ((m_pEdit->GetStates() & FWL_WGTSTATE_Focused) == 0) { | 1053 if ((m_pEdit->GetStates() & FWL_WGTSTATE_Focused) == 0) { |
| 1064 CFWL_MsgSetFocus msg; | 1054 CFWL_MsgSetFocus msg(nullptr, m_pEdit.get()); |
| 1065 msg.m_pDstTarget = m_pEdit.get(); | |
| 1066 msg.m_pSrcTarget = nullptr; | |
| 1067 m_pEdit->GetDelegate()->OnProcessMessage(&msg); | 1055 m_pEdit->GetDelegate()->OnProcessMessage(&msg); |
| 1068 } | 1056 } |
| 1069 } else { | 1057 } else { |
| 1070 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; | 1058 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; |
| 1071 DisForm_ShowDropList(false); | 1059 DisForm_ShowDropList(false); |
| 1072 CFWL_MsgKillFocus msg; | 1060 CFWL_MsgKillFocus msg(m_pEdit.get()); |
| 1073 msg.m_pDstTarget = nullptr; | |
| 1074 msg.m_pSrcTarget = m_pEdit.get(); | |
| 1075 m_pEdit->GetDelegate()->OnProcessMessage(&msg); | 1061 m_pEdit->GetDelegate()->OnProcessMessage(&msg); |
| 1076 } | 1062 } |
| 1077 } | 1063 } |
| 1078 | 1064 |
| 1079 void CFWL_ComboBox::DisForm_OnKey(CFWL_MsgKey* pMsg) { | 1065 void CFWL_ComboBox::DisForm_OnKey(CFWL_MsgKey* pMsg) { |
| 1080 uint32_t dwKeyCode = pMsg->m_dwKeyCode; | 1066 uint32_t dwKeyCode = pMsg->m_dwKeyCode; |
| 1081 const bool bUp = dwKeyCode == FWL_VKEY_Up; | 1067 const bool bUp = dwKeyCode == FWL_VKEY_Up; |
| 1082 const bool bDown = dwKeyCode == FWL_VKEY_Down; | 1068 const bool bDown = dwKeyCode == FWL_VKEY_Down; |
| 1083 if (bUp || bDown) { | 1069 if (bUp || bDown) { |
| 1084 CFWL_ComboList* pComboList = m_pListBox.get(); | 1070 CFWL_ComboList* pComboList = m_pListBox.get(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1107 else | 1093 else |
| 1108 iCurSel++; | 1094 iCurSel++; |
| 1109 } | 1095 } |
| 1110 m_iCurSel = iCurSel; | 1096 m_iCurSel = iCurSel; |
| 1111 SyncEditText(m_iCurSel); | 1097 SyncEditText(m_iCurSel); |
| 1112 return; | 1098 return; |
| 1113 } | 1099 } |
| 1114 if (m_pEdit) | 1100 if (m_pEdit) |
| 1115 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); | 1101 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); |
| 1116 } | 1102 } |
| OLD | NEW |