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 "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
10 #include "xfa/fde/tto/fde_textout.h" | 10 #include "xfa/fde/tto/fde_textout.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 : IFWL_Widget(app, properties, pOuter), | 27 : IFWL_Widget(app, properties, pOuter), |
28 m_dwTTOStyles(0), | 28 m_dwTTOStyles(0), |
29 m_iTTOAligns(0), | 29 m_iTTOAligns(0), |
30 m_hAnchor(nullptr), | 30 m_hAnchor(nullptr), |
31 m_fScorllBarWidth(0), | 31 m_fScorllBarWidth(0), |
32 m_bLButtonDown(FALSE), | 32 m_bLButtonDown(FALSE), |
33 m_pScrollBarTP(nullptr) { | 33 m_pScrollBarTP(nullptr) { |
34 m_rtClient.Reset(); | 34 m_rtClient.Reset(); |
35 m_rtConent.Reset(); | 35 m_rtConent.Reset(); |
36 m_rtStatic.Reset(); | 36 m_rtStatic.Reset(); |
37 | |
38 SetDelegate(pdfium::MakeUnique<CFWL_ListBoxImpDelegate>(this)); | |
39 } | 37 } |
40 | 38 |
41 IFWL_ListBox::~IFWL_ListBox() {} | 39 IFWL_ListBox::~IFWL_ListBox() {} |
42 | 40 |
43 FWL_Type IFWL_ListBox::GetClassID() const { | 41 FWL_Type IFWL_ListBox::GetClassID() const { |
44 return FWL_Type::ListBox; | 42 return FWL_Type::ListBox; |
45 } | 43 } |
46 | 44 |
47 FWL_Error IFWL_ListBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 45 FWL_Error IFWL_ListBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
48 if (bAutoSize) { | 46 if (bAutoSize) { |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 for (int32_t i = 0; i < iCount; i++) { | 904 for (int32_t i = 0; i < iCount; i++) { |
907 IFWL_ListItem* item = GetSelItem(i); | 905 IFWL_ListItem* item = GetSelItem(i); |
908 if (!item) { | 906 if (!item) { |
909 continue; | 907 continue; |
910 } | 908 } |
911 selEvent.iarraySels.Add(i); | 909 selEvent.iarraySels.Add(i); |
912 } | 910 } |
913 DispatchEvent(&selEvent); | 911 DispatchEvent(&selEvent); |
914 } | 912 } |
915 | 913 |
916 CFWL_ListBoxImpDelegate::CFWL_ListBoxImpDelegate(IFWL_ListBox* pOwner) | 914 void IFWL_ListBox::OnProcessMessage(CFWL_Message* pMessage) { |
917 : m_pOwner(pOwner) {} | |
918 | |
919 void CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | |
920 if (!pMessage) | 915 if (!pMessage) |
921 return; | 916 return; |
922 if (!m_pOwner->IsEnabled()) | 917 if (!IsEnabled()) |
923 return; | 918 return; |
924 | 919 |
925 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); | 920 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
926 switch (dwMsgCode) { | 921 switch (dwMsgCode) { |
927 case CFWL_MessageType::SetFocus: { | 922 case CFWL_MessageType::SetFocus: |
928 OnFocusChanged(pMessage, TRUE); | 923 OnFocusChanged(pMessage, TRUE); |
929 break; | 924 break; |
930 } | 925 case CFWL_MessageType::KillFocus: |
931 case CFWL_MessageType::KillFocus: { | |
932 OnFocusChanged(pMessage, FALSE); | 926 OnFocusChanged(pMessage, FALSE); |
933 break; | 927 break; |
934 } | |
935 case CFWL_MessageType::Mouse: { | 928 case CFWL_MessageType::Mouse: { |
936 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 929 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
937 switch (pMsg->m_dwCmd) { | 930 switch (pMsg->m_dwCmd) { |
938 case FWL_MouseCommand::LeftButtonDown: { | 931 case FWL_MouseCommand::LeftButtonDown: |
939 OnLButtonDown(pMsg); | 932 OnLButtonDown(pMsg); |
940 break; | 933 break; |
941 } | 934 case FWL_MouseCommand::LeftButtonUp: |
942 case FWL_MouseCommand::LeftButtonUp: { | |
943 OnLButtonUp(pMsg); | 935 OnLButtonUp(pMsg); |
944 break; | 936 break; |
945 } | |
946 default: | 937 default: |
947 break; | 938 break; |
948 } | 939 } |
949 break; | 940 break; |
950 } | 941 } |
951 case CFWL_MessageType::MouseWheel: { | 942 case CFWL_MessageType::MouseWheel: |
952 OnMouseWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage)); | 943 OnMouseWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage)); |
953 break; | 944 break; |
954 } | |
955 case CFWL_MessageType::Key: { | 945 case CFWL_MessageType::Key: { |
956 CFWL_MsgKey* pMsg = static_cast<CFWL_MsgKey*>(pMessage); | 946 CFWL_MsgKey* pMsg = static_cast<CFWL_MsgKey*>(pMessage); |
957 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown) | 947 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown) |
958 OnKeyDown(pMsg); | 948 OnKeyDown(pMsg); |
959 break; | 949 break; |
960 } | 950 } |
961 default: { break; } | 951 default: |
| 952 break; |
962 } | 953 } |
963 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 954 IFWL_Widget::OnProcessMessage(pMessage); |
964 } | 955 } |
965 | 956 |
966 void CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 957 void IFWL_ListBox::OnProcessEvent(CFWL_Event* pEvent) { |
967 if (!pEvent) | 958 if (!pEvent) |
968 return; | 959 return; |
969 if (pEvent->GetClassID() != CFWL_EventType::Scroll) | 960 if (pEvent->GetClassID() != CFWL_EventType::Scroll) |
970 return; | 961 return; |
971 | 962 |
972 IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; | 963 IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; |
973 if ((pSrcTarget == m_pOwner->m_pVertScrollBar.get() && | 964 if ((pSrcTarget == m_pVertScrollBar.get() && m_pVertScrollBar) || |
974 m_pOwner->m_pVertScrollBar) || | 965 (pSrcTarget == m_pHorzScrollBar.get() && m_pHorzScrollBar)) { |
975 (pSrcTarget == m_pOwner->m_pHorzScrollBar.get() && | |
976 m_pOwner->m_pHorzScrollBar)) { | |
977 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); | 966 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); |
978 OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget), | 967 OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget), |
979 pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); | 968 pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); |
980 } | 969 } |
981 } | 970 } |
982 | 971 |
983 void CFWL_ListBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 972 void IFWL_ListBox::OnDrawWidget(CFX_Graphics* pGraphics, |
984 const CFX_Matrix* pMatrix) { | 973 const CFX_Matrix* pMatrix) { |
985 m_pOwner->DrawWidget(pGraphics, pMatrix); | 974 DrawWidget(pGraphics, pMatrix); |
986 } | 975 } |
987 | 976 |
988 void CFWL_ListBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { | 977 void IFWL_ListBox::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { |
989 if (m_pOwner->GetStylesEx() & FWL_STYLEEXT_LTB_ShowScrollBarFocus) { | 978 if (GetStylesEx() & FWL_STYLEEXT_LTB_ShowScrollBarFocus) { |
990 if (m_pOwner->m_pVertScrollBar) { | 979 if (m_pVertScrollBar) |
991 m_pOwner->m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, !bSet); | 980 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, !bSet); |
| 981 if (m_pHorzScrollBar) |
| 982 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, !bSet); |
| 983 } |
| 984 if (bSet) |
| 985 m_pProperties->m_dwStates |= (FWL_WGTSTATE_Focused); |
| 986 else |
| 987 m_pProperties->m_dwStates &= ~(FWL_WGTSTATE_Focused); |
| 988 |
| 989 Repaint(&m_rtClient); |
| 990 } |
| 991 |
| 992 void IFWL_ListBox::OnLButtonDown(CFWL_MsgMouse* pMsg) { |
| 993 m_bLButtonDown = TRUE; |
| 994 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) |
| 995 SetFocus(TRUE); |
| 996 |
| 997 IFWL_ListItem* pItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
| 998 if (!pItem) |
| 999 return; |
| 1000 |
| 1001 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) { |
| 1002 if (pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl) { |
| 1003 FX_BOOL bSelected = IsItemSelected(pItem); |
| 1004 SetSelectionDirect(pItem, !bSelected); |
| 1005 m_hAnchor = pItem; |
| 1006 } else if (pMsg->m_dwFlags & FWL_KEYFLAG_Shift) { |
| 1007 if (m_hAnchor) |
| 1008 SetSelection(m_hAnchor, pItem, TRUE); |
| 1009 else |
| 1010 SetSelectionDirect(pItem, TRUE); |
| 1011 } else { |
| 1012 SetSelection(pItem, pItem, TRUE); |
| 1013 m_hAnchor = pItem; |
992 } | 1014 } |
993 if (m_pOwner->m_pHorzScrollBar) { | 1015 } else { |
994 m_pOwner->m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, !bSet); | 1016 SetSelection(pItem, pItem, TRUE); |
| 1017 } |
| 1018 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check) { |
| 1019 IFWL_ListItem* hSelectedItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
| 1020 CFX_RectF rtCheck; |
| 1021 GetItemCheckRect(hSelectedItem, rtCheck); |
| 1022 FX_BOOL bChecked = GetItemChecked(pItem); |
| 1023 if (rtCheck.Contains(pMsg->m_fx, pMsg->m_fy)) { |
| 1024 SetItemChecked(pItem, !bChecked); |
| 1025 Update(); |
995 } | 1026 } |
996 } | 1027 } |
997 if (bSet) { | 1028 SetFocusItem(pItem); |
998 m_pOwner->m_pProperties->m_dwStates |= (FWL_WGTSTATE_Focused); | 1029 ScrollToVisible(pItem); |
999 } else { | 1030 SetGrab(TRUE); |
1000 m_pOwner->m_pProperties->m_dwStates &= ~(FWL_WGTSTATE_Focused); | 1031 ProcessSelChanged(); |
1001 } | 1032 Repaint(&m_rtClient); |
1002 m_pOwner->Repaint(&m_pOwner->m_rtClient); | |
1003 } | 1033 } |
1004 | 1034 |
1005 void CFWL_ListBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { | 1035 void IFWL_ListBox::OnLButtonUp(CFWL_MsgMouse* pMsg) { |
1006 m_pOwner->m_bLButtonDown = TRUE; | 1036 if (!m_bLButtonDown) |
1007 if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) { | |
1008 m_pOwner->SetFocus(TRUE); | |
1009 } | |
1010 IFWL_ListItem* pItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); | |
1011 if (!pItem) { | |
1012 return; | 1037 return; |
1013 } | 1038 |
1014 if (m_pOwner->m_pProperties->m_dwStyleExes & | 1039 m_bLButtonDown = FALSE; |
1015 FWL_STYLEEXT_LTB_MultiSelection) { | 1040 SetGrab(FALSE); |
1016 if (pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl) { | 1041 DispatchSelChangedEv(); |
1017 FX_BOOL bSelected = m_pOwner->IsItemSelected(pItem); | |
1018 m_pOwner->SetSelectionDirect(pItem, !bSelected); | |
1019 m_pOwner->m_hAnchor = pItem; | |
1020 } else if (pMsg->m_dwFlags & FWL_KEYFLAG_Shift) { | |
1021 if (m_pOwner->m_hAnchor) { | |
1022 m_pOwner->SetSelection(m_pOwner->m_hAnchor, pItem, TRUE); | |
1023 } else { | |
1024 m_pOwner->SetSelectionDirect(pItem, TRUE); | |
1025 } | |
1026 } else { | |
1027 m_pOwner->SetSelection(pItem, pItem, TRUE); | |
1028 m_pOwner->m_hAnchor = pItem; | |
1029 } | |
1030 } else { | |
1031 m_pOwner->SetSelection(pItem, pItem, TRUE); | |
1032 } | |
1033 if (m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check) { | |
1034 IFWL_ListItem* hSelectedItem = | |
1035 m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); | |
1036 CFX_RectF rtCheck; | |
1037 m_pOwner->GetItemCheckRect(hSelectedItem, rtCheck); | |
1038 FX_BOOL bChecked = m_pOwner->GetItemChecked(pItem); | |
1039 if (rtCheck.Contains(pMsg->m_fx, pMsg->m_fy)) { | |
1040 if (bChecked) { | |
1041 m_pOwner->SetItemChecked(pItem, FALSE); | |
1042 } else { | |
1043 m_pOwner->SetItemChecked(pItem, TRUE); | |
1044 } | |
1045 m_pOwner->Update(); | |
1046 } | |
1047 } | |
1048 m_pOwner->SetFocusItem(pItem); | |
1049 m_pOwner->ScrollToVisible(pItem); | |
1050 m_pOwner->SetGrab(TRUE); | |
1051 m_pOwner->ProcessSelChanged(); | |
1052 m_pOwner->Repaint(&m_pOwner->m_rtClient); | |
1053 } | 1042 } |
1054 | 1043 |
1055 void CFWL_ListBoxImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { | 1044 void IFWL_ListBox::OnMouseWheel(CFWL_MsgMouseWheel* pMsg) { |
1056 if (m_pOwner->m_bLButtonDown) { | 1045 if (IsShowScrollBar(TRUE)) |
1057 m_pOwner->m_bLButtonDown = FALSE; | 1046 m_pVertScrollBar->GetDelegate()->OnProcessMessage(pMsg); |
1058 m_pOwner->SetGrab(FALSE); | |
1059 DispatchSelChangedEv(); | |
1060 } | |
1061 } | 1047 } |
1062 | 1048 |
1063 void CFWL_ListBoxImpDelegate::OnMouseWheel(CFWL_MsgMouseWheel* pMsg) { | 1049 void IFWL_ListBox::OnKeyDown(CFWL_MsgKey* pMsg) { |
1064 if (m_pOwner->IsShowScrollBar(TRUE)) | |
1065 m_pOwner->m_pVertScrollBar->GetCurrentDelegate()->OnProcessMessage(pMsg); | |
1066 } | |
1067 | |
1068 void CFWL_ListBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { | |
1069 uint32_t dwKeyCode = pMsg->m_dwKeyCode; | 1050 uint32_t dwKeyCode = pMsg->m_dwKeyCode; |
1070 switch (dwKeyCode) { | 1051 switch (dwKeyCode) { |
1071 case FWL_VKEY_Tab: | 1052 case FWL_VKEY_Tab: |
1072 case FWL_VKEY_Up: | 1053 case FWL_VKEY_Up: |
1073 case FWL_VKEY_Down: | 1054 case FWL_VKEY_Down: |
1074 case FWL_VKEY_Home: | 1055 case FWL_VKEY_Home: |
1075 case FWL_VKEY_End: { | 1056 case FWL_VKEY_End: { |
1076 IFWL_ListItem* pItem = m_pOwner->GetFocusedItem(); | 1057 IFWL_ListItem* pItem = GetFocusedItem(); |
1077 pItem = m_pOwner->GetItem(pItem, dwKeyCode); | 1058 pItem = GetItem(pItem, dwKeyCode); |
1078 bool bShift = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Shift); | 1059 bool bShift = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Shift); |
1079 bool bCtrl = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl); | 1060 bool bCtrl = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl); |
1080 OnVK(pItem, bShift, bCtrl); | 1061 OnVK(pItem, bShift, bCtrl); |
1081 DispatchSelChangedEv(); | 1062 DispatchSelChangedEv(); |
1082 m_pOwner->ProcessSelChanged(); | 1063 ProcessSelChanged(); |
1083 break; | 1064 break; |
1084 } | 1065 } |
1085 default: | 1066 default: |
1086 break; | 1067 break; |
1087 } | 1068 } |
1088 } | 1069 } |
1089 | 1070 |
1090 void CFWL_ListBoxImpDelegate::OnVK(IFWL_ListItem* pItem, | 1071 void IFWL_ListBox::OnVK(IFWL_ListItem* pItem, FX_BOOL bShift, FX_BOOL bCtrl) { |
1091 FX_BOOL bShift, | 1072 if (!pItem) |
1092 FX_BOOL bCtrl) { | |
1093 if (!pItem) { | |
1094 return; | 1073 return; |
1095 } | 1074 |
1096 if (m_pOwner->m_pProperties->m_dwStyleExes & | 1075 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) { |
1097 FWL_STYLEEXT_LTB_MultiSelection) { | |
1098 if (bCtrl) { | 1076 if (bCtrl) { |
1099 } else if (bShift) { | 1077 } else if (bShift) { |
1100 if (m_pOwner->m_hAnchor) { | 1078 if (m_hAnchor) |
1101 m_pOwner->SetSelection(m_pOwner->m_hAnchor, pItem, TRUE); | 1079 SetSelection(m_hAnchor, pItem, TRUE); |
1102 } else { | 1080 else |
1103 m_pOwner->SetSelectionDirect(pItem, TRUE); | 1081 SetSelectionDirect(pItem, TRUE); |
1104 } | |
1105 } else { | 1082 } else { |
1106 m_pOwner->SetSelection(pItem, pItem, TRUE); | 1083 SetSelection(pItem, pItem, TRUE); |
1107 m_pOwner->m_hAnchor = pItem; | 1084 m_hAnchor = pItem; |
1108 } | 1085 } |
1109 } else { | 1086 } else { |
1110 m_pOwner->SetSelection(pItem, pItem, TRUE); | 1087 SetSelection(pItem, pItem, TRUE); |
1111 } | 1088 } |
1112 m_pOwner->SetFocusItem(pItem); | 1089 |
1113 m_pOwner->ScrollToVisible(pItem); | 1090 SetFocusItem(pItem); |
1114 { | 1091 ScrollToVisible(pItem); |
1115 CFX_RectF rtInvalidate; | 1092 |
1116 rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width, | 1093 CFX_RectF rtInvalidate; |
1117 m_pOwner->m_pProperties->m_rtWidget.height); | 1094 rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, |
1118 m_pOwner->Repaint(&rtInvalidate); | 1095 m_pProperties->m_rtWidget.height); |
1119 } | 1096 Repaint(&rtInvalidate); |
1120 } | 1097 } |
1121 | 1098 |
1122 FX_BOOL CFWL_ListBoxImpDelegate::OnScroll(IFWL_ScrollBar* pScrollBar, | 1099 FX_BOOL IFWL_ListBox::OnScroll(IFWL_ScrollBar* pScrollBar, |
1123 uint32_t dwCode, | 1100 uint32_t dwCode, |
1124 FX_FLOAT fPos) { | 1101 FX_FLOAT fPos) { |
1125 CFX_SizeF fs; | 1102 CFX_SizeF fs; |
1126 pScrollBar->GetRange(fs.x, fs.y); | 1103 pScrollBar->GetRange(fs.x, fs.y); |
1127 FX_FLOAT iCurPos = pScrollBar->GetPos(); | 1104 FX_FLOAT iCurPos = pScrollBar->GetPos(); |
1128 FX_FLOAT fStep = pScrollBar->GetStepSize(); | 1105 FX_FLOAT fStep = pScrollBar->GetStepSize(); |
1129 switch (dwCode) { | 1106 switch (dwCode) { |
1130 case FWL_SCBCODE_Min: { | 1107 case FWL_SCBCODE_Min: { |
1131 fPos = fs.x; | 1108 fPos = fs.x; |
1132 break; | 1109 break; |
1133 } | 1110 } |
1134 case FWL_SCBCODE_Max: { | 1111 case FWL_SCBCODE_Max: { |
1135 fPos = fs.y; | 1112 fPos = fs.y; |
1136 break; | 1113 break; |
1137 } | 1114 } |
1138 case FWL_SCBCODE_StepBackward: { | 1115 case FWL_SCBCODE_StepBackward: { |
1139 fPos -= fStep; | 1116 fPos -= fStep; |
1140 if (fPos < fs.x + fStep / 2) { | 1117 if (fPos < fs.x + fStep / 2) |
1141 fPos = fs.x; | 1118 fPos = fs.x; |
1142 } | |
1143 break; | 1119 break; |
1144 } | 1120 } |
1145 case FWL_SCBCODE_StepForward: { | 1121 case FWL_SCBCODE_StepForward: { |
1146 fPos += fStep; | 1122 fPos += fStep; |
1147 if (fPos > fs.y - fStep / 2) { | 1123 if (fPos > fs.y - fStep / 2) |
1148 fPos = fs.y; | 1124 fPos = fs.y; |
1149 } | |
1150 break; | 1125 break; |
1151 } | 1126 } |
1152 case FWL_SCBCODE_PageBackward: { | 1127 case FWL_SCBCODE_PageBackward: { |
1153 fPos -= pScrollBar->GetPageSize(); | 1128 fPos -= pScrollBar->GetPageSize(); |
1154 if (fPos < fs.x) { | 1129 if (fPos < fs.x) |
1155 fPos = fs.x; | 1130 fPos = fs.x; |
1156 } | |
1157 break; | 1131 break; |
1158 } | 1132 } |
1159 case FWL_SCBCODE_PageForward: { | 1133 case FWL_SCBCODE_PageForward: { |
1160 fPos += pScrollBar->GetPageSize(); | 1134 fPos += pScrollBar->GetPageSize(); |
1161 if (fPos > fs.y) { | 1135 if (fPos > fs.y) |
1162 fPos = fs.y; | 1136 fPos = fs.y; |
1163 } | |
1164 break; | 1137 break; |
1165 } | 1138 } |
1166 case FWL_SCBCODE_Pos: | 1139 case FWL_SCBCODE_Pos: |
1167 case FWL_SCBCODE_TrackPos: | 1140 case FWL_SCBCODE_TrackPos: |
1168 break; | 1141 break; |
1169 case FWL_SCBCODE_EndScroll: | 1142 case FWL_SCBCODE_EndScroll: |
1170 return FALSE; | 1143 return FALSE; |
1171 } | 1144 } |
1172 if (iCurPos != fPos) { | 1145 if (iCurPos != fPos) { |
1173 pScrollBar->SetPos(fPos); | 1146 pScrollBar->SetPos(fPos); |
1174 pScrollBar->SetTrackPos(fPos); | 1147 pScrollBar->SetTrackPos(fPos); |
1175 m_pOwner->Repaint(&m_pOwner->m_rtClient); | 1148 Repaint(&m_rtClient); |
1176 } | 1149 } |
1177 return TRUE; | 1150 return TRUE; |
1178 } | 1151 } |
1179 | 1152 |
1180 void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() { | 1153 void IFWL_ListBox::DispatchSelChangedEv() { |
1181 CFWL_EvtLtbSelChanged ev; | 1154 CFWL_EvtLtbSelChanged ev; |
1182 ev.m_pSrcTarget = m_pOwner; | 1155 ev.m_pSrcTarget = this; |
1183 m_pOwner->DispatchEvent(&ev); | 1156 DispatchEvent(&ev); |
1184 } | 1157 } |
OLD | NEW |