Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: xfa/fwl/core/ifwl_listbox.cpp

Issue 2520413002: Rename common methods between ifwl and cfwl. (Closed)
Patch Set: Review cleanup Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 SetFocusItem(nullptr); 208 SetFocusItem(nullptr);
209 } 209 }
210 return; 210 return;
211 } 211 }
212 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) 212 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection)
213 SetSelectionDirect(pItem, bSelect); 213 SetSelectionDirect(pItem, bSelect);
214 else 214 else
215 SetSelection(pItem, pItem, bSelect); 215 SetSelection(pItem, pItem, bSelect);
216 } 216 }
217 217
218 void IFWL_ListBox::GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText) { 218 void IFWL_ListBox::GetDataProviderItemText(CFWL_ListItem* pItem,
Tom Sepez 2016/11/22 17:10:24 same
dsinclair 2016/11/22 17:24:37 Acknowledged.
219 CFX_WideString& wsText) {
219 if (!m_pProperties->m_pDataProvider) 220 if (!m_pProperties->m_pDataProvider)
220 return; 221 return;
221 222
222 IFWL_ListBox::DataProvider* pData = 223 IFWL_ListBox::DataProvider* pData =
223 static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); 224 static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider);
224 if (!pItem) 225 if (!pItem)
225 return; 226 return;
226 227
227 pData->GetItemText(this, pItem, wsText); 228 pData->GetItemText(this, pItem, wsText);
228 } 229 }
229 230
230 CFWL_ListItem* IFWL_ListBox::GetItem(CFWL_ListItem* pItem, uint32_t dwKeyCode) { 231 CFWL_ListItem* IFWL_ListBox::GetListItem(CFWL_ListItem* pItem,
232 uint32_t dwKeyCode) {
231 CFWL_ListItem* hRet = nullptr; 233 CFWL_ListItem* hRet = nullptr;
232 switch (dwKeyCode) { 234 switch (dwKeyCode) {
233 case FWL_VKEY_Up: 235 case FWL_VKEY_Up:
234 case FWL_VKEY_Down: 236 case FWL_VKEY_Down:
235 case FWL_VKEY_Home: 237 case FWL_VKEY_Home:
236 case FWL_VKEY_End: { 238 case FWL_VKEY_End: {
237 const bool bUp = dwKeyCode == FWL_VKEY_Up; 239 const bool bUp = dwKeyCode == FWL_VKEY_Up;
238 const bool bDown = dwKeyCode == FWL_VKEY_Down; 240 const bool bDown = dwKeyCode == FWL_VKEY_Down;
239 const bool bHome = dwKeyCode == FWL_VKEY_Home; 241 const bool bHome = dwKeyCode == FWL_VKEY_Home;
240 IFWL_ListBox::DataProvider* pData = 242 IFWL_ListBox::DataProvider* pData =
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 386
385 CFX_RectF rtItem; 387 CFX_RectF rtItem;
386 pData->GetItemRect(this, pItem, rtItem); 388 pData->GetItemRect(this, pItem, rtItem);
387 rtItem.Offset(-fPosX, -fPosY); 389 rtItem.Offset(-fPosX, -fPosY);
388 if (rtItem.Contains(fx, fy)) 390 if (rtItem.Contains(fx, fy))
389 return pItem; 391 return pItem;
390 } 392 }
391 return nullptr; 393 return nullptr;
392 } 394 }
393 395
394 bool IFWL_ListBox::GetItemCheckRect(CFWL_ListItem* pItem, CFX_RectF& rtCheck) { 396 bool IFWL_ListBox::GetItemCheckRectInternal(CFWL_ListItem* pItem,
397 CFX_RectF& rtCheck) {
395 if (!m_pProperties->m_pDataProvider) 398 if (!m_pProperties->m_pDataProvider)
396 return false; 399 return false;
397 if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) 400 if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check))
398 return false; 401 return false;
399 402
400 IFWL_ListBox::DataProvider* pData = 403 IFWL_ListBox::DataProvider* pData =
401 static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); 404 static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider);
402 pData->GetItemCheckRect(this, pItem, rtCheck); 405 pData->GetItemCheckRect(this, pItem, rtCheck);
403 return true; 406 return true;
404 } 407 }
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 } else { 931 } else {
929 SetSelection(pItem, pItem, true); 932 SetSelection(pItem, pItem, true);
930 m_hAnchor = pItem; 933 m_hAnchor = pItem;
931 } 934 }
932 } else { 935 } else {
933 SetSelection(pItem, pItem, true); 936 SetSelection(pItem, pItem, true);
934 } 937 }
935 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check) { 938 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check) {
936 CFWL_ListItem* hSelectedItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); 939 CFWL_ListItem* hSelectedItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
937 CFX_RectF rtCheck; 940 CFX_RectF rtCheck;
938 GetItemCheckRect(hSelectedItem, rtCheck); 941 GetItemCheckRectInternal(hSelectedItem, rtCheck);
939 bool bChecked = GetItemChecked(pItem); 942 bool bChecked = GetItemChecked(pItem);
940 if (rtCheck.Contains(pMsg->m_fx, pMsg->m_fy)) { 943 if (rtCheck.Contains(pMsg->m_fx, pMsg->m_fy)) {
941 SetItemChecked(pItem, !bChecked); 944 SetItemChecked(pItem, !bChecked);
942 Update(); 945 Update();
943 } 946 }
944 } 947 }
945 SetFocusItem(pItem); 948 SetFocusItem(pItem);
946 ScrollToVisible(pItem); 949 ScrollToVisible(pItem);
947 SetGrab(true); 950 SetGrab(true);
948 Repaint(&m_rtClient); 951 Repaint(&m_rtClient);
(...skipping 14 matching lines...) Expand all
963 966
964 void IFWL_ListBox::OnKeyDown(CFWL_MsgKey* pMsg) { 967 void IFWL_ListBox::OnKeyDown(CFWL_MsgKey* pMsg) {
965 uint32_t dwKeyCode = pMsg->m_dwKeyCode; 968 uint32_t dwKeyCode = pMsg->m_dwKeyCode;
966 switch (dwKeyCode) { 969 switch (dwKeyCode) {
967 case FWL_VKEY_Tab: 970 case FWL_VKEY_Tab:
968 case FWL_VKEY_Up: 971 case FWL_VKEY_Up:
969 case FWL_VKEY_Down: 972 case FWL_VKEY_Down:
970 case FWL_VKEY_Home: 973 case FWL_VKEY_Home:
971 case FWL_VKEY_End: { 974 case FWL_VKEY_End: {
972 CFWL_ListItem* pItem = GetFocusedItem(); 975 CFWL_ListItem* pItem = GetFocusedItem();
973 pItem = GetItem(pItem, dwKeyCode); 976 pItem = GetListItem(pItem, dwKeyCode);
974 bool bShift = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Shift); 977 bool bShift = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Shift);
975 bool bCtrl = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl); 978 bool bCtrl = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl);
976 OnVK(pItem, bShift, bCtrl); 979 OnVK(pItem, bShift, bCtrl);
977 break; 980 break;
978 } 981 }
979 default: 982 default:
980 break; 983 break;
981 } 984 }
982 } 985 }
983 986
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 case FWL_SCBCODE::EndScroll: 1060 case FWL_SCBCODE::EndScroll:
1058 return false; 1061 return false;
1059 } 1062 }
1060 if (iCurPos != fPos) { 1063 if (iCurPos != fPos) {
1061 pScrollBar->SetPos(fPos); 1064 pScrollBar->SetPos(fPos);
1062 pScrollBar->SetTrackPos(fPos); 1065 pScrollBar->SetTrackPos(fPos);
1063 Repaint(&m_rtClient); 1066 Repaint(&m_rtClient);
1064 } 1067 }
1065 return true; 1068 return true;
1066 } 1069 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698