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

Unified Diff: xfa/fwl/lightwidget/cfwl_listbox.cpp

Issue 1834323003: Move xfa/include/fwl/{theme,lightwidget} to xfa/fwl (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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/lightwidget/cfwl_listbox.cpp
diff --git a/xfa/fwl/lightwidget/listbox.cpp b/xfa/fwl/lightwidget/cfwl_listbox.cpp
similarity index 99%
rename from xfa/fwl/lightwidget/listbox.cpp
rename to xfa/fwl/lightwidget/cfwl_listbox.cpp
index 79137277756376a3de1139df1412abfa2f1827a4..2102d2d3ee63e025503286437994dc7a3db2deef 100644
--- a/xfa/fwl/lightwidget/listbox.cpp
+++ b/xfa/fwl/lightwidget/cfwl_listbox.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/include/fwl/lightwidget/listbox.h"
+#include "xfa/fwl/lightwidget/cfwl_listbox.h"
#include <memory>
@@ -13,6 +13,7 @@
CFWL_ListBox* CFWL_ListBox::Create() {
return new CFWL_ListBox;
}
+
FWL_ERR CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (m_pIface)
return FWL_ERR_Indefinite;
@@ -29,10 +30,12 @@ FWL_ERR CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) {
CFWL_Widget::Initialize();
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, FWL_HLISTITEM hItem) {
reinterpret_cast<CFWL_ListItem*>(hItem)->m_pDIB = pDIB;
return FWL_ERR_Succeeded;
}
+
FWL_HLISTITEM CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd,
FX_BOOL bSelect) {
std::unique_ptr<CFWL_ListItem> pItem(new CFWL_ListItem);
@@ -42,6 +45,7 @@ FWL_HLISTITEM CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd,
m_ListBoxDP.m_ItemArray.push_back(std::move(pItem));
return (FWL_HLISTITEM)m_ListBoxDP.m_ItemArray.back().get();
}
+
FX_BOOL CFWL_ListBox::DeleteString(FWL_HLISTITEM hItem) {
int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), hItem);
if (nIndex < 0 ||
@@ -64,43 +68,52 @@ FX_BOOL CFWL_ListBox::DeleteString(FWL_HLISTITEM hItem) {
m_ListBoxDP.m_ItemArray.erase(m_ListBoxDP.m_ItemArray.begin() + nIndex);
return TRUE;
}
+
void CFWL_ListBox::DeleteAll() {
m_ListBoxDP.m_ItemArray.clear();
}
+
int32_t CFWL_ListBox::CountSelItems() {
if (!m_pIface)
return 0;
return static_cast<IFWL_ListBox*>(m_pIface)->CountSelItems();
}
+
FWL_HLISTITEM CFWL_ListBox::GetSelItem(int32_t nIndexSel) {
if (!m_pIface)
return NULL;
return static_cast<IFWL_ListBox*>(m_pIface)->GetSelItem(nIndexSel);
}
+
int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) {
if (!m_pIface)
return 0;
return static_cast<IFWL_ListBox*>(m_pIface)->GetSelIndex(nIndex);
}
+
FWL_ERR CFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ListBox*>(m_pIface)->SetSelItem(hItem, bSelect);
}
+
FWL_ERR CFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ListBox*>(m_pIface)->GetItemText(hItem, wsText);
}
+
FWL_ERR CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) {
if (!m_pIface)
return FWL_ERR_Indefinite;
return static_cast<IFWL_ListBox*>(m_pIface)->GetScrollPos(fPos, bVert);
}
+
FWL_ERR CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) {
m_ListBoxDP.m_fItemHeight = fItemHeight;
return FWL_ERR_Succeeded;
}
+
FWL_HLISTITEM CFWL_ListBox::GetFocusItem() {
for (const auto& hItem : m_ListBoxDP.m_ItemArray) {
if (hItem->m_dwStates & FWL_ITEMSTATE_LTB_Focused)
@@ -108,23 +121,28 @@ FWL_HLISTITEM CFWL_ListBox::GetFocusItem() {
}
return nullptr;
}
+
FWL_ERR CFWL_ListBox::SetFocusItem(FWL_HLISTITEM hItem) {
int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), hItem);
m_ListBoxDP.m_ItemArray[nIndex]->m_dwStates |= FWL_ITEMSTATE_LTB_Focused;
return FWL_ERR_Succeeded;
}
+
FWL_ERR* CFWL_ListBox::Sort(IFWL_ListBoxCompare* pCom) {
return static_cast<IFWL_ListBox*>(m_pIface)->Sort(pCom);
}
+
int32_t CFWL_ListBox::CountItems() {
return pdfium::CollectionSize<int32_t>(m_ListBoxDP.m_ItemArray);
}
+
FWL_HLISTITEM CFWL_ListBox::GetItem(int32_t nIndex) {
if (nIndex < 0 || nIndex >= CountItems())
return nullptr;
return (FWL_HLISTITEM)m_ListBoxDP.m_ItemArray[nIndex].get();
}
+
FWL_ERR CFWL_ListBox::SetItemString(FWL_HLISTITEM hItem,
const CFX_WideStringC& wsText) {
if (!hItem)
@@ -132,6 +150,7 @@ FWL_ERR CFWL_ListBox::SetItemString(FWL_HLISTITEM hItem,
reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText = wsText;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::GetItemString(FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
if (!hItem)
@@ -139,17 +158,20 @@ FWL_ERR CFWL_ListBox::GetItemString(FWL_HLISTITEM hItem,
wsText = reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::SetItemData(FWL_HLISTITEM hItem, void* pData) {
if (!hItem)
return FWL_ERR_Indefinite;
reinterpret_cast<CFWL_ListItem*>(hItem)->m_pData = pData;
return FWL_ERR_Succeeded;
}
+
void* CFWL_ListBox::GetItemData(FWL_HLISTITEM hItem) {
if (!hItem)
return NULL;
return reinterpret_cast<CFWL_ListItem*>(hItem)->m_pData;
}
+
FWL_HLISTITEM CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
CFX_RectF rtClient;
m_pIface->GetClientRect(rtClient);
@@ -174,24 +196,32 @@ FWL_HLISTITEM CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
}
return NULL;
}
+
uint32_t CFWL_ListBox::GetItemStates(FWL_HLISTITEM hItem) {
if (!hItem)
return 0;
CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem);
return pItem->m_dwStates | pItem->m_dwCheckState;
}
+
CFWL_ListBox::CFWL_ListBox() {}
+
CFWL_ListBox::~CFWL_ListBox() {}
+
CFWL_ListBox::CFWL_ListBoxDP::CFWL_ListBoxDP() {}
+
CFWL_ListBox::CFWL_ListBoxDP::~CFWL_ListBoxDP() {}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetCaption(IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {
wsCaption = m_wsData;
return FWL_ERR_Succeeded;
}
+
int32_t CFWL_ListBox::CFWL_ListBoxDP::CountItems(IFWL_Widget* pWidget) {
return pdfium::CollectionSize<int32_t>(m_ItemArray);
}
+
FWL_HLISTITEM CFWL_ListBox::CFWL_ListBoxDP::GetItem(IFWL_Widget* pWidget,
int32_t nIndex) {
if (nIndex < 0 || nIndex >= CountItems(pWidget))
@@ -199,6 +229,7 @@ FWL_HLISTITEM CFWL_ListBox::CFWL_ListBoxDP::GetItem(IFWL_Widget* pWidget,
return (FWL_HLISTITEM)m_ItemArray[nIndex].get();
}
+
int32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemIndex(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
auto it = std::find_if(
@@ -208,6 +239,7 @@ int32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemIndex(IFWL_Widget* pWidget,
});
return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1;
}
+
FX_BOOL CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
int32_t nIndex) {
@@ -216,12 +248,14 @@ FX_BOOL CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget,
m_ItemArray[nIndex].reset(reinterpret_cast<CFWL_ListItem*>(hItem));
return TRUE;
}
+
uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
return -1;
return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
@@ -230,6 +264,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget,
wsText = reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_RectF& rtItem) {
@@ -239,6 +274,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget,
rtItem = pItem->m_rtItem;
return FWL_ERR_Succeeded;
}
+
void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
@@ -246,6 +282,7 @@ void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget,
CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem);
return pItem->m_pData;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
uint32_t dwStyle) {
@@ -254,6 +291,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget,
reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates = dwStyle;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const FX_WCHAR* pszText) {
@@ -262,6 +300,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget,
reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText = pszText;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const CFX_RectF& rtItem) {
@@ -270,19 +309,23 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget,
reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtItem = rtItem;
return FWL_ERR_Succeeded;
}
+
FX_FLOAT CFWL_ListBox::CFWL_ListBoxDP::GetItemHeight(IFWL_Widget* pWidget) {
return m_fItemHeight;
}
+
CFX_DIBitmap* CFWL_ListBox::CFWL_ListBoxDP::GetItemIcon(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
return reinterpret_cast<CFWL_ListItem*>(hItem)->m_pDIB;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_RectF& rtCheck) {
rtCheck = reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox;
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect(
IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
@@ -290,10 +333,12 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect(
reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox = rtCheck;
return FWL_ERR_Succeeded;
}
+
uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckState(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState;
}
+
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckState(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
uint32_t dwCheckState) {

Powered by Google App Engine
This is Rietveld 408576698