Mercurial > hg > svgui
comparison layer/SingleColourLayer.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 | |
children | 15b8a4bfe855 |
comparison
equal
deleted
inserted
replaced
286:7554ae119882 | 287:cd2492c5fe45 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 This file copyright 2007 QMUL. | |
8 | |
9 This program is free software; you can redistribute it and/or | |
10 modify it under the terms of the GNU General Public License as | |
11 published by the Free Software Foundation; either version 2 of the | |
12 License, or (at your option) any later version. See the file | |
13 COPYING included with this distribution for more information. | |
14 */ | |
15 | |
16 #ifndef _SINGLE_COLOUR_LAYER_H_ | |
17 #define _SINGLE_COLOUR_LAYER_H_ | |
18 | |
19 #include "Layer.h" | |
20 #include <QColor> | |
21 #include <vector> | |
22 | |
23 class SingleColourLayer : public Layer | |
24 { | |
25 public: | |
26 virtual void setBaseColour(int); | |
27 virtual int getBaseColour() const; | |
28 | |
29 virtual bool hasLightBackground() const; | |
30 | |
31 virtual ColourSignificance getLayerColourSignificance() const { | |
32 return ColourDistinguishes; | |
33 } | |
34 | |
35 virtual PropertyList getProperties() const; | |
36 virtual QString getPropertyLabel(const PropertyName &) const; | |
37 virtual PropertyType getPropertyType(const PropertyName &) const; | |
38 virtual QString getPropertyGroupName(const PropertyName &) const; | |
39 virtual int getPropertyRangeAndValue(const PropertyName &, | |
40 int *min, int *max, int *deflt) const; | |
41 virtual QString getPropertyValueLabel(const PropertyName &, | |
42 int value) const; | |
43 virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const; | |
44 virtual void setProperty(const PropertyName &, int value); | |
45 | |
46 virtual QString toXmlString(QString indent = "", | |
47 QString extraAttributes = "") const; | |
48 | |
49 virtual void setProperties(const QXmlAttributes &attributes); | |
50 | |
51 virtual void setDefaultColourFor(View *v); | |
52 | |
53 protected: | |
54 SingleColourLayer(); | |
55 | |
56 virtual QColor getBaseQColor() const; | |
57 virtual QColor getBackgroundQColor(View *v) const; | |
58 virtual QColor getForegroundQColor(View *v) const; | |
59 std::vector<QColor> getPartialShades(View *v) const; | |
60 | |
61 virtual void flagBaseColourChanged() { } | |
62 virtual int getDefaultColourHint(bool /* darkBackground */, | |
63 bool & /* impose */) { return -1; } | |
64 | |
65 typedef std::multiset<int> ColourIndexPool; | |
66 static ColourIndexPool m_usedColourIndices; | |
67 | |
68 int m_colour; | |
69 }; | |
70 | |
71 #endif |