recompute width cache if client width has changed to take into account the fact
that derived OnSize is run before cache has been cleared in own OnSize git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17929 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -108,6 +108,8 @@ protected:
|
|||||||
|
|
||||||
wxArrayString m_statusStrings;
|
wxArrayString m_statusStrings;
|
||||||
|
|
||||||
|
// the last known width of the client rect (used to rebuild cache)
|
||||||
|
int m_lastClientWidth;
|
||||||
// the widths of the status bar panes in pixels
|
// the widths of the status bar panes in pixels
|
||||||
wxArrayInt m_widthsAbs;
|
wxArrayInt m_widthsAbs;
|
||||||
|
|
||||||
|
@@ -300,11 +300,16 @@ bool wxStatusBarGeneric::GetFieldRect(int n, wxRect& rect) const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// we cache m_widthsAbs between calls normally but it's cleared when the
|
// we cache m_widthsAbs between calls normally but it's cleared when the
|
||||||
// status widths change so recompute it if needed
|
// status widths change so recompute it if needed and also if client width
|
||||||
if ( m_widthsAbs.IsEmpty() )
|
// has changed to take into account the fact that derived OnSize is run
|
||||||
|
// before cache has been cleared in own OnSize
|
||||||
|
if ( m_widthsAbs.IsEmpty() || (m_lastClientWidth != width) )
|
||||||
{
|
{
|
||||||
wxConstCast(this, wxStatusBarGeneric)->
|
wxConstCast(this, wxStatusBarGeneric)->
|
||||||
m_widthsAbs = CalculateAbsWidths(width);
|
m_widthsAbs = CalculateAbsWidths(width);
|
||||||
|
// remember last width for which we have recomputed the widths in pixels
|
||||||
|
wxConstCast(this, wxStatusBarGeneric)->
|
||||||
|
m_lastClientWidth = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
|
Reference in New Issue
Block a user