Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
/home/iurt/rpm/BUILD/canorus-0.7.R1002/src/drawable/drawablecontext.h
Go to the documentation of this file.
00001 
00008 #ifndef DRAWABLECONTEXT_H_
00009 #define DRAWABLECONTEXT_H_
00010 
00011 #include <QList>
00012 
00013 #include "drawable/drawable.h"
00014 #include "drawable/drawablemuselement.h"
00015 
00016 class CAContext;
00017 
00018 class CADrawableContext : public CADrawable {
00019 public:
00020         enum CADrawableContextType {
00021                 DrawableStaff,
00022                 DrawableLyricsContext,
00023                 DrawableFunctionMarkContext
00024         };
00025 
00026         CADrawableContext(CAContext *c, double x, double y);
00027         inline CAContext *context() { return _context; }
00028         CADrawableContextType drawableContextType() { return _drawableContextType; }
00029         inline virtual void addMElement(CADrawableMusElement *elt) {
00030                 int i;
00031                 for (i=_drawableMusElementList.size()-1; (i>=0) && _drawableMusElementList[i]->xPos()>elt->xPos(); i--);
00032                 _drawableMusElementList.insert( ++i, elt);
00033         }
00034         virtual int removeMElement(CADrawableMusElement *elt) { return _drawableMusElementList.removeAll(elt); }
00035         CADrawableMusElement *lastDrawableMusElement() { if (_drawableMusElementList.size()) return _drawableMusElementList.last(); else return 0; }
00036         virtual CADrawableContext* clone() = 0;
00037         QList<CADrawableMusElement*>& drawableMusElementList() { return _drawableMusElementList; }
00038 
00039         inline CADrawableMusElement *findMElement(CAMusElement* elt) {
00040                 for (int i=0; i<_drawableMusElementList.size(); i++)
00041                         if (_drawableMusElementList[i]->musElement()==elt)
00042                                 return _drawableMusElementList[i];
00043                 return 0;
00044         }
00045 
00046         QList<CADrawableMusElement*> findInRange( double x1, double x2 );
00047 
00048 protected:
00049         void setDrawableContextType( CADrawableContextType type ) { _drawableContextType = type; }
00050 
00051         CADrawableContextType _drawableContextType;
00052         CAContext *_context;
00053         QList<CADrawableMusElement *> _drawableMusElementList;  // List of all the drawable musElements in this context sorted by their left borders
00054 };
00055 
00056 #endif /* DRAWABLECONTEXT_H_ */