openshot-audio  0.1.4
juce_DrawableText.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_DRAWABLETEXT_H_INCLUDED
26 #define JUCE_DRAWABLETEXT_H_INCLUDED
27 
28 
29 //==============================================================================
36 {
37 public:
38  //==============================================================================
40  DrawableText();
41  DrawableText (const DrawableText&);
42 
44  ~DrawableText();
45 
46  //==============================================================================
48  void setText (const String& newText);
49 
51  const String& getText() const noexcept { return text;}
52 
54  void setColour (Colour newColour);
55 
57  Colour getColour() const noexcept { return colour; }
58 
65  void setFont (const Font& newFont, bool applySizeAndScale);
66 
68  const Font& getFont() const noexcept { return font; }
69 
71  void setJustification (Justification newJustification);
72 
74  Justification getJustification() const noexcept { return justification; }
75 
77  const RelativeParallelogram& getBoundingBox() const noexcept { return bounds; }
78 
80  void setBoundingBox (const RelativeParallelogram& newBounds);
81 
82  const RelativeCoordinate& getFontHeight() const { return fontHeight; }
83  void setFontHeight (const RelativeCoordinate& newHeight);
84 
85  const RelativeCoordinate& getFontHorizontalScale() const { return fontHScale; }
86  void setFontHorizontalScale (const RelativeCoordinate& newScale);
87 
88  //==============================================================================
90  void paint (Graphics&) override;
92  Drawable* createCopy() const override;
94  void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder);
96  ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const override;
98  static const Identifier valueTreeType;
100  Rectangle<float> getDrawableBounds() const override;
101 
102  //==============================================================================
105  {
106  public:
107  ValueTreeWrapper (const ValueTree& state);
108 
109  String getText() const;
110  void setText (const String& newText, UndoManager* undoManager);
111  Value getTextValue (UndoManager* undoManager);
112 
113  Colour getColour() const;
114  void setColour (Colour newColour, UndoManager* undoManager);
115 
116  Justification getJustification() const;
117  void setJustification (Justification newJustification, UndoManager* undoManager);
118 
119  Font getFont() const;
120  void setFont (const Font& newFont, UndoManager* undoManager);
121  Value getFontValue (UndoManager* undoManager);
122 
123  RelativeParallelogram getBoundingBox() const;
124  void setBoundingBox (const RelativeParallelogram& newBounds, UndoManager* undoManager);
125 
126  RelativeCoordinate getFontHeight() const;
127  void setFontHeight (const RelativeCoordinate& newHeight, UndoManager* undoManager);
128 
129  RelativeCoordinate getFontHorizontalScale() const;
130  void setFontHorizontalScale (const RelativeCoordinate& newScale, UndoManager* undoManager);
131 
132  static const Identifier text, colour, font, justification, topLeft, topRight, bottomLeft, fontHeight, fontHScale;
133  };
134 
135 private:
136  //==============================================================================
137  RelativeParallelogram bounds;
138  RelativeCoordinate fontHeight, fontHScale;
139  Point<float> resolvedPoints[3];
140  Font font, scaledFont;
141  String text;
142  Colour colour;
143  Justification justification;
144 
147  void recalculateCoordinates (Expression::Scope*);
148  void refreshBounds();
149 
150  DrawableText& operator= (const DrawableText&);
152 };
153 
154 
155 #endif // JUCE_DRAWABLETEXT_H_INCLUDED
Definition: juce_DrawableText.h:35
void setColour(int colourId, Colour newColour)
Definition: juce_Component.cpp:2189
Definition: juce_Font.h:39
Definition: juce_RelativeCoordinate.h:70
#define noexcept
Definition: juce_CompilerSupport.h:141
const String & getText() const noexcept
Definition: juce_DrawableText.h:51
Definition: juce_Justification.h:38
Definition: juce_Expression.h:113
Colour getColour() const noexcept
Definition: juce_DrawableText.h:57
const Font & getFont() const noexcept
Definition: juce_DrawableText.h:68
Definition: juce_Point.h:39
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_Drawable.h:222
Definition: juce_Rectangle.h:36
Definition: juce_Colour.h:35
static const Identifier topRight
Definition: juce_DrawableText.h:132
Definition: juce_DrawableText.h:104
virtual void paint(Graphics &g)
Definition: juce_Component.cpp:1929
const RelativeCoordinate & getFontHorizontalScale() const
Definition: juce_DrawableText.h:85
Definition: juce_RelativeCoordinatePositioner.h:33
virtual Drawable * createCopy() const =0
virtual ValueTree createValueTree(ComponentBuilder::ImageProvider *imageProvider) const =0
const RelativeParallelogram & getBoundingBox() const noexcept
Definition: juce_DrawableText.h:77
Definition: juce_RelativeParallelogram.h:35
bool registerCoordinates() override
Definition: juce_Drawable.h:230
Definition: juce_ComponentBuilder.h:45
Definition: juce_Drawable.h:35
Definition: juce_Value.h:44
Definition: juce_GraphicsContext.h:42
Definition: juce_Drawable.h:185
Definition: juce_ValueTree.h:64
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141
Definition: juce_UndoManager.h:49
const RelativeCoordinate & getFontHeight() const
Definition: juce_DrawableText.h:82
Justification getJustification() const noexcept
Definition: juce_DrawableText.h:74
virtual Rectangle< float > getDrawableBounds() const =0
static const Identifier valueTreeType
Definition: juce_DrawableText.h:98
Definition: juce_Identifier.h:43
Definition: juce_ComponentBuilder.h:183