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/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/cfwl_app.h" |
17 #include "xfa/fwl/core/cfwl_event.h" | 17 #include "xfa/fwl/cfwl_event.h" |
18 #include "xfa/fwl/core/cfwl_evtselectchanged.h" | 18 #include "xfa/fwl/cfwl_eventselectchanged.h" |
19 #include "xfa/fwl/core/cfwl_evttextchanged.h" | 19 #include "xfa/fwl/cfwl_eventtextchanged.h" |
20 #include "xfa/fwl/core/cfwl_formproxy.h" | 20 #include "xfa/fwl/cfwl_formproxy.h" |
21 #include "xfa/fwl/core/cfwl_listbox.h" | 21 #include "xfa/fwl/cfwl_listbox.h" |
22 #include "xfa/fwl/core/cfwl_msgkey.h" | 22 #include "xfa/fwl/cfwl_messagekey.h" |
23 #include "xfa/fwl/core/cfwl_msgkillfocus.h" | 23 #include "xfa/fwl/cfwl_messagekillfocus.h" |
24 #include "xfa/fwl/core/cfwl_msgmouse.h" | 24 #include "xfa/fwl/cfwl_messagemouse.h" |
25 #include "xfa/fwl/core/cfwl_msgsetfocus.h" | 25 #include "xfa/fwl/cfwl_messagesetfocus.h" |
26 #include "xfa/fwl/core/cfwl_notedriver.h" | 26 #include "xfa/fwl/cfwl_notedriver.h" |
27 #include "xfa/fwl/core/cfwl_themebackground.h" | 27 #include "xfa/fwl/cfwl_themebackground.h" |
28 #include "xfa/fwl/core/cfwl_themepart.h" | 28 #include "xfa/fwl/cfwl_themepart.h" |
29 #include "xfa/fwl/core/cfwl_themetext.h" | 29 #include "xfa/fwl/cfwl_themetext.h" |
30 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 30 #include "xfa/fwl/cfwl_widgetmgr.h" |
31 #include "xfa/fwl/core/ifwl_themeprovider.h" | 31 #include "xfa/fwl/ifwl_themeprovider.h" |
32 | 32 |
33 CFWL_ComboBox::CFWL_ComboBox(const CFWL_App* app) | 33 CFWL_ComboBox::CFWL_ComboBox(const CFWL_App* app) |
34 : CFWL_Widget(app, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr), | 34 : CFWL_Widget(app, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr), |
35 m_pComboBoxProxy(nullptr), | 35 m_pComboBoxProxy(nullptr), |
36 m_bLButtonDown(false), | 36 m_bLButtonDown(false), |
37 m_iCurSel(-1), | 37 m_iCurSel(-1), |
38 m_iBtnState(CFWL_PartState_Normal), | 38 m_iBtnState(CFWL_PartState_Normal), |
39 m_fComboFormHandler(0) { | 39 m_fComboFormHandler(0) { |
40 m_rtClient.Reset(); | 40 m_rtClient.Reset(); |
41 m_rtBtn.Reset(); | 41 m_rtBtn.Reset(); |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 if (!hItem) | 520 if (!hItem) |
521 return; | 521 return; |
522 | 522 |
523 CFX_WideString wsText = m_pListBox->GetItemText(this, hItem); | 523 CFX_WideString wsText = m_pListBox->GetItemText(this, hItem); |
524 if (m_pEdit) { | 524 if (m_pEdit) { |
525 m_pEdit->SetText(wsText); | 525 m_pEdit->SetText(wsText); |
526 m_pEdit->Update(); | 526 m_pEdit->Update(); |
527 m_pEdit->SetSelected(); | 527 m_pEdit->SetSelected(); |
528 } | 528 } |
529 | 529 |
530 CFWL_EvtSelectChanged ev(this); | 530 CFWL_EventSelectChanged ev(this); |
531 ev.bLButtonUp = bLButtonUp; | 531 ev.bLButtonUp = bLButtonUp; |
532 DispatchEvent(&ev); | 532 DispatchEvent(&ev); |
533 } | 533 } |
534 | 534 |
535 void CFWL_ComboBox::InitProxyForm() { | 535 void CFWL_ComboBox::InitProxyForm() { |
536 if (m_pComboBoxProxy) | 536 if (m_pComboBoxProxy) |
537 return; | 537 return; |
538 if (!m_pListBox) | 538 if (!m_pListBox) |
539 return; | 539 return; |
540 | 540 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 return; | 765 return; |
766 | 766 |
767 switch (pMessage->GetType()) { | 767 switch (pMessage->GetType()) { |
768 case CFWL_Message::Type::SetFocus: | 768 case CFWL_Message::Type::SetFocus: |
769 OnFocusChanged(pMessage, true); | 769 OnFocusChanged(pMessage, true); |
770 break; | 770 break; |
771 case CFWL_Message::Type::KillFocus: | 771 case CFWL_Message::Type::KillFocus: |
772 OnFocusChanged(pMessage, false); | 772 OnFocusChanged(pMessage, false); |
773 break; | 773 break; |
774 case CFWL_Message::Type::Mouse: { | 774 case CFWL_Message::Type::Mouse: { |
775 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 775 CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage); |
776 switch (pMsg->m_dwCmd) { | 776 switch (pMsg->m_dwCmd) { |
777 case FWL_MouseCommand::LeftButtonDown: | 777 case FWL_MouseCommand::LeftButtonDown: |
778 OnLButtonDown(pMsg); | 778 OnLButtonDown(pMsg); |
779 break; | 779 break; |
780 case FWL_MouseCommand::LeftButtonUp: | 780 case FWL_MouseCommand::LeftButtonUp: |
781 OnLButtonUp(pMsg); | 781 OnLButtonUp(pMsg); |
782 break; | 782 break; |
783 case FWL_MouseCommand::Move: | 783 case FWL_MouseCommand::Move: |
784 OnMouseMove(pMsg); | 784 OnMouseMove(pMsg); |
785 break; | 785 break; |
786 case FWL_MouseCommand::Leave: | 786 case FWL_MouseCommand::Leave: |
787 OnMouseLeave(pMsg); | 787 OnMouseLeave(pMsg); |
788 break; | 788 break; |
789 default: | 789 default: |
790 break; | 790 break; |
791 } | 791 } |
792 break; | 792 break; |
793 } | 793 } |
794 case CFWL_Message::Type::Key: | 794 case CFWL_Message::Type::Key: |
795 OnKey(static_cast<CFWL_MsgKey*>(pMessage)); | 795 OnKey(static_cast<CFWL_MessageKey*>(pMessage)); |
796 break; | 796 break; |
797 default: | 797 default: |
798 break; | 798 break; |
799 } | 799 } |
800 | 800 |
801 CFWL_Widget::OnProcessMessage(pMessage); | 801 CFWL_Widget::OnProcessMessage(pMessage); |
802 } | 802 } |
803 | 803 |
804 void CFWL_ComboBox::OnProcessEvent(CFWL_Event* pEvent) { | 804 void CFWL_ComboBox::OnProcessEvent(CFWL_Event* pEvent) { |
805 CFWL_Event::Type type = pEvent->GetType(); | 805 CFWL_Event::Type type = pEvent->GetType(); |
806 if (type == CFWL_Event::Type::Scroll) { | 806 if (type == CFWL_Event::Type::Scroll) { |
807 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); | 807 CFWL_EventScroll* pScrollEvent = static_cast<CFWL_EventScroll*>(pEvent); |
808 CFWL_EvtScroll pScrollEv(this); | 808 CFWL_EventScroll pScrollEv(this); |
809 pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode; | 809 pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode; |
810 pScrollEv.m_fPos = pScrollEvent->m_fPos; | 810 pScrollEv.m_fPos = pScrollEvent->m_fPos; |
811 DispatchEvent(&pScrollEv); | 811 DispatchEvent(&pScrollEv); |
812 } else if (type == CFWL_Event::Type::TextChanged) { | 812 } else if (type == CFWL_Event::Type::TextChanged) { |
813 CFWL_Event pTemp(CFWL_Event::Type::EditChanged, this); | 813 CFWL_Event pTemp(CFWL_Event::Type::EditChanged, this); |
814 DispatchEvent(&pTemp); | 814 DispatchEvent(&pTemp); |
815 } | 815 } |
816 } | 816 } |
817 | 817 |
818 void CFWL_ComboBox::OnDrawWidget(CFX_Graphics* pGraphics, | 818 void CFWL_ComboBox::OnDrawWidget(CFX_Graphics* pGraphics, |
(...skipping 20 matching lines...) Expand all Loading... |
839 Repaint(&m_rtClient); | 839 Repaint(&m_rtClient); |
840 return; | 840 return; |
841 } | 841 } |
842 if (!m_pEdit) | 842 if (!m_pEdit) |
843 return; | 843 return; |
844 | 844 |
845 m_pEdit->FlagFocus(false); | 845 m_pEdit->FlagFocus(false); |
846 m_pEdit->ClearSelected(); | 846 m_pEdit->ClearSelected(); |
847 } | 847 } |
848 | 848 |
849 void CFWL_ComboBox::OnLButtonDown(CFWL_MsgMouse* pMsg) { | 849 void CFWL_ComboBox::OnLButtonDown(CFWL_MessageMouse* pMsg) { |
850 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) | 850 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) |
851 return; | 851 return; |
852 | 852 |
853 CFX_RectF& rtBtn = IsDropDownStyle() ? m_rtBtn : m_rtClient; | 853 CFX_RectF& rtBtn = IsDropDownStyle() ? m_rtBtn : m_rtClient; |
854 if (!rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) | 854 if (!rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) |
855 return; | 855 return; |
856 | 856 |
857 if (IsDropDownStyle() && m_pEdit) | 857 if (IsDropDownStyle() && m_pEdit) |
858 MatchEditText(); | 858 MatchEditText(); |
859 | 859 |
860 m_bLButtonDown = true; | 860 m_bLButtonDown = true; |
861 m_iBtnState = CFWL_PartState_Pressed; | 861 m_iBtnState = CFWL_PartState_Pressed; |
862 Repaint(&m_rtClient); | 862 Repaint(&m_rtClient); |
863 | 863 |
864 ShowDropList(true); | 864 ShowDropList(true); |
865 m_iBtnState = CFWL_PartState_Normal; | 865 m_iBtnState = CFWL_PartState_Normal; |
866 Repaint(&m_rtClient); | 866 Repaint(&m_rtClient); |
867 } | 867 } |
868 | 868 |
869 void CFWL_ComboBox::OnLButtonUp(CFWL_MsgMouse* pMsg) { | 869 void CFWL_ComboBox::OnLButtonUp(CFWL_MessageMouse* pMsg) { |
870 m_bLButtonDown = false; | 870 m_bLButtonDown = false; |
871 if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) | 871 if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) |
872 m_iBtnState = CFWL_PartState_Hovered; | 872 m_iBtnState = CFWL_PartState_Hovered; |
873 else | 873 else |
874 m_iBtnState = CFWL_PartState_Normal; | 874 m_iBtnState = CFWL_PartState_Normal; |
875 | 875 |
876 Repaint(&m_rtBtn); | 876 Repaint(&m_rtBtn); |
877 } | 877 } |
878 | 878 |
879 void CFWL_ComboBox::OnMouseMove(CFWL_MsgMouse* pMsg) { | 879 void CFWL_ComboBox::OnMouseMove(CFWL_MessageMouse* pMsg) { |
880 int32_t iOldState = m_iBtnState; | 880 int32_t iOldState = m_iBtnState; |
881 if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { | 881 if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { |
882 m_iBtnState = | 882 m_iBtnState = |
883 m_bLButtonDown ? CFWL_PartState_Pressed : CFWL_PartState_Hovered; | 883 m_bLButtonDown ? CFWL_PartState_Pressed : CFWL_PartState_Hovered; |
884 } else { | 884 } else { |
885 m_iBtnState = CFWL_PartState_Normal; | 885 m_iBtnState = CFWL_PartState_Normal; |
886 } | 886 } |
887 if ((iOldState != m_iBtnState) && | 887 if ((iOldState != m_iBtnState) && |
888 !((m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == | 888 !((m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == |
889 FWL_WGTSTATE_Disabled)) { | 889 FWL_WGTSTATE_Disabled)) { |
890 Repaint(&m_rtBtn); | 890 Repaint(&m_rtBtn); |
891 } | 891 } |
892 } | 892 } |
893 | 893 |
894 void CFWL_ComboBox::OnMouseLeave(CFWL_MsgMouse* pMsg) { | 894 void CFWL_ComboBox::OnMouseLeave(CFWL_MessageMouse* pMsg) { |
895 if (!IsDropListVisible() && | 895 if (!IsDropListVisible() && |
896 !((m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == | 896 !((m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == |
897 FWL_WGTSTATE_Disabled)) { | 897 FWL_WGTSTATE_Disabled)) { |
898 m_iBtnState = CFWL_PartState_Normal; | 898 m_iBtnState = CFWL_PartState_Normal; |
899 Repaint(&m_rtBtn); | 899 Repaint(&m_rtBtn); |
900 } | 900 } |
901 } | 901 } |
902 | 902 |
903 void CFWL_ComboBox::OnKey(CFWL_MsgKey* pMsg) { | 903 void CFWL_ComboBox::OnKey(CFWL_MessageKey* pMsg) { |
904 uint32_t dwKeyCode = pMsg->m_dwKeyCode; | 904 uint32_t dwKeyCode = pMsg->m_dwKeyCode; |
905 if (dwKeyCode == FWL_VKEY_Tab) | 905 if (dwKeyCode == FWL_VKEY_Tab) |
906 return; | 906 return; |
907 if (pMsg->m_pDstTarget == this) | 907 if (pMsg->m_pDstTarget == this) |
908 DoSubCtrlKey(pMsg); | 908 DoSubCtrlKey(pMsg); |
909 } | 909 } |
910 | 910 |
911 void CFWL_ComboBox::DoSubCtrlKey(CFWL_MsgKey* pMsg) { | 911 void CFWL_ComboBox::DoSubCtrlKey(CFWL_MessageKey* pMsg) { |
912 uint32_t dwKeyCode = pMsg->m_dwKeyCode; | 912 uint32_t dwKeyCode = pMsg->m_dwKeyCode; |
913 const bool bUp = dwKeyCode == FWL_VKEY_Up; | 913 const bool bUp = dwKeyCode == FWL_VKEY_Up; |
914 const bool bDown = dwKeyCode == FWL_VKEY_Down; | 914 const bool bDown = dwKeyCode == FWL_VKEY_Down; |
915 if (bUp || bDown) { | 915 if (bUp || bDown) { |
916 int32_t iCount = m_pListBox->CountItems(nullptr); | 916 int32_t iCount = m_pListBox->CountItems(nullptr); |
917 if (iCount < 1) | 917 if (iCount < 1) |
918 return; | 918 return; |
919 | 919 |
920 bool bMatchEqual = false; | 920 bool bMatchEqual = false; |
921 int32_t iCurSel = m_iCurSel; | 921 int32_t iCurSel = m_iCurSel; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 DisForm_OnFocusChanged(pMessage, true); | 962 DisForm_OnFocusChanged(pMessage, true); |
963 break; | 963 break; |
964 } | 964 } |
965 case CFWL_Message::Type::KillFocus: { | 965 case CFWL_Message::Type::KillFocus: { |
966 backDefault = false; | 966 backDefault = false; |
967 DisForm_OnFocusChanged(pMessage, false); | 967 DisForm_OnFocusChanged(pMessage, false); |
968 break; | 968 break; |
969 } | 969 } |
970 case CFWL_Message::Type::Mouse: { | 970 case CFWL_Message::Type::Mouse: { |
971 backDefault = false; | 971 backDefault = false; |
972 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 972 CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage); |
973 switch (pMsg->m_dwCmd) { | 973 switch (pMsg->m_dwCmd) { |
974 case FWL_MouseCommand::LeftButtonDown: | 974 case FWL_MouseCommand::LeftButtonDown: |
975 DisForm_OnLButtonDown(pMsg); | 975 DisForm_OnLButtonDown(pMsg); |
976 break; | 976 break; |
977 case FWL_MouseCommand::LeftButtonUp: | 977 case FWL_MouseCommand::LeftButtonUp: |
978 OnLButtonUp(pMsg); | 978 OnLButtonUp(pMsg); |
979 break; | 979 break; |
980 default: | 980 default: |
981 break; | 981 break; |
982 } | 982 } |
983 break; | 983 break; |
984 } | 984 } |
985 case CFWL_Message::Type::Key: { | 985 case CFWL_Message::Type::Key: { |
986 backDefault = false; | 986 backDefault = false; |
987 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 987 CFWL_MessageKey* pKey = static_cast<CFWL_MessageKey*>(pMessage); |
988 if (pKey->m_dwCmd == FWL_KeyCommand::KeyUp) | 988 if (pKey->m_dwCmd == FWL_KeyCommand::KeyUp) |
989 break; | 989 break; |
990 if (DisForm_IsDropListVisible() && | 990 if (DisForm_IsDropListVisible() && |
991 pKey->m_dwCmd == FWL_KeyCommand::KeyDown) { | 991 pKey->m_dwCmd == FWL_KeyCommand::KeyDown) { |
992 bool bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || | 992 bool bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || |
993 pKey->m_dwKeyCode == FWL_VKEY_Down || | 993 pKey->m_dwKeyCode == FWL_VKEY_Down || |
994 pKey->m_dwKeyCode == FWL_VKEY_Return || | 994 pKey->m_dwKeyCode == FWL_VKEY_Return || |
995 pKey->m_dwKeyCode == FWL_VKEY_Escape; | 995 pKey->m_dwKeyCode == FWL_VKEY_Escape; |
996 if (bListKey) { | 996 if (bListKey) { |
997 m_pListBox->GetDelegate()->OnProcessMessage(pMessage); | 997 m_pListBox->GetDelegate()->OnProcessMessage(pMessage); |
998 break; | 998 break; |
999 } | 999 } |
1000 } | 1000 } |
1001 DisForm_OnKey(pKey); | 1001 DisForm_OnKey(pKey); |
1002 break; | 1002 break; |
1003 } | 1003 } |
1004 default: | 1004 default: |
1005 break; | 1005 break; |
1006 } | 1006 } |
1007 if (backDefault) | 1007 if (backDefault) |
1008 CFWL_Widget::OnProcessMessage(pMessage); | 1008 CFWL_Widget::OnProcessMessage(pMessage); |
1009 } | 1009 } |
1010 | 1010 |
1011 void CFWL_ComboBox::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) { | 1011 void CFWL_ComboBox::DisForm_OnLButtonDown(CFWL_MessageMouse* pMsg) { |
1012 bool bDropDown = DisForm_IsDropListVisible(); | 1012 bool bDropDown = DisForm_IsDropListVisible(); |
1013 CFX_RectF& rtBtn = bDropDown ? m_rtBtn : m_rtClient; | 1013 CFX_RectF& rtBtn = bDropDown ? m_rtBtn : m_rtClient; |
1014 if (!rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) | 1014 if (!rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) |
1015 return; | 1015 return; |
1016 | 1016 |
1017 if (DisForm_IsDropListVisible()) { | 1017 if (DisForm_IsDropListVisible()) { |
1018 DisForm_ShowDropList(false); | 1018 DisForm_ShowDropList(false); |
1019 return; | 1019 return; |
1020 } | 1020 } |
1021 if (m_pEdit) | 1021 if (m_pEdit) |
1022 MatchEditText(); | 1022 MatchEditText(); |
1023 DisForm_ShowDropList(true); | 1023 DisForm_ShowDropList(true); |
1024 } | 1024 } |
1025 | 1025 |
1026 void CFWL_ComboBox::DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet) { | 1026 void CFWL_ComboBox::DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet) { |
1027 if (bSet) { | 1027 if (bSet) { |
1028 m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; | 1028 m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; |
1029 if ((m_pEdit->GetStates() & FWL_WGTSTATE_Focused) == 0) { | 1029 if ((m_pEdit->GetStates() & FWL_WGTSTATE_Focused) == 0) { |
1030 CFWL_MsgSetFocus msg(nullptr, m_pEdit.get()); | 1030 CFWL_MessageSetFocus msg(nullptr, m_pEdit.get()); |
1031 m_pEdit->GetDelegate()->OnProcessMessage(&msg); | 1031 m_pEdit->GetDelegate()->OnProcessMessage(&msg); |
1032 } | 1032 } |
1033 } else { | 1033 } else { |
1034 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; | 1034 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; |
1035 DisForm_ShowDropList(false); | 1035 DisForm_ShowDropList(false); |
1036 CFWL_MsgKillFocus msg(m_pEdit.get()); | 1036 CFWL_MessageKillFocus msg(m_pEdit.get()); |
1037 m_pEdit->GetDelegate()->OnProcessMessage(&msg); | 1037 m_pEdit->GetDelegate()->OnProcessMessage(&msg); |
1038 } | 1038 } |
1039 } | 1039 } |
1040 | 1040 |
1041 void CFWL_ComboBox::DisForm_OnKey(CFWL_MsgKey* pMsg) { | 1041 void CFWL_ComboBox::DisForm_OnKey(CFWL_MessageKey* pMsg) { |
1042 uint32_t dwKeyCode = pMsg->m_dwKeyCode; | 1042 uint32_t dwKeyCode = pMsg->m_dwKeyCode; |
1043 const bool bUp = dwKeyCode == FWL_VKEY_Up; | 1043 const bool bUp = dwKeyCode == FWL_VKEY_Up; |
1044 const bool bDown = dwKeyCode == FWL_VKEY_Down; | 1044 const bool bDown = dwKeyCode == FWL_VKEY_Down; |
1045 if (bUp || bDown) { | 1045 if (bUp || bDown) { |
1046 CFWL_ComboList* pComboList = m_pListBox.get(); | 1046 CFWL_ComboList* pComboList = m_pListBox.get(); |
1047 int32_t iCount = pComboList->CountItems(nullptr); | 1047 int32_t iCount = pComboList->CountItems(nullptr); |
1048 if (iCount < 1) | 1048 if (iCount < 1) |
1049 return; | 1049 return; |
1050 | 1050 |
1051 bool bMatchEqual = false; | 1051 bool bMatchEqual = false; |
(...skipping 17 matching lines...) Expand all Loading... |
1069 else | 1069 else |
1070 iCurSel++; | 1070 iCurSel++; |
1071 } | 1071 } |
1072 m_iCurSel = iCurSel; | 1072 m_iCurSel = iCurSel; |
1073 SyncEditText(m_iCurSel); | 1073 SyncEditText(m_iCurSel); |
1074 return; | 1074 return; |
1075 } | 1075 } |
1076 if (m_pEdit) | 1076 if (m_pEdit) |
1077 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); | 1077 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); |
1078 } | 1078 } |
OLD | NEW |