summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-11-23 16:49:50 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-23 16:49:50 -0800
commit41ba08e5552c2eccad0c34024dc680feb3f2b251 (patch)
treec8479436921bb71d9d2a59da3f4a2ad8260b2058
parent106e9a37050197936731d7f13354757dff21d57e (diff)
downloadpdfium-41ba08e5552c2eccad0c34024dc680feb3f2b251.tar.xz
Add CFWL_ListBox::IsMultiSelection().
Review-Url: https://codereview.chromium.org/2527783004
-rw-r--r--xfa/fwl/core/cfwl_listbox.cpp14
-rw-r--r--xfa/fwl/core/cfwl_listbox.h1
2 files changed, 10 insertions, 5 deletions
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp
index f2345858ef..1208ab34dc 100644
--- a/xfa/fwl/core/cfwl_listbox.cpp
+++ b/xfa/fwl/core/cfwl_listbox.cpp
@@ -196,7 +196,7 @@ void CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) {
}
return;
}
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection)
+ if (IsMultiSelection())
SetSelectionDirect(pItem, bSelect);
else
SetSelection(pItem, pItem, bSelect);
@@ -269,13 +269,17 @@ void CFWL_ListBox::SetSelectionDirect(CFWL_ListItem* pItem, bool bSelect) {
SetItemStyles(this, pItem, dwOldStyle);
}
+bool CFWL_ListBox::IsMultiSelection() const {
+ return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection;
+}
+
bool CFWL_ListBox::IsItemSelected(CFWL_ListItem* pItem) {
uint32_t dwState = GetItemStyles(this, pItem);
return (dwState & FWL_ITEMSTATE_LTB_Selected) != 0;
}
void CFWL_ListBox::ClearSelection() {
- bool bMulti = m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection;
+ bool bMulti = IsMultiSelection();
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
CFWL_ListItem* pItem = GetItem(this, i);
@@ -289,7 +293,7 @@ void CFWL_ListBox::ClearSelection() {
}
void CFWL_ListBox::SelectAll() {
- if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection))
+ if (!IsMultiSelection())
return;
int32_t iCount = CountItems(this);
@@ -852,7 +856,7 @@ void CFWL_ListBox::OnLButtonDown(CFWL_MsgMouse* pMsg) {
if (!pItem)
return;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) {
+ if (IsMultiSelection()) {
if (pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl) {
bool bSelected = IsItemSelected(pItem);
SetSelectionDirect(pItem, !bSelected);
@@ -922,7 +926,7 @@ void CFWL_ListBox::OnVK(CFWL_ListItem* pItem, bool bShift, bool bCtrl) {
if (!pItem)
return;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) {
+ if (IsMultiSelection()) {
if (bCtrl) {
// Do nothing.
} else if (bShift) {
diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h
index a758e196ea..a2dcdbaf7f 100644
--- a/xfa/fwl/core/cfwl_listbox.h
+++ b/xfa/fwl/core/cfwl_listbox.h
@@ -113,6 +113,7 @@ class CFWL_ListBox : public CFWL_Widget {
private:
void SetSelectionDirect(CFWL_ListItem* hItem, bool bSelect);
+ bool IsMultiSelection() const;
bool IsItemSelected(CFWL_ListItem* hItem);
void ClearSelection();
void SelectAll();