Fixed [ 548055 ] Bug in wxToolBarSimple::Realize()

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
This commit is contained in:
Julian Smart
2002-09-20 08:21:00 +00:00
parent ddbbd35e11
commit 4849c8132b

View File

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