Replace wxSizer::RecalcSizes() with RepositionChildren()

The new method takes minimal size just computed by RecalcSizes() as its
argument making it unnecessary to store it as a member variable in the derived
classes such as wx{Box,FlexGrid}Sizer.

The old method can still be overridden for compatibility and by the derived
class that don't need minimal size when updating children.
This commit is contained in:
Vadim Zeitlin
2015-10-11 01:13:33 +02:00
parent 7d9675472d
commit 622deec262
7 changed files with 84 additions and 72 deletions

View File

@@ -36,7 +36,7 @@ public:
// override base class virtual methods
virtual wxSize CalcMin() wxOVERRIDE;
virtual void RecalcSizes() wxOVERRIDE;
virtual void RepositionChildren(const wxSize& minSize) wxOVERRIDE;
virtual bool InformFirstDirection(int direction,
int size,
@@ -84,13 +84,17 @@ protected:
bool m_lastUsed; // Indicates whether value from InformFirst... has
// been used yet
// The sizes below are computed by RecalcSizes(), i.e. they don't have
// The sizes below are computed by RepositionChildren(), i.e. they don't have
// valid values during the initial call to CalcMin() and they are only
// valid for the current layout (i.e. the current number of rows)
int m_minSizeMinor; // Min size in minor direction
int m_maxSizeMajor; // Size of longest row
int m_minItemMajor; // Size of smallest item in major direction
// the minimal size needed for this sizer as calculated by the last call to
// our CalcMin()
wxSize m_calculatedMinSize;
wxBoxSizer m_rows; // Sizer containing multiple rows of our items
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWrapSizer);