vcl/inc/PriorityMergedHBox.hxx            |    2 +-
 vcl/source/control/PriorityMergedHBox.cxx |   10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit d3613d15e518c0c8cc4930c4bdf37219813fd665
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Nov 21 14:52:08 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Nov 22 00:16:11 2024 +0100

    notebookbar: Simplify logic to detect whether hidden children
    
    The actual number of hidden children is not of interest here,
    only whether there is at least one, so stop iterating once
    the first hidden child is encountered.
    
    Change-Id: Ice1a7461d2bfd9d576109771cf93deb6a17ef975
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176930
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/PriorityMergedHBox.hxx b/vcl/inc/PriorityMergedHBox.hxx
index c464f0dbdc85..087f09a75928 100644
--- a/vcl/inc/PriorityMergedHBox.hxx
+++ b/vcl/inc/PriorityMergedHBox.hxx
@@ -38,7 +38,7 @@ public:
 
     virtual void dispose() override;
 
-    int GetHiddenCount() const;
+    bool HasHiddenChildren() const;
 
     Size calculateRequisition() const override;
 
diff --git a/vcl/source/control/PriorityMergedHBox.cxx 
b/vcl/source/control/PriorityMergedHBox.cxx
index fd5aa5814dac..64fad5acb488 100644
--- a/vcl/source/control/PriorityMergedHBox.cxx
+++ b/vcl/source/control/PriorityMergedHBox.cxx
@@ -106,7 +106,7 @@ void PriorityMergedHBox::Resize()
 
     VclHBox::Resize();
 
-    if (GetHiddenCount())
+    if (HasHiddenChildren())
         m_pButton->Show();
     else
         m_pButton->Hide();
@@ -120,18 +120,16 @@ void PriorityMergedHBox::dispose()
     PriorityHBox::dispose();
 }
 
-int PriorityMergedHBox::GetHiddenCount() const
+bool PriorityMergedHBox::HasHiddenChildren() const
 {
-    int nCount = 0;
-
     for (int i = GetChildCount() - 1; i >= 0; i--)
     {
         vcl::Window* pWindow = GetChild(i);
         if (pWindow && pWindow->GetParent() == this && !pWindow->IsVisible())
-            nCount++;
+            return true;
     }
 
-    return nCount;
+    return false;
 }
 
 Size PriorityMergedHBox::calculateRequisition() const

Reply via email to