BsGUIHelper.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include "BsPrerequisites.h"
  3. #include "BsTextSprite.h"
  4. #include "BsGUIContent.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Contains various helper methods used by GUI.
  9. */
  10. class BS_EXPORT GUIHelper
  11. {
  12. public:
  13. /**
  14. * @brief Calculates optimal content size by returning the nearest valid size to the provided value.
  15. *
  16. * @param contentSize Wanted content size. This will be limited by minimal constraints of the style and layout options.
  17. * @param style Style to use for determining size constraints.
  18. * @param dimensions Dimension constraints of a GUI element.
  19. */
  20. static Vector2I calcOptimalContentsSize(const Vector2I& contentSize, const GUIElementStyle& style, const GUIDimensions& dimensions);
  21. /**
  22. * @brief Calculates optimal content size for the provided content using the provided style and layout options for constraints.
  23. *
  24. * @param content Content to calculate size for.
  25. * @param style Style to use for determining size constraints.
  26. * @param dimensions Dimension constraints of a GUI element.
  27. */
  28. static Vector2I calcOptimalContentsSize(const GUIContent& content, const GUIElementStyle& style, const GUIDimensions& dimensions);
  29. /**
  30. * @brief Calculates optimal content size for the provided text using the provided style and layout options for constraints.
  31. *
  32. * @param text Text to calculate size for.
  33. * @param style Style to use for determining size constraints.
  34. * @param dimensions Dimension constraints of a GUI element.
  35. */
  36. static Vector2I calcOptimalContentsSize(const WString& text, const GUIElementStyle& style, const GUIDimensions& dimensions);
  37. };
  38. }