Add wxSizerFlags::DisableConsistencyChecks()

This allows to (hopefully temporarily) disable size flag check asserts.
This commit is contained in:
Vadim Zeitlin
2021-05-20 00:20:54 +01:00
parent 5502d2d86b
commit 2e289d7231
4 changed files with 46 additions and 5 deletions

View File

@@ -1480,6 +1480,29 @@ public:
*/
wxSizerFlags& CentreVertical();
/**
Globally disable checks for sizer flag consistency in debug builds.
By default, sizer classes such as wxBoxSizer and wxFlexGridSizer assert
when passed invalid flags, even though doing this usually doesn't
result in any catastrophic consequences and the invalid flags are
simply ignored later. Due to this, and the fact that these checks were
only added in wxWidgets 3.1, existing code may run into multiple
asserts warning about incorrect sizer flags use. Using this function
provides a temporary solution for avoiding such asserts when upgrading
to wxWidgets 3.1 from a previous version and will prevent such checks
from being done.
Please do note that correcting the code by removing the invalid flags
remains a much better solution as these asserts may be very helpful to
understand why some code using sizer flags doesn't work as expected, so
using this function, especially permanently, rather than a temporary
workaround, is @e not recommended.
@since 3.1.6
*/
static void DisableConsistencyChecks();
/**
Sets the border in the given @a direction having twice the default
border size.