Nest CFWL_ListItem as CFWL_ListBox::Item.
Its name is currently too similar to those of CFWL_Widget sub-classes,
so this makes it clearer that it is not one.
-- Remove a few locals where not needed.
Change-Id: I68e15690197001e3e925fc8e7eeba7a23a64322a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/72917
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fwl/BUILD.gn b/xfa/fwl/BUILD.gn
index bdb2e4a..634237e 100644
--- a/xfa/fwl/BUILD.gn
+++ b/xfa/fwl/BUILD.gn
@@ -45,8 +45,6 @@
"cfwl_eventvalidate.h",
"cfwl_listbox.cpp",
"cfwl_listbox.h",
- "cfwl_listitem.cpp",
- "cfwl_listitem.h",
"cfwl_message.cpp",
"cfwl_message.h",
"cfwl_messagekey.cpp",
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index d3e9949..4cace71 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -123,7 +123,7 @@
}
WideString CFWL_ComboBox::GetTextByIndex(int32_t iIndex) const {
- CFWL_ListItem* pItem = static_cast<CFWL_ListItem*>(
+ auto* pItem = static_cast<CFWL_ListBox::Item*>(
m_pListBox->GetItem(m_pListBox.get(), iIndex));
return pItem ? pItem->GetText() : WideString();
}
@@ -135,7 +135,7 @@
if (bClearSel) {
m_pEdit->SetText(WideString());
} else {
- CFWL_ListItem* hItem = m_pListBox->GetItem(this, iSel);
+ CFWL_ListBox::Item* hItem = m_pListBox->GetItem(this, iSel);
m_pEdit->SetText(hItem ? hItem->GetText() : WideString());
}
m_pEdit->Update();
@@ -173,7 +173,7 @@
if (!m_pListBox)
return WideString();
- CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
+ CFWL_ListBox::Item* hItem = m_pListBox->GetItem(this, m_iCurSel);
return hItem ? hItem->GetText() : WideString();
}
@@ -256,7 +256,7 @@
}
void CFWL_ComboBox::SyncEditText(int32_t iListItem) {
- CFWL_ListItem* hItem = m_pListBox->GetItem(this, iListItem);
+ CFWL_ListBox::Item* hItem = m_pListBox->GetItem(this, iListItem);
m_pEdit->SetText(hItem ? hItem->GetText() : WideString());
m_pEdit->Update();
m_pEdit->SetSelected();
@@ -289,7 +289,7 @@
m_pEdit->SetWidgetRect(rtEdit);
if (m_iCurSel >= 0) {
- CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
+ CFWL_ListBox::Item* hItem = m_pListBox->GetItem(this, m_iCurSel);
ScopedUpdateLock update_lock(m_pEdit.get());
m_pEdit->SetText(hItem ? hItem->GetText() : WideString());
}
@@ -358,7 +358,7 @@
return;
}
- CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
+ CFWL_ListBox::Item* hItem = m_pListBox->GetItem(this, m_iCurSel);
if (!hItem)
return;
if (m_pEdit) {
@@ -501,7 +501,7 @@
WideString wsText = m_pEdit->GetText();
iCurSel = pComboList->MatchItem(wsText.AsStringView());
if (iCurSel >= 0) {
- CFWL_ListItem* item = m_pListBox->GetSelItem(iCurSel);
+ CFWL_ListBox::Item* item = m_pListBox->GetSelItem(iCurSel);
bMatchEqual = wsText == (item ? item->GetText() : WideString());
}
}
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp
index 709c24a..6a34453 100644
--- a/xfa/fwl/cfwl_combolist.cpp
+++ b/xfa/fwl/cfwl_combolist.cpp
@@ -29,7 +29,7 @@
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- CFWL_ListItem* hItem = GetItem(this, i);
+ CFWL_ListBox::Item* hItem = GetItem(this, i);
WideString wsText = hItem ? hItem->GetText() : WideString();
auto pos = wsText.Find(wsMatch);
if (pos.has_value() && pos.value() == 0)
@@ -39,22 +39,22 @@
}
void CFWL_ComboList::ChangeSelected(int32_t iSel) {
- CFWL_ListItem* hItem = GetItem(this, iSel);
- CFWL_ListItem* hOld = GetSelItem(0);
+ CFWL_ListBox::Item* hItem = GetItem(this, iSel);
+ CFWL_ListBox::Item* hOld = GetSelItem(0);
int32_t iOld = GetItemIndex(this, hOld);
if (iOld == iSel)
return;
CFX_RectF rtInvalidate;
if (iOld > -1) {
- if (CFWL_ListItem* hOldItem = GetItem(this, iOld))
+ if (CFWL_ListBox::Item* hOldItem = GetItem(this, iOld))
rtInvalidate = hOldItem->GetRect();
SetSelItem(hOld, false);
}
if (hItem) {
- if (CFWL_ListItem* hOldItem = GetItem(this, iSel))
+ if (CFWL_ListBox::Item* hOldItem = GetItem(this, iSel))
rtInvalidate.Union(hOldItem->GetRect());
- CFWL_ListItem* hSel = GetItem(this, iSel);
+ CFWL_ListBox::Item* hSel = GetItem(this, iSel);
SetSelItem(hSel, true);
}
if (!rtInvalidate.IsEmpty())
@@ -132,7 +132,7 @@
return;
}
- CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_pos);
+ CFWL_ListBox::Item* hItem = GetItemAtPoint(pMsg->m_pos);
if (!hItem)
return;
@@ -169,7 +169,7 @@
}
pOuter->ShowDropList(false);
- CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_pos);
+ CFWL_ListBox::Item* hItem = GetItemAtPoint(pMsg->m_pos);
if (hItem)
pOuter->ProcessSelChanged(true);
}
@@ -215,7 +215,7 @@
case XFA_FWL_VKEY_Home:
case XFA_FWL_VKEY_End: {
CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(GetOuter());
- CFWL_ListItem* hItem = GetItem(this, pOuter->GetCurrentSelection());
+ CFWL_ListBox::Item* hItem = GetItem(this, pOuter->GetCurrentSelection());
hItem = GetListItem(hItem, dwKeyCode);
if (!hItem)
break;
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index 61fb83a..27f694e 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -103,7 +103,7 @@
int32_t iRet = 0;
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- CFWL_ListItem* pItem = GetItem(this, i);
+ Item* pItem = GetItem(this, i);
if (!pItem)
continue;
if (pItem->GetStates() & FWL_ITEMSTATE_LTB_Selected)
@@ -112,7 +112,7 @@
return iRet;
}
-CFWL_ListItem* CFWL_ListBox::GetSelItem(int32_t nIndexSel) {
+CFWL_ListBox::Item* CFWL_ListBox::GetSelItem(int32_t nIndexSel) {
int32_t idx = GetSelIndex(nIndexSel);
if (idx < 0)
return nullptr;
@@ -123,7 +123,7 @@
int32_t index = 0;
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- CFWL_ListItem* pItem = GetItem(this, i);
+ Item* pItem = GetItem(this, i);
if (!pItem)
return -1;
if (pItem->GetStates() & FWL_ITEMSTATE_LTB_Selected) {
@@ -135,7 +135,7 @@
return -1;
}
-void CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) {
+void CFWL_ListBox::SetSelItem(Item* pItem, bool bSelect) {
if (!pItem) {
if (bSelect) {
SelectAll();
@@ -151,9 +151,8 @@
SetSelection(pItem, pItem, bSelect);
}
-CFWL_ListItem* CFWL_ListBox::GetListItem(CFWL_ListItem* pItem,
- uint32_t dwKeyCode) {
- CFWL_ListItem* hRet = nullptr;
+CFWL_ListBox::Item* CFWL_ListBox::GetListItem(Item* pItem, uint32_t dwKeyCode) {
+ Item* hRet = nullptr;
switch (dwKeyCode) {
case XFA_FWL_VKEY_Up:
case XFA_FWL_VKEY_Down:
@@ -181,9 +180,7 @@
return hRet;
}
-void CFWL_ListBox::SetSelection(CFWL_ListItem* hStart,
- CFWL_ListItem* hEnd,
- bool bSelected) {
+void CFWL_ListBox::SetSelection(Item* hStart, Item* hEnd, bool bSelected) {
int32_t iStart = GetItemIndex(this, hStart);
int32_t iEnd = GetItemIndex(this, hEnd);
if (iStart > iEnd) {
@@ -193,18 +190,14 @@
}
if (bSelected) {
int32_t iCount = CountItems(this);
- for (int32_t i = 0; i < iCount; i++) {
- CFWL_ListItem* pItem = GetItem(this, i);
- SetSelectionDirect(pItem, false);
- }
+ for (int32_t i = 0; i < iCount; i++)
+ SetSelectionDirect(GetItem(this, i), false);
}
- for (; iStart <= iEnd; iStart++) {
- CFWL_ListItem* pItem = GetItem(this, iStart);
- SetSelectionDirect(pItem, bSelected);
- }
+ for (; iStart <= iEnd; iStart++)
+ SetSelectionDirect(GetItem(this, iStart), bSelected);
}
-void CFWL_ListBox::SetSelectionDirect(CFWL_ListItem* pItem, bool bSelect) {
+void CFWL_ListBox::SetSelectionDirect(Item* pItem, bool bSelect) {
if (!pItem)
return;
@@ -218,7 +211,7 @@
return m_Properties.m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection;
}
-bool CFWL_ListBox::IsItemSelected(CFWL_ListItem* pItem) {
+bool CFWL_ListBox::IsItemSelected(Item* pItem) {
return pItem && (pItem->GetStates() & FWL_ITEMSTATE_LTB_Selected) != 0;
}
@@ -226,7 +219,7 @@
bool bMulti = IsMultiSelection();
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- CFWL_ListItem* pItem = GetItem(this, i);
+ Item* pItem = GetItem(this, i);
if (!pItem)
continue;
if (!(pItem->GetStates() & FWL_ITEMSTATE_LTB_Selected))
@@ -245,15 +238,15 @@
if (iCount <= 0)
return;
- CFWL_ListItem* pItemStart = GetItem(this, 0);
- CFWL_ListItem* pItemEnd = GetItem(this, iCount - 1);
+ Item* pItemStart = GetItem(this, 0);
+ Item* pItemEnd = GetItem(this, iCount - 1);
SetSelection(pItemStart, pItemEnd, false);
}
-CFWL_ListItem* CFWL_ListBox::GetFocusedItem() {
+CFWL_ListBox::Item* CFWL_ListBox::GetFocusedItem() {
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- CFWL_ListItem* pItem = GetItem(this, i);
+ Item* pItem = GetItem(this, i);
if (!pItem)
return nullptr;
if (pItem->GetStates() & FWL_ITEMSTATE_LTB_Focused)
@@ -262,8 +255,8 @@
return nullptr;
}
-void CFWL_ListBox::SetFocusItem(CFWL_ListItem* pItem) {
- CFWL_ListItem* hFocus = GetFocusedItem();
+void CFWL_ListBox::SetFocusItem(Item* pItem) {
+ Item* hFocus = GetFocusedItem();
if (pItem == hFocus)
return;
@@ -279,7 +272,7 @@
}
}
-CFWL_ListItem* CFWL_ListBox::GetItemAtPoint(const CFX_PointF& point) {
+CFWL_ListBox::Item* CFWL_ListBox::GetItemAtPoint(const CFX_PointF& point) {
CFX_PointF pos = point - m_ContentRect.TopLeft();
float fPosX = 0.0f;
if (m_pHorzScrollBar)
@@ -291,7 +284,7 @@
int32_t nCount = CountItems(this);
for (int32_t i = 0; i < nCount; i++) {
- CFWL_ListItem* pItem = GetItem(this, i);
+ Item* pItem = GetItem(this, i);
if (!pItem)
continue;
@@ -303,7 +296,7 @@
return nullptr;
}
-bool CFWL_ListBox::ScrollToVisible(CFWL_ListItem* pItem) {
+bool CFWL_ListBox::ScrollToVisible(Item* pItem) {
if (!m_pVertScrollBar)
return false;
@@ -364,7 +357,7 @@
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- CFWL_ListItem* pItem = GetItem(this, i);
+ CFWL_ListBox::Item* pItem = GetItem(this, i);
if (!pItem)
continue;
@@ -379,7 +372,7 @@
}
void CFWL_ListBox::DrawItem(CXFA_Graphics* pGraphics,
- CFWL_ListItem* pItem,
+ Item* pItem,
int32_t Index,
const CFX_RectF& rtItem,
const CFX_Matrix* pMatrix) {
@@ -462,7 +455,7 @@
int32_t iCount = CountItems(this);
CFX_SizeF fs;
for (int32_t i = 0; i < iCount; i++) {
- CFWL_ListItem* htem = GetItem(this, i);
+ Item* htem = GetItem(this, i);
UpdateItemSize(htem, fs, fWidth, m_fItemHeight, bAutoSize);
}
if (bAutoSize)
@@ -548,7 +541,7 @@
return fs;
}
-void CFWL_ListBox::UpdateItemSize(CFWL_ListItem* pItem,
+void CFWL_ListBox::UpdateItemSize(Item* pItem,
CFX_SizeF& size,
float fWidth,
float fItemHeight,
@@ -565,7 +558,7 @@
float fRet = 0.0f;
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- CFWL_ListItem* pItem = GetItem(this, i);
+ Item* pItem = GetItem(this, i);
if (!pItem)
continue;
@@ -701,7 +694,7 @@
void CFWL_ListBox::OnLButtonDown(CFWL_MessageMouse* pMsg) {
m_bLButtonDown = true;
- CFWL_ListItem* pItem = GetItemAtPoint(pMsg->m_pos);
+ Item* pItem = GetItemAtPoint(pMsg->m_pos);
if (!pItem)
return;
@@ -750,8 +743,7 @@
case XFA_FWL_VKEY_Down:
case XFA_FWL_VKEY_Home:
case XFA_FWL_VKEY_End: {
- CFWL_ListItem* pItem = GetFocusedItem();
- pItem = GetListItem(pItem, dwKeyCode);
+ Item* pItem = GetListItem(GetFocusedItem(), dwKeyCode);
bool bShift = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Shift);
bool bCtrl = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl);
OnVK(pItem, bShift, bCtrl);
@@ -762,7 +754,7 @@
}
}
-void CFWL_ListBox::OnVK(CFWL_ListItem* pItem, bool bShift, bool bCtrl) {
+void CFWL_ListBox::OnVK(Item* pItem, bool bShift, bool bCtrl) {
if (!pItem)
return;
@@ -846,24 +838,23 @@
return pdfium::CollectionSize<int32_t>(m_ItemArray);
}
-CFWL_ListItem* CFWL_ListBox::GetItem(const CFWL_Widget* pWidget,
- int32_t nIndex) const {
+CFWL_ListBox::Item* CFWL_ListBox::GetItem(const CFWL_Widget* pWidget,
+ int32_t nIndex) const {
if (nIndex < 0 || nIndex >= CountItems(pWidget))
return nullptr;
return m_ItemArray[nIndex].get();
}
-int32_t CFWL_ListBox::GetItemIndex(CFWL_Widget* pWidget, CFWL_ListItem* pItem) {
- auto it =
- std::find_if(m_ItemArray.begin(), m_ItemArray.end(),
- [pItem](const std::unique_ptr<CFWL_ListItem>& candidate) {
- return candidate.get() == pItem;
- });
+int32_t CFWL_ListBox::GetItemIndex(CFWL_Widget* pWidget, Item* pItem) {
+ auto it = std::find_if(m_ItemArray.begin(), m_ItemArray.end(),
+ [pItem](const std::unique_ptr<Item>& candidate) {
+ return candidate.get() == pItem;
+ });
return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1;
}
-CFWL_ListItem* CFWL_ListBox::AddString(const WideString& wsAdd) {
- m_ItemArray.emplace_back(std::make_unique<CFWL_ListItem>(wsAdd));
+CFWL_ListBox::Item* CFWL_ListBox::AddString(const WideString& wsAdd) {
+ m_ItemArray.push_back(std::make_unique<Item>(wsAdd));
return m_ItemArray.back().get();
}
@@ -873,7 +864,7 @@
m_ItemArray.erase(m_ItemArray.begin() + iIndex);
}
-void CFWL_ListBox::DeleteString(CFWL_ListItem* pItem) {
+void CFWL_ListBox::DeleteString(Item* pItem) {
int32_t nIndex = GetItemIndex(this, pItem);
if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size())
return;
@@ -882,7 +873,8 @@
if (iSel >= CountItems(this))
iSel = nIndex - 1;
if (iSel >= 0) {
- if (CFWL_ListItem* item = GetItem(this, iSel))
+ Item* item = GetItem(this, iSel);
+ if (item)
item->SetStates(item->GetStates() | FWL_ITEMSTATE_LTB_Selected);
}
@@ -892,3 +884,7 @@
void CFWL_ListBox::DeleteAll() {
m_ItemArray.clear();
}
+
+CFWL_ListBox::Item::Item(const WideString& text) : m_wsText(text) {}
+
+CFWL_ListBox::Item::~Item() = default;
diff --git a/xfa/fwl/cfwl_listbox.h b/xfa/fwl/cfwl_listbox.h
index 685d910..cd36e94 100644
--- a/xfa/fwl/cfwl_listbox.h
+++ b/xfa/fwl/cfwl_listbox.h
@@ -13,7 +13,6 @@
#include "xfa/fwl/cfwl_edit.h"
#include "xfa/fwl/cfwl_event.h"
#include "xfa/fwl/cfwl_listbox.h"
-#include "xfa/fwl/cfwl_listitem.h"
#include "xfa/fwl/cfwl_widget.h"
#define FWL_STYLEEXT_LTB_MultiSelection (1L << 0)
@@ -32,6 +31,23 @@
class CFWL_ListBox : public CFWL_Widget {
public:
+ class Item {
+ public:
+ explicit Item(const WideString& text);
+ ~Item();
+
+ CFX_RectF GetRect() const { return m_ItemRect; }
+ void SetRect(const CFX_RectF& rect) { m_ItemRect = rect; }
+ uint32_t GetStates() const { return m_dwStates; }
+ void SetStates(uint32_t dwStates) { m_dwStates = dwStates; }
+ WideString GetText() const { return m_wsText; }
+
+ private:
+ uint32_t m_dwStates = 0;
+ CFX_RectF m_ItemRect;
+ WideString m_wsText;
+ };
+
CFWL_ListBox(const CFWL_App* pApp,
const Properties& properties,
CFWL_Widget* pOuter);
@@ -48,27 +64,24 @@
const CFX_Matrix& matrix) override;
int32_t CountItems(const CFWL_Widget* pWidget) const;
- CFWL_ListItem* GetItem(const CFWL_Widget* pWidget, int32_t nIndex) const;
- int32_t GetItemIndex(CFWL_Widget* pWidget, CFWL_ListItem* pItem);
-
- CFWL_ListItem* AddString(const WideString& wsAdd);
+ Item* GetItem(const CFWL_Widget* pWidget, int32_t nIndex) const;
+ int32_t GetItemIndex(CFWL_Widget* pWidget, Item* pItem);
+ Item* AddString(const WideString& wsAdd);
void RemoveAt(int32_t iIndex);
- void DeleteString(CFWL_ListItem* pItem);
+ void DeleteString(Item* pItem);
void DeleteAll();
-
int32_t CountSelItems();
- CFWL_ListItem* GetSelItem(int32_t nIndexSel);
+ Item* GetSelItem(int32_t nIndexSel);
int32_t GetSelIndex(int32_t nIndex);
- void SetSelItem(CFWL_ListItem* hItem, bool bSelect);
-
+ void SetSelItem(Item* hItem, bool bSelect);
float GetItemHeight() const { return m_fItemHeight; }
float CalcItemHeight();
protected:
- CFWL_ListItem* GetListItem(CFWL_ListItem* hItem, uint32_t dwKeyCode);
- void SetSelection(CFWL_ListItem* hStart, CFWL_ListItem* hEnd, bool bSelected);
- CFWL_ListItem* GetItemAtPoint(const CFX_PointF& point);
- bool ScrollToVisible(CFWL_ListItem* hItem);
+ Item* GetListItem(Item* hItem, uint32_t dwKeyCode);
+ void SetSelection(Item* hStart, Item* hEnd, bool bSelected);
+ Item* GetItemAtPoint(const CFX_PointF& point);
+ bool ScrollToVisible(Item* hItem);
void InitVerticalScrollBar();
void InitHorizontalScrollBar();
bool IsShowScrollBar(bool bVert);
@@ -76,25 +89,23 @@
const CFX_RectF& GetRTClient() const { return m_ClientRect; }
private:
- void SetSelectionDirect(CFWL_ListItem* hItem, bool bSelect);
+ void SetSelectionDirect(Item* hItem, bool bSelect);
bool IsMultiSelection() const;
- bool IsItemSelected(CFWL_ListItem* hItem);
+ bool IsItemSelected(Item* hItem);
void ClearSelection();
void SelectAll();
- CFWL_ListItem* GetFocusedItem();
- void SetFocusItem(CFWL_ListItem* hItem);
- void DrawBkground(CXFA_Graphics* pGraphics,
- const CFX_Matrix* pMatrix);
- void DrawItems(CXFA_Graphics* pGraphics,
- const CFX_Matrix* pMatrix);
+ Item* GetFocusedItem();
+ void SetFocusItem(Item* hItem);
+ void DrawBkground(CXFA_Graphics* pGraphics, const CFX_Matrix* pMatrix);
+ void DrawItems(CXFA_Graphics* pGraphics, const CFX_Matrix* pMatrix);
void DrawItem(CXFA_Graphics* pGraphics,
- CFWL_ListItem* hItem,
+ Item* hItem,
int32_t Index,
const CFX_RectF& rtItem,
const CFX_Matrix* pMatrix);
void DrawStatic(CXFA_Graphics* pGraphics);
CFX_SizeF CalcSize(bool bAutoSize);
- void UpdateItemSize(CFWL_ListItem* hItem,
+ void UpdateItemSize(Item* hItem,
CFX_SizeF& size,
float fWidth,
float fHeight,
@@ -107,7 +118,7 @@
void OnLButtonUp(CFWL_MessageMouse* pMsg);
void OnMouseWheel(CFWL_MessageMouseWheel* pMsg);
void OnKeyDown(CFWL_MessageKey* pMsg);
- void OnVK(CFWL_ListItem* hItem, bool bShift, bool bCtrl);
+ void OnVK(Item* hItem, bool bShift, bool bCtrl);
bool OnScroll(CFWL_ScrollBar* pScrollBar,
CFWL_EventScroll::Code dwCode,
float fPos);
@@ -122,8 +133,8 @@
bool m_bLButtonDown = false;
float m_fItemHeight = 0.0f;
float m_fScorllBarWidth = 0.0f;
- CFWL_ListItem* m_hAnchor = nullptr;
- std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray;
+ Item* m_hAnchor = nullptr;
+ std::vector<std::unique_ptr<Item>> m_ItemArray;
};
#endif // XFA_FWL_CFWL_LISTBOX_H_
diff --git a/xfa/fwl/cfwl_listitem.cpp b/xfa/fwl/cfwl_listitem.cpp
deleted file mode 100644
index 25e8cec..0000000
--- a/xfa/fwl/cfwl_listitem.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fwl/cfwl_listitem.h"
-
-CFWL_ListItem::CFWL_ListItem(const WideString& text) : m_wsText(text) {}
-
-CFWL_ListItem::~CFWL_ListItem() = default;
diff --git a/xfa/fwl/cfwl_listitem.h b/xfa/fwl/cfwl_listitem.h
deleted file mode 100644
index bb91d6e..0000000
--- a/xfa/fwl/cfwl_listitem.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_CFWL_LISTITEM_H_
-#define XFA_FWL_CFWL_LISTITEM_H_
-
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxcrt/fx_string.h"
-
-class CFWL_ListItem {
- public:
- explicit CFWL_ListItem(const WideString& text);
- ~CFWL_ListItem();
-
- CFX_RectF GetRect() const { return m_ItemRect; }
- void SetRect(const CFX_RectF& rect) { m_ItemRect = rect; }
-
- uint32_t GetStates() const { return m_dwStates; }
- void SetStates(uint32_t dwStates) { m_dwStates = dwStates; }
-
- WideString GetText() const { return m_wsText; }
-
- private:
- uint32_t m_dwStates = 0;
- CFX_RectF m_ItemRect;
- WideString m_wsText;
-};
-
-#endif // XFA_FWL_CFWL_LISTITEM_H_
diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp
index 819f7ba..4c0101b 100644
--- a/xfa/fxfa/cxfa_fflistbox.cpp
+++ b/xfa/fxfa/cxfa_fflistbox.cpp
@@ -106,7 +106,7 @@
return true;
for (int32_t i = 0; i < iSels; ++i) {
- CFWL_ListItem* hlistItem = pListBox->GetItem(nullptr, iSelArray[i]);
+ CFWL_ListBox::Item* hlistItem = pListBox->GetItem(nullptr, iSelArray[i]);
if (!(hlistItem->GetStates() & FWL_ITEMSTATE_LTB_Selected))
return true;
}
@@ -145,12 +145,12 @@
return false;
std::vector<int32_t> iSelArray = m_pNode->GetSelectedItems();
- std::vector<CFWL_ListItem*> selItemArray(iSelArray.size());
+ std::vector<CFWL_ListBox::Item*> selItemArray(iSelArray.size());
std::transform(iSelArray.begin(), iSelArray.end(), selItemArray.begin(),
[pListBox](int32_t val) { return pListBox->GetSelItem(val); });
pListBox->SetSelItem(pListBox->GetSelItem(-1), false);
- for (CFWL_ListItem* pItem : selItemArray)
+ for (CFWL_ListBox::Item* pItem : selItemArray)
pListBox->SetSelItem(pItem, true);
GetNormalWidget()->Update();