SingleColourLayer.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2007 QMUL.
00008     
00009     This program is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU General Public License as
00011     published by the Free Software Foundation; either version 2 of the
00012     License, or (at your option) any later version.  See the file
00013     COPYING included with this distribution for more information.
00014 */
00015 
00016 #ifndef _SINGLE_COLOUR_LAYER_H_
00017 #define _SINGLE_COLOUR_LAYER_H_
00018 
00019 #include "Layer.h"
00020 #include <QColor>
00021 #include <vector>
00022 #include <map>
00023 
00024 class SingleColourLayer : public Layer
00025 {
00026 public:
00027     virtual void setBaseColour(int);
00028     virtual int getBaseColour() const;
00029 
00030     virtual bool hasLightBackground() const;
00031 
00032     virtual ColourSignificance getLayerColourSignificance() const {
00033         return ColourDistinguishes;
00034     }
00035 
00036     virtual QPixmap getLayerPresentationPixmap(QSize size) const;
00037 
00038     virtual PropertyList getProperties() const;
00039     virtual QString getPropertyLabel(const PropertyName &) const;
00040     virtual PropertyType getPropertyType(const PropertyName &) const;
00041     virtual QString getPropertyGroupName(const PropertyName &) const;
00042     virtual int getPropertyRangeAndValue(const PropertyName &,
00043                                          int *min, int *max, int *deflt) const;
00044     virtual QString getPropertyValueLabel(const PropertyName &,
00045                                           int value) const;
00046     virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const;
00047     virtual void setProperty(const PropertyName &, int value);
00048 
00049     virtual void toXml(QTextStream &stream, QString indent = "",
00050                        QString extraAttributes = "") const;
00051 
00052     virtual void setProperties(const QXmlAttributes &attributes);
00053 
00054     virtual void setDefaultColourFor(View *v);
00055 
00056 protected:
00057     SingleColourLayer();
00058 
00059     virtual QColor getBaseQColor() const;
00060     virtual QColor getBackgroundQColor(View *v) const;
00061     virtual QColor getForegroundQColor(View *v) const;
00062     std::vector<QColor> getPartialShades(View *v) const;
00063 
00064     virtual void flagBaseColourChanged() { }
00065     virtual int getDefaultColourHint(bool /* darkBackground */,
00066                                      bool & /* impose */) { return -1; }
00067 
00068     typedef std::map<int, int> ColourRefCount;
00069     static ColourRefCount m_colourRefCount;
00070 
00071     int m_colour;
00072     bool m_colourExplicitlySet;
00073     bool m_defaultColourSet;
00074 };
00075 
00076 #endif

Generated on Wed Feb 20 15:45:28 2008 for SonicVisualiser by  doxygen 1.5.1