comparison layer/TextLayer.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 e175ade2d6b0
children c0b9eec70639
comparison
equal deleted inserted replaced
286:7554ae119882 287:cd2492c5fe45
14 */ 14 */
15 15
16 #ifndef _TEXT_LAYER_H_ 16 #ifndef _TEXT_LAYER_H_
17 #define _TEXT_LAYER_H_ 17 #define _TEXT_LAYER_H_
18 18
19 #include "Layer.h" 19 #include "SingleColourLayer.h"
20 #include "data/model/TextModel.h" 20 #include "data/model/TextModel.h"
21 21
22 #include <QObject> 22 #include <QObject>
23 #include <QColor> 23 #include <QColor>
24 24
25 class View; 25 class View;
26 class QPainter; 26 class QPainter;
27 27
28 class TextLayer : public Layer 28 class TextLayer : public SingleColourLayer
29 { 29 {
30 Q_OBJECT 30 Q_OBJECT
31 31
32 public: 32 public:
33 TextLayer(); 33 TextLayer();
68 int *min, int *max, int *deflt) const; 68 int *min, int *max, int *deflt) const;
69 virtual QString getPropertyValueLabel(const PropertyName &, 69 virtual QString getPropertyValueLabel(const PropertyName &,
70 int value) const; 70 int value) const;
71 virtual void setProperty(const PropertyName &, int value); 71 virtual void setProperty(const PropertyName &, int value);
72 72
73 void setBaseColour(QColor);
74 QColor getBaseColour() const { return m_colour; }
75
76 virtual bool isLayerScrollable(const View *v) const; 73 virtual bool isLayerScrollable(const View *v) const;
77 74
78 virtual bool isLayerEditable() const { return true; } 75 virtual bool isLayerEditable() const { return true; }
79 76
80 virtual int getCompletion(View *) const { return m_model->getCompletion(); } 77 virtual int getCompletion(View *) const { return m_model->getCompletion(); }
89 86
90 protected: 87 protected:
91 int getYForHeight(View *v, float height) const; 88 int getYForHeight(View *v, float height) const;
92 float getHeightForY(View *v, int y) const; 89 float getHeightForY(View *v, int y) const;
93 90
91 virtual int getDefaultColourHint(bool dark, bool &impose);
92
94 TextModel::PointList getLocalPoints(View *v, int x, int y) const; 93 TextModel::PointList getLocalPoints(View *v, int x, int y) const;
95 94
96 TextModel *m_model; 95 TextModel *m_model;
97 bool m_editing; 96 bool m_editing;
98 QPoint m_editOrigin; 97 QPoint m_editOrigin;
99 TextModel::Point m_originalPoint; 98 TextModel::Point m_originalPoint;
100 TextModel::Point m_editingPoint; 99 TextModel::Point m_editingPoint;
101 TextModel::EditCommand *m_editingCommand; 100 TextModel::EditCommand *m_editingCommand;
102 QColor m_colour;
103 }; 101 };
104 102
105 #endif 103 #endif
106 104