Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
4.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. /**
  22. Represents a FlexBox container, which contains and manages the layout of a set
  23. of FlexItem objects.
  24. To use this class, set its parameters appropriately (you can search online for
  25. more help on exactly how the FlexBox protocol works!), then add your sub-items
  26. to the items array, and call performLayout().
  27. @see FlexItem
  28. */
  29. class JUCE_API FlexBox
  30. {
  31. public:
  32. /** Possible values for the flexDirection property. */
  33. enum class Direction { row, rowReverse, column, columnReverse };
  34. /** Possible values for the flexWrap property. */
  35. enum class Wrap { noWrap, wrap, wrapReverse };
  36. /** Possible values for the alignContent property. */
  37. enum class AlignContent { stretch, flexStart, flexEnd, center, spaceBetween, spaceAround };
  38. /** Possible values for the alignItems property. */
  39. enum class AlignItems { stretch, flexStart, flexEnd, center };
  40. /** Possible values for the justifyContent property. */
  41. enum class JustifyContent { flexStart, flexEnd, center, spaceBetween, spaceAround };
  42. //==============================================================================
  43. /** Creates an empty FlexBox container with default parameters. */
  44. FlexBox() noexcept;
  45. /** Creates an empty FlexBox container with these parameters. */
  46. FlexBox (Direction, Wrap, AlignContent, AlignItems, JustifyContent) noexcept;
  47. /** Creates an empty FlexBox container with the given content-justification mode. */
  48. FlexBox (JustifyContent) noexcept;
  49. /** Destructor. */
  50. ~FlexBox() noexcept;
  51. //==============================================================================
  52. /** Lays-out the box's items within the given rectangle. */
  53. void performLayout (Rectangle<float> targetArea);
  54. /** Lays-out the box's items within the given rectangle. */
  55. void performLayout (Rectangle<int> targetArea);
  56. //==============================================================================
  57. /** Specifies how flex items are placed in the flex container, and defines the
  58. direction of the main axis.
  59. */
  60. Direction flexDirection = Direction::row;
  61. /** Specifies whether items are forced into a single line or can be wrapped onto multiple lines.
  62. If wrapping is allowed, this property also controls the direction in which lines are stacked.
  63. */
  64. Wrap flexWrap = Wrap::noWrap;
  65. /** Specifies how a flex container's lines are placed within the flex container when
  66. there is extra space on the cross-axis.
  67. This property has no effect on single line layouts.
  68. */
  69. AlignContent alignContent = AlignContent::stretch;
  70. /** Specifies the alignment of flex items along the cross-axis of each line. */
  71. AlignItems alignItems = AlignItems::stretch;
  72. /** Defines how the container distributes space between and around items along the main-axis.
  73. The alignment is done after the lengths and auto margins are applied, so that if there is at
  74. least one flexible element, with flex-grow different from 0, it will have no effect as there
  75. won't be any available space.
  76. */
  77. JustifyContent justifyContent = JustifyContent::flexStart;
  78. /** The set of items to lay-out. */
  79. Array<FlexItem> items;
  80. private:
  81. JUCE_LEAK_DETECTOR (FlexBox)
  82. };
  83. } // namespace juce