Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
muselement.h
Go to the documentation of this file.
1 
8 #ifndef MUSELEMENT_H_
9 #define MUSELEMENT_H_
10 
11 #include <QString>
12 #include <QList>
13 #include <QColor>
14 
15 class CAContext;
16 class CAMusElement;
17 class CAPlayable;
18 class CAMark;
19 
20 class CAMusElement {
21 public:
23  Undefined = 0,
35  };
36 
38  virtual ~CAMusElement();
39 
40  virtual CAMusElement* clone(CAContext* context=0) = 0;
41  virtual int compare(CAMusElement *elt) = 0;
42 
44 
45  inline CAContext *context() { return _context; }
47 
48  inline virtual int timeStart() { return _timeStart; }
49  inline void setTimeStart(int time) { _timeStart = time; }
50  inline virtual int timeLength() { return _timeLength; }
51  inline void setTimeLength(int length) { _timeLength = length; }
52  inline int timeEnd() { return timeStart() + timeLength(); }
53 
54  inline const QString name() { return _name; }
55  inline void setName(const QString name) { _name = name; }
56 
57  inline const bool isVisible() { return _visible; }
58  inline void setVisible( const bool v ) { _visible = v; }
59 
60  inline const QColor color() { return _color; }
61  inline void setColor( const QColor c ) { _color = c; }
62 
63  inline const QList<CAMark*> markList() { return _markList; }
64  void addMark( CAMark *mark );
65  void addMarks( QList<CAMark*> marks );
66  inline void removeMark( CAMark* mark ) { _markList.removeAll(mark); }
67 
68  bool isPlayable();
69 
70  static const QString musElementTypeToString(CAMusElementType);
71  static CAMusElementType musElementTypeFromString(const QString);
72 
73 protected:
74  inline void setMusElementType( CAMusElementType type ) { _musElementType = type; }
75 
76  QList< CAMark* > _markList;
81  bool _visible;
82  QColor _color;
83  QString _name;
84 };
85 #endif /* MUSELEMENT_H_ */
void setColor(const QColor c)
Definition: muselement.h:61
CAContext * _context
Definition: muselement.h:78
virtual ~CAMusElement()
Definition: muselement.cpp:51
const bool isVisible()
Definition: muselement.h:57
bool _visible
Definition: muselement.h:81
void removeMark(CAMark *mark)
Definition: muselement.h:66
void setTimeLength(int length)
Definition: muselement.h:51
bool isPlayable()
Definition: muselement.cpp:73
static CAMusElementType musElementTypeFromString(const QString)
Definition: muselement.cpp:103
CAContext * setContext(CAContext *context)
Definition: muselement.h:46
void setName(const QString name)
Definition: muselement.h:55
static const QString musElementTypeToString(CAMusElementType)
Definition: muselement.cpp:83
Marks that depend on other music elements.
Definition: mark.h:15
Definition: muselement.h:33
virtual int compare(CAMusElement *elt)=0
CAMusElementType _musElementType
Definition: muselement.h:77
Definition: muselement.h:29
virtual int timeStart()
Definition: muselement.h:48
Definition: muselement.h:28
int _timeStart
Definition: muselement.h:79
void addMark(CAMark *mark)
Definition: muselement.cpp:119
QColor _color
Definition: muselement.h:82
const QList< CAMark * > markList()
Definition: muselement.h:63
int _timeLength
Definition: muselement.h:80
Definition: muselement.h:26
CAMusElementType
Definition: muselement.h:22
CAMusElementType musElementType()
Definition: muselement.h:43
CAMusElement(CAContext *context, int timeStart, int timeLength=0)
Definition: muselement.cpp:38
QString _name
Definition: muselement.h:83
int timeEnd()
Definition: muselement.h:52
QList< CAMark * > _markList
Definition: muselement.h:76
virtual int timeLength()
Definition: muselement.h:50
Definition: muselement.h:32
Definition: muselement.h:31
An abstract class which represents every music element in the score.
Definition: muselement.h:20
void setMusElementType(CAMusElementType type)
Definition: muselement.h:74
Definition: muselement.h:24
Playable instances of music elements.
Definition: playable.h:18
void setVisible(const bool v)
Definition: muselement.h:58
Definition: muselement.h:30
Definition: muselement.h:25
void addMarks(QList< CAMark * > marks)
Definition: muselement.cpp:137
Definition: muselement.h:27
const QString name()
Definition: muselement.h:54
Definition: muselement.h:23
Definition: muselement.h:34
CAContext * context()
Definition: muselement.h:45
virtual CAMusElement * clone(CAContext *context=0)=0
void setTimeStart(int time)
Definition: muselement.h:49
const QColor color()
Definition: muselement.h:60
Line of music elements in the sheet.
Definition: context.h:16