Verovio
Source code documentation
textelement.h
1 // Name: textelement.h
3 // Author: Laurent Pugin
4 // Created: 2015
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_TEXT_ELEMENT_H__
9 #define __VRV_TEXT_ELEMENT_H__
10 
11 #include "atts_shared.h"
12 #include "object.h"
13 
14 namespace vrv {
15 
16 class Rend;
17 
18 //----------------------------------------------------------------------------
19 // TextElement
20 //----------------------------------------------------------------------------
21 
22 class TextElement : public Object, public AttLabelled, public AttTyped {
23 public:
29  TextElement();
30  TextElement(ClassId classId);
31  virtual ~TextElement();
32  void Reset() override;
34 
39  int GetDrawingX() const override;
40  int GetDrawingY() const override;
42 
47  int GetDrawingXRel() const { return m_drawingXRel; }
48  virtual void SetDrawingXRel(int drawingXRel);
49  int GetDrawingYRel() const { return m_drawingYRel; }
50  virtual void SetDrawingYRel(int drawingYRel);
52 
53  //----------//
54  // Functors //
55  //----------//
56 
61  FunctorCode Accept(Functor &functor) override;
62  FunctorCode Accept(ConstFunctor &functor) const override;
63  FunctorCode AcceptEnd(Functor &functor) override;
64  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
66 
67 private:
68  //
69 public:
70  //
71 private:
75  int m_drawingYRel;
76 
80  int m_drawingXRel;
81 };
82 
83 //----------------------------------------------------------------------------
84 // TextDrawingParams
85 //----------------------------------------------------------------------------
86 
90 struct TextEnclosure {
91  TextElement *m_element = NULL;
92  int m_fontBottom = 0;
93  int m_fontTop = 0;
94 };
95 
100 public:
102  {
103  m_x = 0;
104  m_y = 0;
105  m_width = 0;
106  m_height = 0;
107  m_laidOut = false;
108  m_explicitPosition = false;
109  m_verticalShift = false;
110  m_alignment = HORIZONTALALIGNMENT_left;
111  m_pointSize = 0;
112  m_staffSize = 100;
113  m_actualWidth = 0;
114  m_enclose = TEXTRENDITION_NONE;
115  m_textEnclose = ENCLOSURE_NONE;
116  }
117  virtual ~TextDrawingParams() {}
118 
119  int m_x;
120  int m_y;
121  int m_width;
122  int m_height;
123  int m_actualWidth;
124  bool m_laidOut;
125  // used when X and Y has been changed manually or otherwise (e.g. newline <lb/> shift or shift for
126  // boxed enclosure for rend)
127  bool m_explicitPosition;
128  bool m_verticalShift;
129  data_HORIZONTALALIGNMENT m_alignment;
130  int m_pointSize;
133  std::vector<TextEnclosure> m_enclosedRend;
134  data_TEXTRENDITION m_enclose;
135  data_ENCLOSURE m_textEnclose;
136 };
137 
138 } // namespace vrv
139 
140 #endif
This abstract class is the base class for all const functors.
Definition: functor.h:126
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
This class represents a basic object.
Definition: object.h:66
This class stores current drawing parameters for text.
Definition: textelement.h:99
int m_staffSize
Staff-size percentage used for virtual units; 100 is the unscaled fallback when no staff context exis...
Definition: textelement.h:132
Definition: textelement.h:22
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
void Reset() override
Reset the object, that is 1) removing all children and 2) resetting all attributes.
An enclosed text element with the bottom and top of its font, for drawing the enclosure.
Definition: textelement.h:90