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.
This commit is contained in:
Vadim Zeitlin 2023-12-25 17:52:31 +01:00
parent 8f822d3c59
commit c53fc91cd6
2 changed files with 8 additions and 8 deletions

View file

@ -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);

View file

@ -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)