Fix missing tool in the overflow menu of wxAuiToolBar

When determining if a tool is hidden, it takes the width (or height) of
the overflow sizer into account -- but when tools are overlapping, this
is 0. By setting and getting the minimum size of the overflow sizer, the
actual size of the overflow button can be used.

Closes #17960.

Closes https://github.com/wxWidgets/wxWidgets/pull/799
This commit is contained in:
Maarten Bent
2018-05-01 21:20:21 +02:00
committed by Vadim Zeitlin
parent 58a7339cb9
commit 2a5aafb274
2 changed files with 4 additions and 2 deletions

View File

@@ -79,6 +79,7 @@ All:
All (GUI): All (GUI):
- Improve stock items consistency and aesthetics (dhowland). - Improve stock items consistency and aesthetics (dhowland).
- Fix bug with missing items in overflowing AUI toolbar (Maarten Bent).
wxGTK: wxGTK:

View File

@@ -1773,7 +1773,7 @@ bool wxAuiToolBar::GetToolFitsByIndex(int tool_idx) const
{ {
// take the dropdown size into account // take the dropdown size into account
if (m_overflowVisible && m_overflowSizerItem) if (m_overflowVisible && m_overflowSizerItem)
cli_h -= m_overflowSizerItem->GetSize().y; cli_h -= m_overflowSizerItem->GetMinSize().y;
if (rect.y+rect.height < cli_h) if (rect.y+rect.height < cli_h)
return true; return true;
@@ -1782,7 +1782,7 @@ bool wxAuiToolBar::GetToolFitsByIndex(int tool_idx) const
{ {
// take the dropdown size into account // take the dropdown size into account
if (m_overflowVisible && m_overflowSizerItem) if (m_overflowVisible && m_overflowSizerItem)
cli_w -= m_overflowSizerItem->GetSize().x; cli_w -= m_overflowSizerItem->GetMinSize().x;
if (rect.x+rect.width < cli_w) if (rect.x+rect.width < cli_w)
return true; return true;
@@ -2024,6 +2024,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
m_overflowSizerItem = sizer->Add(overflow_size, 1, 0, wxEXPAND); m_overflowSizerItem = sizer->Add(overflow_size, 1, 0, wxEXPAND);
else else
m_overflowSizerItem = sizer->Add(1, overflow_size, 0, wxEXPAND); m_overflowSizerItem = sizer->Add(1, overflow_size, 0, wxEXPAND);
m_overflowSizerItem->SetMinSize(m_overflowSizerItem->GetSize());
} }
else else
{ {