diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
commit | 47e6e7c84f008a53061e661f31ae96629bc694ef (patch) | |
tree | 648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /src/pmview/colorlist.h | |
download | pcp-47e6e7c84f008a53061e661f31ae96629bc694ef.tar.gz |
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'src/pmview/colorlist.h')
-rw-r--r-- | src/pmview/colorlist.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/pmview/colorlist.h b/src/pmview/colorlist.h new file mode 100644 index 0000000..8f8a431 --- /dev/null +++ b/src/pmview/colorlist.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 1997 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2009 Aconex. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ +#ifndef _COLORLIST_H_ +#define _COLORLIST_H_ + +#include "metriclist.h" +#include <QStringList> + +struct ColorSpec; + +typedef QList<ColorSpec *> ColorsList; + +class ColorList +{ +private: + + QStringList _names; + ColorsList _colors; + +public: + + virtual ~ColorList(); + + ColorList(); + + int numLists() const + { return _colors.size(); } + + const ColorSpec *list(const char *name); + + bool add(const char *name, const char *color = NULL); + bool add(const char *name, float red, float green, float blue); + + // Add colors + bool addColor(const char *color); + bool addColor(float red, float blue, float green); + + // Add scaled colors + bool addColor(const char *color, double max); + bool addColor(float red, float green, float blue, double max); + + static bool findColor(const char *color, float &r, float &g, float &b); + + friend QTextStream& operator<<(QTextStream& os, ColorList const& rhs); + +private: + bool findColor(const char *color); + + ColorList(ColorList const &); + ColorList const& operator=(ColorList const &); + // Never defined +}; + +struct ColorSpec +{ + bool _scale; + SbColorList _list; + QList<double> _max; + + ColorSpec(bool scale) : _scale(scale) {} +}; + +extern ColorList theColorLists; + +#endif /* _COLORLIST_H_ */ |