- * Helper function to calculate a dimension given the policy of that dimension; the minimum &
- * maximum values that dimension can be; and the allocated value for that dimension.
- *
- * @param[in] policy The size policy for that dimension.
- * @param[in] minimum The minimum value that dimension can be.
- * @param[in] maximum The maximum value that dimension can be.
- * @param[in] allocated The value allocated for that dimension.
- *
- * @return The value that the dimension should be.
- *
- * @note This does not handle Control::Fixed policy.
- */
-float Calculate( Control::SizePolicy policy, float minimum, float maximum, float allocated )
-{
- float size( allocated );
-
- switch( policy )
- {
- case Control::Fixed:
- {
- // Use allocated value
- break;
- }
-
- case Control::Minimum:
- {
- // Size is always at least the minimum.
- size = std::max( allocated, minimum );
- break;
- }
-
- case Control::Maximum:
- {
- // Size can grow but up to a maximum value.
- size = std::min( allocated, maximum );
- break;
- }
-
- case Control::Range:
- {
- // Size is at least the minimum and can grow up to the maximum
- size = std::max( size, minimum );
- size = std::min( size, maximum );
- break;
- }
-
- case Control::Flexible:
- {
- // Size grows or shrinks with no limits.
- size = allocated;
- break;
- }
-
- default:
- {
- DALI_ASSERT_DEBUG( false && "This function was not intended to be used by any other policy." );
- break;
- }
- }
-
- return size;
-}
-
-/**