From c53fc91cd6771dcc4b0712391d30c17205073816 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 25 Dec 2023 17:52:31 +0100 Subject: [PATCH] Pass wxOrientation and not bool to wxAuiToolBar::RealizeHelper() This makes the code more readable and also simpler as RealizeHelper() only used its boolean parameter to convert it to wxOrientation anyhow after the changes of the parent commit. No real changes. --- include/wx/aui/auibar.h | 2 +- src/aui/auibar.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/wx/aui/auibar.h b/include/wx/aui/auibar.h index b85c85fdf0..8d1a0276f7 100644 --- a/include/wx/aui/auibar.h +++ b/include/wx/aui/auibar.h @@ -704,7 +704,7 @@ private: // Common part of OnLeaveWindow() and OnCaptureLost(). void DoResetMouseState(); - wxSize RealizeHelper(wxClientDC& dc, bool horizontal); + wxSize RealizeHelper(wxClientDC& dc, wxOrientation orientation); wxDECLARE_EVENT_TABLE(); wxDECLARE_CLASS(wxAuiToolBar); diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp index bd3c88e415..2a4e34b419 100644 --- a/src/aui/auibar.cpp +++ b/src/aui/auibar.cpp @@ -1879,20 +1879,20 @@ bool wxAuiToolBar::Realize() // in the order that leaves toolbar in correct final state if (m_orientation == wxHORIZONTAL) { - m_vertHintSize = RealizeHelper(dc, false); - m_horzHintSize = RealizeHelper(dc, true); + m_vertHintSize = RealizeHelper(dc, wxVERTICAL); + m_horzHintSize = RealizeHelper(dc, wxHORIZONTAL); } else { - m_horzHintSize = RealizeHelper(dc, true); - m_vertHintSize = RealizeHelper(dc, false); + m_horzHintSize = RealizeHelper(dc, wxHORIZONTAL); + m_vertHintSize = RealizeHelper(dc, wxVERTICAL); } Refresh(false); return true; } -wxSize wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) +wxSize wxAuiToolBar::RealizeHelper(wxClientDC& dc, wxOrientation orientation) { // Remove old sizer before adding any controls in this tool bar, which are // elements of this sizer, to the new sizer below. @@ -1900,7 +1900,7 @@ wxSize wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) m_sizer = nullptr; // create the new sizer to add toolbar elements to - wxBoxSizer* sizer = new wxBoxSizer(horizontal ? wxHORIZONTAL : wxVERTICAL); + wxBoxSizer* sizer = new wxBoxSizer(orientation); // add gripper area int separatorSize = m_art->GetElementSize(wxAUI_TBART_SEPARATOR_SIZE); @@ -2055,7 +2055,7 @@ wxSize wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) // the outside sizer helps us apply the "top" and "bottom" padding - wxBoxSizer* outside_sizer = new wxBoxSizer(horizontal ? wxVERTICAL : wxHORIZONTAL); + wxBoxSizer* outside_sizer = new wxBoxSizer(orientation ^ wxBOTH); // add "top" padding if (m_topPadding > 0)