Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
drawablecontext.h
Go to the documentation of this file.
1 
8 #ifndef DRAWABLECONTEXT_H_
9 #define DRAWABLECONTEXT_H_
10 
11 #include <QList>
12 
13 #include "drawable/drawable.h"
15 
16 class CAContext;
17 
18 class CADrawableContext : public CADrawable {
19 public:
24  };
25 
26  CADrawableContext(CAContext *c, double x, double y);
27  inline CAContext *context() { return _context; }
29  inline virtual void addMElement(CADrawableMusElement *elt) {
30  int i;
31  for (i=_drawableMusElementList.size()-1; (i>=0) && _drawableMusElementList[i]->xPos()>elt->xPos(); i--);
32  _drawableMusElementList.insert( ++i, elt);
33  }
34  virtual int removeMElement(CADrawableMusElement *elt) { return _drawableMusElementList.removeAll(elt); }
36  virtual CADrawableContext* clone() = 0;
37  QList<CADrawableMusElement*>& drawableMusElementList() { return _drawableMusElementList; }
38 
40  for (int i=0; i<_drawableMusElementList.size(); i++)
41  if (_drawableMusElementList[i]->musElement()==elt)
42  return _drawableMusElementList[i];
43  return 0;
44  }
45 
46  QList<CADrawableMusElement*> findInRange( double x1, double x2 );
47 
48 protected:
50 
53  QList<CADrawableMusElement *> _drawableMusElementList; // List of all the drawable musElements in this context sorted by their left borders
54 };
55 
56 #endif /* DRAWABLECONTEXT_H_ */