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

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

Issue 2527783004: Add CFWL_ListBox::IsMultiSelection(). (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « xfa/fwl/core/cfwl_listbox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/core/cfwl_listbox.cpp
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp
index f2345858efdae9be51002de74fc3b424c43e62db..1208ab34dc33f22b348b8d0ff1dbc18d4f26755c 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) {
« no previous file with comments | « xfa/fwl/core/cfwl_listbox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698