Mercurial > hg > svgui
comparison layer/TimeRulerLayer.h @ 287:cd2492c5fe45
* Add SingleColourLayer to manage colours for layers that have a single
predominant colour (i.e. most of them).
author | Chris Cannam |
---|---|
date | Thu, 12 Jul 2007 16:14:59 +0000 |
parents | 1a49bd0d8375 |
children | c0b9eec70639 |
comparison
equal
deleted
inserted
replaced
286:7554ae119882 | 287:cd2492c5fe45 |
---|---|
14 */ | 14 */ |
15 | 15 |
16 #ifndef _TIME_RULER_H_ | 16 #ifndef _TIME_RULER_H_ |
17 #define _TIME_RULER_H_ | 17 #define _TIME_RULER_H_ |
18 | 18 |
19 #include "Layer.h" | 19 #include "SingleColourLayer.h" |
20 | 20 |
21 #include <QRect> | 21 #include <QRect> |
22 #include <QColor> | 22 #include <QColor> |
23 | 23 |
24 class View; | 24 class View; |
25 class Model; | 25 class Model; |
26 class QPainter; | 26 class QPainter; |
27 | 27 |
28 class TimeRulerLayer : public Layer | 28 class TimeRulerLayer : public SingleColourLayer |
29 { | 29 { |
30 Q_OBJECT | 30 Q_OBJECT |
31 | 31 |
32 public: | 32 public: |
33 TimeRulerLayer(); | 33 TimeRulerLayer(); |
35 virtual void paint(View *v, QPainter &paint, QRect rect) const; | 35 virtual void paint(View *v, QPainter &paint, QRect rect) const; |
36 | 36 |
37 void setModel(Model *); | 37 void setModel(Model *); |
38 virtual const Model *getModel() const { return m_model; } | 38 virtual const Model *getModel() const { return m_model; } |
39 | 39 |
40 void setBaseColour(QColor); | |
41 QColor getBaseColour() const { return m_colour; } | |
42 | |
43 enum LabelHeight { LabelTop, LabelMiddle, LabelBottom }; | 40 enum LabelHeight { LabelTop, LabelMiddle, LabelBottom }; |
44 void setLabelHeight(LabelHeight h) { m_labelHeight = h; } | 41 void setLabelHeight(LabelHeight h) { m_labelHeight = h; } |
45 LabelHeight getLabelHeight() const { return m_labelHeight; } | 42 LabelHeight getLabelHeight() const { return m_labelHeight; } |
46 | 43 |
47 virtual bool snapToFeatureFrame(View *, int &, size_t &, SnapType) const; | 44 virtual bool snapToFeatureFrame(View *, int &, size_t &, SnapType) const; |
48 | 45 |
49 virtual PropertyList getProperties() const; | 46 virtual ColourSignificance getLayerColourSignificance() const { |
50 virtual QString getPropertyLabel(const PropertyName &) const; | 47 return ColourIrrelevant; |
51 virtual PropertyType getPropertyType(const PropertyName &) const; | 48 } |
52 virtual int getPropertyRangeAndValue(const PropertyName &, | |
53 int *min, int *max, int *deflt) const; | |
54 virtual QString getPropertyValueLabel(const PropertyName &, | |
55 int value) const; | |
56 virtual void setProperty(const PropertyName &, int value); | |
57 | 49 |
58 virtual bool getValueExtents(float &, float &, bool &, QString &) const { | 50 virtual bool getValueExtents(float &, float &, bool &, QString &) const { |
59 return false; | 51 return false; |
60 } | 52 } |
61 | 53 |
64 | 56 |
65 void setProperties(const QXmlAttributes &attributes); | 57 void setProperties(const QXmlAttributes &attributes); |
66 | 58 |
67 protected: | 59 protected: |
68 Model *m_model; | 60 Model *m_model; |
69 QColor m_colour; | |
70 LabelHeight m_labelHeight; | 61 LabelHeight m_labelHeight; |
62 | |
63 virtual int getDefaultColourHint(bool dark, bool &impose); | |
71 | 64 |
72 int getMajorTickSpacing(View *, bool &quarterTicks) const; | 65 int getMajorTickSpacing(View *, bool &quarterTicks) const; |
73 }; | 66 }; |
74 | 67 |
75 #endif | 68 #endif |