From 4849c8132b3bbb616e14929ad0b3bdc2739de3ea Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 20 Sep 2002 08:21:00 +0000 Subject: [PATCH] Fixed [ 548055 ] Bug in wxToolBarSimple::Realize() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cédric RICARD There is an inversion in wxToolBarSimple::Realize(): The current code is : if ( GetWindowStyleFlag() & wxTB_HORIZONTAL ) m_maxWidth += maxToolWidth; else m_maxHeight += maxToolHeight; I think it should be : if ( GetWindowStyleFlag() & wxTB_HORIZONTAL ) m_maxHeight += maxToolHeight; else m_maxWidth += maxToolWidth; Just take an example to see the bug, and have a look to the rest of the function : If you create an horizontal tool bar with only 3 tools of 16 pixels length each, when you reach this code, m_maxWidth is equal to 3*16 pixels. So it have the good width. You needn't to add other 16 pixels. But m_maxHeight is equal to 0 ! So you have to take care of the line you have just created... This is very logical. In an horizontal tool bar, m_maxWidth is increased after each new tool. But m_maxHeight is only increased when an entire line is finished, or when the last tool is added to take care of the last line. And at last, I think you should add a : SetSize(m_maxWidth, m_maxHeight); after the previous code. Just try the ToolBar sample code. It only works if I do that... git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17294 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/tbarsmpl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/generic/tbarsmpl.cpp b/src/generic/tbarsmpl.cpp index 522736e77f..b7e16e0d4d 100644 --- a/src/generic/tbarsmpl.cpp +++ b/src/generic/tbarsmpl.cpp @@ -356,13 +356,15 @@ bool wxToolBarSimple::Realize() } if ( GetWindowStyleFlag() & wxTB_HORIZONTAL ) - m_maxWidth += maxToolWidth; - else m_maxHeight += maxToolHeight; + else + m_maxWidth += maxToolWidth; m_maxWidth += m_xMargin; m_maxHeight += m_yMargin; + SetSize(m_maxWidth, m_maxHeight); + return TRUE; }