From 7ea528b280560f4c1fda4afee830e480e8aaae40 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 25 Dec 2023 20:57:09 +0100 Subject: [PATCH] Simplify wxAuiToolBar resizing code a bit more No real changes, just remove a duplicate call to wxSizer::SetDimension() too and call it only once. Also add some comments to explain what's going on here. --- src/aui/auibar.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp index 1d3390aaf9..5e166dbdb3 100644 --- a/src/aui/auibar.cpp +++ b/src/aui/auibar.cpp @@ -1893,24 +1893,19 @@ bool wxAuiToolBar::Realize() size = m_vertHintSize; } - // set control size + // Remember our minimum size. m_minWidth = size.x; m_minHeight = size.y; + // And set control size if we are not forbidden from doing it by the use of + // a special flag and if it did actually change. wxSize curSize = GetClientSize(); - if ((m_windowStyle & wxAUI_TB_NO_AUTORESIZE) == 0) + if ((m_windowStyle & wxAUI_TB_NO_AUTORESIZE) == 0 && (size != curSize)) { - if (size != curSize) - { - SetClientSize(size); - } - else - { - m_sizer->SetDimension(0, 0, curSize.x, curSize.y); - } + SetClientSize(size); } - else + else // Don't change the size but let the sizer know about available size. { m_sizer->SetDimension(0, 0, curSize.x, curSize.y); }