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_ */