JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_GridItem.cpp
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29GridItem::Property::Property() noexcept : isAuto (true)
30{
31}
32
33GridItem::Property::Property (GridItem::Keyword keyword) noexcept : isAuto (keyword == GridItem::Keyword::autoValue)
34{
35 jassert (keyword == GridItem::Keyword::autoValue);
36}
37
38GridItem::Property::Property (const char* lineNameToUse) noexcept : GridItem::Property (String (lineNameToUse))
39{
40}
41
42GridItem::Property::Property (const String& lineNameToUse) noexcept : name (lineNameToUse), number (1)
43{
44}
45
46GridItem::Property::Property (int numberToUse) noexcept : number (numberToUse)
47{
48}
49
50GridItem::Property::Property (int numberToUse, const String& lineNameToUse) noexcept
51 : name (lineNameToUse), number (numberToUse)
52{
53}
54
55GridItem::Property::Property (Span spanToUse) noexcept
56 : name (spanToUse.name), number (spanToUse.number), isSpan (true)
57{
58}
59
60
61//==============================================================================
62GridItem::Margin::Margin() noexcept : left(), right(), top(), bottom() {}
63
64GridItem::Margin::Margin (int v) noexcept : GridItem::Margin::Margin (static_cast<float> (v)) {}
65
66GridItem::Margin::Margin (float v) noexcept : left (v), right (v), top (v), bottom (v) {}
67
68GridItem::Margin::Margin (float t, float r, float b, float l) noexcept : left (l), right (r), top (t), bottom (b) {}
69
70//==============================================================================
71GridItem::GridItem() noexcept = default;
72GridItem::GridItem (Component& componentToUse) noexcept : associatedComponent (&componentToUse) {}
73GridItem::GridItem (Component* componentToUse) noexcept : associatedComponent (componentToUse) {}
74
75void GridItem::setArea (Property rowStart, Property columnStart, Property rowEnd, Property columnEnd)
76{
77 column.start = columnStart;
78 column.end = columnEnd;
79 row.start = rowStart;
80 row.end = rowEnd;
81}
82
83void GridItem::setArea (Property rowStart, Property columnStart)
84{
85 column.start = columnStart;
86 row.start = rowStart;
87}
88
89void GridItem::setArea (const String& areaName)
90{
91 area = areaName;
92}
93
94GridItem GridItem::withArea (Property rowStart, Property columnStart, Property rowEnd, Property columnEnd) const noexcept
95{
96 auto gi = *this;
97 gi.setArea (rowStart, columnStart, rowEnd, columnEnd);
98 return gi;
99}
100
101GridItem GridItem::withArea (Property rowStart, Property columnStart) const noexcept
102{
103 auto gi = *this;
104 gi.setArea (rowStart, columnStart);
105 return gi;
106}
107
108GridItem GridItem::withArea (const String& areaName) const noexcept
109{
110 auto gi = *this;
111 gi.setArea (areaName);
112 return gi;
113}
114
116{
117 auto gi = *this;
118 gi.row = newRow;
119 return gi;
120}
121
123{
124 auto gi = *this;
125 gi.column = newColumn;
126 return gi;
127}
128
129GridItem GridItem::withAlignSelf (AlignSelf newAlignSelf) const noexcept
130{
131 auto gi = *this;
132 gi.alignSelf = newAlignSelf;
133 return gi;
134}
135
136GridItem GridItem::withJustifySelf (JustifySelf newJustifySelf) const noexcept
137{
138 auto gi = *this;
139 gi.justifySelf = newJustifySelf;
140 return gi;
141}
142
143GridItem GridItem::withWidth (float newWidth) const noexcept
144{
145 auto gi = *this;
146 gi.width = newWidth;
147 return gi;
148}
149
150GridItem GridItem::withHeight (float newHeight) const noexcept
151{
152 auto gi = *this;
153 gi.height = newHeight;
154 return gi;
155}
156
157GridItem GridItem::withSize (float newWidth, float newHeight) const noexcept
158{
159 auto gi = *this;
160 gi.width = newWidth;
161 gi.height = newHeight;
162 return gi;
163}
164
165GridItem GridItem::withMargin (Margin newHeight) const noexcept
166{
167 auto gi = *this;
168 gi.margin = newHeight;
169 return gi;
170}
171
172GridItem GridItem::withOrder (int newOrder) const noexcept
173{
174 auto gi = *this;
175 gi.order = newOrder;
176 return gi;
177}
178
179} // namespace juce
The base class for all JUCE user-interface objects.
Defines an item in a Grid.
void setArea(Property rowStart, Property columnStart, Property rowEnd, Property columnEnd)
Short-hand.
GridItem withOrder(int newOrder) const noexcept
Returns a copy of this object with a new order.
GridItem withJustifySelf(JustifySelf newJustifySelf) const noexcept
Returns a copy of this object with a new justifySelf property.
AlignSelf
Possible values for the alignSelf property.
Component * associatedComponent
If this is non-null, it represents a Component whose bounds are controlled by this item.
GridItem withMargin(Margin newMargin) const noexcept
Returns a copy of this object with a new margin.
GridItem withColumn(StartAndEndProperty column) const noexcept
Returns a copy of this object with a new column property.
GridItem withHeight(float newHeight) const noexcept
Returns a copy of this object with a new height.
StartAndEndProperty row
These are the start and end properties of the row.
int order
Determines the order used to lay out items in their grid container.
GridItem withAlignSelf(AlignSelf newAlignSelf) const noexcept
Returns a copy of this object with a new alignSelf property.
GridItem withSize(float newWidth, float newHeight) const noexcept
Returns a copy of this object with a new size.
GridItem() noexcept
Creates an item with default parameters.
StartAndEndProperty column
These are the start and end properties of the column.
GridItem withRow(StartAndEndProperty row) const noexcept
Returns a copy of this object with a new row property.
GridItem withArea(Property rowStart, Property columnStart, Property rowEnd, Property columnEnd) const noexcept
Short-hand.
GridItem withWidth(float newWidth) const noexcept
Returns a copy of this object with a new width.
Margin margin
The margin to leave around this item.
JustifySelf justifySelf
This is the justify-self property of the item.
JustifySelf
Possible values for the justifySelf property.
AlignSelf alignSelf
This is the align-self property of the item.
Represents start and end properties.
The JUCE String class!
Definition juce_String.h:53
#define jassert(expression)
Platform-independent assertion macro.
T left(T... args)
JUCE Namespace.
Represents a margin.
Represents a property.