LMMS
Loading...
Searching...
No Matches
juce_GridItem.h
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
36{
37public:
38 enum class Keyword { autoValue };
39
40 //==============================================================================
42 struct Span
43 {
44 explicit Span (int numberToUse) noexcept : number (numberToUse)
45 {
46 /* Span must be at least one and positive */
47 jassert (numberToUse > 0);
48 }
49
50 explicit Span (int numberToUse, const String& nameToUse) : Span (numberToUse)
51 {
52 /* Name must not be empty */
53 jassert (nameToUse.isNotEmpty());
54 name = nameToUse;
55 }
56
57 explicit Span (const String& nameToUse) : name (nameToUse)
58 {
59 /* Name must not be empty */
60 jassert (nameToUse.isNotEmpty());
61 }
62
63 int number = 1;
65 };
66
67 //==============================================================================
69 struct Property
70 {
71 Property() noexcept;
72
73 Property (Keyword keyword) noexcept;
74
75 Property (const char* lineNameToUse) noexcept;
76
77 Property (const String& lineNameToUse) noexcept;
78
79 Property (int numberToUse) noexcept;
80
81 Property (int numberToUse, const String& lineNameToUse) noexcept;
82
83 Property (Span spanToUse) noexcept;
84
85 bool hasSpan() const noexcept { return isSpan && ! isAuto; }
86 bool hasAbsolute() const noexcept { return ! (isSpan || isAuto); }
87 bool hasAuto() const noexcept { return isAuto; }
88 bool hasName() const noexcept { return name.isNotEmpty(); }
89 const String& getName() const noexcept { return name; }
90 int getNumber() const noexcept { return number; }
91
92 private:
94 int number = 1;
95 bool isSpan = false;
96 bool isAuto = false;
97 };
98
99 //==============================================================================
102
103 //==============================================================================
105 enum class JustifySelf : int
106 {
107 start = 0,
109 center,
110 stretch,
111 autoValue
112 };
113
115 enum class AlignSelf : int
116 {
117 start = 0,
119 center,
120 stretch,
121 autoValue
122 };
123
127 GridItem (Component& componentToUse) noexcept;
129 GridItem (Component* componentToUse) noexcept;
130
131 //==============================================================================
134
135 //==============================================================================
137 int order = 0;
138
143
148
151
154
157
158 //==============================================================================
159 enum
160 {
161 useDefaultValue = -2, /* TODO: useDefaultValue should be named useAuto */
163 };
164
165 /* TODO: move all of this into a common class that is shared with the FlexItem */
167 float minWidth = 0.0f;
169
171 float minHeight = 0.0f;
173
175 struct Margin
176 {
177 Margin() noexcept;
178 Margin (int size) noexcept;
179 Margin (float size) noexcept;
180 Margin (float top, float right, float bottom, float left) noexcept;
181
182 float left;
183 float right;
184 float top;
185 float bottom;
186 };
187
190
193
195 void setArea (Property rowStart, Property columnStart, Property rowEnd, Property columnEnd);
196
198 void setArea (Property rowStart, Property columnStart);
199
201 void setArea (const String& areaName);
202
204 GridItem withArea (Property rowStart, Property columnStart, Property rowEnd, Property columnEnd) const noexcept;
205
207 GridItem withArea (Property rowStart, Property columnStart) const noexcept;
208
210 GridItem withArea (const String& areaName) const noexcept;
211
213 GridItem withRow (StartAndEndProperty row) const noexcept;
214
217
219 GridItem withAlignSelf (AlignSelf newAlignSelf) const noexcept;
220
222 GridItem withJustifySelf (JustifySelf newJustifySelf) const noexcept;
223
225 GridItem withWidth (float newWidth) const noexcept;
226
228 GridItem withHeight (float newHeight) const noexcept;
229
231 GridItem withSize (float newWidth, float newHeight) const noexcept;
232
234 GridItem withMargin (Margin newMargin) const noexcept;
235
237 GridItem withOrder (int newOrder) const noexcept;
238};
239
240} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_Component.h:36
void setArea(Property rowStart, Property columnStart, Property rowEnd, Property columnEnd)
Definition juce_GridItem.cpp:75
float maxHeight
Definition juce_GridItem.h:172
float width
Definition juce_GridItem.h:166
GridItem withOrder(int newOrder) const noexcept
Definition juce_GridItem.cpp:172
Rectangle< float > currentBounds
Definition juce_GridItem.h:192
String area
Definition juce_GridItem.h:156
GridItem withJustifySelf(JustifySelf newJustifySelf) const noexcept
Definition juce_GridItem.cpp:136
AlignSelf
Definition juce_GridItem.h:116
float minHeight
Definition juce_GridItem.h:171
Component * associatedComponent
Definition juce_GridItem.h:133
GridItem withMargin(Margin newMargin) const noexcept
Definition juce_GridItem.cpp:165
Keyword
Definition juce_GridItem.h:38
@ autoValue
Definition juce_GridItem.h:38
GridItem withColumn(StartAndEndProperty column) const noexcept
Definition juce_GridItem.cpp:122
GridItem withHeight(float newHeight) const noexcept
Definition juce_GridItem.cpp:150
float height
Definition juce_GridItem.h:170
StartAndEndProperty row
Definition juce_GridItem.h:153
int order
Definition juce_GridItem.h:137
GridItem withAlignSelf(AlignSelf newAlignSelf) const noexcept
Definition juce_GridItem.cpp:129
@ useDefaultValue
Definition juce_GridItem.h:161
@ notAssigned
Definition juce_GridItem.h:162
GridItem withSize(float newWidth, float newHeight) const noexcept
Definition juce_GridItem.cpp:157
float minWidth
Definition juce_GridItem.h:167
GridItem() noexcept
StartAndEndProperty column
Definition juce_GridItem.h:150
GridItem withRow(StartAndEndProperty row) const noexcept
Definition juce_GridItem.cpp:115
float maxWidth
Definition juce_GridItem.h:168
GridItem withArea(Property rowStart, Property columnStart, Property rowEnd, Property columnEnd) const noexcept
Definition juce_GridItem.cpp:94
GridItem withWidth(float newWidth) const noexcept
Definition juce_GridItem.cpp:143
Margin margin
Definition juce_GridItem.h:189
JustifySelf justifySelf
Definition juce_GridItem.h:142
JustifySelf
Definition juce_GridItem.h:106
AlignSelf alignSelf
Definition juce_GridItem.h:147
Definition juce_Rectangle.h:67
Definition juce_String.h:53
bool isNotEmpty() const noexcept
Definition juce_String.h:316
virtual ASIOError start()=0
#define jassert(expression)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
RangedDirectoryIterator end(const RangedDirectoryIterator &)
Definition juce_RangedDirectoryIterator.h:184
Definition juce_GridItem.h:176
Margin() noexcept
Definition juce_GridItem.cpp:62
float right
Definition juce_GridItem.h:183
float top
Definition juce_GridItem.h:184
float left
Definition juce_GridItem.h:182
float bottom
Definition juce_GridItem.h:185
Definition juce_GridItem.h:70
bool hasName() const noexcept
Definition juce_GridItem.h:88
bool isAuto
Definition juce_GridItem.h:96
Property() noexcept
Definition juce_GridItem.cpp:29
int getNumber() const noexcept
Definition juce_GridItem.h:90
bool hasAuto() const noexcept
Definition juce_GridItem.h:87
const String & getName() const noexcept
Definition juce_GridItem.h:89
int number
Definition juce_GridItem.h:94
String name
Definition juce_GridItem.h:93
bool hasSpan() const noexcept
Definition juce_GridItem.h:85
bool isSpan
Definition juce_GridItem.h:95
bool hasAbsolute() const noexcept
Definition juce_GridItem.h:86
Definition juce_GridItem.h:43
Span(int numberToUse) noexcept
Definition juce_GridItem.h:44
int number
Definition juce_GridItem.h:63
Span(int numberToUse, const String &nameToUse)
Definition juce_GridItem.h:50
Span(const String &nameToUse)
Definition juce_GridItem.h:57
String name
Definition juce_GridItem.h:64
Definition juce_GridItem.h:101
Property start
Definition juce_GridItem.h:101
Property end
Definition juce_GridItem.h:101
ulg size
Definition extract.c:2350
#define const
Definition zconf.h:137