summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-11-21 14:52:08 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-11-22 00:16:11 +0100
commitd3613d15e518c0c8cc4930c4bdf37219813fd665 (patch)
tree41aca18072c9755e6beb0fef44367aa528ecf0d9
parentde426177dcf08925b0a12b437ceb4d0a1eae006e (diff)
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.weghorn@posteo.de>
-rw-r--r--vcl/inc/PriorityMergedHBox.hxx2
-rw-r--r--vcl/source/control/PriorityMergedHBox.cxx10
2 files changed, 5 insertions, 7 deletions
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