LMMS
Loading...
Searching...
No Matches
juce_AttributedString.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
29//==============================================================================
47{
48public:
50 AttributedString() = default;
51
53 explicit AttributedString (const String& newString) { setText (newString); }
54
56 AttributedString& operator= (const AttributedString&) = default;
58 AttributedString& operator= (AttributedString&&) noexcept = default;
59
60 //==============================================================================
63
68 void setText (const String& newText);
69
71 void append (const String& textToAppend);
73 void append (const String& textToAppend, const Font& font);
75 void append (const String& textToAppend, Colour colour);
77 void append (const String& textToAppend, const Font& font, Colour colour);
78
83 void append (const AttributedString& other);
84
89 void clear();
90
91 //==============================================================================
96 void draw (Graphics& g, const Rectangle<float>& area) const;
97
98 //==============================================================================
103
107 void setJustification (Justification newJustification) noexcept;
108
109 //==============================================================================
119
122
124 void setWordWrap (WordWrap newWordWrap) noexcept;
125
126 //==============================================================================
136
139
141 void setReadingDirection (ReadingDirection newReadingDirection) noexcept;
142
143 //==============================================================================
146
148 void setLineSpacing (float newLineSpacing) noexcept;
149
150 //==============================================================================
153 {
154 public:
155 Attribute() = default;
156
157 Attribute (const Attribute&) = default;
158 Attribute& operator= (const Attribute&) = default;
160 Attribute& operator= (Attribute&&) noexcept = default;
161
164
167
170
172 Colour colour { 0xff000000 };
173
174 private:
176 };
177
179 int getNumAttributes() const noexcept { return attributes.size(); }
180
184 const Attribute& getAttribute (int index) const noexcept { return attributes.getReference (index); }
185
186 //==============================================================================
188 void setColour (Range<int> range, Colour colour);
189
191 void setColour (Colour colour);
192
194 void setFont (Range<int> range, const Font& font);
195
197 void setFont (const Font& font);
198
199private:
201 float lineSpacing = 0.0f;
206
208};
209
210} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_Array.h:56
Definition juce_AttributedString.h:153
Colour colour
Definition juce_AttributedString.h:172
Attribute(Attribute &&) noexcept=default
Font font
Definition juce_AttributedString.h:169
Attribute(const Attribute &)=default
Range< int > range
Definition juce_AttributedString.h:166
Definition juce_AttributedString.h:47
ReadingDirection readingDirection
Definition juce_AttributedString.h:204
float lineSpacing
Definition juce_AttributedString.h:201
WordWrap getWordWrap() const noexcept
Definition juce_AttributedString.h:121
AttributedString(const String &newString)
Definition juce_AttributedString.h:53
Justification justification
Definition juce_AttributedString.h:202
float getLineSpacing() const noexcept
Definition juce_AttributedString.h:145
WordWrap wordWrap
Definition juce_AttributedString.h:203
String text
Definition juce_AttributedString.h:200
const Attribute & getAttribute(int index) const noexcept
Definition juce_AttributedString.h:184
Array< Attribute > attributes
Definition juce_AttributedString.h:205
ReadingDirection
Definition juce_AttributedString.h:131
@ natural
Definition juce_AttributedString.h:132
@ rightToLeft
Definition juce_AttributedString.h:134
@ leftToRight
Definition juce_AttributedString.h:133
int getNumAttributes() const noexcept
Definition juce_AttributedString.h:179
WordWrap
Definition juce_AttributedString.h:114
@ none
Definition juce_AttributedString.h:115
@ byWord
Definition juce_AttributedString.h:116
@ byChar
Definition juce_AttributedString.h:117
void setText(const String &newText)
Definition juce_AttributedString.cpp:161
ReadingDirection getReadingDirection() const noexcept
Definition juce_AttributedString.h:138
AttributedString(const AttributedString &)=default
const String & getText() const noexcept
Definition juce_AttributedString.h:62
AttributedString(AttributedString &&) noexcept=default
Justification getJustification() const noexcept
Definition juce_AttributedString.h:102
Definition juce_Colour.h:38
Definition juce_Font.h:42
Definition juce_GraphicsContext.h:45
Definition juce_Justification.h:41
@ left
Definition juce_Justification.h:108
Definition juce_Range.h:40
Definition juce_Rectangle.h:67
Definition juce_String.h:53
int g
Definition inflate.c:1573
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition juce_LeakedObjectDetector.h:138
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
#define const
Definition zconf.h:137