Make it possible to combine wxEXPAND and alignment in wxGridSizer.

Allow overriding wxEXPAND effect in one of the directions by specifying
wxALIGN_{RIGHT,BOTTOM} or wxALIGN_CENTRE_{HORIZONTAL,VERTICAL} together with
it (unfortunately this doesn't work for wxALIGN_{LEFT,TOP} as their value is 0
and so their presence in flags can't be detected).
This commit is contained in:
Vadim Zeitlin
2015-04-04 18:59:06 +02:00
parent 233a7fe77b
commit 9aaa38c7c8
3 changed files with 43 additions and 4 deletions

View File

@@ -136,4 +136,23 @@ void GridSizerTestCase::Expand()
CPPUNIT_ASSERT_EQUAL( wxSize(sizeChild.x, sizeRest.y),
children[2]->GetSize() );
CPPUNIT_ASSERT_EQUAL( sizeRest, children[3]->GetSize() );
// With expand and another alignment flag, they should expand only in the
// direction in which the alignment is not given.
SetChildren(children, wxSizerFlags().Expand().CentreVertical());
CPPUNIT_ASSERT_EQUAL( sizeChild, children[0]->GetSize() );
CPPUNIT_ASSERT_EQUAL( wxSize(sizeRest.x, sizeChild.y),
children[1]->GetSize() );
CPPUNIT_ASSERT_EQUAL( sizeChild, children[2]->GetSize() );
CPPUNIT_ASSERT_EQUAL( wxSize(sizeRest.x, sizeChild.y),
children[3]->GetSize() );
// Same as above but mirrored.
SetChildren(children, wxSizerFlags().Expand().CentreHorizontal());
CPPUNIT_ASSERT_EQUAL( sizeChild, children[0]->GetSize() );
CPPUNIT_ASSERT_EQUAL( sizeChild, children[1]->GetSize() );
CPPUNIT_ASSERT_EQUAL( wxSize(sizeChild.x, sizeRest.y),
children[2]->GetSize() );
CPPUNIT_ASSERT_EQUAL( wxSize(sizeChild.x, sizeRest.y),
children[3]->GetSize() );
}