diff options
author | tsepez <tsepez@chromium.org> | 2016-06-02 14:17:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-02 14:17:40 -0700 |
commit | ad700c2c1fc3c3843dae71e5982f462e42efc987 (patch) | |
tree | 9d996c8101e0d467a278d51a90f0cf4889ef358e /xfa/fwl/basewidget | |
parent | ec409315f876bbac0e73abacfe73ef9bd1dd3db9 (diff) | |
download | pdfium-ad700c2c1fc3c3843dae71e5982f462e42efc987.tar.xz |
Replace FWL_HLISTITEM with class IFWL_ListItem {}
Make CFWL_ classes inherit from IFWL_ListItem.
Replace reinterpret_casts with static_casts.
Review-Url: https://codereview.chromium.org/2029923002
Diffstat (limited to 'xfa/fwl/basewidget')
-rw-r--r-- | xfa/fwl/basewidget/fwl_comboboximp.cpp | 34 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_listboximp.cpp | 234 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_listboximp.h | 38 | ||||
-rw-r--r-- | xfa/fwl/basewidget/ifwl_listbox.h | 43 |
4 files changed, 175 insertions, 174 deletions
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index 3e70cffffd..34e98fa38a 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -223,7 +223,7 @@ int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) { 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); CFX_WideString wsText; pData->GetItemText(m_pInterface, hItem, wsText); FX_STRSIZE pos = wsText.Find(wsMatch.c_str()); @@ -238,10 +238,10 @@ void CFWL_ComboListImp::ChangeSelected(int32_t iSel) { return; IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel); + IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iSel); CFX_RectF rtInvalidate; rtInvalidate.Reset(); - FWL_HLISTITEM hOld = GetSelItem(0); + IFWL_ListItem* hOld = GetSelItem(0); int32_t iOld = pData->GetItemIndex(m_pInterface, hOld); if (iOld == iSel) { return; @@ -253,7 +253,7 @@ void CFWL_ComboListImp::ChangeSelected(int32_t iSel) { CFX_RectF rect; GetItemRect(iSel, rect); rtInvalidate.Union(rect); - FWL_HLISTITEM hSel = pData->GetItem(m_pInterface, iSel); + IFWL_ListItem* hSel = pData->GetItem(m_pInterface, iSel); SetSelItem(hSel, TRUE); } if (!rtInvalidate.IsEmpty()) { @@ -268,7 +268,7 @@ int32_t CFWL_ComboListImp::CountItems() { void CFWL_ComboListImp::GetItemRect(int32_t nIndex, CFX_RectF& rtItem) { IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, nIndex); + IFWL_ListItem* hItem = pData->GetItem(m_pInterface, nIndex); pData->GetItemRect(m_pInterface, hItem, rtItem); } void CFWL_ComboListImp::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) { @@ -358,7 +358,7 @@ int32_t CFWL_ComboListImpDelegate::OnDropListMouseMove(CFWL_MsgMouse* pMsg) { return 1; } } - 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) { if (!m_pOwner->m_pProperties->m_pDataProvider) return 0; @@ -403,7 +403,7 @@ int32_t CFWL_ComboListImpDelegate::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) { } } pOuter->ShowDropList(FALSE); - 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) { pOuter->ProcessSelChanged(TRUE); } @@ -452,7 +452,7 @@ void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) { static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>( m_pOwner->m_pProperties->m_pDataProvider); - FWL_HLISTITEM hItem = + IFWL_ListItem* hItem = pData->GetItem(m_pOwner->m_pInterface, pOuter->m_iCurSel); hItem = m_pOwner->GetItem(hItem, dwKeyCode); if (!hItem) { @@ -657,7 +657,7 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, CFX_WideString wsText; IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); - FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); + IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel); static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) ->GetItemText(hItem, wsText); CFWL_ThemeText param; @@ -718,7 +718,7 @@ FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { CFX_WideString wsText; IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); - FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel); + IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iSel); static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) ->GetItemText(hItem, wsText); m_pEdit->SetText(wsText); @@ -757,7 +757,7 @@ FWL_Error CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, } else if (m_pListBox) { IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); - FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); + IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel); return m_pListBox->GetItemText(hItem, wsText); } return FWL_Error::Indefinite; @@ -997,7 +997,7 @@ void CFWL_ComboBoxImp::SynchrEditText(int32_t iListItem) { CFX_WideString wsText; IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); - FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iListItem); + IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iListItem); static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) ->GetItemText(hItem, wsText); m_pEdit->SetText(wsText); @@ -1026,7 +1026,7 @@ void CFWL_ComboBoxImp::Layout() { CFX_WideString wsText; IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); - FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); + IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel); static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) ->GetItemText(hItem, wsText); m_pEdit->LockUpdate(); @@ -1115,7 +1115,7 @@ void CFWL_ComboBoxImp::ProcessSelChanged(FX_BOOL bLButtonUp) { if (bDropDown) { IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); - FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); + IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel); if (hItem) { CFX_WideString wsText; pData->GetItemText(m_pInterface, hItem, wsText); @@ -1357,7 +1357,7 @@ void CFWL_ComboBoxImp::DisForm_Layout() { CFX_WideString wsText; IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); - FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); + IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel); static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) ->GetItemText(hItem, wsText); m_pEdit->LockUpdate(); @@ -1570,7 +1570,7 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { CFX_WideString wsTemp; IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>( m_pOwner->m_pProperties->m_pDataProvider); - FWL_HLISTITEM hItem = pData->GetItem(m_pOwner->m_pInterface, iCurSel); + IFWL_ListItem* hItem = pData->GetItem(m_pOwner->m_pInterface, iCurSel); static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) ->GetItemText(hItem, wsTemp); bMatchEqual = wsText == wsTemp; @@ -1721,7 +1721,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) { iCurSel = pComboList->MatchItem(wsText); if (iCurSel >= 0) { CFX_WideString wsTemp; - FWL_HLISTITEM item = m_pOwner->m_pListBox->GetSelItem(iCurSel); + IFWL_ListItem* item = m_pOwner->m_pListBox->GetSelItem(iCurSel); m_pOwner->m_pListBox->GetItemText(item, wsTemp); bMatchEqual = wsText == wsTemp; } diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index 9b05a7fee4..639a46c87b 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -46,18 +46,18 @@ 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) { - return static_cast<CFWL_ListBoxImp*>(GetImpl())->SetSelItem(hItem, bSelect); +FWL_Error IFWL_ListBox::SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect) { + return static_cast<CFWL_ListBoxImp*>(GetImpl())->SetSelItem(pItem, bSelect); } -FWL_Error IFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, +FWL_Error IFWL_ListBox::GetItemText(IFWL_ListItem* pItem, CFX_WideString& wsText) { - return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetItemText(hItem, wsText); + return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetItemText(pItem, wsText); } FWL_Error IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetScrollPos(fPos, bVert); @@ -217,18 +217,18 @@ 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); - if (!hItem) { + IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); + if (!pItem) { continue; } - uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hItem); + uint32_t dwStyle = pData->GetItemStyles(m_pInterface, pItem); if (dwStyle & FWL_ITEMSTATE_LTB_Selected) { iRet++; } } 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,14 +236,14 @@ 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); - if (!hItem) { + IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); + if (!pItem) { return NULL; } - uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hItem); + uint32_t dwStyle = pData->GetItemStyles(m_pInterface, pItem); if (dwStyle & FWL_ITEMSTATE_LTB_Selected) { if (index == nIndexSel) { - return hItem; + return pItem; } else { index++; } @@ -259,11 +259,11 @@ 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); - if (!hItem) { + IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); + if (!pItem) { return -1; } - uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hItem); + uint32_t dwStyle = pData->GetItemStyles(m_pInterface, pItem); if (dwStyle & FWL_ITEMSTATE_LTB_Selected) { if (index == nIndex) { return i; @@ -274,10 +274,10 @@ 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* pItem, FX_BOOL bSelect) { if (!m_pProperties->m_pDataProvider) return FWL_Error::Indefinite; - if (!hItem) { + if (!pItem) { if (bSelect) { SelectAll(); } else { @@ -287,21 +287,21 @@ FWL_Error CFWL_ListBoxImp::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { return FWL_Error::Indefinite; } if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) { - SetSelectionDirect(hItem, bSelect); + SetSelectionDirect(pItem, bSelect); } else { - SetSelection(hItem, hItem, bSelect); + SetSelection(pItem, pItem, bSelect); } return FWL_Error::Succeeded; } -FWL_Error CFWL_ListBoxImp::GetItemText(FWL_HLISTITEM hItem, +FWL_Error CFWL_ListBoxImp::GetItemText(IFWL_ListItem* pItem, CFX_WideString& wsText) { if (!m_pProperties->m_pDataProvider) return FWL_Error::Indefinite; IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - if (!hItem) + if (!pItem) return FWL_Error::Indefinite; - pData->GetItemText(m_pInterface, hItem, wsText); + pData->GetItemText(m_pInterface, pItem, wsText); return FWL_Error::Succeeded; } @@ -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* pItem, + uint32_t dwKeyCode) { + IFWL_ListItem* hRet = NULL; switch (dwKeyCode) { case FWL_VKEY_Up: case FWL_VKEY_Down: @@ -330,7 +330,7 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem, static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); int32_t iDstItem = -1; if (bUp || bDown) { - int32_t index = pData->GetItemIndex(m_pInterface, hItem); + int32_t index = pData->GetItemIndex(m_pInterface, pItem); iDstItem = dwKeyCode == FWL_VKEY_Up ? index - 1 : index + 1; } else if (bHome) { iDstItem = 0; @@ -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,27 +360,28 @@ 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); - SetSelectionDirect(hItem, FALSE); + IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); + SetSelectionDirect(pItem, FALSE); } } for (; iStart <= iEnd; iStart++) { - FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iStart); - SetSelectionDirect(hItem, bSelected); + IFWL_ListItem* pItem = pData->GetItem(m_pInterface, iStart); + SetSelectionDirect(pItem, bSelected); } } -void CFWL_ListBoxImp::SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect) { +void CFWL_ListBoxImp::SetSelectionDirect(IFWL_ListItem* pItem, + FX_BOOL bSelect) { IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - uint32_t dwOldStyle = pData->GetItemStyles(m_pInterface, hItem); + uint32_t dwOldStyle = pData->GetItemStyles(m_pInterface, pItem); bSelect ? dwOldStyle |= FWL_ITEMSTATE_LTB_Selected : dwOldStyle &= ~FWL_ITEMSTATE_LTB_Selected; - pData->SetItemStyles(m_pInterface, hItem, dwOldStyle); + pData->SetItemStyles(m_pInterface, pItem, dwOldStyle); } -FX_BOOL CFWL_ListBoxImp::IsItemSelected(FWL_HLISTITEM hItem) { +FX_BOOL CFWL_ListBoxImp::IsItemSelected(IFWL_ListItem* pItem) { IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - uint32_t dwState = pData->GetItemStyles(m_pInterface, hItem); + uint32_t dwState = pData->GetItemStyles(m_pInterface, pItem); return (dwState & FWL_ITEMSTATE_LTB_Selected) != 0; } void CFWL_ListBoxImp::ClearSelection() { @@ -390,11 +391,11 @@ 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); - uint32_t dwState = pData->GetItemStyles(m_pInterface, hItem); + IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); + uint32_t dwState = pData->GetItemStyles(m_pInterface, pItem); if (!(dwState & FWL_ITEMSTATE_LTB_Selected)) continue; - SetSelectionDirect(hItem, FALSE); + SetSelectionDirect(pItem, FALSE); if (!bMulti) return; } @@ -409,43 +410,43 @@ 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); - SetSelection(hItemStart, hItemEnd, FALSE); + IFWL_ListItem* pItemStart = pData->GetItem(m_pInterface, 0); + IFWL_ListItem* pItemEnd = pData->GetItem(m_pInterface, iCount - 1); + SetSelection(pItemStart, pItemEnd, 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); - if (!hItem) + IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); + if (!pItem) return NULL; - if (pData->GetItemStyles(m_pInterface, hItem) & FWL_ITEMSTATE_LTB_Focused) { - return hItem; + if (pData->GetItemStyles(m_pInterface, pItem) & FWL_ITEMSTATE_LTB_Focused) { + return pItem; } } return NULL; } -void CFWL_ListBoxImp::SetFocusItem(FWL_HLISTITEM hItem) { +void CFWL_ListBoxImp::SetFocusItem(IFWL_ListItem* pItem) { IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - FWL_HLISTITEM hFocus = GetFocusedItem(); - if (hItem != hFocus) { + IFWL_ListItem* hFocus = GetFocusedItem(); + if (pItem != hFocus) { if (hFocus) { uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hFocus); dwStyle &= ~FWL_ITEMSTATE_LTB_Focused; pData->SetItemStyles(m_pInterface, hFocus, dwStyle); } - if (hItem) { - uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hItem); + if (pItem) { + uint32_t dwStyle = pData->GetItemStyles(m_pInterface, pItem); dwStyle |= FWL_ITEMSTATE_LTB_Focused; - pData->SetItemStyles(m_pInterface, hItem, dwStyle); + pData->SetItemStyles(m_pInterface, pItem, dwStyle); } } } -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,20 +460,20 @@ 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); - if (!hItem) { + IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); + if (!pItem) { continue; } CFX_RectF rtItem; - pData->GetItemRect(m_pInterface, hItem, rtItem); + pData->GetItemRect(m_pInterface, pItem, rtItem); rtItem.Offset(-fPosX, -fPosY); if (rtItem.Contains(fx, fy)) { - return hItem; + return pItem; } } return NULL; } -FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(FWL_HLISTITEM hItem, +FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(IFWL_ListItem* pItem, CFX_RectF& rtCheck) { if (!m_pProperties->m_pDataProvider) return FALSE; @@ -481,10 +482,10 @@ FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(FWL_HLISTITEM hItem, } IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - pData->GetItemCheckRect(m_pInterface, hItem, rtCheck); + pData->GetItemCheckRect(m_pInterface, pItem, rtCheck); return TRUE; } -FX_BOOL CFWL_ListBoxImp::GetItemChecked(FWL_HLISTITEM hItem) { +FX_BOOL CFWL_ListBoxImp::GetItemChecked(IFWL_ListItem* pItem) { if (!m_pProperties->m_pDataProvider) return FALSE; if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) { @@ -492,10 +493,11 @@ FX_BOOL CFWL_ListBoxImp::GetItemChecked(FWL_HLISTITEM hItem) { } IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - return (pData->GetItemCheckState(m_pInterface, hItem) & + return (pData->GetItemCheckState(m_pInterface, pItem) & FWL_ITEMSTATE_LTB_Checked); } -FX_BOOL CFWL_ListBoxImp::SetItemChecked(FWL_HLISTITEM hItem, FX_BOOL bChecked) { +FX_BOOL CFWL_ListBoxImp::SetItemChecked(IFWL_ListItem* pItem, + FX_BOOL bChecked) { if (!m_pProperties->m_pDataProvider) return FALSE; if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) { @@ -503,17 +505,17 @@ FX_BOOL CFWL_ListBoxImp::SetItemChecked(FWL_HLISTITEM hItem, FX_BOOL bChecked) { } IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - pData->SetItemCheckState(m_pInterface, hItem, + pData->SetItemCheckState(m_pInterface, pItem, bChecked ? FWL_ITEMSTATE_LTB_Checked : 0); return TRUE; } -FX_BOOL CFWL_ListBoxImp::ScrollToVisible(FWL_HLISTITEM hItem) { +FX_BOOL CFWL_ListBoxImp::ScrollToVisible(IFWL_ListItem* pItem) { if (!m_pVertScrollBar) return FALSE; CFX_RectF rtItem; IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - pData->GetItemRect(m_pInterface, hItem, rtItem); + pData->GetItemRect(m_pInterface, pItem, rtItem); FX_BOOL bScroll = FALSE; FX_FLOAT fPosY = m_pVertScrollBar->GetPos(); rtItem.Offset(0, -fPosY + m_rtConent.top); @@ -578,12 +580,12 @@ 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); - if (!hItem) { + IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); + if (!pItem) { continue; } CFX_RectF rtItem; - pData->GetItemRect(m_pInterface, hItem, rtItem); + pData->GetItemRect(m_pInterface, pItem, rtItem); rtItem.Offset(m_rtConent.left - fPosX, m_rtConent.top - fPosY); if (rtItem.bottom() < m_rtConent.top) { continue; @@ -603,19 +605,19 @@ void CFWL_ListBoxImp::DrawItems(CFX_Graphics* pGraphics, ev.m_rect = rtItem; DispatchEvent(&ev); } else { - DrawItem(pGraphics, pTheme, hItem, i, rtItem, pMatrix); + DrawItem(pGraphics, pTheme, pItem, i, rtItem, pMatrix); } } } void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - FWL_HLISTITEM hItem, + IFWL_ListItem* pItem, int32_t Index, const CFX_RectF& rtItem, const CFX_Matrix* pMatrix) { IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - uint32_t dwItemStyles = pData->GetItemStyles(m_pInterface, hItem); + uint32_t dwItemStyles = pData->GetItemStyles(m_pInterface, pItem); uint32_t dwPartStates = CFWL_PartState_Normal; if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) { dwPartStates = CFWL_PartState_Disabled; @@ -649,7 +651,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, FX_BOOL bHasIcon = GetStylesEx() & FWL_STYLEEXT_LTB_Icon; if (bHasIcon) { CFX_RectF rtDIB; - CFX_DIBitmap* pDib = pData->GetItemIcon(m_pInterface, hItem); + CFX_DIBitmap* pDib = pData->GetItemIcon(m_pInterface, pItem); rtDIB.Set(rtItem.left, rtItem.top, rtItem.height, rtItem.height); if (pDib) { CFWL_ThemeBackground param; @@ -668,12 +670,12 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, CFX_RectF rtCheck; rtCheck.Set(rtItem.left, rtItem.top, rtItem.height, rtItem.height); rtCheck.Deflate(2, 2, 2, 2); - pData->SetItemCheckRect(m_pInterface, hItem, rtCheck); + pData->SetItemCheckRect(m_pInterface, pItem, rtCheck); CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; param.m_iPart = CFWL_Part::Check; param.m_pGraphics = pGraphics; - if (GetItemChecked(hItem)) { + if (GetItemChecked(pItem)) { param.m_dwStates = CFWL_PartState_Checked; } else { param.m_dwStates = CFWL_PartState_Normal; @@ -684,7 +686,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m); } CFX_WideString wsText; - pData->GetItemText(m_pInterface, hItem, wsText); + pData->GetItemText(m_pInterface, pItem, wsText); if (wsText.GetLength() <= 0) { return; } @@ -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* pItem = pData->GetItem(m_pInterface, i); CFWL_ThemePart itemPart; itemPart.m_pWidget = m_pInterface; itemPart.m_iPart = CFWL_Part::ListItem; @@ -745,7 +745,7 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) { rtItem.Set(m_rtClient.left, m_rtClient.top + fs.y, r.width, r.height); IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - pData->SetItemRect(m_pInterface, hItem, rtItem); + pData->SetItemRect(m_pInterface, pItem, rtItem); } fs.y += r.height; if (fs.x < r.width) { @@ -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* pItem, FX_FLOAT fWidth, FX_FLOAT m_fItemHeight, FX_BOOL bAutoSize) { @@ -888,7 +888,7 @@ void CFWL_ListBoxImp::GetItemSize(CFX_SizeF& size, rtItem.Set(0, size.y, fWidth, m_fItemHeight); IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - pData->SetItemRect(m_pInterface, hItem, rtItem); + pData->SetItemRect(m_pInterface, pItem, rtItem); } size.x = fWidth; size.y += m_fItemHeight; @@ -900,12 +900,12 @@ 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); - if (!hItem) { + IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); + if (!pItem) { continue; } CFX_WideString wsText; - pData->GetItemText(m_pInterface, hItem, wsText); + pData->GetItemText(m_pInterface, pItem, wsText); CFX_SizeF sz = CalcTextSize(wsText, m_pProperties->m_pThemeProvider); if (sz.x > fRet) { fRet = sz.x; @@ -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,46 +1061,46 @@ 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); - if (!hItem) { + IFWL_ListItem* pItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); + if (!pItem) { return; } if (m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) { if (pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl) { - FX_BOOL bSelected = m_pOwner->IsItemSelected(hItem); - m_pOwner->SetSelectionDirect(hItem, !bSelected); - m_pOwner->m_hAnchor = hItem; + FX_BOOL bSelected = m_pOwner->IsItemSelected(pItem); + m_pOwner->SetSelectionDirect(pItem, !bSelected); + m_pOwner->m_hAnchor = pItem; } else if (pMsg->m_dwFlags & FWL_KEYFLAG_Shift) { if (m_pOwner->m_hAnchor) { - m_pOwner->SetSelection(m_pOwner->m_hAnchor, hItem, TRUE); + m_pOwner->SetSelection(m_pOwner->m_hAnchor, pItem, TRUE); } else { - m_pOwner->SetSelectionDirect(hItem, TRUE); + m_pOwner->SetSelectionDirect(pItem, TRUE); } } else { - m_pOwner->SetSelection(hItem, hItem, TRUE); - m_pOwner->m_hAnchor = hItem; + m_pOwner->SetSelection(pItem, pItem, TRUE); + m_pOwner->m_hAnchor = pItem; } } else { - m_pOwner->SetSelection(hItem, hItem, TRUE); + m_pOwner->SetSelection(pItem, pItem, 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); - FX_BOOL bChecked = m_pOwner->GetItemChecked(hItem); + FX_BOOL bChecked = m_pOwner->GetItemChecked(pItem); if (rtCheck.Contains(pMsg->m_fx, pMsg->m_fy)) { if (bChecked) { - m_pOwner->SetItemChecked(hItem, FALSE); + m_pOwner->SetItemChecked(pItem, FALSE); } else { - m_pOwner->SetItemChecked(hItem, TRUE); + m_pOwner->SetItemChecked(pItem, TRUE); } m_pOwner->Update(); } } - m_pOwner->SetFocusItem(hItem); - m_pOwner->ScrollToVisible(hItem); + m_pOwner->SetFocusItem(pItem); + m_pOwner->ScrollToVisible(pItem); m_pOwner->SetGrab(TRUE); m_pOwner->ProcessSelChanged(); m_pOwner->Repaint(&m_pOwner->m_rtClient); @@ -1128,11 +1128,11 @@ 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(); - hItem = m_pOwner->GetItem(hItem, dwKeyCode); + IFWL_ListItem* pItem = m_pOwner->GetFocusedItem(); + pItem = m_pOwner->GetItem(pItem, dwKeyCode); FX_BOOL bShift = pMsg->m_dwFlags & FWL_KEYFLAG_Shift; FX_BOOL bCtrl = pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl; - OnVK(hItem, bShift, bCtrl); + OnVK(pItem, bShift, bCtrl); DispatchSelChangedEv(); m_pOwner->ProcessSelChanged(); break; @@ -1140,10 +1140,10 @@ void CFWL_ListBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { default: {} } } -void CFWL_ListBoxImpDelegate::OnVK(FWL_HLISTITEM hItem, +void CFWL_ListBoxImpDelegate::OnVK(IFWL_ListItem* pItem, FX_BOOL bShift, FX_BOOL bCtrl) { - if (!hItem) { + if (!pItem) { return; } if (m_pOwner->m_pProperties->m_dwStyleExes & @@ -1151,19 +1151,19 @@ void CFWL_ListBoxImpDelegate::OnVK(FWL_HLISTITEM hItem, if (bCtrl) { } else if (bShift) { if (m_pOwner->m_hAnchor) { - m_pOwner->SetSelection(m_pOwner->m_hAnchor, hItem, TRUE); + m_pOwner->SetSelection(m_pOwner->m_hAnchor, pItem, TRUE); } else { - m_pOwner->SetSelectionDirect(hItem, TRUE); + m_pOwner->SetSelectionDirect(pItem, TRUE); } } else { - m_pOwner->SetSelection(hItem, hItem, TRUE); - m_pOwner->m_hAnchor = hItem; + m_pOwner->SetSelection(pItem, pItem, TRUE); + m_pOwner->m_hAnchor = pItem; } } else { - m_pOwner->SetSelection(hItem, hItem, TRUE); + m_pOwner->SetSelection(pItem, pItem, TRUE); } - m_pOwner->SetFocusItem(hItem); - m_pOwner->ScrollToVisible(hItem); + m_pOwner->SetFocusItem(pItem); + m_pOwner->ScrollToVisible(pItem); { CFX_RectF rtInvalidate; rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width, diff --git a/xfa/fwl/basewidget/fwl_listboximp.h b/xfa/fwl/basewidget/fwl_listboximp.h index f32dece8dc..1a7a9419e5 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.h +++ b/xfa/fwl/basewidget/fwl_listboximp.h @@ -39,31 +39,31 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; int32_t CountSelItems(); - FWL_HLISTITEM GetSelItem(int32_t nIndexSel); + IFWL_ListItem* GetSelItem(int32_t nIndexSel); int32_t GetSelIndex(int32_t nIndex); - FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); - FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); + FWL_Error SetSelItem(IFWL_ListItem* hItem, FX_BOOL bSelect = TRUE); + FWL_Error GetItemText(IFWL_ListItem* hItem, CFX_WideString& wsText); FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); FWL_Error* Sort(IFWL_ListBoxCompare* pCom); protected: friend class CFWL_ListBoxImpDelegate; - FWL_HLISTITEM GetItem(FWL_HLISTITEM hItem, uint32_t dwKeyCode); - void SetSelection(FWL_HLISTITEM hStart, - FWL_HLISTITEM hEnd, + IFWL_ListItem* GetItem(IFWL_ListItem* hItem, uint32_t dwKeyCode); + void SetSelection(IFWL_ListItem* hStart, + IFWL_ListItem* hEnd, FX_BOOL bSelected); - void SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect); - FX_BOOL IsItemSelected(FWL_HLISTITEM hItem); + void SetSelectionDirect(IFWL_ListItem* hItem, FX_BOOL bSelect); + FX_BOOL IsItemSelected(IFWL_ListItem* hItem); void ClearSelection(); void SelectAll(); - FWL_HLISTITEM GetFocusedItem(); - void SetFocusItem(FWL_HLISTITEM hItem); - FWL_HLISTITEM GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); - FX_BOOL GetItemCheckRect(FWL_HLISTITEM hItem, CFX_RectF& rtCheck); - FX_BOOL SetItemChecked(FWL_HLISTITEM hItem, FX_BOOL bChecked); - FX_BOOL GetItemChecked(FWL_HLISTITEM hItem); - FX_BOOL ScrollToVisible(FWL_HLISTITEM hItem); + IFWL_ListItem* GetFocusedItem(); + void SetFocusItem(IFWL_ListItem* hItem); + IFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); + FX_BOOL GetItemCheckRect(IFWL_ListItem* hItem, CFX_RectF& rtCheck); + FX_BOOL SetItemChecked(IFWL_ListItem* hItem, FX_BOOL bChecked); + FX_BOOL GetItemChecked(IFWL_ListItem* hItem); + FX_BOOL ScrollToVisible(IFWL_ListItem* hItem); void DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix = NULL); @@ -72,14 +72,14 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { const CFX_Matrix* pMatrix = NULL); void DrawItem(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - FWL_HLISTITEM hItem, + IFWL_ListItem* hItem, int32_t Index, const CFX_RectF& rtItem, const CFX_Matrix* pMatrix = NULL); void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); CFX_SizeF CalcSize(FX_BOOL bAutoSize = FALSE); void GetItemSize(CFX_SizeF& size, - FWL_HLISTITEM hItem, + IFWL_ListItem* hItem, FX_FLOAT fWidth, FX_FLOAT fHeight, FX_BOOL bAutoSize = FALSE); @@ -97,7 +97,7 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; uint32_t m_dwTTOStyles; int32_t m_iTTOAligns; - FWL_HLISTITEM m_hAnchor; + IFWL_ListItem* m_hAnchor; FX_FLOAT m_fItemHeight; FX_FLOAT m_fScorllBarWidth; FX_BOOL m_bLButtonDown; @@ -117,7 +117,7 @@ class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); void OnKeyDown(CFWL_MsgKey* pMsg); - void OnVK(FWL_HLISTITEM hItem, FX_BOOL bShift, FX_BOOL bCtrl); + void OnVK(IFWL_ListItem* hItem, FX_BOOL bShift, FX_BOOL bCtrl); FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); void DispatchSelChangedEv(); CFWL_ListBoxImp* m_pOwner; diff --git a/xfa/fwl/basewidget/ifwl_listbox.h b/xfa/fwl/basewidget/ifwl_listbox.h index 9782cbbc29..c531cea9f3 100644 --- a/xfa/fwl/basewidget/ifwl_listbox.h +++ b/xfa/fwl/basewidget/ifwl_listbox.h @@ -29,8 +29,6 @@ #define FWL_ITEMSTATE_LTB_Focused (1L << 1) #define FWL_ITEMSTATE_LTB_Checked (1L << 2) -typedef struct FWL_HLISTITEM_ { void* pData; } * FWL_HLISTITEM; - class CFX_DIBitmap; BEGIN_FWL_EVENT_DEF(CFWL_EvtLtbSelChanged, CFWL_EventType::SelectChanged) @@ -44,51 +42,54 @@ int32_t m_index; CFX_RectF m_rect; END_FWL_EVENT_DEF +class IFWL_ListItem {}; + class IFWL_ListBoxDP : public IFWL_DataProvider { public: virtual int32_t CountItems(IFWL_Widget* pWidget) = 0; - virtual FWL_HLISTITEM GetItem(IFWL_Widget* pWidget, int32_t nIndex) = 0; - virtual int32_t GetItemIndex(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; + virtual IFWL_ListItem* GetItem(IFWL_Widget* pWidget, int32_t nIndex) = 0; + virtual int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) = 0; virtual FX_BOOL SetItemIndex(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, + IFWL_ListItem* pItem, int32_t nIndex) = 0; - virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; + virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, + IFWL_ListItem* pItem) = 0; virtual FWL_Error GetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, + IFWL_ListItem* pItem, CFX_WideString& wsText) = 0; virtual FWL_Error GetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, + IFWL_ListItem* pItem, CFX_RectF& rtItem) = 0; - virtual void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; + virtual void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) = 0; virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, + IFWL_ListItem* pItem, uint32_t dwStyle) = 0; virtual FWL_Error SetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, + IFWL_ListItem* pItem, const FX_WCHAR* pszText) = 0; virtual FWL_Error SetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, + IFWL_ListItem* pItem, const CFX_RectF& rtItem) = 0; virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0; virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem) = 0; + IFWL_ListItem* pItem) = 0; virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, + IFWL_ListItem* pItem, CFX_RectF& rtCheck) = 0; virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, + IFWL_ListItem* pItem, const CFX_RectF& rtCheck) = 0; virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem) = 0; + IFWL_ListItem* pItem) = 0; virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, + IFWL_ListItem* pItem, uint32_t dwCheckState) = 0; }; class IFWL_ListBoxCompare { public: virtual ~IFWL_ListBoxCompare() {} - virtual int32_t Compare(FWL_HLISTITEM hLeft, FWL_HLISTITEM hRight) = 0; + virtual int32_t Compare(IFWL_ListItem* hLeft, IFWL_ListItem* hRight) = 0; }; class IFWL_ListBox : public IFWL_Widget { @@ -100,10 +101,10 @@ class IFWL_ListBox : public IFWL_Widget { IFWL_Widget* pOuter); int32_t CountSelItems(); - FWL_HLISTITEM GetSelItem(int32_t nIndexSel); + IFWL_ListItem* GetSelItem(int32_t nIndexSel); int32_t GetSelIndex(int32_t nIndex); - FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); - FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); + FWL_Error SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect = TRUE); + FWL_Error GetItemText(IFWL_ListItem* pItem, CFX_WideString& wsText); FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); protected: |