include/vcl/toolkit/treelistbox.hxx  |    2 --
 vcl/inc/iconview.hxx                 |    4 ++++
 vcl/source/treelist/iconview.cxx     |    6 +++---
 vcl/source/treelist/iconviewimpl.cxx |    4 ++--
 4 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 4caf129378204a74da7fa226870d97a44cc142ff
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 25 19:01:45 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jul 25 20:53:11 2025 +0200

    vcl: Move SvTreeListBox::nColumns to IconView subclass
    
    It's only used there. Also rename to `m_nColumnCount`.
    
    Change-Id: Ie940912c5cdf8faa83327f900b5cf879251dcb61
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188362
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/include/vcl/toolkit/treelistbox.hxx 
b/include/vcl/toolkit/treelistbox.hxx
index 0a80253bc169..d6ee35bbcd6f 100644
--- a/include/vcl/toolkit/treelistbox.hxx
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -240,7 +240,6 @@ class UNLESS_MERGELIBS_MORE(VCL_DLLPUBLIC) SvTreeListBox
 
 protected:
     std::unique_ptr<SvImpLBox>              pImpl;
-    short                   nColumns;
     short                   nEntryHeight;
     short                   nEntryWidth;
     bool                    mbCenterAndClipText;
@@ -604,7 +603,6 @@ public:
 
     void            ScrollOutputArea( short nDeltaEntries );
 
-    short           GetColumnsCount() const { return nColumns; }
     short           GetEntryHeight() const  { return nEntryHeight; }
     void            SetEntryHeight( short nHeight );
     short           GetEntryWidth() const { return nEntryWidth; }
diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx
index 612cefaacebe..594cb9dc3b16 100644
--- a/vcl/inc/iconview.hxx
+++ b/vcl/inc/iconview.hxx
@@ -25,10 +25,14 @@
 
 class IconView final : public SvTreeListBox
 {
+private:
+    short m_nColumnCount;
+
 public:
     IconView(vcl::Window* pParent, WinBits nBits);
 
     Size GetEntrySize(const SvTreeListEntry&) const;
+    short GetColumnCount() const { return m_nColumnCount; }
 
     virtual void Resize() override;
 
diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index aa56cf2c463e..fe3e02e0acf9 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -39,7 +39,7 @@ const int nSpacing = 5; // 5 pixels from top, from bottom, 
between icon and labe
 IconView::IconView(vcl::Window* pParent, WinBits nBits)
     : SvTreeListBox(pParent, nBits)
 {
-    nColumns = 1;
+    m_nColumnCount = 1;
     mbCenterAndClipText = true;
     SetEntryWidth(100);
 
@@ -49,7 +49,7 @@ IconView::IconView(vcl::Window* pParent, WinBits nBits)
 Size IconView::GetEntrySize(const SvTreeListEntry& entry) const
 {
     if (entry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR)
-        return { GetEntryWidth() * GetColumnsCount(), separatorHeight };
+        return { GetEntryWidth() * GetColumnCount(), separatorHeight };
     return { GetEntryWidth(), GetEntryHeight() };
 }
 
@@ -92,7 +92,7 @@ void IconView::Resize()
     if (!aBoxSize.Width())
         return;
 
-    nColumns = nEntryWidth ? aBoxSize.Width() / nEntryWidth : 1;
+    m_nColumnCount = nEntryWidth ? aBoxSize.Width() / nEntryWidth : 1;
 
     SvTreeListBox::Resize();
 }
diff --git a/vcl/source/treelist/iconviewimpl.cxx 
b/vcl/source/treelist/iconviewimpl.cxx
index fbf25844f2c5..34c781e4b1df 100644
--- a/vcl/source/treelist/iconviewimpl.cxx
+++ b/vcl/source/treelist/iconviewimpl.cxx
@@ -47,7 +47,7 @@ void IconViewImpl::IterateVisibleEntryAreas(const 
IterateEntriesFunc& f, bool fr
 {
     tools::Long x = 0, y = 0;
     short column = 0;
-    const tools::Long rowWidth = m_pView->GetEntryWidth() * 
m_pView->GetColumnsCount();
+    const tools::Long rowWidth = m_pView->GetEntryWidth() * 
GetIconView().GetColumnCount();
     tools::Long nPrevHeight = 0;
     for (auto entry = fromStartEntry ? m_pStartEntry : 
m_pView->FirstVisible(); entry;
          entry = m_pView->NextVisible(entry))
@@ -374,7 +374,7 @@ void IconViewImpl::AdjustScrollBars( Size& rSize )
 
     // number of entries visible within the view
     const tools::Long nVisibleRows = aOSize.Height() / nEntryHeight;
-    m_nVisibleCount = nVisibleRows * m_pView->GetColumnsCount();
+    m_nVisibleCount = nVisibleRows * GetIconView().GetColumnCount();
 
     tools::Long nTotalRows = 0;
     tools::Long totalHeight = 0;

Reply via email to