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

Unified Diff: xfa/fwl/basewidget/fwl_listboximp.cpp

Issue 2029923002: Replace FWL_HLISTITEM with class IFWL_ListItem {} (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: xfa/fwl/basewidget/fwl_listboximp.cpp
diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp
index 9b05a7fee4a4a6dfb416baac3d811505c50ca345..fa0ceb72de4be2d57f790c68bb2a5d32988edc9a 100644
--- a/xfa/fwl/basewidget/fwl_listboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_listboximp.cpp
@@ -46,16 +46,16 @@ IFWL_ListBox::IFWL_ListBox() {}
int32_t IFWL_ListBox::CountSelItems() {
return static_cast<CFWL_ListBoxImp*>(GetImpl())->CountSelItems();
}
-FWL_HLISTITEM IFWL_ListBox::GetSelItem(int32_t nIndexSel) {
+IFWL_ListItem* IFWL_ListBox::GetSelItem(int32_t nIndexSel) {
return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetSelItem(nIndexSel);
}
int32_t IFWL_ListBox::GetSelIndex(int32_t nIndex) {
return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetSelIndex(nIndex);
}
-FWL_Error IFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
+FWL_Error IFWL_ListBox::SetSelItem(IFWL_ListItem* hItem, FX_BOOL bSelect) {
return static_cast<CFWL_ListBoxImp*>(GetImpl())->SetSelItem(hItem, bSelect);
}
-FWL_Error IFWL_ListBox::GetItemText(FWL_HLISTITEM hItem,
+FWL_Error IFWL_ListBox::GetItemText(IFWL_ListItem* hItem,
CFX_WideString& wsText) {
return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetItemText(hItem, wsText);
}
@@ -217,7 +217,7 @@ int32_t CFWL_ListBoxImp::CountSelItems() {
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
- FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
if (!hItem) {
continue;
}
@@ -228,7 +228,7 @@ int32_t CFWL_ListBoxImp::CountSelItems() {
}
return iRet;
}
-FWL_HLISTITEM CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) {
+IFWL_ListItem* CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) {
if (!m_pProperties->m_pDataProvider)
return NULL;
int32_t index = 0;
@@ -236,7 +236,7 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) {
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
- FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
if (!hItem) {
return NULL;
}
@@ -259,7 +259,7 @@ int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) {
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
- FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
dsinclair 2016/06/02 01:28:58 Should the variables in here be rename to p instea
Tom Sepez 2016/06/02 21:02:59 Done.
if (!hItem) {
return -1;
}
@@ -274,7 +274,7 @@ int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) {
}
return -1;
}
-FWL_Error CFWL_ListBoxImp::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
+FWL_Error CFWL_ListBoxImp::SetSelItem(IFWL_ListItem* hItem, FX_BOOL bSelect) {
if (!m_pProperties->m_pDataProvider)
return FWL_Error::Indefinite;
if (!hItem) {
@@ -293,7 +293,7 @@ FWL_Error CFWL_ListBoxImp::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ListBoxImp::GetItemText(FWL_HLISTITEM hItem,
+FWL_Error CFWL_ListBoxImp::GetItemText(IFWL_ListItem* hItem,
CFX_WideString& wsText) {
if (!m_pProperties->m_pDataProvider)
return FWL_Error::Indefinite;
@@ -315,9 +315,9 @@ FWL_Error CFWL_ListBoxImp::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) {
return FWL_Error::Indefinite;
}
-FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem,
- uint32_t dwKeyCode) {
- FWL_HLISTITEM hRet = NULL;
+IFWL_ListItem* CFWL_ListBoxImp::GetItem(IFWL_ListItem* hItem,
+ uint32_t dwKeyCode) {
+ IFWL_ListItem* hRet = NULL;
switch (dwKeyCode) {
case FWL_VKEY_Up:
case FWL_VKEY_Down:
@@ -345,8 +345,8 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem,
}
return hRet;
}
-void CFWL_ListBoxImp::SetSelection(FWL_HLISTITEM hStart,
- FWL_HLISTITEM hEnd,
+void CFWL_ListBoxImp::SetSelection(IFWL_ListItem* hStart,
+ IFWL_ListItem* hEnd,
FX_BOOL bSelected) {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
@@ -360,16 +360,17 @@ void CFWL_ListBoxImp::SetSelection(FWL_HLISTITEM hStart,
if (bSelected) {
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
- FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
SetSelectionDirect(hItem, FALSE);
}
}
for (; iStart <= iEnd; iStart++) {
- FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iStart);
+ IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iStart);
SetSelectionDirect(hItem, bSelected);
}
}
-void CFWL_ListBoxImp::SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
+void CFWL_ListBoxImp::SetSelectionDirect(IFWL_ListItem* hItem,
+ FX_BOOL bSelect) {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
uint32_t dwOldStyle = pData->GetItemStyles(m_pInterface, hItem);
@@ -377,7 +378,7 @@ void CFWL_ListBoxImp::SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
: dwOldStyle &= ~FWL_ITEMSTATE_LTB_Selected;
pData->SetItemStyles(m_pInterface, hItem, dwOldStyle);
}
-FX_BOOL CFWL_ListBoxImp::IsItemSelected(FWL_HLISTITEM hItem) {
+FX_BOOL CFWL_ListBoxImp::IsItemSelected(IFWL_ListItem* hItem) {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
uint32_t dwState = pData->GetItemStyles(m_pInterface, hItem);
@@ -390,7 +391,7 @@ void CFWL_ListBoxImp::ClearSelection() {
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
- FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
uint32_t dwState = pData->GetItemStyles(m_pInterface, hItem);
if (!(dwState & FWL_ITEMSTATE_LTB_Selected))
continue;
@@ -409,17 +410,17 @@ void CFWL_ListBoxImp::SelectAll() {
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
if (iCount > 0) {
- FWL_HLISTITEM hItemStart = pData->GetItem(m_pInterface, 0);
- FWL_HLISTITEM hItemEnd = pData->GetItem(m_pInterface, iCount - 1);
+ IFWL_ListItem* hItemStart = pData->GetItem(m_pInterface, 0);
+ IFWL_ListItem* hItemEnd = pData->GetItem(m_pInterface, iCount - 1);
SetSelection(hItemStart, hItemEnd, FALSE);
}
}
-FWL_HLISTITEM CFWL_ListBoxImp::GetFocusedItem() {
+IFWL_ListItem* CFWL_ListBoxImp::GetFocusedItem() {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
- FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
if (!hItem)
return NULL;
if (pData->GetItemStyles(m_pInterface, hItem) & FWL_ITEMSTATE_LTB_Focused) {
@@ -428,10 +429,10 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetFocusedItem() {
}
return NULL;
}
-void CFWL_ListBoxImp::SetFocusItem(FWL_HLISTITEM hItem) {
+void CFWL_ListBoxImp::SetFocusItem(IFWL_ListItem* hItem) {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- FWL_HLISTITEM hFocus = GetFocusedItem();
+ IFWL_ListItem* hFocus = GetFocusedItem();
if (hItem != hFocus) {
if (hFocus) {
uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hFocus);
@@ -445,7 +446,7 @@ void CFWL_ListBoxImp::SetFocusItem(FWL_HLISTITEM hItem) {
}
}
}
-FWL_HLISTITEM CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
+IFWL_ListItem* CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
fx -= m_rtConent.left, fy -= m_rtConent.top;
FX_FLOAT fPosX = 0.0f;
if (m_pHorzScrollBar) {
@@ -459,7 +460,7 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t nCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < nCount; i++) {
- FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
if (!hItem) {
continue;
}
@@ -472,7 +473,7 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
}
return NULL;
}
-FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(FWL_HLISTITEM hItem,
+FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(IFWL_ListItem* hItem,
CFX_RectF& rtCheck) {
if (!m_pProperties->m_pDataProvider)
return FALSE;
@@ -484,7 +485,7 @@ FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(FWL_HLISTITEM hItem,
pData->GetItemCheckRect(m_pInterface, hItem, rtCheck);
return TRUE;
}
-FX_BOOL CFWL_ListBoxImp::GetItemChecked(FWL_HLISTITEM hItem) {
+FX_BOOL CFWL_ListBoxImp::GetItemChecked(IFWL_ListItem* hItem) {
if (!m_pProperties->m_pDataProvider)
return FALSE;
if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) {
@@ -495,7 +496,8 @@ FX_BOOL CFWL_ListBoxImp::GetItemChecked(FWL_HLISTITEM hItem) {
return (pData->GetItemCheckState(m_pInterface, hItem) &
FWL_ITEMSTATE_LTB_Checked);
}
-FX_BOOL CFWL_ListBoxImp::SetItemChecked(FWL_HLISTITEM hItem, FX_BOOL bChecked) {
+FX_BOOL CFWL_ListBoxImp::SetItemChecked(IFWL_ListItem* hItem,
+ FX_BOOL bChecked) {
if (!m_pProperties->m_pDataProvider)
return FALSE;
if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) {
@@ -507,7 +509,7 @@ FX_BOOL CFWL_ListBoxImp::SetItemChecked(FWL_HLISTITEM hItem, FX_BOOL bChecked) {
bChecked ? FWL_ITEMSTATE_LTB_Checked : 0);
return TRUE;
}
-FX_BOOL CFWL_ListBoxImp::ScrollToVisible(FWL_HLISTITEM hItem) {
+FX_BOOL CFWL_ListBoxImp::ScrollToVisible(IFWL_ListItem* hItem) {
if (!m_pVertScrollBar)
return FALSE;
CFX_RectF rtItem;
@@ -578,7 +580,7 @@ void CFWL_ListBoxImp::DrawItems(CFX_Graphics* pGraphics,
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
- FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
if (!hItem) {
continue;
}
@@ -609,7 +611,7 @@ void CFWL_ListBoxImp::DrawItems(CFX_Graphics* pGraphics,
}
void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
- FWL_HLISTITEM hItem,
+ IFWL_ListItem* hItem,
int32_t Index,
const CFX_RectF& rtItem,
const CFX_Matrix* pMatrix) {
@@ -728,11 +730,9 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
if (m_pProperties->m_pThemeProvider->IsCustomizedLayout(m_pInterface)) {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- if (!bAutoSize) {
- }
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
- FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
CFWL_ThemePart itemPart;
itemPart.m_pWidget = m_pInterface;
itemPart.m_iPart = CFWL_Part::ListItem;
@@ -773,7 +773,7 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
}
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
- FWL_HLISTITEM htem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* htem = pData->GetItem(m_pInterface, i);
GetItemSize(fs, htem, fWidth, m_fItemHeight, bAutoSize);
}
}
@@ -877,7 +877,7 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
return fs;
}
void CFWL_ListBoxImp::GetItemSize(CFX_SizeF& size,
- FWL_HLISTITEM hItem,
+ IFWL_ListItem* hItem,
FX_FLOAT fWidth,
FX_FLOAT m_fItemHeight,
FX_BOOL bAutoSize) {
@@ -900,7 +900,7 @@ FX_FLOAT CFWL_ListBoxImp::GetMaxTextWidth() {
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
- FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
if (!hItem) {
continue;
}
@@ -957,7 +957,7 @@ void CFWL_ListBoxImp::ProcessSelChanged() {
CFX_Int32Array arrSels;
int32_t iCount = CountSelItems();
for (int32_t i = 0; i < iCount; i++) {
- FWL_HLISTITEM item = GetSelItem(i);
+ IFWL_ListItem* item = GetSelItem(i);
if (item == NULL) {
continue;
}
@@ -1061,7 +1061,7 @@ void CFWL_ListBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) {
m_pOwner->SetFocus(TRUE);
}
- FWL_HLISTITEM hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
+ IFWL_ListItem* hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
if (!hItem) {
return;
}
@@ -1085,7 +1085,7 @@ void CFWL_ListBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->SetSelection(hItem, hItem, TRUE);
}
if (m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check) {
- FWL_HLISTITEM hSelectedItem =
+ IFWL_ListItem* hSelectedItem =
m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
CFX_RectF rtCheck;
m_pOwner->GetItemCheckRect(hSelectedItem, rtCheck);
@@ -1128,7 +1128,7 @@ void CFWL_ListBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
case FWL_VKEY_Down:
case FWL_VKEY_Home:
case FWL_VKEY_End: {
- FWL_HLISTITEM hItem = m_pOwner->GetFocusedItem();
+ IFWL_ListItem* hItem = m_pOwner->GetFocusedItem();
hItem = m_pOwner->GetItem(hItem, dwKeyCode);
FX_BOOL bShift = pMsg->m_dwFlags & FWL_KEYFLAG_Shift;
FX_BOOL bCtrl = pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl;
@@ -1140,7 +1140,7 @@ void CFWL_ListBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
default: {}
}
}
-void CFWL_ListBoxImpDelegate::OnVK(FWL_HLISTITEM hItem,
+void CFWL_ListBoxImpDelegate::OnVK(IFWL_ListItem* hItem,
FX_BOOL bShift,
FX_BOOL bCtrl) {
if (!hItem) {

Powered by Google App Engine
This is Rietveld 408576698