From 0b190ffcee9e2fdc1856b68ac4a1b083194d3c11 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 14 Aug 2002 23:25:06 +0000 Subject: [PATCH] Bugfix for wxListCtrl::GetColumn. It wasn't checking the returned format correctly. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/missing.h | 4 ++++ src/msw/listctrl.cpp | 22 +++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/wx/msw/missing.h b/include/wx/msw/missing.h index 66acdfc7e2..fdcff64cc2 100644 --- a/include/wx/msw/missing.h +++ b/include/wx/msw/missing.h @@ -39,6 +39,10 @@ #define HDM_FIRST 0x1200 #endif +#ifndef LVCFMT_JUSTIFYMASK + #define LVCFMT_JUSTIFYMASK 0x0003 +#endif + // mingw32/cygwin don't have declarations for comctl32.dll 4.70+ stuff #ifndef NM_CACHEHINT typedef struct tagNMLVCACHEHINT diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 9ea8e389a1..2379386b1c 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -598,7 +598,7 @@ bool wxListCtrl::GetColumn(int col, wxListItem& item) const lvCol.mask |= LVCF_IMAGE; } - bool success = ListView_GetColumn(GetHwnd(), col, & lvCol) != 0; + bool success = ListView_GetColumn(GetHwnd(), col, &lvCol) != 0; // item.m_subItem = lvCol.iSubItem; item.m_width = lvCol.cx; @@ -611,12 +611,20 @@ bool wxListCtrl::GetColumn(int col, wxListItem& item) const if ( item.m_mask & wxLIST_MASK_FORMAT ) { - if (lvCol.fmt == LVCFMT_LEFT) - item.m_format = wxLIST_FORMAT_LEFT; - else if (lvCol.fmt == LVCFMT_RIGHT) - item.m_format = wxLIST_FORMAT_RIGHT; - else if (lvCol.fmt == LVCFMT_CENTER) - item.m_format = wxLIST_FORMAT_CENTRE; + switch (lvCol.fmt & LVCFMT_JUSTIFYMASK) { + case LVCFMT_LEFT: + item.m_format = wxLIST_FORMAT_LEFT; + break; + case LVCFMT_RIGHT: + item.m_format = wxLIST_FORMAT_RIGHT; + break; + case LVCFMT_CENTER: + item.m_format = wxLIST_FORMAT_CENTRE; + break; + default: + item.m_format = -1; // Unknown? + break; + } } #if _WIN32_IE >= 0x0300 -- 2.45.2