00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _TIME_RULER_H_
00017 #define _TIME_RULER_H_
00018
00019 #include "SingleColourLayer.h"
00020
00021 #include <QRect>
00022 #include <QColor>
00023
00024 class View;
00025 class Model;
00026 class QPainter;
00027
00028 class TimeRulerLayer : public SingleColourLayer
00029 {
00030 Q_OBJECT
00031
00032 public:
00033 TimeRulerLayer();
00034
00035 virtual void paint(View *v, QPainter &paint, QRect rect) const;
00036
00037 void setModel(Model *);
00038 virtual const Model *getModel() const { return m_model; }
00039
00040 enum LabelHeight { LabelTop, LabelMiddle, LabelBottom };
00041 void setLabelHeight(LabelHeight h) { m_labelHeight = h; }
00042 LabelHeight getLabelHeight() const { return m_labelHeight; }
00043
00044 virtual bool snapToFeatureFrame(View *, int &, size_t &, SnapType) const;
00045
00046 virtual ColourSignificance getLayerColourSignificance() const {
00047 return ColourIrrelevant;
00048 }
00049
00050 virtual bool getValueExtents(float &, float &, bool &, QString &) const {
00051 return false;
00052 }
00053
00054 virtual QString getLayerPresentationName() const;
00055
00056 virtual void toXml(QTextStream &stream, QString indent = "",
00057 QString extraAttributes = "") const;
00058
00059 void setProperties(const QXmlAttributes &attributes);
00060
00061 protected:
00062 Model *m_model;
00063 LabelHeight m_labelHeight;
00064
00065 virtual int getDefaultColourHint(bool dark, bool &impose);
00066
00067 int getMajorTickSpacing(View *, bool &quarterTicks) const;
00068 };
00069
00070 #endif