1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-08 04:20:09 +00:00

Added a few extra FlexItem convenience methods

This commit is contained in:
jules 2016-11-08 17:36:24 +00:00
parent 63eabb4456
commit 58bd2b130f
2 changed files with 25 additions and 3 deletions

View file

@ -831,6 +831,13 @@ FlexItem FlexItem::withFlex (float newFlexGrow, float newFlexShrink, float newFl
return fi;
}
FlexItem FlexItem::withWidth (float newWidth) const noexcept { auto fi = *this; fi.width = newWidth; return fi; }
FlexItem FlexItem::withHeight (float newHeight) const noexcept { auto fi = *this; fi.height = newHeight; return fi; }
FlexItem FlexItem::withMargin (Margin m) const noexcept { auto fi = *this; fi.margin = m; return fi; }
FlexItem FlexItem::withWidth (float newWidth) const noexcept { auto fi = *this; fi.width = newWidth; return fi; }
FlexItem FlexItem::withMinWidth (float newMinWidth) const noexcept { auto fi = *this; fi.minWidth = newMinWidth; return fi; }
FlexItem FlexItem::withMaxWidth (float newMaxWidth) const noexcept { auto fi = *this; fi.maxWidth = newMaxWidth; return fi; }
FlexItem FlexItem::withMinHeight (float newMinHeight) const noexcept { auto fi = *this; fi.minHeight = newMinHeight; return fi; };
FlexItem FlexItem::withMaxHeight (float newMaxHeight) const noexcept { auto fi = *this; fi.maxHeight = newMaxHeight; return fi; };
FlexItem FlexItem::withHeight (float newHeight) const noexcept { auto fi = *this; fi.height = newHeight; return fi; }
FlexItem FlexItem::withMargin (Margin m) const noexcept { auto fi = *this; fi.margin = m; return fi; }
FlexItem FlexItem::withOrder (int newOrder) const noexcept { auto fi = *this; fi.order = newOrder; return fi; }

View file

@ -134,9 +134,24 @@ public:
/** Returns a copy of this object with a new width. */
FlexItem withWidth (float newWidth) const noexcept;
/** Returns a copy of this object with a new minimum width. */
FlexItem withMinWidth (float newMinWidth) const noexcept;
/** Returns a copy of this object with a new maximum width. */
FlexItem withMaxWidth (float newMaxWidth) const noexcept;
/** Returns a copy of this object with a new height. */
FlexItem withHeight (float newHeight) const noexcept;
/** Returns a copy of this object with a new minimum height. */
FlexItem withMinHeight (float newMinHeight) const noexcept;
/** Returns a copy of this object with a new maximum height. */
FlexItem withMaxHeight (float newMaxHeight) const noexcept;
/** Returns a copy of this object with a new margin. */
FlexItem withMargin (Margin) const noexcept;
/** Returns a copy of this object with a new order. */
FlexItem withOrder (int newOrder) const noexcept;
};